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 {
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'
}

View File

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

View File

@ -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<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;
}

View File

@ -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:

View File

@ -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);
}