diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ca78035ef..d6e2637af 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c76e8f2d8..589dd6099 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu May 05 15:11:12 PDT 2016 +#Wed Nov 23 21:39:25 PST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-bin.zip diff --git a/gradlew b/gradlew index 27309d923..4ef3a871f 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,18 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +# Escape application args +for s in "${@}" ; do + s=\"$s\" + APP_ARGS=$APP_ARGS" "$s +done -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- "$DEFAULT_JVM_OPTS" "$JAVA_OPTS" "$GRADLE_OPTS" "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f6d5974e7..e95643d6a 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -49,7 +49,6 @@ goto fail @rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index cd7563435..c69019b14 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -26,13 +26,11 @@ repositories { } } -//version = "6.1.2" -ext.forgeVersion = "12.18.0.2002-1.10.0" -//ext.internalVersion = version + ";" + gitCommitHash +ext.forgeVersion = "13.19.0.2149" minecraft { - version = "1.10.2-${project.forgeVersion}" - mappings = "snapshot_20160629" + version = "1.11-${project.forgeVersion}" + mappings = "snapshot_20161118" 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 eef6df939..38cd3c8ca 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 @@ -38,12 +38,12 @@ public class CommandWrapper extends CommandBase { } @Override - public String getCommandName() { + public String getName() { return command.getPrimaryAlias(); } @Override - public List getCommandAliases() { + public List getAliases() { return Arrays.asList(command.getAllAliases()); } @@ -52,7 +52,7 @@ public class CommandWrapper extends CommandBase { } @Override - public String getCommandUsage(ICommandSender icommandsender) { + public String getUsage(ICommandSender icommandsender) { return "/" + command.getPrimaryAlias() + " " + command.getDescription().getUsage(); } @@ -70,10 +70,8 @@ public class CommandWrapper extends CommandBase { public int compareTo(@Nullable ICommand o) { if (o == null) { return 0; - } else if (o instanceof ICommand) { - return super.compareTo((ICommand) o); } else { - return 0; + return super.compareTo(o); } } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java index 849d03885..efc32d43e 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java @@ -68,7 +68,7 @@ class ForgeEntity implements Entity { float yaw = entity.rotationYaw; float pitch = entity.rotationPitch; - return new Location(ForgeAdapter.adapt(entity.worldObj), position, yaw, pitch); + return new Location(ForgeAdapter.adapt(entity.world), position, yaw, pitch); } else { return new Location(NullWorld.getInstance()); } @@ -78,7 +78,7 @@ class ForgeEntity implements Entity { public Extent getExtent() { net.minecraft.entity.Entity entity = entityRef.get(); if (entity != null) { - return ForgeAdapter.adapt(entity.worldObj); + return ForgeAdapter.adapt(entity.world); } else { return NullWorld.getInstance(); } 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 e4f78cf36..d84f53b89 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 @@ -36,6 +36,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.PlayerList; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -92,7 +93,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public boolean isValidMobType(String type) { - return EntityList.NAME_TO_CLASS.containsKey(type); + return EntityList.isStringValidEntityName(new ResourceLocation(type)); } @Override @@ -122,7 +123,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { return player; } else { EntityPlayerMP entity = server.getPlayerList().getPlayerByUsername(player.getName()); - return entity != null ? new ForgePlayer(this, entity) : null; + return entity != null ? new ForgePlayer(entity) : null; } } @@ -201,9 +202,9 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { public Collection getConnectedUsers() { List users = new ArrayList(); PlayerList scm = server.getPlayerList(); - for (EntityPlayerMP entity : scm.getPlayerList()) { + for (EntityPlayerMP entity : scm.getPlayers()) { if (entity != null) { - users.add(new ForgePlayer(this, entity)); + users.add(new ForgePlayer(entity)); } } return users; 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 6a9027e69..c0b1ed7ed 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 @@ -44,11 +44,9 @@ import net.minecraft.util.text.TextFormatting; public class ForgePlayer extends AbstractPlayerActor { - private final ForgePlatform platform; private final EntityPlayerMP player; - protected ForgePlayer(ForgePlatform platform, EntityPlayerMP player) { - this.platform = platform; + protected ForgePlayer(EntityPlayerMP player) { this.player = player; ThreadSafeCache.getInstance().getOnlineIds().add(getUniqueId()); } @@ -78,7 +76,7 @@ public class ForgePlayer extends AbstractPlayerActor { public Location getLocation() { Vector position = new Vector(this.player.posX, this.player.posY, this.player.posZ); return new Location( - ForgeWorldEdit.inst.getWorld(this.player.worldObj), + ForgeWorldEdit.inst.getWorld(this.player.world), position, this.player.rotationYaw, this.player.rotationPitch); @@ -87,12 +85,12 @@ public class ForgePlayer extends AbstractPlayerActor { @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); + return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.world)), this.player.posX, this.player.posY, this.player.posZ); } @Override public com.sk89q.worldedit.world.World getWorld() { - return ForgeWorldEdit.inst.getWorld(this.player.worldObj); + return ForgeWorldEdit.inst.getWorld(this.player.world); } @Override @@ -125,7 +123,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public void printRaw(String msg) { for (String part : msg.split("\n")) { - this.player.addChatMessage(new TextComponentString(part)); + this.player.sendMessage(new TextComponentString(part)); } } @@ -148,7 +146,7 @@ public class ForgePlayer extends AbstractPlayerActor { for (String part : msg.split("\n")) { TextComponentString component = new TextComponentString(part); component.getStyle().setColor(formatting); - this.player.addChatMessage(component); + this.player.sendMessage(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 d2a2d69ff..cc711611e 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 @@ -27,6 +27,7 @@ import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.LazyBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Direction; @@ -50,6 +51,7 @@ import net.minecraft.server.management.PlayerChunkMapEntry; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; @@ -77,7 +79,7 @@ import static com.google.common.base.Preconditions.checkNotNull; public class ForgeWorld extends AbstractWorld { private static final Random random = new Random(); - private static final int UPDATE = 1, NOTIFY = 2, NOTIFY_CLIENT = 4; + private static final int UPDATE = 1, NOTIFY = 2; 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); @@ -145,6 +147,7 @@ public class ForgeWorld extends AbstractWorld { Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4); BlockPos pos = new BlockPos(x, y, z); IBlockState old = chunk.getBlockState(pos); + @SuppressWarnings("deprecation") IBlockState newState = Block.getBlockById(block.getId()).getStateFromMeta(block.getData()); IBlockState successState = chunk.setBlockState(pos, newState); boolean successful = successState != null; @@ -233,7 +236,7 @@ public class ForgeWorld extends AbstractWorld { EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeWorldEdit.toForgeItemStack(item)); entity.setPickupDelay(10); - getWorld().spawnEntityInWorld(entity); + getWorld().spawnEntity(entity); } @Override @@ -263,7 +266,7 @@ public class ForgeWorld extends AbstractWorld { try { ChunkProviderServer chunkServer = (ChunkProviderServer) provider; IChunkGenerator gen = chunkServer.chunkGenerator; - long pos = ChunkPos.chunkXZ2Int(chunk.getBlockX(), chunk.getBlockZ()); + long pos = ChunkPos.asLong(chunk.getBlockX(), chunk.getBlockZ()); if (chunkServer.chunkExists(chunk.getBlockX(), chunk.getBlockZ())) { mcChunk = chunkServer.loadChunk(chunk.getBlockX(), chunk.getBlockZ()); PlayerChunkMapEntry entry = playerManager.getEntry(chunk.getBlockX(), chunk.getBlockZ()); @@ -295,7 +298,7 @@ public class ForgeWorld extends AbstractWorld { if (!region.contains(pt)) editSession.smartSetBlock(pt, history[index]); else { - editSession.rememberChange(pt, history[index], editSession.rawGetBlock(pt)); + editSession.getChangeSet().add(new BlockChange(pt.toBlockVector(), history[index], editSession.getBlock(pt))); } } } @@ -423,7 +426,7 @@ public class ForgeWorld extends AbstractWorld { @Override public Entity createEntity(Location location, BaseEntity entity) { World world = getWorld(); - net.minecraft.entity.Entity createdEntity = EntityList.createEntityByName(entity.getTypeId(), world); + net.minecraft.entity.Entity createdEntity = EntityList.createEntityByIDFromName(new ResourceLocation(entity.getTypeId()), world); if (createdEntity != null) { CompoundTag nativeTag = entity.getNbtData(); if (nativeTag != null) { @@ -436,7 +439,7 @@ public class ForgeWorld extends AbstractWorld { createdEntity.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - world.spawnEntityInWorld(createdEntity); + world.spawnEntity(createdEntity); return new ForgeEntity(createdEntity); } else { return null; @@ -446,6 +449,7 @@ public class ForgeWorld extends AbstractWorld { /** * Thrown when the reference to the world is lost. */ + @SuppressWarnings("serial") private static class WorldReferenceLostException extends WorldEditException { private WorldReferenceLostException(String message) { super(message); 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 056a6882d..5b08a260e 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 @@ -138,10 +138,10 @@ public class ForgeWorldEdit { @SubscribeEvent public void onCommandEvent(CommandEvent event) { if ((event.getSender() instanceof EntityPlayerMP)) { - if (((EntityPlayerMP) event.getSender()).worldObj.isRemote) return; + if (((EntityPlayerMP) event.getSender()).world.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(); + split[0] = event.getCommand().getName(); com.sk89q.worldedit.event.platform.CommandEvent weEvent = new com.sk89q.worldedit.event.platform.CommandEvent(wrap((EntityPlayerMP) event.getSender()), Joiner.on(" ").join(split)); WorldEdit.getInstance().getEventBus().post(weEvent); @@ -164,13 +164,13 @@ public class ForgeWorldEdit { event instanceof PlayerInteractEvent.RightClickBlock && ((PlayerInteractEvent.RightClickBlock) event) .getUseItem() == Result.DENY; - if (isLeftDeny || isRightDeny || event.getEntity().worldObj.isRemote) { + if (isLeftDeny || isRightDeny || event.getEntity().world.isRemote) { return; } WorldEdit we = WorldEdit.getInstance(); ForgePlayer player = wrap((EntityPlayerMP) event.getEntityPlayer()); - ForgeWorld world = getWorld(event.getEntityPlayer().worldObj); + ForgeWorld world = getWorld(event.getEntityPlayer().world); if (event instanceof PlayerInteractEvent.LeftClickBlock) { @SuppressWarnings("deprecation") @@ -229,7 +229,7 @@ public class ForgeWorldEdit { */ public ForgePlayer wrap(EntityPlayerMP player) { checkNotNull(player); - return new ForgePlayer(platform, player); + return new ForgePlayer(player); } /** 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 ea037e548..a89d2edc2 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 @@ -40,8 +40,8 @@ public class KeyHandler { @SubscribeEvent public void onKey(KeyInputEvent evt) { - if (mc.thePlayer != null && mc.theWorld != null && mainKey.isPressed()) { - mc.thePlayer.openGui(ForgeWorldEdit.inst, GuiHandler.REFERENCE_ID, mc.theWorld, 0, 0, 0); + if (mc.player != null && mc.world != null && mainKey.isPressed()) { + mc.player.openGui(ForgeWorldEdit.inst, GuiHandler.REFERENCE_ID, mc.world, 0, 0, 0); } } 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 d24d83bb0..1b2eb4487 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 @@ -175,7 +175,7 @@ final class NBTConverter { } public static ListTag fromNative(NBTTagList other) { - other = (NBTTagList) other.copy(); + other = other.copy(); List list = new ArrayList(); Class listClass = StringTag.class; int tags = other.tagCount(); 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 bd33ac01b..6f3b4182d 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 @@ -61,7 +61,7 @@ public class ThreadSafeCache { if (server == null || server.getPlayerList() == null) { return; } - for (EntityPlayerMP player : server.getPlayerList().getPlayerList()) { + for (EntityPlayerMP player : server.getPlayerList().getPlayers()) { if (player != null) { onlineIds.add(player.getUniqueID()); } 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 1a89fc5db..4a87abba4 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 @@ -46,7 +46,7 @@ public class WECUIPacketHandler { public void onPacketData(ServerCustomPacketEvent event) { if (event.getPacket().channel().equals(ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) { EntityPlayerMP player = getPlayerFromEvent(event); - LocalSession session = ForgeWorldEdit.inst.getSession((EntityPlayerMP) player); + LocalSession session = ForgeWorldEdit.inst.getSession(player); if (session.hasCUISupport()) { return; 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 97ff555cd..a9e53d36d 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 @@ -50,7 +50,7 @@ public class GuiReferenceCard extends GuiScreen { @Override protected void actionPerformed(GuiButton button) { if (button.id == 0) { - this.mc.thePlayer.closeScreen(); + this.mc.player.closeScreen(); } }