From ecc49486688dfed3c0a21c9672cfe1b34daa5ccc Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Sat, 19 Mar 2016 09:53:52 -0700 Subject: [PATCH] Switch to Forge 1.9 (12.16.0.1770) --- gradle/wrapper/gradle-wrapper.jar | Bin 53638 -> 53556 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 46 +++++----- gradlew.bat | 6 +- worldedit-forge/build.gradle | 6 +- .../sk89q/worldedit/forge/CommandWrapper.java | 7 +- .../sk89q/worldedit/forge/ForgeAdapter.java | 11 ++- .../worldedit/forge/ForgeBiomeRegistry.java | 40 +------- .../worldedit/forge/ForgeEntityType.java | 4 +- .../forge/ForgePermissionsProvider.java | 4 +- .../sk89q/worldedit/forge/ForgePlatform.java | 19 ++-- .../sk89q/worldedit/forge/ForgePlayer.java | 34 +++---- .../com/sk89q/worldedit/forge/ForgeWorld.java | 31 +++---- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 86 +++++++++--------- .../sk89q/worldedit/forge/NBTConverter.java | 2 +- .../worldedit/forge/ThreadSafeCache.java | 7 +- .../worldedit/forge/TileEntityUtils.java | 10 +- .../worldedit/forge/WECUIPacketHandler.java | 10 +- .../worldedit/forge/gui/GuiReferenceCard.java | 1 - .../main/resources/META-INF/worldedit_at.cfg | 2 +- 20 files changed, 148 insertions(+), 182 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5ccda13e9cb94678ba179b32452cf3d60dc36353..ca78035ef0501d802d4fc55381ef2d5c3ce0ec6e 100644 GIT binary patch delta 3196 zcmZWr3p|ur8-KmyR>oMDacR^rlS{6H6j^MP8Ijx)(uLegD3n{4VRsa{b+RZeHnQD_ zarxTp<~kVnN|>@N5{Y#6rP%MCGrR3KzxDh1JBA@^ol`_J#j{1wTp6gl2?i%LV?UD(7;=S$mlak>u&Op6lXu5oR zzX|)2eSMDtPyQFTS)v(PyEMeJM1@+GDzWzAts|v2Z@n+gHLy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fm?7S6xAt%gFWi1+;q+5gI2rH1wV^J5Ysin zJW$fJ2Zo>NAz&M$QQHns_)rYm-uOM!8b@P?p;q%Xwm}f_z!BQo9uTk!zku<0ZEne- zt&r-?u0+$S_`fxp2Kv3W(Dq9&0n14O_O(RN)CnxNa0#cSBn0?4A{3=S%mO`a@AFukpeFW^AGL%9K zCuwhOJ(yGn9e3(RT@Db+ZOt^;)9Ze z&>`=jZ+e3@zS-N*H+)+fjP>vavAHR{Xo?Q$;x*NAPKq1e1n05m_^02k=TU4;r& Q*N8{Jw?_tozO7vHf9)yu{r~^~ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b2c6e7a02..c76e8f2d8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Feb 22 17:40:44 PST 2016 +#Thu May 05 15:11:12 PDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip diff --git a/gradlew b/gradlew index 9d82f7891..27309d923 100755 --- a/gradlew +++ b/gradlew @@ -6,12 +6,30 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -85,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then diff --git a/gradlew.bat b/gradlew.bat index 72d362daf..f6d5974e7 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 41e0f4126..b7cae2c0e 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -27,12 +27,12 @@ repositories { } version = "6.1.1" -ext.forgeVersion = "11.15.1.1760" +ext.forgeVersion = "12.16.1.1891" ext.internalVersion = version + ";" + gitCommitHash minecraft { - version = "1.8.9-${project.forgeVersion}" - mappings = "snapshot_20160111" + version = "1.9-${project.forgeVersion}" + mappings = "snapshot_20160505" runDir = 'run' replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java" diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java index 2b555c851..eef6df939 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java @@ -25,8 +25,10 @@ import java.util.Arrays; import java.util.List; import javax.annotation.Nullable; import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; public class CommandWrapper extends CommandBase { private CommandMapping command; @@ -46,7 +48,8 @@ public class CommandWrapper extends CommandBase { } @Override - public void processCommand(ICommandSender var1, String[] var2) {} + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + } @Override public String getCommandUsage(ICommandSender icommandsender) { @@ -59,7 +62,7 @@ public class CommandWrapper extends CommandBase { } @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { + public boolean checkPermission(MinecraftServer server, ICommandSender sender) { return true; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index 9c64b9403..57b8e1f2e 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -21,8 +21,9 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.world.World; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; final class ForgeAdapter { @@ -33,7 +34,7 @@ final class ForgeAdapter { return new ForgeWorld(world); } - public static Vector adapt(Vec3 vector) { + public static Vector adapt(Vec3d vector) { return new Vector(vector.xCoord, vector.yCoord, vector.zCoord); } @@ -41,8 +42,8 @@ final class ForgeAdapter { return new Vector(pos.getX(), pos.getY(), pos.getZ()); } - public static Vec3 toVec3(Vector vector) { - return new Vec3(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); + public static Vec3d toVec3(Vector vector) { + return new Vec3d(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); } public static BlockPos toBlockPos(Vector vector) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java index 6de863048..6dd3d515d 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java @@ -19,29 +19,20 @@ package com.sk89q.worldedit.forge; -import com.google.common.collect.HashBiMap; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.registry.BiomeRegistry; import net.minecraft.world.biome.BiomeGenBase; -import javax.annotation.Nullable; - import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * Provides access to biome data in Forge. */ class ForgeBiomeRegistry implements BiomeRegistry { - private static Map biomes = Collections.emptyMap(); - private static Map biomeData = Collections.emptyMap(); - @Nullable @Override public BaseBiome createFromId(int id) { return new BaseBiome(id); @@ -50,38 +41,15 @@ class ForgeBiomeRegistry implements BiomeRegistry { @Override public List getBiomes() { List list = new ArrayList(); - for (int biome : biomes.keySet()) { - list.add(new BaseBiome(biome)); + for (BiomeGenBase biome : BiomeGenBase.REGISTRY) { + list.add(new BaseBiome(BiomeGenBase.getIdForBiome(biome))); } return list; } - @Nullable @Override public BiomeData getData(BaseBiome biome) { - return biomeData.get(biome.getId()); - } - - /** - * Populate the internal static list of biomes. - * - *

If called repeatedly, the last call will overwrite all previous - * calls.

- */ - static void populate() { - Map biomes = HashBiMap.create(); - Map biomeData = new HashMap(); - - for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) { - if ((biome == null) || (biomes.containsValue(biome))) { - continue; - } - biomes.put(biome.biomeID, biome); - biomeData.put(biome.biomeID, new ForgeBiomeData(biome)); - } - - ForgeBiomeRegistry.biomes = biomes; - ForgeBiomeRegistry.biomeData = biomeData; + return new ForgeBiomeData(BiomeGenBase.getBiome(biome.getId())); } /** @@ -101,7 +69,7 @@ class ForgeBiomeRegistry implements BiomeRegistry { @Override public String getName() { - return biome.biomeName; + return biome.getBiomeName(); } } 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 c56375105..a7a4b3cbd 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 @@ -25,6 +25,7 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.IMerchant; import net.minecraft.entity.INpc; import net.minecraft.entity.IProjectile; +import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityBoat; import net.minecraft.entity.item.EntityEnderEye; import net.minecraft.entity.item.EntityFallingBlock; @@ -38,7 +39,6 @@ import net.minecraft.entity.monster.EntityGolem; import net.minecraft.entity.passive.EntityAmbientCreature; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityTameable; -import net.minecraft.entity.passive.IAnimals; import net.minecraft.entity.player.EntityPlayer; import static com.google.common.base.Preconditions.checkNotNull; @@ -139,6 +139,6 @@ public class ForgeEntityType implements EntityType { @Override public boolean isArmorStand() { - return false; // TODO re-add when forge version is updated to 1.8: entity instanceof EntityArmorStand; + return entity instanceof EntityArmorStand; } } 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 c68131265..0c9b0542f 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 @@ -43,8 +43,8 @@ public interface ForgePermissionsProvider { public boolean hasPermission(EntityPlayerMP player, String permission) { ForgeConfiguration configuration = platform.getConfiguration(); return configuration.cheatMode || - FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands(player.getGameProfile()) || - (configuration.creativeEnable && player.theItemInWorldManager.getGameType() == GameType.CREATIVE); + FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile()) || + (configuration.creativeEnable && player.interactionManager.getGameType() == GameType.CREATIVE); } @Override 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 7edb92b3a..5adab0ec0 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 @@ -35,7 +35,7 @@ import net.minecraft.entity.EntityList; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.management.ServerConfigurationManager; +import net.minecraft.server.management.PlayerList; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -43,7 +43,6 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import javax.annotation.Nullable; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.EnumMap; import java.util.List; @@ -77,8 +76,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { } } - for (Object itemObj : Item.itemRegistry) { - Item item = (Item) itemObj; + for (Item item : Item.REGISTRY) { if (item == null) continue; if (item.getUnlocalizedName() == null) continue; if (item.getUnlocalizedName().startsWith("item.")) { @@ -94,7 +92,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public boolean isValidMobType(String type) { - return EntityList.stringToClassMapping.containsKey(type); + return EntityList.NAME_TO_CLASS.containsKey(type); } @Override @@ -109,8 +107,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public List getWorlds() { - List worlds = Arrays.asList(DimensionManager.getWorlds()); - List ret = new ArrayList(worlds.size()); + WorldServer[] worlds = DimensionManager.getWorlds(); + List ret = new ArrayList(worlds.length); for (WorldServer world : worlds) { ret.add(new ForgeWorld(world)); } @@ -123,7 +121,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { if (player instanceof ForgePlayer) { return player; } else { - EntityPlayerMP entity = server.getConfigurationManager().getPlayerByUsername(player.getName()); + EntityPlayerMP entity = server.getPlayerList().getPlayerByUsername(player.getName()); return entity != null ? new ForgePlayer(this, entity) : null; } } @@ -202,9 +200,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public Collection getConnectedUsers() { List users = new ArrayList(); - ServerConfigurationManager scm = server.getConfigurationManager(); - for (String name : scm.getAllUsernames()) { - EntityPlayerMP entity = scm.getPlayerByUsername(name); + PlayerList scm = server.getPlayerList(); + for (EntityPlayerMP entity : scm.getPlayerList()) { 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 4553c1694..d01c7f6e6 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 @@ -30,18 +30,17 @@ import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.Location; +import io.netty.buffer.Unpooled; +import java.util.UUID; +import javax.annotation.Nullable; 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 net.minecraft.util.EnumChatFormatting; - -import javax.annotation.Nullable; - -import java.util.UUID; +import net.minecraft.network.play.server.SPacketCustomPayload; +import net.minecraft.util.EnumHand; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; public class ForgePlayer extends AbstractPlayerActor { @@ -61,7 +60,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public int getItemInHand() { - ItemStack is = this.player.getCurrentEquippedItem(); + ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND); return is == null ? 0 : Item.getIdFromItem(is.getItem()); } @@ -85,6 +84,7 @@ public class ForgePlayer extends AbstractPlayerActor { this.player.rotationPitch); } + @SuppressWarnings("deprecation") @Override public WorldVector getPosition() { return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.worldObj)), this.player.posX, this.player.posY, this.player.posZ); @@ -118,36 +118,36 @@ public class ForgePlayer extends AbstractPlayerActor { send = send + "|" + StringUtil.joinString(params, "|"); } PacketBuffer buffer = new PacketBuffer(Unpooled.copiedBuffer(send.getBytes(WECUIPacketHandler.UTF_8_CHARSET))); - S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, buffer); + SPacketCustomPayload packet = new SPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, buffer); this.player.playerNetServerHandler.sendPacket(packet); } @Override public void printRaw(String msg) { for (String part : msg.split("\n")) { - this.player.addChatMessage(new ChatComponentText(part)); + this.player.addChatMessage(new TextComponentString(part)); } } @Override public void printDebug(String msg) { - sendColorized(msg, EnumChatFormatting.GRAY); + sendColorized(msg, TextFormatting.GRAY); } @Override public void print(String msg) { - sendColorized(msg, EnumChatFormatting.LIGHT_PURPLE); + sendColorized(msg, TextFormatting.LIGHT_PURPLE); } @Override public void printError(String msg) { - sendColorized(msg, EnumChatFormatting.RED); + sendColorized(msg, TextFormatting.RED); } - private void sendColorized(String msg, EnumChatFormatting formatting) { + private void sendColorized(String msg, TextFormatting formatting) { for (String part : msg.split("\n")) { - ChatComponentText component = new ChatComponentText(part); - component.getChatStyle().setColor(formatting); + TextComponentString component = new TextComponentString(part); + component.getStyle().setColor(formatting); this.player.addChatMessage(component); } } 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 e89c46112..73db996d1 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 @@ -58,16 +58,17 @@ import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderServer; import net.minecraft.world.gen.feature.WorldGenBigMushroom; import net.minecraft.world.gen.feature.WorldGenBigTree; +import net.minecraft.world.gen.feature.WorldGenBirchTree; import net.minecraft.world.gen.feature.WorldGenCanopyTree; -import net.minecraft.world.gen.feature.WorldGenForest; import net.minecraft.world.gen.feature.WorldGenMegaJungle; import net.minecraft.world.gen.feature.WorldGenMegaPineTree; import net.minecraft.world.gen.feature.WorldGenSavannaTree; @@ -89,9 +90,9 @@ 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 IBlockState JUNGLE_LOG = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); - private static final IBlockState JUNGLE_LEAF = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); - private static final IBlockState JUNGLE_SHRUB = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final IBlockState JUNGLE_LOG = Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); + private static final IBlockState JUNGLE_LEAF = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final IBlockState JUNGLE_SHRUB = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); private final WeakReference worldRef; @@ -204,7 +205,7 @@ public class ForgeWorld extends AbstractWorld { @Override public BaseBiome getBiome(Vector2D position) { checkNotNull(position); - return new BaseBiome(getWorld().getBiomeGenForCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())).biomeID); + return new BaseBiome(BiomeGenBase.getIdForBiome(getWorld().getBiomeGenForCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())))); } @Override @@ -258,8 +259,6 @@ public class ForgeWorld extends AbstractWorld { return false; } ChunkProviderServer chunkServer = (ChunkProviderServer) provider; - IChunkProvider chunkProvider = chunkServer.serverChunkGenerator; - for (Vector2D coord : chunks) { long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ()); Chunk mcChunk; @@ -269,12 +268,12 @@ public class ForgeWorld extends AbstractWorld { } chunkServer.droppedChunksSet.remove(pos); chunkServer.id2ChunkMap.remove(pos); - mcChunk = chunkProvider.provideChunk(coord.getBlockX(), coord.getBlockZ()); + mcChunk = chunkServer.provideChunk(coord.getBlockX(), coord.getBlockZ()); chunkServer.id2ChunkMap.add(pos, mcChunk); chunkServer.loadedChunks.add(mcChunk); if (mcChunk != null) { mcChunk.onChunkLoad(); - mcChunk.populateChunk(chunkProvider, chunkProvider, coord.getBlockX(), coord.getBlockZ()); + mcChunk.populateChunk(chunkServer, chunkServer.chunkGenerator); } } } catch (Throwable t) { @@ -308,18 +307,18 @@ public class ForgeWorld extends AbstractWorld { case BIG_TREE: return new WorldGenBigTree(true); case REDWOOD: return new WorldGenTaiga2(true); case TALL_REDWOOD: return new WorldGenTaiga1(); - case BIRCH: return new WorldGenForest(true, false); + case BIRCH: return new WorldGenBirchTree(true, false); case JUNGLE: return new WorldGenMegaJungle(true, 10, 20, JUNGLE_LOG, JUNGLE_LEAF); case SMALL_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, false); case SHORT_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, true); case JUNGLE_BUSH: return new WorldGenShrub(JUNGLE_LOG, JUNGLE_SHRUB); - case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.brown_mushroom_block); - case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.red_mushroom_block); + case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.BROWN_MUSHROOM_BLOCK); + case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.RED_MUSHROOM_BLOCK); case SWAMP: return new WorldGenSwamp(); case ACACIA: return new WorldGenSavannaTree(true); case DARK_OAK: return new WorldGenCanopyTree(true); case MEGA_REDWOOD: return new WorldGenMegaPineTree(false, random.nextBoolean()); - case TALL_BIRCH: return new WorldGenForest(true, true); + case TALL_BIRCH: return new WorldGenBirchTree(true, true); case RANDOM: case PINE: case RANDOM_REDWOOD: @@ -390,9 +389,7 @@ public class ForgeWorld extends AbstractWorld { @Override public List getEntities(Region region) { List entities = new ArrayList(); - World world = getWorld(); - List ents = world.loadedEntityList; - for (net.minecraft.entity.Entity entity : ents) { + for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) { if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) { entities.add(new ForgeEntity(entity)); } 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 5ae29054e..009e1cf13 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 @@ -19,6 +19,8 @@ package com.sk89q.worldedit.forge; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.common.FMLCommonHandler; import org.apache.logging.log4j.Logger; import com.google.common.base.Joiner; @@ -39,7 +41,6 @@ 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.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -110,8 +111,6 @@ public class ForgeWorldEdit { WorldEdit.getInstance().getPlatformManager().unregister(platform); } - ForgeBiomeRegistry.populate(); - this.platform = new ForgePlatform(this); WorldEdit.getInstance().getPlatformManager().register(platform); @@ -135,13 +134,13 @@ public class ForgeWorldEdit { @SubscribeEvent public void onCommandEvent(CommandEvent event) { - if ((event.sender instanceof EntityPlayerMP)) { - if (((EntityPlayerMP) event.sender).worldObj.isRemote) return; - String[] split = new String[event.parameters.length + 1]; - System.arraycopy(event.parameters, 0, split, 1, event.parameters.length); - split[0] = event.command.getCommandName(); + if ((event.getSender() instanceof EntityPlayerMP)) { + if (((EntityPlayerMP) event.getSender()).worldObj.isRemote) return; + String[] split = new String[event.getParameters().length + 1]; + System.arraycopy(event.getParameters(), 0, split, 1, event.getParameters().length); + split[0] = event.getCommand().getCommandName(); com.sk89q.worldedit.event.platform.CommandEvent weEvent = - new com.sk89q.worldedit.event.platform.CommandEvent(wrap((EntityPlayerMP) event.sender), Joiner.on(" ").join(split)); + new com.sk89q.worldedit.event.platform.CommandEvent(wrap((EntityPlayerMP) event.getSender()), Joiner.on(" ").join(split)); WorldEdit.getInstance().getEventBus().post(weEvent); } } @@ -152,48 +151,49 @@ public class ForgeWorldEdit { return; } - if (!platform.isHookingEvents()) return; // We have to be told to catch these events + if (!platform.isHookingEvents()) + return; // We have to be told to catch these events - if (event.useItem == Result.DENY || event.entity.worldObj.isRemote) return; + if ((event instanceof PlayerInteractEvent.LeftClickBlock + && ((PlayerInteractEvent.LeftClickBlock) event) + .getUseItem() == Result.DENY) + || (event instanceof PlayerInteractEvent.RightClickBlock + && ((PlayerInteractEvent.RightClickBlock) event) + .getUseItem() == Result.DENY) + || event.getEntity().worldObj.isRemote) + return; WorldEdit we = WorldEdit.getInstance(); - ForgePlayer player = wrap((EntityPlayerMP) event.entityPlayer); - ForgeWorld world = getWorld(event.entityPlayer.worldObj); + ForgePlayer player = wrap((EntityPlayerMP) event.getEntityPlayer()); + ForgeWorld world = getWorld(event.getEntityPlayer().worldObj); - Action action = event.action; - switch (action) { - case LEFT_CLICK_BLOCK: { - WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ()); + if (event instanceof PlayerInteractEvent.LeftClickBlock) { + @SuppressWarnings("deprecation") + WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), + event.getPos().getX(), event.getPos().getY(), event.getPos().getZ()); - if (we.handleBlockLeftClick(player, pos)) { - event.setCanceled(true); - } - - if (we.handleArmSwing(player)) { - event.setCanceled(true); - } - - break; + if (we.handleBlockLeftClick(player, pos)) { + event.setCanceled(true); } - case RIGHT_CLICK_BLOCK: { - WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ()); - if (we.handleBlockRightClick(player, pos)) { - event.setCanceled(true); - } - - if (we.handleRightClick(player)) { - event.setCanceled(true); - } - - break; + if (we.handleArmSwing(player)) { + event.setCanceled(true); } - case RIGHT_CLICK_AIR: { - if (we.handleRightClick(player)) { - event.setCanceled(true); - } + } else if (event instanceof PlayerInteractEvent.RightClickBlock) { + @SuppressWarnings("deprecation") + WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), + event.getPos().getX(), event.getPos().getY(), event.getPos().getZ()); - break; + if (we.handleBlockRightClick(player, pos)) { + event.setCanceled(true); + } + + if (we.handleRightClick(player)) { + event.setCanceled(true); + } + } else if (event instanceof PlayerInteractEvent.RightClickEmpty) { + if (we.handleRightClick(player)) { + event.setCanceled(true); } } } @@ -201,7 +201,7 @@ public class ForgeWorldEdit { public static ItemStack toForgeItemStack(BaseItemStack item) { ItemStack ret = new ItemStack(Item.getItemById(item.getType()), item.getAmount(), item.getData()); for (Map.Entry entry : item.getEnchantments().entrySet()) { - ret.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentById(entry.getKey()), entry.getValue()); + ret.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentByID(entry.getKey()), entry.getValue()); } return ret; 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 69f4ab6ad..d24d83bb0 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 @@ -213,7 +213,7 @@ final class NBTConverter { } public static CompoundTag fromNative(NBTTagCompound other) { - @SuppressWarnings("unchecked") Set tags = other.getKeySet(); + Set tags = other.getKeySet(); Map map = new HashMap(); for (String tagName : tags) { map.put(tagName, fromNative(other.getTag(tagName))); 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 0ca19c5b0..bd33ac01b 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 @@ -58,12 +58,11 @@ public class ThreadSafeCache { Set onlineIds = new HashSet(); MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); - if (server == null || server.getConfigurationManager() == null) { + if (server == null || server.getPlayerList() == null) { return; } - for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) { - if (object != null) { - EntityPlayerMP player = (EntityPlayerMP) object; + for (EntityPlayerMP player : server.getPlayerList().getPlayerList()) { + if (player != null) { onlineIds.add(player.getUniqueID()); } } 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 328420b27..0ac31b951 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 @@ -21,16 +21,14 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.Vector; +import java.lang.reflect.Constructor; +import javax.annotation.Nullable; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; - -import java.lang.reflect.Constructor; - import static com.google.common.base.Preconditions.checkNotNull; /** @@ -98,7 +96,7 @@ final class TileEntityUtils { static void setTileEntity(World world, Vector position, @Nullable NBTTagCompound tag) { if (tag != null) { updateForSet(tag, position); - TileEntity tileEntity = TileEntity.createAndLoadEntity(tag); + TileEntity tileEntity = TileEntity.createTileEntity(world.getMinecraftServer(), tag); if (tileEntity != null) { 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 24da15c53..1a89fc5db 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 @@ -26,7 +26,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.network.ThreadQuickExitException; -import net.minecraft.network.play.server.S3FPacketCustomPayload; +import net.minecraft.network.play.server.SPacketCustomPayload; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.FMLEventChannel; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; @@ -44,7 +44,7 @@ public class WECUIPacketHandler { @SubscribeEvent public void onPacketData(ServerCustomPacketEvent event) { - if (event.packet.channel().equals(ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) { + if (event.getPacket().channel().equals(ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) { EntityPlayerMP player = getPlayerFromEvent(event); LocalSession session = ForgeWorldEdit.inst.getSession((EntityPlayerMP) player); @@ -52,7 +52,7 @@ public class WECUIPacketHandler { return; } - String text = event.packet.payload().toString(UTF_8_CHARSET); + String text = event.getPacket().payload().toString(UTF_8_CHARSET); session.handleCUIInitializationMessage(text); session.describeCUI(ForgeWorldEdit.inst.wrap(player)); } @@ -61,12 +61,12 @@ public class WECUIPacketHandler { @SubscribeEvent public void callProcessPacket(ClientCustomPacketEvent event) { try { - new S3FPacketCustomPayload(event.packet.channel(), new PacketBuffer(event.packet.payload())).processPacket(event.handler); + new SPacketCustomPayload(event.getPacket().channel(), new PacketBuffer(event.getPacket().payload())).processPacket(event.getHandler()); } catch (ThreadQuickExitException suppress) { } } private static EntityPlayerMP getPlayerFromEvent(ServerCustomPacketEvent event) { - return ((NetHandlerPlayServer) event.handler).playerEntity; + return ((NetHandlerPlayServer) event.getHandler()).playerEntity; } } \ No newline at end of file diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java index 592c0dadb..97ff555cd 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java @@ -32,7 +32,6 @@ public class GuiReferenceCard extends GuiScreen { private int backgroundHeight = 256; @Override - @SuppressWarnings("unchecked") public void initGui() { this.buttonList.add(this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close")); } diff --git a/worldedit-forge/src/main/resources/META-INF/worldedit_at.cfg b/worldedit-forge/src/main/resources/META-INF/worldedit_at.cfg index 33f039ce3..a15c42170 100644 --- a/worldedit-forge/src/main/resources/META-INF/worldedit_at.cfg +++ b/worldedit-forge/src/main/resources/META-INF/worldedit_at.cfg @@ -1,4 +1,4 @@ public net.minecraft.world.gen.ChunkProviderServer field_73248_b # droppedChunksSet public net.minecraft.world.gen.ChunkProviderServer field_73244_f # id2ChunkMap public net.minecraft.world.gen.ChunkProviderServer field_73245_g # loadedChunks -public net.minecraft.world.gen.ChunkProviderServer field_73246_d # serverChunkGenerator +public net.minecraft.world.gen.ChunkProviderServer field_186029_c # chunkGenerator