Update Sponge implementation for Minecraft 1.9.4

This commit is contained in:
Minecrell 2016-05-21 12:48:39 +02:00 committed by wizjany
parent a8d04c24be
commit 3216695d65
6 changed files with 20 additions and 20 deletions

View File

@ -9,7 +9,7 @@ buildscript {
dependencies { dependencies {
classpath 'net.minecrell:VanillaGradle:2.0.3_1' 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 { dependencies {
compile project(':worldedit-core') 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' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1'
} }
@ -35,8 +35,8 @@ sponge {
} }
minecraft { minecraft {
version = "1.8.9" version = "1.9.4"
mappings = "stable_22" mappings = 'snapshot_20160521'
runDir = 'run' runDir = 'run'
} }

View File

@ -44,7 +44,7 @@ public abstract class CommandAdapter implements CommandCallable {
} }
@Override @Override
public Optional<? extends Text> getShortDescription(CommandSource source) { public Optional<Text> getShortDescription(CommandSource source) {
String description = command.getDescription().getDescription(); String description = command.getDescription().getDescription();
if (description != null && !description.isEmpty()) { if (description != null && !description.isEmpty()) {
return Optional.of(Text.of(description)); return Optional.of(Text.of(description));
@ -53,7 +53,7 @@ public abstract class CommandAdapter implements CommandCallable {
} }
@Override @Override
public Optional<? extends Text> getHelp(CommandSource source) { public Optional<Text> getHelp(CommandSource source) {
String help = command.getDescription().getHelp(); String help = command.getDescription().getHelp();
if (help != null && !help.isEmpty()) { if (help != null && !help.isEmpty()) {
return Optional.of(Text.of(help)); return Optional.of(Text.of(help));

View File

@ -21,7 +21,7 @@ package com.sk89q.worldedit.sponge.nms;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; 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.block.BlockType;
import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.world.biome.BiomeType; import org.spongepowered.api.world.biome.BiomeType;
@ -40,7 +40,7 @@ public final class IDHelper {
} }
public static int resolve(BiomeType type) { public static int resolve(BiomeType type) {
return ((BiomeGenBase) type).biomeID; return Biome.getIdForBiome((Biome) type);
} }
public static ItemType resolveItem(int intID) { public static ItemType resolveItem(int intID) {
@ -52,6 +52,6 @@ public final class IDHelper {
} }
public static BiomeType resolveBiome(int intID) { public static BiomeType resolveBiome(int intID) {
return (BiomeType) BiomeGenBase.getBiome(intID); return (BiomeType) Biome.getBiome(intID);
} }
} }

View File

@ -36,7 +36,7 @@ public final class NMSHelper {
public static ItemStack makeSpongeStack(BaseItemStack itemStack) { public static ItemStack makeSpongeStack(BaseItemStack itemStack) {
net.minecraft.item.ItemStack newStack = new net.minecraft.item.ItemStack(Item.getItemById(itemStack.getType()), itemStack.getAmount(), itemStack.getData()); net.minecraft.item.ItemStack newStack = new net.minecraft.item.ItemStack(Item.getItemById(itemStack.getType()), itemStack.getAmount(), itemStack.getData());
for (Map.Entry<Integer, Integer> entry : itemStack.getEnchantments().entrySet()) { for (Map.Entry<Integer, Integer> 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; return (ItemStack) (Object) newStack;
} }

View File

@ -35,7 +35,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt; import net.minecraft.nbt.NBTTagInt;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.gen.feature.*; import net.minecraft.world.gen.feature.*;
import org.spongepowered.api.block.BlockState; import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.Entity;
@ -49,9 +49,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
@Deprecated @Deprecated
public class SpongeNMSWorld extends SpongeWorld { 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_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_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_SHRUB = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
/** /**
* Construct a new world. * Construct a new world.
@ -119,18 +119,18 @@ public class SpongeNMSWorld extends SpongeWorld {
case BIG_TREE: return new WorldGenBigTree(true); case BIG_TREE: return new WorldGenBigTree(true);
case REDWOOD: return new WorldGenTaiga2(true); case REDWOOD: return new WorldGenTaiga2(true);
case TALL_REDWOOD: return new WorldGenTaiga1(); 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 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 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 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 JUNGLE_BUSH: return new WorldGenShrub(JUNGLE_LOG, JUNGLE_SHRUB);
case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.brown_mushroom_block); case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.BROWN_MUSHROOM_BLOCK);
case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.red_mushroom_block); case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.RED_MUSHROOM_BLOCK);
case SWAMP: return new WorldGenSwamp(); case SWAMP: return new WorldGenSwamp();
case ACACIA: return new WorldGenSavannaTree(true); case ACACIA: return new WorldGenSavannaTree(true);
case DARK_OAK: return new WorldGenCanopyTree(true); case DARK_OAK: return new WorldGenCanopyTree(true);
case MEGA_REDWOOD: return new WorldGenMegaPineTree(false, random.nextBoolean()); 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 RANDOM:
case PINE: case PINE:
case RANDOM_REDWOOD: case RANDOM_REDWOOD:

View File

@ -23,7 +23,7 @@ import com.sk89q.worldedit.Vector;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt; import net.minecraft.nbt.NBTTagInt;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -97,7 +97,7 @@ final class TileEntityUtils {
static void setTileEntity(World world, Vector position, @Nullable NBTTagCompound tag) { static void setTileEntity(World world, Vector position, @Nullable NBTTagCompound tag) {
if (tag != null) { if (tag != null) {
updateForSet(tag, position); updateForSet(tag, position);
TileEntity tileEntity = TileEntity.createAndLoadEntity(tag); TileEntity tileEntity = TileEntity.create(tag);
if (tileEntity != null) { if (tileEntity != null) {
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
} }