mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Postmerge
This commit is contained in:
parent
994f0afd3e
commit
dba033bac0
3 changed files with 17 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.api.registry;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -16,12 +17,12 @@ import com.simibubi.create.content.logistics.packagePort.PackagePortTargetType;
|
|||
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.WritableRegistry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.EventBusSubscriber.Bus;
|
||||
import net.neoforged.neoforge.registries.BaseMappedRegistry;
|
||||
import net.neoforged.neoforge.registries.NewRegistryEvent;
|
||||
|
||||
/**
|
||||
|
@ -51,7 +52,15 @@ public class CreateBuiltInRegistries {
|
|||
return register(new MappedRegistry<>(key, Lifecycle.stable(), true));
|
||||
}
|
||||
|
||||
private static <T> Registry<T> register(WritableRegistry<T> registry) {
|
||||
private static <T> Registry<T> register(MappedRegistry<T> registry) {
|
||||
// TODO - Remove after https://github.com/neoforged/NeoForge/pull/1966 is merged and backported
|
||||
try {
|
||||
Field field = BaseMappedRegistry.class.getDeclaredField("sync");
|
||||
field.setAccessible(true);
|
||||
field.set(registry, true);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
REGISTRIES.add(registry);
|
||||
return registry;
|
||||
}
|
||||
|
@ -60,5 +69,6 @@ public class CreateBuiltInRegistries {
|
|||
public static void onNewRegistryEvent(NewRegistryEvent event) {
|
||||
for (Registry<?> registry : REGISTRIES)
|
||||
event.register(registry);
|
||||
REGISTRIES.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.api.contraption.transformable.TransformableBlock;
|
|||
import com.simibubi.create.api.contraption.transformable.TransformableBlockEntity;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.createmod.catnip.codecs.stream.CatnipStreamCodecBuilders;
|
||||
import net.createmod.catnip.codecs.stream.CatnipStreamCodecs;
|
||||
import net.createmod.catnip.math.VecHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -41,9 +42,9 @@ public class StructureTransform {
|
|||
public static final StreamCodec<ByteBuf, StructureTransform> STREAM_CODEC = StreamCodec.composite(
|
||||
BlockPos.STREAM_CODEC, i -> i.offset,
|
||||
ByteBufCodecs.INT, i -> i.angle,
|
||||
CatnipStreamCodecs.AXIS, i -> i.rotationAxis,
|
||||
CatnipStreamCodecs.ROTATION, i -> i.rotation,
|
||||
CatnipStreamCodecs.MIRROR, i -> i.mirror,
|
||||
CatnipStreamCodecBuilders.nullable(CatnipStreamCodecs.AXIS), i -> i.rotationAxis,
|
||||
CatnipStreamCodecBuilders.nullable(CatnipStreamCodecs.ROTATION), i -> i.rotation,
|
||||
CatnipStreamCodecBuilders.nullable(CatnipStreamCodecs.MIRROR), i -> i.mirror,
|
||||
StructureTransform::new
|
||||
);
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ public class KineticBlockEntity extends SmartBlockEntity implements IHaveGoggleI
|
|||
}
|
||||
|
||||
public float getSpeed() {
|
||||
if (overStressed || level.tickRateManager().isFrozen())
|
||||
if (overStressed || (level != null && level.tickRateManager().isFrozen()))
|
||||
return 0;
|
||||
return getTheoreticalSpeed();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue