fix converter + doors
This commit is contained in:
parent
601a331ee3
commit
96fb940087
3 changed files with 347 additions and 489 deletions
|
@ -28,388 +28,273 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockDoor extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyBool OPEN = PropertyBool.create("open");
|
||||
public static final PropertyEnum<BlockDoor.EnumHingePosition> HINGE = PropertyEnum.<BlockDoor.EnumHingePosition>create("hinge", BlockDoor.EnumHingePosition.class);
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
public static final PropertyEnum<BlockDoor.EnumDoorHalf> HALF = PropertyEnum.<BlockDoor.EnumDoorHalf>create("half", BlockDoor.EnumDoorHalf.class);
|
||||
public static final List<BlockDoor> DOORS = Lists.newArrayList();
|
||||
public class BlockDoor extends Block implements Rotatable {
|
||||
public static enum EnumDoorHalf implements Identifyable {
|
||||
UPPER, LOWER;
|
||||
|
||||
public BlockDoor(Material materialIn)
|
||||
{
|
||||
super(materialIn);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HINGE, BlockDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf(false)).withProperty(HALF, BlockDoor.EnumDoorHalf.LOWER));
|
||||
DOORS.add(this);
|
||||
}
|
||||
public String toString() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Gets the localized name of this block. Used for the statistics page.
|
||||
// */
|
||||
// public String getLocalizedName()
|
||||
// {
|
||||
// return Strs.get((this.getUnlocalizedName() + ".name").replaceAll("tile", "item"));
|
||||
// }
|
||||
public String getName() {
|
||||
return this == UPPER ? "upper" : "lower";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public static enum EnumHingePosition implements Identifyable {
|
||||
LEFT, RIGHT;
|
||||
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn.getState(pos).getValue(OPEN);
|
||||
}
|
||||
public String toString() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public String getName() {
|
||||
return this == LEFT ? "left" : "right";
|
||||
}
|
||||
}
|
||||
|
||||
public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(worldIn, pos);
|
||||
return super.getSelectedBoundingBox(worldIn, pos);
|
||||
}
|
||||
public static final PropertyBool OPEN = PropertyBool.create("open");
|
||||
public static final PropertyEnum<EnumHingePosition> HINGE = PropertyEnum.<EnumHingePosition>create("hinge", EnumHingePosition.class);
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
public static final PropertyEnum<EnumDoorHalf> HALF = PropertyEnum.<EnumDoorHalf>create("half", EnumDoorHalf.class);
|
||||
public static final List<BlockDoor> DOORS = Lists.newArrayList();
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(worldIn, pos);
|
||||
return super.getCollisionBoundingBox(worldIn, pos, state);
|
||||
}
|
||||
public BlockDoor(Material material) {
|
||||
super(material);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, false)
|
||||
.withProperty(HINGE, EnumHingePosition.LEFT).withProperty(POWERED, false)
|
||||
.withProperty(HALF, EnumDoorHalf.LOWER));
|
||||
DOORS.add(this);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
float f = 0.1875F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
|
||||
State state = worldIn.getState(pos);
|
||||
Facing enumfacing = state.getValue(FACING);
|
||||
boolean flag = state.getValue(OPEN);
|
||||
boolean flag1 = state.getValue(HINGE) == BlockDoor.EnumHingePosition.RIGHT;
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (enumfacing == Facing.EAST)
|
||||
{
|
||||
if (!flag1)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
else if (enumfacing == Facing.SOUTH)
|
||||
{
|
||||
if (!flag1)
|
||||
{
|
||||
this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
else if (enumfacing == Facing.WEST)
|
||||
{
|
||||
if (!flag1)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
}
|
||||
}
|
||||
else if (enumfacing == Facing.NORTH)
|
||||
{
|
||||
if (!flag1)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (enumfacing == Facing.EAST)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
}
|
||||
else if (enumfacing == Facing.SOUTH)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
}
|
||||
else if (enumfacing == Facing.WEST)
|
||||
{
|
||||
this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else if (enumfacing == Facing.NORTH)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
public boolean isPassable(IBlockAccess world, BlockPos pos) {
|
||||
return world.getState(pos).getValue(OPEN);
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (this.material == Material.SOLID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
|
||||
State iblockstate = pos.equals(blockpos) ? state : worldIn.getState(blockpos);
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iblockstate.getBlock() != this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = iblockstate.cycleProperty(OPEN);
|
||||
worldIn.setState(blockpos, state, 2);
|
||||
worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
|
||||
worldIn.playAuxSFX(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public BoundingBox getSelectedBoundingBox(World world, BlockPos pos) {
|
||||
this.setBlockBoundsBasedOnState(world, pos);
|
||||
return super.getSelectedBoundingBox(world, pos);
|
||||
}
|
||||
|
||||
public void toggleDoor(World worldIn, BlockPos pos, boolean open)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
public BoundingBox getCollisionBoundingBox(World world, BlockPos pos, State state) {
|
||||
this.setBlockBoundsBasedOnState(world, pos);
|
||||
return super.getCollisionBoundingBox(world, pos, state);
|
||||
}
|
||||
|
||||
if (iblockstate.getBlock() == this)
|
||||
{
|
||||
BlockPos blockpos = iblockstate.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
|
||||
State iblockstate1 = pos == blockpos ? iblockstate : worldIn.getState(blockpos);
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess world, BlockPos pos) {
|
||||
float thick = 0.1875F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
|
||||
State state = world.getState(pos);
|
||||
Facing facing = state.getValue(FACING);
|
||||
boolean open = state.getValue(OPEN);
|
||||
boolean right = state.getValue(HINGE) == EnumHingePosition.RIGHT;
|
||||
|
||||
if (iblockstate1.getBlock() == this && ((Boolean)iblockstate1.getValue(OPEN)).booleanValue() != open)
|
||||
{
|
||||
worldIn.setState(blockpos, iblockstate1.withProperty(OPEN, Boolean.valueOf(open)), 2);
|
||||
worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
|
||||
worldIn.playAuxSFX(open ? 1003 : 1006, pos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(open) {
|
||||
if(facing == Facing.EAST) {
|
||||
if(!right) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, thick);
|
||||
}
|
||||
else {
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - thick, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
else if(facing == Facing.SOUTH) {
|
||||
if(!right) {
|
||||
this.setBlockBounds(1.0F - thick, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, thick, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
else if(facing == Facing.WEST) {
|
||||
if(!right) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - thick, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, thick);
|
||||
}
|
||||
}
|
||||
else if(facing == Facing.NORTH) {
|
||||
if(!right) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, thick, 1.0F, 1.0F);
|
||||
}
|
||||
else {
|
||||
this.setBlockBounds(1.0F - thick, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(facing == Facing.EAST) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, thick, 1.0F, 1.0F);
|
||||
}
|
||||
else if(facing == Facing.SOUTH) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, thick);
|
||||
}
|
||||
else if(facing == Facing.WEST) {
|
||||
this.setBlockBounds(1.0F - thick, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else if(facing == Facing.NORTH) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - thick, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a neighboring block changes.
|
||||
*/
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock)
|
||||
{
|
||||
if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER)
|
||||
{
|
||||
BlockPos blockpos = pos.down();
|
||||
State iblockstate = worldIn.getState(blockpos);
|
||||
public boolean onBlockActivated(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) {
|
||||
if(this.material == Material.SOLID)
|
||||
return true;
|
||||
BlockPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down();
|
||||
BlockPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up();
|
||||
State bottom = pos.equals(lower) ? state : world.getState(lower);
|
||||
State top = pos.equals(upper) ? state : world.getState(upper);
|
||||
if(bottom.getBlock() != this || top.getBlock() != this)
|
||||
return false;
|
||||
boolean open = !state.getValue(OPEN);
|
||||
world.setState(lower, bottom.withProperty(OPEN, open), 2);
|
||||
world.setState(upper, top.withProperty(OPEN, open), 2);
|
||||
world.markBlockRangeForRenderUpdate(lower, upper);
|
||||
world.playAuxSFX(player, open ? 1003 : 1006, pos, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (iblockstate.getBlock() != this)
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
else if (neighborBlock != this)
|
||||
{
|
||||
this.onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean flag1 = false;
|
||||
BlockPos blockpos1 = pos.up();
|
||||
State iblockstate1 = worldIn.getState(blockpos1);
|
||||
public void toggleDoor(World world, BlockPos pos, boolean open) {
|
||||
State state = world.getState(pos);
|
||||
if(state.getBlock() == this) {
|
||||
BlockPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down();
|
||||
BlockPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up();
|
||||
State bottom = pos.equals(lower) ? state : world.getState(lower);
|
||||
State top = pos.equals(upper) ? state : world.getState(upper);
|
||||
if(bottom.getBlock() == this && top.getBlock() == this && ((open != bottom.getValue(OPEN)) || (open != top.getValue(OPEN)))) {
|
||||
world.setState(lower, bottom.withProperty(OPEN, open), 2);
|
||||
world.setState(upper, top.withProperty(OPEN, open), 2);
|
||||
world.markBlockRangeForRenderUpdate(lower, upper);
|
||||
world.playAuxSFX(open ? 1003 : 1006, pos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iblockstate1.getBlock() != this)
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
flag1 = true;
|
||||
}
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, State state, Block neighbor) {
|
||||
if(state.getValue(HALF) == EnumDoorHalf.UPPER) {
|
||||
BlockPos lower = pos.down();
|
||||
State bottom = world.getState(lower);
|
||||
|
||||
if (!worldIn.isBlockSolid(pos.down()))
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
flag1 = true;
|
||||
if(bottom.getBlock() != this) {
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
else if(neighbor != this) {
|
||||
this.onNeighborBlockChange(world, lower, bottom, neighbor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
boolean wrong = false;
|
||||
BlockPos upper = pos.up();
|
||||
State top = world.getState(upper);
|
||||
|
||||
if (iblockstate1.getBlock() == this)
|
||||
{
|
||||
worldIn.setBlockToAir(blockpos1);
|
||||
}
|
||||
}
|
||||
if(top.getBlock() != this) {
|
||||
world.setBlockToAir(pos);
|
||||
wrong = true;
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (!worldIn.client)
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos1);
|
||||
if(!world.isBlockSolid(pos.down())) {
|
||||
world.setBlockToAir(pos);
|
||||
wrong = true;
|
||||
|
||||
if ((flag || neighborBlock.canProvidePower()) && neighborBlock != this && flag != ((Boolean)iblockstate1.getValue(POWERED)).booleanValue())
|
||||
{
|
||||
worldIn.setState(blockpos1, iblockstate1.withProperty(POWERED, Boolean.valueOf(flag)), 2);
|
||||
if(top.getBlock() == this) {
|
||||
world.setBlockToAir(upper);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != ((Boolean)state.getValue(OPEN)).booleanValue())
|
||||
{
|
||||
worldIn.setState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2);
|
||||
worldIn.markBlockRangeForRenderUpdate(pos, pos);
|
||||
worldIn.playAuxSFX(flag ? 1003 : 1006, pos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(wrong) {
|
||||
if(!world.client) {
|
||||
this.dropBlockAsItem(world, pos, state, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
boolean power = world.isBlockPowered(pos) || world.isBlockPowered(upper);
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? null : this.getItem();
|
||||
}
|
||||
if((power || neighbor.canProvidePower()) && neighbor != this) {
|
||||
world.setState(pos, state.withProperty(POWERED, power), 2);
|
||||
world.setState(upper, top.withProperty(POWERED, power), 2);
|
||||
|
||||
/**
|
||||
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
|
||||
*/
|
||||
public HitPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(worldIn, pos);
|
||||
return super.collisionRayTrace(worldIn, pos, start, end);
|
||||
}
|
||||
if((power != state.getValue(OPEN)) || (power != top.getValue(OPEN))) {
|
||||
world.setState(pos, state.withProperty(OPEN, power), 2);
|
||||
world.setState(upper, top.withProperty(OPEN, power), 2);
|
||||
world.markBlockRangeForRenderUpdate(pos, upper);
|
||||
world.playAuxSFX(power ? 1003 : 1006, pos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return pos.getY() >= World.MAX_SIZE_Y - 1 ? false : worldIn.isBlockSolid(pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
|
||||
}
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return state.getValue(HALF) == EnumDoorHalf.UPPER ? null : this.getItem();
|
||||
}
|
||||
|
||||
public int getMobilityFlag()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
public HitPosition collisionRayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) {
|
||||
this.setBlockBoundsBasedOnState(world, pos);
|
||||
return super.collisionRayTrace(world, pos, start, end);
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return this.getItem();
|
||||
}
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
return pos.getY() < World.MAX_SIZE_Y - 1 && world.isBlockSolid(pos.down()) && super.canPlaceBlockAt(world, pos) && super.canPlaceBlockAt(world, pos.up());
|
||||
}
|
||||
|
||||
// public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player)
|
||||
// {
|
||||
// BlockPos blockpos = pos.down();
|
||||
//
|
||||
// if (player.creative && state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER && worldIn.getState(blockpos).getBlock() == this)
|
||||
// {
|
||||
// worldIn.setBlockToAir(blockpos);
|
||||
// }
|
||||
// }
|
||||
public int getMobilityFlag() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
{
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
public Item getItem(World world, BlockPos pos) {
|
||||
return this.getItem();
|
||||
}
|
||||
|
||||
public static Facing getFacing(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return worldIn.getState(pos).getValue(FACING);
|
||||
}
|
||||
public BlockLayer getBlockLayer() {
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {HALF, FACING, OPEN, HINGE, POWERED};
|
||||
}
|
||||
|
||||
private static ModelRotation getRotation(Facing rot, int offset) {
|
||||
return ModelRotation.getEastRot(Facing.getHorizontal(rot.getHorizontalIndex() + offset), false);
|
||||
}
|
||||
public static Facing getFacing(IBlockAccess world, BlockPos pos) {
|
||||
return world.getState(pos).getValue(FACING);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
String bottom = name + "_bottom";
|
||||
String top = name + "_top";
|
||||
if(state.getValue(HALF) == EnumDoorHalf.LOWER) {
|
||||
if(state.getValue(HINGE) == EnumHingePosition.LEFT == state.getValue(OPEN))
|
||||
return provider.getModel(bottom)
|
||||
.add(0, 0, 0, 3, 16, 16)
|
||||
.d().uv(13, 0, 16, 16)
|
||||
.n().uv(3, 0, 0, 16)
|
||||
.s().uv(0, 0, 3, 16)
|
||||
.w().uv(16, 0, 0, 16)
|
||||
.e().uv(0, 0, 16, 16).noCull()
|
||||
.rotate(getRotation(state.getValue(FACING), state.getValue(OPEN) ? 1 : 0));
|
||||
else
|
||||
return provider.getModel(bottom)
|
||||
.add(0, 0, 0, 3, 16, 16)
|
||||
.d().uv(13, 0, 16, 16)
|
||||
.n().uv(3, 0, 0, 16)
|
||||
.s().uv(0, 0, 3, 16)
|
||||
.w().uv(0, 0, 16, 16)
|
||||
.e().uv(16, 0, 0, 16).noCull()
|
||||
.rotate(getRotation(state.getValue(FACING), state.getValue(OPEN) ? 3 : 0));
|
||||
}
|
||||
else {
|
||||
if(state.getValue(HINGE) == EnumHingePosition.LEFT == state.getValue(OPEN))
|
||||
return provider.getModel(top)
|
||||
.add(0, 0, 0, 3, 16, 16)
|
||||
.u(bottom).uv(13, 0, 16, 16)
|
||||
.n().uv(3, 0, 0, 16)
|
||||
.s().uv(0, 0, 3, 16)
|
||||
.w().uv(16, 0, 0, 16)
|
||||
.e().uv(0, 0, 16, 16).noCull()
|
||||
.rotate(getRotation(state.getValue(FACING), state.getValue(OPEN) ? 1 : 0));
|
||||
else
|
||||
return provider.getModel(top)
|
||||
.add(0, 0, 0, 3, 16, 16)
|
||||
.u(bottom).uv(13, 0, 16, 16)
|
||||
.n().uv(3, 0, 0, 16)
|
||||
.s().uv(0, 0, 3, 16)
|
||||
.w().uv(0, 0, 16, 16)
|
||||
.e().uv(16, 0, 0, 16).noCull()
|
||||
.rotate(getRotation(state.getValue(FACING), state.getValue(OPEN) ? 3 : 0));
|
||||
}
|
||||
}
|
||||
protected Property[] getProperties() {
|
||||
return new Property[] {HALF, FACING, OPEN, HINGE, POWERED};
|
||||
}
|
||||
|
||||
private static ModelRotation getRotation(Facing rot, int offset) {
|
||||
return ModelRotation.getEastRot(Facing.getHorizontal(rot.getHorizontalIndex() + offset), false);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
String bottom = name + "_bottom";
|
||||
String top = name + "_top";
|
||||
if(state.getValue(HALF) == EnumDoorHalf.LOWER) {
|
||||
if(state.getValue(HINGE) == EnumHingePosition.LEFT == state.getValue(OPEN))
|
||||
return provider.getModel(bottom).add(0, 0, 0, 3, 16, 16).d().uv(13, 0, 16, 16).n().uv(3, 0, 0, 16).s().uv(0, 0, 3, 16).w()
|
||||
.uv(16, 0, 0, 16).e().uv(0, 0, 16, 16).noCull().rotate(getRotation(state.getValue(FACING), state.getValue(OPEN) ? 1 : 0));
|
||||
else
|
||||
return provider.getModel(bottom).add(0, 0, 0, 3, 16, 16).d().uv(13, 0, 16, 16).n().uv(3, 0, 0, 16).s().uv(0, 0, 3, 16).w()
|
||||
.uv(0, 0, 16, 16).e().uv(16, 0, 0, 16).noCull().rotate(getRotation(state.getValue(FACING), state.getValue(OPEN) ? 3 : 0));
|
||||
}
|
||||
else {
|
||||
if(state.getValue(HINGE) == EnumHingePosition.LEFT == state.getValue(OPEN))
|
||||
return provider.getModel(top).add(0, 0, 0, 3, 16, 16).u(bottom).uv(13, 0, 16, 16).n().uv(3, 0, 0, 16).s().uv(0, 0, 3, 16).w()
|
||||
.uv(16, 0, 0, 16).e().uv(0, 0, 16, 16).noCull().rotate(getRotation(state.getValue(FACING), state.getValue(OPEN) ? 1 : 0));
|
||||
else
|
||||
return provider.getModel(top).add(0, 0, 0, 3, 16, 16).u(bottom).uv(13, 0, 16, 16).n().uv(3, 0, 0, 16).s().uv(0, 0, 3, 16).w()
|
||||
.uv(0, 0, 16, 16).e().uv(16, 0, 0, 16).noCull().rotate(getRotation(state.getValue(FACING), state.getValue(OPEN) ? 3 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {POWERED};
|
||||
}
|
||||
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {POWERED};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemDoor(this);
|
||||
}
|
||||
|
||||
public static enum EnumDoorHalf implements Identifyable
|
||||
{
|
||||
UPPER,
|
||||
LOWER;
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this == UPPER ? "upper" : "lower";
|
||||
}
|
||||
}
|
||||
|
||||
public static enum EnumHingePosition implements Identifyable
|
||||
{
|
||||
LEFT,
|
||||
RIGHT;
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this == LEFT ? "left" : "right";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -405,7 +405,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
|
||||
public void run(long time) {
|
||||
Region.loadMap();
|
||||
Converter.convert();
|
||||
Converter.convert("terra");
|
||||
long wtime = this.loadServerConfig();
|
||||
if(this.keyPair == null) {
|
||||
Log.SYSTEM.info("Generiere neues Schlüsselpaar");
|
||||
|
|
|
@ -23,8 +23,6 @@ import common.block.artificial.BlockBed.EnumPartType;
|
|||
import common.block.artificial.BlockCake;
|
||||
import common.block.artificial.BlockCarpet;
|
||||
import common.block.artificial.BlockDoor;
|
||||
import common.block.artificial.BlockDoor.EnumDoorHalf;
|
||||
import common.block.artificial.BlockDoor.EnumHingePosition;
|
||||
import common.block.artificial.BlockFenceGate;
|
||||
import common.block.artificial.BlockHay;
|
||||
import common.block.artificial.BlockLadder;
|
||||
|
@ -42,6 +40,7 @@ import common.block.foliage.BlockCactus;
|
|||
import common.block.foliage.BlockCarrot;
|
||||
import common.block.foliage.BlockCocoa;
|
||||
import common.block.foliage.BlockCrops;
|
||||
import common.block.foliage.BlockDoublePlant;
|
||||
import common.block.foliage.BlockFarmland;
|
||||
import common.block.foliage.BlockHugeMushroom;
|
||||
import common.block.foliage.BlockHugeMushroom.EnumType;
|
||||
|
@ -128,6 +127,7 @@ import common.tileentity.TileEntityEnchantmentTable;
|
|||
import common.tileentity.TileEntityFurnace;
|
||||
import common.tileentity.TileEntityHopper;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Facing.Axis;
|
||||
import common.util.NibbleArray;
|
||||
|
@ -311,7 +311,7 @@ public abstract class Converter {
|
|||
private static final Random RANDOM = new Random();
|
||||
private static final Map<String, String> ENTITY_MAP = Maps.newHashMap();
|
||||
private static final Map<String, String> TILE_MAP = Maps.newHashMap();
|
||||
private static final char[] BLOCK_MAP = new char[65536];
|
||||
private static final State[] BLOCK_MAP = new State[65536];
|
||||
|
||||
private static void mapEntity(Class<? extends Entity> clazz, String ... names) {
|
||||
String name = EntityRegistry.getEntityString(clazz);
|
||||
|
@ -328,7 +328,7 @@ public abstract class Converter {
|
|||
}
|
||||
|
||||
private static void mapBlock(State state, int id, int data) {
|
||||
BLOCK_MAP[(id << 4) | data] = (char)BlockRegistry.getId(state);
|
||||
BLOCK_MAP[(id << 4) | data] = state;
|
||||
}
|
||||
|
||||
private static void mapBlock(State state, int id, int ... values) {
|
||||
|
@ -738,18 +738,7 @@ public abstract class Converter {
|
|||
mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 13), 63, 13);
|
||||
mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 14), 63, 14);
|
||||
mapBlock(Blocks.sign.getState().withProperty(BlockStandingSign.ROTATION, 15), 63, 15);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 64, 0);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 64, 1);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 64, 2);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 64, 3);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 64, 4);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 64, 5);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 64, 6);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 64, 7);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 64, 8, 12);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 64, 9, 13);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 64, 10, 14);
|
||||
mapBlock(Blocks.oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 64, 11, 15);
|
||||
mapBlock(Blocks.oak_door, 64);
|
||||
mapBlock(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.NORTH), 65);
|
||||
mapBlock(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.SOUTH), 65, 3, 9, 15);
|
||||
mapBlock(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.WEST), 65, 4, 10);
|
||||
|
@ -794,18 +783,7 @@ public abstract class Converter {
|
|||
mapBlock(Blocks.lever.getState().withProperty(BlockLever.FACING, EnumOrientation.DOWN_Z).withProperty(BlockLever.POWERED, true), 69, 15);
|
||||
mapBlock(Blocks.stone_pressure_plate.getState().withProperty(BlockPressurePlate.POWERED, false), 70);
|
||||
mapBlock(Blocks.stone_pressure_plate.getState().withProperty(BlockPressurePlate.POWERED, true), 70, 1);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 71, 0);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 71, 1);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 71, 2);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 71, 3);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 71, 4);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 71, 5);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 71, 6);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 71, 7);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 71, 8, 12);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 71, 9, 13);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 71, 10, 14);
|
||||
mapBlock(Blocks.iron_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 71, 11, 15);
|
||||
mapBlock(Blocks.iron_door, 71);
|
||||
mapBlock(Blocks.wooden_pressure_plate.getState().withProperty(BlockPressurePlate.POWERED, false), 72);
|
||||
mapBlock(Blocks.wooden_pressure_plate.getState().withProperty(BlockPressurePlate.POWERED, true), 72, 1);
|
||||
mapBlock(Blocks.redstone_ore, 73);
|
||||
|
@ -1042,10 +1020,7 @@ public abstract class Converter {
|
|||
mapBlock(Blocks.stonebrick_stairs.getState().withProperty(BlockStairs.FACING, Facing.SOUTH).withProperty(BlockStairs.HALF, EnumHalf.TOP), 109, 6, 14);
|
||||
mapBlock(Blocks.stonebrick_stairs.getState().withProperty(BlockStairs.FACING, Facing.NORTH).withProperty(BlockStairs.HALF, EnumHalf.TOP), 109, 7, 15);
|
||||
mapBlock(Blocks.mycelium, 110);
|
||||
mapBlock(Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.SOUTH), 111, 0, 4, 8, 12);
|
||||
mapBlock(Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.WEST), 111, 1, 5, 9, 13);
|
||||
mapBlock(Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.NORTH), 111, 2, 6, 10, 14);
|
||||
mapBlock(Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.EAST), 111, 3, 7, 11, 15);
|
||||
mapBlock(Blocks.waterlily, 111);
|
||||
mapBlock(Blocks.blood_brick, 112);
|
||||
mapBlock(Blocks.blood_brick_fence, 113);
|
||||
mapBlock(Blocks.blood_brick_stairs.getState().withProperty(BlockStairs.FACING, Facing.EAST).withProperty(BlockStairs.HALF, EnumHalf.BOTTOM), 114, 0, 8);
|
||||
|
@ -1452,12 +1427,12 @@ public abstract class Converter {
|
|||
mapBlock(Blocks.hardened_clay, 172);
|
||||
mapBlock(Blocks.coal_block, 173);
|
||||
mapBlock(Blocks.packed_ice, 174);
|
||||
mapBlock(Blocks.dandelion, 175, 0);
|
||||
mapBlock(Blocks.blue_orchid, 175, 1);
|
||||
mapBlock(Blocks.tallgrass, 175, 2);
|
||||
mapBlock(Blocks.fern, 175, 3);
|
||||
mapBlock(Blocks.rose, 175, 4);
|
||||
mapBlock(Blocks.pink_tulip, 175, 5);
|
||||
mapBlock(Blocks.sunflower, 175);
|
||||
mapBlock(Blocks.syringa, 175, 1);
|
||||
mapBlock(Blocks.large_tallgrass, 175, 2);
|
||||
mapBlock(Blocks.large_fern, 175, 3);
|
||||
mapBlock(Blocks.rose_bush, 175, 4);
|
||||
mapBlock(Blocks.paeonia, 175, 5);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 0), 176, 0);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 1), 176, 1);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 2), 176, 2);
|
||||
|
@ -1596,66 +1571,11 @@ public abstract class Converter {
|
|||
mapBlock(Blocks.jungle_fence, 190);
|
||||
mapBlock(Blocks.dark_oak_fence, 191);
|
||||
mapBlock(Blocks.acacia_fence, 192);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 193, 0);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 193, 1);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 193, 2);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 193, 3);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 193, 4);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 193, 5);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 193, 6);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 193, 7);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 193, 8, 12);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 193, 9, 13);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 193, 10, 14);
|
||||
mapBlock(Blocks.spruce_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 193, 11, 15);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 194, 0);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 194, 1);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 194, 2);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 194, 3);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 194, 4);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 194, 5);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 194, 6);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 194, 7);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 194, 8, 12);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 194, 9, 13);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 194, 10, 14);
|
||||
mapBlock(Blocks.birch_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 194, 11, 15);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 195, 0);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 195, 1);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 195, 2);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 195, 3);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 195, 4);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 195, 5);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 195, 6);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 195, 7);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 195, 8, 12);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 195, 9, 13);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 195, 10, 14);
|
||||
mapBlock(Blocks.jungle_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 195, 11, 15);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 196, 0);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 196, 1);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 196, 2);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 196, 3);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 196, 4);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 196, 5);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 196, 6);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 196, 7);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 196, 8, 12);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 196, 9, 13);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 196, 10, 14);
|
||||
mapBlock(Blocks.acacia_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 196, 11, 15);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 197, 0);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 197, 1);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 197, 2);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 197, 3);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.EAST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 197, 4);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.SOUTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 197, 5);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.WEST).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 197, 6);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.LOWER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, true).withProperty(BlockDoor.POWERED, false), 197, 7);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 197, 8, 12);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, false), 197, 9, 13);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.LEFT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 197, 10, 14);
|
||||
mapBlock(Blocks.dark_oak_door.getState().withProperty(BlockDoor.FACING, Facing.NORTH).withProperty(BlockDoor.HALF, EnumDoorHalf.UPPER).withProperty(BlockDoor.HINGE, EnumHingePosition.RIGHT).withProperty(BlockDoor.OPEN, false).withProperty(BlockDoor.POWERED, true), 197, 11, 15);
|
||||
mapBlock(Blocks.spruce_door, 193);
|
||||
mapBlock(Blocks.birch_door, 194);
|
||||
mapBlock(Blocks.jungle_door, 195);
|
||||
mapBlock(Blocks.acacia_door, 196);
|
||||
mapBlock(Blocks.dark_oak_door, 197);
|
||||
|
||||
mapBlock(Blocks.iron_bars, 198);
|
||||
mapBlock(Blocks.glass_pane, 199);
|
||||
|
@ -1842,6 +1762,24 @@ public abstract class Converter {
|
|||
return idx >= 0 ? name.substring(idx + 1) : name; // save compat
|
||||
}
|
||||
|
||||
private static State getState(int id, int meta, int down, int up) {
|
||||
if(id >= 256)
|
||||
return Blocks.stone.getState();
|
||||
State state = BLOCK_MAP[(id << 4) | meta];
|
||||
if(id == 111)
|
||||
return state.withProperty(BlockLilyPad.FACING, Facing.randHorizontal(RANDOM));
|
||||
else if(id == 175)
|
||||
return ((meta & 8) > 0 ? BLOCK_MAP[(id << 4) | (down & 7)] : state).withProperty(BlockDoublePlant.HALF, (meta & 8) > 0 ? BlockDoublePlant.EnumBlockHalf.UPPER : BlockDoublePlant.EnumBlockHalf.LOWER);
|
||||
else if(id == 64 || id == 71 || (id >= 193 && id <= 197))
|
||||
return state.withProperty(BlockDoor.HALF, (meta & 8) > 0 ? BlockDoor.EnumDoorHalf.UPPER : BlockDoor.EnumDoorHalf.LOWER)
|
||||
.withProperty(BlockDoor.HINGE, (((meta & 8) > 0 ? meta : up) & 1) > 0 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT)
|
||||
.withProperty(BlockDoor.POWERED, (((meta & 8) > 0 ? meta : up) & 2) > 0)
|
||||
.withProperty(BlockDoor.OPEN, (((meta & 8) > 0 ? down : meta) & 4) > 0)
|
||||
.withProperty(BlockDoor.FACING, Facing.getHorizontal(((meta & 8) > 0 ? down : meta) & 3).rotateYCCW());
|
||||
else
|
||||
return state;
|
||||
}
|
||||
|
||||
private static TagObject convertChunkData(NbtTag tag, boolean legacy) {
|
||||
TagObject ntag = new TagObject();
|
||||
tag = tag.getTag("Level");
|
||||
|
@ -1930,7 +1868,6 @@ public abstract class Converter {
|
|||
nent.setFloat("Yaw", rotation[0]);
|
||||
nent.setFloat("Pitch", rotation[1]);
|
||||
nent.setBool("OnGround", ground);
|
||||
nent.setInt("Dimension", 1);
|
||||
nent.setString("id", mapped);
|
||||
entities.add(nent);
|
||||
}
|
||||
|
@ -1956,39 +1893,75 @@ public abstract class Converter {
|
|||
NbtTag[] sects = tag.getTagList("Sections");
|
||||
entities = Lists.newArrayList();
|
||||
char[] mapping = Region.getEncodeMap();
|
||||
NbtTag[] sections = new NbtTag[16];
|
||||
for(NbtTag sect : sects) {
|
||||
TagObject nsect = new TagObject();
|
||||
nsect.setInt("Y", sect.getByte("Y"));
|
||||
byte[] blocks = sect.getByteArray("Blocks");
|
||||
NibbleArray data = new NibbleArray(sect.getByteArray("Data"));
|
||||
byte[] add = sect.getByteArray("Add");
|
||||
NibbleArray adddata = add.length > 0 ? new NibbleArray(add) : null;
|
||||
NibbleArray addnew = null;
|
||||
for(int c = 0; c < blocks.length; ++c) {
|
||||
int cx = c & 15;
|
||||
int cy = c >> 8 & 15;
|
||||
int cz = c >> 4 & 15;
|
||||
int ca = adddata != null ? adddata.get(cx, cy, cz) : 0;
|
||||
char block = (char)((ca << 8) | (blocks[c] & 255));
|
||||
if(block == 0)
|
||||
continue;
|
||||
int dt = block == 111 ? RANDOM.zrange(4) : data.get(cx, cy, cz);
|
||||
char cd = mapping[block >= 256 ? BLOCK_MAP[1 << 4] : BLOCK_MAP[(block << 4) | dt]];
|
||||
if(cd >> 12 != 0) {
|
||||
if(addnew == null)
|
||||
addnew = new NibbleArray();
|
||||
addnew.set(cx, cy, cz, cd >> 12);
|
||||
int y = sect.getByte("Y");
|
||||
if(y >= 0 && y < sections.length)
|
||||
sections[y] = sect;
|
||||
}
|
||||
byte[] lastBlocks = null;
|
||||
NibbleArray lastData = null;
|
||||
NibbleArray lastAdd = null;
|
||||
byte[] blocks = null;
|
||||
NibbleArray data = null;
|
||||
NibbleArray adddata = null;
|
||||
byte[] nextBlocks = null;
|
||||
NibbleArray nextData = null;
|
||||
NibbleArray nextAdd = null;
|
||||
if(sections[0] != null) {
|
||||
nextBlocks = sections[0].getByteArray("Blocks");
|
||||
nextData = new NibbleArray(sections[0].getByteArray("Data"));
|
||||
byte[] add = sections[0].getByteArray("Add");
|
||||
nextAdd = add.length > 0 ? new NibbleArray(add) : null;
|
||||
}
|
||||
for(int y = 0; y < sections.length; y++) {
|
||||
blocks = nextBlocks;
|
||||
data = nextData;
|
||||
adddata = nextAdd;
|
||||
|
||||
NbtTag next = y == sections.length - 1 ? null : sections[y + 1];
|
||||
nextBlocks = next == null ? null : next.getByteArray("Blocks");
|
||||
nextData = next == null ? null : new NibbleArray(next.getByteArray("Data"));
|
||||
byte[] add = next == null ? null : next.getByteArray("Add");
|
||||
nextAdd = add != null && add.length > 0 ? new NibbleArray(add) : null;
|
||||
|
||||
NbtTag sect = sections[y];
|
||||
if(sect != null) {
|
||||
byte[] newblks = new byte[4096];
|
||||
NibbleArray datanew = new NibbleArray();
|
||||
NibbleArray addnew = null;
|
||||
for(int c = 0; c < blocks.length; ++c) {
|
||||
int cx = c & 15;
|
||||
int cy = c >> 8 & 15;
|
||||
int cz = c >> 4 & 15;
|
||||
char block = (char)((adddata != null ? adddata.get(cx, cy, cz) << 8 : 0) | (blocks[c] & 255));
|
||||
if(block == 0)
|
||||
continue;
|
||||
char cd = mapping[BlockRegistry.getId(getState(block, data.get(cx, cy, cz), cy == 0 ? (lastData == null ? 0 : lastData.get(cx, 15, cz)) : data.get(cx, cy - 1, cz),
|
||||
cy == 15 ? (nextData == null ? 0 : nextData.get(cx, 0, cz)) : data.get(cx, cy + 1, cz)))];
|
||||
if(cd >> 12 != 0) {
|
||||
if(addnew == null)
|
||||
addnew = new NibbleArray();
|
||||
addnew.set(cx, cy, cz, cd >> 12);
|
||||
}
|
||||
newblks[c] = (byte)(cd & 255);
|
||||
datanew.set(cx, cy, cz, cd >> 8 & 15);
|
||||
}
|
||||
blocks[c] = (byte)(cd & 255);
|
||||
data.set(cx, cy, cz, cd >> 8 & 15);
|
||||
|
||||
TagObject nsect = new TagObject();
|
||||
nsect.setInt("Y", y);
|
||||
nsect.setByteArray("Dat0", newblks);
|
||||
nsect.setByteArray("Dat1", datanew.getData());
|
||||
if(addnew != null)
|
||||
nsect.setByteArray("Dat2", addnew.getData());
|
||||
nsect.setByteArray("BlockLight", sect.getByteArray("BlockLight"));
|
||||
nsect.setByteArray("SkyLight", sect.getByteArray("SkyLight"));
|
||||
entities.add(nsect);
|
||||
}
|
||||
nsect.setByteArray("Dat0", blocks);
|
||||
nsect.setByteArray("Dat1", data.getData());
|
||||
if(addnew != null)
|
||||
nsect.setByteArray("Dat2", addnew.getData());
|
||||
nsect.setByteArray("BlockLight", sect.getByteArray("BlockLight"));
|
||||
nsect.setByteArray("SkyLight", sect.getByteArray("SkyLight"));
|
||||
entities.add(nsect);
|
||||
|
||||
lastBlocks = blocks;
|
||||
lastData = data;
|
||||
lastAdd = adddata;
|
||||
}
|
||||
ntag.setList("Sections", entities);
|
||||
return ntag;
|
||||
|
@ -2061,14 +2034,14 @@ public abstract class Converter {
|
|||
return start;
|
||||
}
|
||||
|
||||
public static boolean convert() {
|
||||
public static BlockPos convert(String dest) {
|
||||
if(new File("server.cdt").exists())
|
||||
return false;
|
||||
return null;
|
||||
File ldat = new File("level.dat");
|
||||
if(!ldat.exists())
|
||||
ldat = new File("level.dat_old");
|
||||
if(!ldat.exists())
|
||||
return false;
|
||||
return null;
|
||||
Log.IO.info("Welt wird konvertiert ...");
|
||||
NbtTag tag;
|
||||
DataInputStream in = null;
|
||||
|
@ -2078,7 +2051,7 @@ public abstract class Converter {
|
|||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Fehler beim Lesen von level.dat");
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
|
@ -2094,18 +2067,18 @@ public abstract class Converter {
|
|||
SaveVersion ver = data >= 1400 ? SaveVersion.RELEASE_1_13 : (data >= 100 ? SaveVersion.RELEASE_1_9 : (version == 19132 || version == 19133 ? SaveVersion.BETA_1_3 : (version == 0 ? SaveVersion.ALPHA_1_0 : null)));
|
||||
if(ver == null) {
|
||||
Log.IO.error("Version %d ist unbekannt", version);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
if(ver == SaveVersion.RELEASE_1_13) {
|
||||
Log.IO.warn("Konvertiere keine Chunk-Daten, da Version zu neu (%s)", ver);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
File regionDir = new File("region");
|
||||
if(!regionDir.exists()) {
|
||||
Log.IO.info("Kein Ordner region/ gefunden");
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
File chunkDir = new File(new File("chunk"), "terra");
|
||||
File chunkDir = new File(new File("chunk"), dest);
|
||||
Log.IO.info("Durchsuche Ordner region/ nach .mca- und .mcr-Dateien ...");
|
||||
File[] files = regionDir.listFiles(new FilenameFilter() {
|
||||
public boolean accept(File file, String name) {
|
||||
|
@ -2114,7 +2087,7 @@ public abstract class Converter {
|
|||
});
|
||||
if(files.length == 0) {
|
||||
Log.IO.info("Keine .mca- oder .mcr-Dateien gefunden");
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
Log.IO.info("Konvertiere %d .mca- und .mcr-Datei%s (%s) von region/*.mca,*.mcr nach %s ...", files.length, files.length == 1 ? "" : "en", ver, chunkDir);
|
||||
if(ver == SaveVersion.RELEASE_1_9)
|
||||
|
@ -2132,7 +2105,7 @@ public abstract class Converter {
|
|||
}
|
||||
time = System.currentTimeMillis() - time;
|
||||
Log.IO.info("Fertig. Konversion dauerte " + ((time / 60000L) > 0 ? ((time / 60000L) + " Minuten und ") : "") + ((time / 1000L) % 60L) + " Sekunden.");
|
||||
Log.IO.info("Einstiegspunkt: /tele %d %d %d terra", tag.getInt("SpawnX"), tag.getInt("SpawnY"), tag.getInt("SpawnZ"));
|
||||
return true;
|
||||
Log.IO.info("Einstiegspunkt: /tele %d %d %d %s", tag.getInt("SpawnX"), tag.getInt("SpawnY"), tag.getInt("SpawnZ"), dest);
|
||||
return new BlockPos(tag.getInt("SpawnX"), tag.getInt("SpawnY"), tag.getInt("SpawnZ"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue