Update to 1.20.1
This commit is contained in:
parent
d28efa2c72
commit
8e65a0f9fd
8 changed files with 101 additions and 72 deletions
|
@ -7,7 +7,6 @@ import dev.zontreck.fire.events.EventHandler;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.InterModComms;
|
||||
|
@ -65,17 +64,4 @@ public class FireMod
|
|||
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
|
||||
// Event bus for receiving Registry Events)
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public static class RegistryEvents
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent)
|
||||
{
|
||||
// Register a new block here
|
||||
LOGGER.info("HELLO from Register Block");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
|
|||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderGetter;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.LongTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
|
@ -52,7 +54,7 @@ public class BlockSnapshot {
|
|||
}
|
||||
}
|
||||
|
||||
world.playSound(null, position.Position.asBlockPos(), SoundEvents.ITEM_PICKUP, SoundSource.NEUTRAL, world.random.nextFloat(0,1), world.random.nextFloat(0,1));
|
||||
world.playSound(null, position.Position.asBlockPos(), SoundEvents.ITEM_PICKUP, SoundSource.NEUTRAL);
|
||||
}
|
||||
|
||||
public CompoundTag serialize()
|
||||
|
@ -73,7 +75,10 @@ public class BlockSnapshot {
|
|||
{
|
||||
try {
|
||||
WorldPosition position = new WorldPosition(tag.getCompound("pos"), true);
|
||||
BlockState state = NbtUtils.readBlockState(tag.getCompound("state"));
|
||||
|
||||
HolderGetter<Block> hg = position.getActualDimension().holderLookup(Registries.BLOCK);
|
||||
|
||||
BlockState state = NbtUtils.readBlockState(hg, tag.getCompound("state"));
|
||||
CompoundTag entity = null;
|
||||
if(tag.contains("entity"))
|
||||
entity = tag.getCompound("entity");
|
||||
|
|
|
@ -16,8 +16,8 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent;
|
||||
import net.minecraftforge.event.server.ServerStoppingEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import java.time.Instant;
|
||||
|
@ -42,7 +42,7 @@ public class EventHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
ServerLevel world = (ServerLevel) event.getWorld();
|
||||
ServerLevel world = (ServerLevel) event.getLevel();
|
||||
if(FireServerConfig.restore.blacklistedDimensions.contains(WorldPosition.getDim(world)))
|
||||
{
|
||||
//FireMod.LOGGER.info("Blacklisted dimension, ignoring");
|
||||
|
@ -115,7 +115,7 @@ public class EventHandler {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onServerTick(TickEvent.WorldTickEvent event) {
|
||||
public void onServerTick(TickEvent.LevelTickEvent event) {
|
||||
if(ServerUtilities.isClient()) return;
|
||||
if(!FireMod.ENABLED)
|
||||
{
|
||||
|
|
Reference in a new issue