From 3216695d65a011681db671a7eade9fd11c4d1fef Mon Sep 17 00:00:00 2001 From: Minecrell Date: Sat, 21 May 2016 12:48:39 +0200 Subject: [PATCH] Update Sponge implementation for Minecraft 1.9.4 --- worldedit-sponge/build.gradle | 8 ++++---- .../sk89q/worldedit/sponge/CommandAdapter.java | 4 ++-- .../com/sk89q/worldedit/sponge/nms/IDHelper.java | 6 +++--- .../sk89q/worldedit/sponge/nms/NMSHelper.java | 2 +- .../worldedit/sponge/nms/SpongeNMSWorld.java | 16 ++++++++-------- .../worldedit/sponge/nms/TileEntityUtils.java | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index abd772fa0..b4b9871ba 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -9,7 +9,7 @@ buildscript { dependencies { classpath 'net.minecrell:VanillaGradle:2.0.3_1' - classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' } } @@ -21,7 +21,7 @@ apply plugin: 'net.minecrell.vanilla.server.library' dependencies { compile project(':worldedit-core') - compile 'org.spongepowered:spongeapi:4.1.0-SNAPSHOT' + compile 'org.spongepowered:spongeapi:5.0.0-SNAPSHOT' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' } @@ -35,8 +35,8 @@ sponge { } minecraft { - version = "1.8.9" - mappings = "stable_22" + version = "1.9.4" + mappings = 'snapshot_20160521' runDir = 'run' } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CommandAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CommandAdapter.java index 1398ba389..f94bd3b08 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CommandAdapter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CommandAdapter.java @@ -44,7 +44,7 @@ public abstract class CommandAdapter implements CommandCallable { } @Override - public Optional getShortDescription(CommandSource source) { + public Optional getShortDescription(CommandSource source) { String description = command.getDescription().getDescription(); if (description != null && !description.isEmpty()) { return Optional.of(Text.of(description)); @@ -53,7 +53,7 @@ public abstract class CommandAdapter implements CommandCallable { } @Override - public Optional getHelp(CommandSource source) { + public Optional getHelp(CommandSource source) { String help = command.getDescription().getHelp(); if (help != null && !help.isEmpty()) { return Optional.of(Text.of(help)); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java index 52aa06c0c..d607bfb64 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.sponge.nms; import net.minecraft.block.Block; import net.minecraft.item.Item; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import org.spongepowered.api.block.BlockType; import org.spongepowered.api.item.ItemType; import org.spongepowered.api.world.biome.BiomeType; @@ -40,7 +40,7 @@ public final class IDHelper { } public static int resolve(BiomeType type) { - return ((BiomeGenBase) type).biomeID; + return Biome.getIdForBiome((Biome) type); } public static ItemType resolveItem(int intID) { @@ -52,6 +52,6 @@ public final class IDHelper { } public static BiomeType resolveBiome(int intID) { - return (BiomeType) BiomeGenBase.getBiome(intID); + return (BiomeType) Biome.getBiome(intID); } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java index 4917c1f68..7abd7588b 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java @@ -36,7 +36,7 @@ public final class NMSHelper { public static ItemStack makeSpongeStack(BaseItemStack itemStack) { net.minecraft.item.ItemStack newStack = new net.minecraft.item.ItemStack(Item.getItemById(itemStack.getType()), itemStack.getAmount(), itemStack.getData()); for (Map.Entry entry : itemStack.getEnchantments().entrySet()) { - newStack.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentById(entry.getKey()), entry.getValue()); + newStack.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentByID(entry.getKey()), entry.getValue()); } return (ItemStack) (Object) newStack; } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java index 4e1c38d23..bb3408e15 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java @@ -35,7 +35,7 @@ import net.minecraft.inventory.IInventory; 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.gen.feature.*; import org.spongepowered.api.block.BlockState; import org.spongepowered.api.entity.Entity; @@ -49,9 +49,9 @@ import static com.google.common.base.Preconditions.checkNotNull; @Deprecated public class SpongeNMSWorld extends SpongeWorld { - 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)); /** * Construct a new world. @@ -119,18 +119,18 @@ public class SpongeNMSWorld extends SpongeWorld { 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: diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java index 357cf53ad..84434b0a8 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java @@ -23,7 +23,7 @@ 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.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; @@ -97,7 +97,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.create(tag); if (tileEntity != null) { world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); }