From ba363bce2016a0c0901eb686f84ae55a29a33900 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Thu, 15 Jan 2015 19:39:15 -0800 Subject: [PATCH] [Forge] Update to 1.8 --- config/checkstyle/import-control.xml | 1 + worldedit-forge/build.gradle | 4 +- .../sk89q/worldedit/forge/ClientProxy.java | 2 +- .../sk89q/worldedit/forge/CommonProxy.java | 3 +- .../worldedit/forge/ForgeEntityType.java | 2 +- .../forge/ForgePermissionsProvider.java | 4 +- .../sk89q/worldedit/forge/ForgePlatform.java | 8 ++- .../sk89q/worldedit/forge/ForgePlayer.java | 9 ++- .../com/sk89q/worldedit/forge/ForgeWorld.java | 66 ++++++++++--------- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 32 ++++----- .../com/sk89q/worldedit/forge/KeyHandler.java | 8 ++- .../sk89q/worldedit/forge/NBTConverter.java | 20 +++--- .../worldedit/forge/ThreadSafeCache.java | 12 ++-- .../worldedit/forge/TileEntityUtils.java | 7 +- .../worldedit/forge/WECUIPacketHandler.java | 11 ++-- .../sk89q/worldedit/forge/gui/GuiHandler.java | 2 +- 16 files changed, 104 insertions(+), 87 deletions(-) diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml index 7a5600470..ab87b642b 100644 --- a/config/checkstyle/import-control.xml +++ b/config/checkstyle/import-control.xml @@ -54,6 +54,7 @@ + diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index f7b51a33e..563ceeea4 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -19,8 +19,8 @@ dependencies { } minecraft { - ext.forgeVersion = "10.13.1.1225" - version = "1.7.10-$forgeVersion" + ext.forgeVersion = "11.14.0.1281" + version = "1.8-$forgeVersion-1.8" replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java" replace "%VERSION%", project.version diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ClientProxy.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ClientProxy.java index ebb5fa675..e029085ab 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ClientProxy.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ClientProxy.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.forge; -import cpw.mods.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLCommonHandler; public class ClientProxy extends CommonProxy { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java index 8163afaae..fbb07b9d2 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java @@ -19,8 +19,9 @@ package com.sk89q.worldedit.forge; +import net.minecraftforge.fml.common.network.NetworkRegistry; + import com.sk89q.worldedit.forge.gui.GuiHandler; -import cpw.mods.fml.common.network.NetworkRegistry; public class CommonProxy { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityType.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityType.java index 4888c748d..8fb19f3cd 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityType.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityType.java @@ -133,7 +133,7 @@ public class ForgeEntityType implements EntityType { @Override public boolean isTagged() { - return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomNameTag(); + return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomName(); } @Override diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java index 60408df6c..ffd8de06b 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.forge; -import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.command.ICommand; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.WorldSettings.GameType; +import net.minecraftforge.fml.common.FMLCommonHandler; public interface ForgePermissionsProvider { @@ -42,7 +42,7 @@ public interface ForgePermissionsProvider { public boolean hasPermission(EntityPlayerMP player, String permission) { ForgeConfiguration configuration = platform.getConfiguration(); return configuration.cheatMode || - FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().func_152596_g(player.getGameProfile()) || + FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands(player.getGameProfile()) || (configuration.creativeEnable && player.theItemInWorldManager.getGameType() == GameType.CREATIVE); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java index 442b2c055..7edb92b3a 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java @@ -28,7 +28,7 @@ import com.sk89q.worldedit.extension.platform.Preference; import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.world.World; -import cpw.mods.fml.common.FMLCommonHandler; + import net.minecraft.block.Block; import net.minecraft.command.ServerCommandManager; import net.minecraft.entity.EntityList; @@ -38,8 +38,10 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.ServerConfigurationManager; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fml.common.FMLCommonHandler; import javax.annotation.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -121,7 +123,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { if (player instanceof ForgePlayer) { return player; } else { - EntityPlayerMP entity = server.getConfigurationManager().func_152612_a(player.getName()); + EntityPlayerMP entity = server.getConfigurationManager().getPlayerByUsername(player.getName()); return entity != null ? new ForgePlayer(this, entity) : null; } } @@ -202,7 +204,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { List users = new ArrayList(); ServerConfigurationManager scm = server.getConfigurationManager(); for (String name : scm.getAllUsernames()) { - EntityPlayerMP entity = scm.func_152612_a(name); + EntityPlayerMP entity = scm.getPlayerByUsername(name); if (entity != null) { users.add(new ForgePlayer(this, entity)); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index 945b790a4..7a5093a4e 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -33,8 +33,10 @@ import com.sk89q.worldedit.util.Location; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.S3FPacketCustomPayload; import net.minecraft.util.ChatComponentText; +import io.netty.buffer.Unpooled; import javax.annotation.Nullable; @@ -64,7 +66,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public String getName() { - return this.player.getCommandSenderName(); + return this.player.getName(); } @Override @@ -114,7 +116,8 @@ public class ForgePlayer extends AbstractPlayerActor { if (params.length > 0) { send = send + "|" + StringUtil.joinString(params, "|"); } - S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, send.getBytes(WECUIPacketHandler.UTF_8_CHARSET)); + PacketBuffer buffer = new PacketBuffer(Unpooled.copiedBuffer(send.getBytes(WECUIPacketHandler.UTF_8_CHARSET))); + S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, buffer); this.player.playerNetServerHandler.sendPacket(packet); } @@ -174,7 +177,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public SessionKey getSessionKey() { - return new SessionKeyImpl(player.getUniqueID(), player.getCommandSenderName()); + return new SessionKeyImpl(player.getUniqueID(), player.getName()); } private static class SessionKeyImpl implements SessionKey { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index c89863610..325bcc8ef 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -39,7 +39,9 @@ import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.registry.WorldData; + import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityList; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; @@ -47,6 +49,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ClassInheritanceMultiMap; import net.minecraft.util.LongHashMap; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; @@ -69,6 +73,7 @@ import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenerator; import javax.annotation.Nullable; + import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.util.ArrayList; @@ -85,6 +90,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class ForgeWorld extends AbstractWorld { + private static final int UPDATE = 1, NOTIFY = 2, NOTIFY_CLIENT = 4; private static final Logger logger = Logger.getLogger(ForgeWorld.class.getCanonicalName()); private static final Random random = new Random(); private final WeakReference worldRef; @@ -154,33 +160,29 @@ public class ForgeWorld extends AbstractWorld { // First set the block Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4); - int previousId = 0; - - if (notifyAndLight) { - previousId = Block.getIdFromBlock(chunk.getBlock(x & 15, y, z & 15)); - } - - boolean successful = chunk.func_150807_a(x & 15, y, z & 15, Block.getBlockById(block.getId()), block.getData()); + BlockPos pos = new BlockPos(x, y, z); + IBlockState old = chunk.getBlockState(pos); + IBlockState newState = Block.getBlockById(block.getId()).getStateFromMeta(block.getData()); + IBlockState successState = chunk.setBlockState(pos, newState); + boolean successful = successState != null; // Create the TileEntity if (successful) { - CompoundTag tag = block.getNbtData(); - if (tag != null) { - NBTTagCompound nativeTag = NBTConverter.toNative(tag); + if (block.hasNbtData()) { + // Kill the old TileEntity + world.removeTileEntity(pos); + NBTTagCompound nativeTag = NBTConverter.toNative(block.getNbtData()); nativeTag.setString("id", block.getNbtId()); - TileEntityUtils.setTileEntity(getWorld(), position, nativeTag); + TileEntityUtils.setTileEntity(world, position, nativeTag); } } if (notifyAndLight) { - world.func_147451_t(x, y, z); - world.markBlockForUpdate(x, y, z); - world.notifyBlockChange(x, y, z, Block.getBlockById(previousId)); - - Block mcBlock = Block.getBlockById(previousId); - if (mcBlock != null && mcBlock.hasComparatorInputOverride()) { - world.func_147453_f(x, y, z, Block.getBlockById(block.getId())); + if (!successful) { + newState = old; } + world.checkLight(pos); + world.markAndNotifyBlock(pos, chunk, old, newState, UPDATE | NOTIFY); } return successful; @@ -189,13 +191,13 @@ public class ForgeWorld extends AbstractWorld { @Override public int getBlockLightLevel(Vector position) { checkNotNull(position); - return getWorld().getBlockLightValue(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + return getWorld().getLight(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ())); } @Override public boolean clearContainerBlockContents(Vector position) { checkNotNull(position); - TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + TileEntity tile = getWorld().getTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ())); if ((tile instanceof IInventory)) { IInventory inv = (IInventory) tile; int size = inv.getSizeInventory(); @@ -210,7 +212,7 @@ public class ForgeWorld extends AbstractWorld { @Override public BaseBiome getBiome(Vector2D position) { checkNotNull(position); - return new BaseBiome(getWorld().getBiomeGenForCoords(position.getBlockX(), position.getBlockZ()).biomeID); + return new BaseBiome(getWorld().getBiomeGenForCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())).biomeID); } @Override @@ -218,8 +220,8 @@ public class ForgeWorld extends AbstractWorld { checkNotNull(position); checkNotNull(biome); - Chunk chunk = getWorld().getChunkFromBlockCoords(position.getBlockX(), position.getBlockZ()); - if ((chunk != null) && (chunk.isChunkLoaded)) { + Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())); + if ((chunk != null) && (chunk.isLoaded())) { chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId(); return true; } @@ -237,7 +239,7 @@ public class ForgeWorld extends AbstractWorld { } EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeWorldEdit.toForgeItemStack(item)); - entity.delayBeforeCanPickup = 10; + entity.setPickupDelay(10); getWorld().spawnEntityInWorld(entity); } @@ -384,23 +386,23 @@ public class ForgeWorld extends AbstractWorld { @Override public BaseBlock getBlock(Vector position) { World world = getWorld(); - int id = Block.getIdFromBlock(world.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ())); - int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + IBlockState state = world.getBlockState(pos); + TileEntity tile = getWorld().getTileEntity(pos); if (tile != null) { - return new TileEntityBaseBlock(id, data, tile); + return new TileEntityBaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), tile); } else { - return new BaseBlock(id, data); + return new BaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state)); } } @Override public BaseBlock getLazyBlock(Vector position) { World world = getWorld(); - int id = Block.getIdFromBlock(world.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ())); - int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - return new LazyBlock(id, data, this, position); + BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + IBlockState state = world.getBlockState(pos); + return new LazyBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), this, position); } @Override diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 7284796e6..30543a238 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -27,19 +27,7 @@ import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.internal.LocalWorldAdapter; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.Mod.Instance; -import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; -import cpw.mods.fml.common.event.FMLServerStartedEvent; -import cpw.mods.fml.common.event.FMLServerStoppingEvent; -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; + import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -47,6 +35,20 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.CommandEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.Mod.Instance; +import net.minecraftforge.fml.common.SidedProxy; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; +import net.minecraftforge.fml.common.event.FMLServerStartedEvent; +import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; +import net.minecraftforge.fml.common.eventhandler.Event.Result; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + import org.apache.logging.log4j.Logger; import java.io.File; @@ -156,7 +158,7 @@ public class ForgeWorldEdit { Action action = event.action; switch (action) { case LEFT_CLICK_BLOCK: { - WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.x, event.y, event.z); + WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ()); if (we.handleBlockLeftClick(player, pos)) { event.setCanceled(true); @@ -169,7 +171,7 @@ public class ForgeWorldEdit { break; } case RIGHT_CLICK_BLOCK: { - WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.x, event.y, event.z); + WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ()); if (we.handleBlockRightClick(player, pos)) { event.setCanceled(true); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java index b8ffa78db..ea037e548 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java @@ -20,11 +20,13 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.forge.gui.GuiHandler; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; + import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; +import net.minecraftforge.fml.client.registry.ClientRegistry; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; + import org.lwjgl.input.Keyboard; public class KeyHandler { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java index 98f88c6e8..69f4ab6ad 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java @@ -170,7 +170,7 @@ final class NBTConverter { } public static IntArrayTag fromNative(NBTTagIntArray other) { - int[] value = other.func_150302_c(); + int[] value = other.getIntArray(); return new IntArrayTag(Arrays.copyOf(value, value.length)); } @@ -192,28 +192,28 @@ final class NBTConverter { } public static LongTag fromNative(NBTTagLong other) { - return new LongTag(other.func_150291_c()); + return new LongTag(other.getLong()); } public static StringTag fromNative(NBTTagString other) { - return new StringTag(other.func_150285_a_()); + return new StringTag(other.getString()); } public static IntTag fromNative(NBTTagInt other) { - return new IntTag(other.func_150287_d()); + return new IntTag(other.getInt()); } public static ByteTag fromNative(NBTTagByte other) { - return new ByteTag(other.func_150290_f()); + return new ByteTag(other.getByte()); } public static ByteArrayTag fromNative(NBTTagByteArray other) { - byte[] value = other.func_150292_c(); + byte[] value = other.getByteArray(); return new ByteArrayTag(Arrays.copyOf(value, value.length)); } public static CompoundTag fromNative(NBTTagCompound other) { - @SuppressWarnings("unchecked") Collection tags = other.func_150296_c(); + @SuppressWarnings("unchecked") Set tags = other.getKeySet(); Map map = new HashMap(); for (String tagName : tags) { map.put(tagName, fromNative(other.getTag(tagName))); @@ -222,15 +222,15 @@ final class NBTConverter { } public static FloatTag fromNative(NBTTagFloat other) { - return new FloatTag(other.func_150288_h()); + return new FloatTag(other.getFloat()); } public static ShortTag fromNative(NBTTagShort other) { - return new ShortTag(other.func_150289_e()); + return new ShortTag(other.getShort()); } public static DoubleTag fromNative(NBTTagDouble other) { - return new DoubleTag(other.func_150286_g()); + return new DoubleTag(other.getDouble()); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java index 1322f0713..0ca19c5b0 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java @@ -19,10 +19,11 @@ package com.sk89q.worldedit.forge; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import java.util.Collections; import java.util.HashSet; @@ -55,8 +56,9 @@ public class ThreadSafeCache { if (now - lastRefresh > REFRESH_DELAY) { Set onlineIds = new HashSet(); - - if (FMLCommonHandler.instance().getMinecraftServerInstance() == null) { + + MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); + if (server == null || server.getConfigurationManager() == null) { return; } for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java index fd8d6e5fe..4bc57b2b8 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java @@ -20,12 +20,15 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.Vector; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; + import java.lang.reflect.Constructor; import static com.google.common.base.Preconditions.checkNotNull; @@ -81,7 +84,7 @@ final class TileEntityUtils { tileEntity.readFromNBT(tag); } - world.setTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ(), tileEntity); + world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); } /** @@ -97,7 +100,7 @@ final class TileEntityUtils { updateForSet(tag, position); TileEntity tileEntity = TileEntity.createAndLoadEntity(tag); if (tileEntity != null) { - world.setTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ(), tileEntity); + world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); } } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java index 03cf3ab0c..32b29d6a9 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java @@ -24,14 +24,13 @@ import java.nio.charset.Charset; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.network.FMLEventChannel; +import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; +import net.minecraftforge.fml.common.network.NetworkRegistry; import com.sk89q.worldedit.LocalSession; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.network.FMLEventChannel; -import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; -import cpw.mods.fml.common.network.NetworkRegistry; - public class WECUIPacketHandler { public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); private static FMLEventChannel WECUI_CHANNEL; @@ -52,7 +51,7 @@ public class WECUIPacketHandler { return; } - String text = new String(rawPacket.func_149558_e(), UTF_8_CHARSET); + String text = new String(rawPacket.getBufferData().array(), UTF_8_CHARSET); session.handleCUIInitializationMessage(text); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiHandler.java index 4aba5eda0..d88b97379 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiHandler.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.forge.gui; -import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; +import net.minecraftforge.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler {