Compare commits

..

No commits in common. "4e43f1ea650d85201d6a94fc37088aa1a175f45f" and "10626a44f4852c5dc9e432a68a3a3fb44aad66a3" have entirely different histories.

57 changed files with 1 additions and 3250 deletions

View File

@ -33,12 +33,10 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.RegistryNamespacedDefaultedByKey;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Rotation;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.EnumSkyBlock;
@ -284,26 +282,6 @@ public class Block implements ILitBlock {
return iblockstate;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
return state;
}
@Deprecated
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
return state;
}
public Block(Material parMaterial, MapColor parMapColor) {
this.enableStats = true;
this.stepSound = soundTypeStone;

View File

@ -22,7 +22,6 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World;
@ -174,15 +173,6 @@ public class BlockAnvil extends BlockFalling {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
return state.getBlock() != this ? state : state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, DAMAGE });
}

View File

@ -18,8 +18,6 @@ import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -170,14 +168,6 @@ public class BlockBanner extends BlockContainer {
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, BlockPos blockpos) {
EnumFacing enumfacing = (EnumFacing) iblockaccess.getBlockState(blockpos).getValue(FACING);
float f = 0.0F;
@ -236,14 +226,6 @@ public class BlockBanner extends BlockContainer {
this.setDefaultState(this.blockState.getBaseState().withProperty(ROTATION, Integer.valueOf(0)));
}
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(ROTATION, Integer.valueOf(rot.rotate(((Integer)state.getValue(ROTATION)).intValue(), 16)));
}
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withProperty(ROTATION, Integer.valueOf(mirrorIn.mirrorRotation(((Integer)state.getValue(ROTATION)).intValue(), 16)));
}
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) {
if (!worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid()) {
this.dropBlockAsItem(worldIn, pos, state, 0);

View File

@ -20,8 +20,6 @@ import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
@ -303,22 +301,6 @@ public class BlockBed extends BlockDirectional {
return state;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
/**
* +
* Convert the BlockState into the correct metadata value

View File

@ -16,8 +16,6 @@ import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -375,22 +373,6 @@ public abstract class BlockButton extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, POWERED });
}

View File

@ -24,8 +24,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.ILockableContainer;
import net.minecraft.world.World;
@ -521,22 +519,6 @@ public class BlockChest extends BlockContainer {
return ((EnumFacing) iblockstate.getValue(FACING)).getIndex();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}

View File

@ -17,8 +17,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -242,22 +240,6 @@ public class BlockCocoa extends BlockDirectional implements IGrowable {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, AGE });
}

View File

@ -16,8 +16,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityCommandBlock;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**

View File

@ -26,9 +26,7 @@ import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityDropper;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.RegistryDefaulted;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -291,22 +289,6 @@ public class BlockDispenser extends BlockContainer {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, TRIGGERED });
}

View File

@ -18,9 +18,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Rotation;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
@ -337,22 +335,6 @@ public class BlockDoor extends Block {
return iblockstate;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.getValue(HALF) != BlockDoor.EnumDoorHalf.LOWER ? state : state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
/**
* +
* Convert the given metadata into a BlockState for this Block

View File

@ -16,8 +16,6 @@ import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -143,22 +141,6 @@ public class BlockEndPortalFrame extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, EYE });
}

View File

@ -14,8 +14,6 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -28,22 +26,6 @@ public class BlockEndRod extends Block {
this.setCreativeTab(CreativeTabs.tabDecorations);
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withProperty(FACING, mirrorIn.mirror((EnumFacing)state.getValue(FACING)));
}
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos blockpos, IBlockState iblockstate) {
this.setBlockBoundsBasedOnState(world, blockpos);
return super.getCollisionBoundingBox(world, blockpos, iblockstate);

View File

@ -20,8 +20,6 @@ import net.minecraft.tileentity.TileEntityEnderChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -191,22 +189,6 @@ public class BlockEnderChest extends BlockContainer {
return ((EnumFacing) iblockstate.getValue(FACING)).getIndex();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}

View File

@ -16,8 +16,6 @@ import net.minecraft.item.ItemLead;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -224,45 +222,6 @@ public class BlockFence extends Block {
.withProperty(WEST, Boolean.valueOf(this.canConnectTo(iblockaccess, blockpos.west())));
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
switch (rot)
{
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST)).withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH)).withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
}
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
switch (mirrorIn)
{
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
}
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { NORTH, EAST, WEST, SOUTH });
}

View File

@ -12,8 +12,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -77,23 +75,6 @@ public class BlockFenceGate extends BlockDirectional {
return iblockstate;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
public boolean canPlaceBlockAt(World world, BlockPos blockpos) {
return world.getBlockState(blockpos.down()).getBlock().getMaterial().isSolid()

View File

@ -20,8 +20,6 @@ import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -269,22 +267,6 @@ public class BlockFurnace extends BlockContainer {
return ((EnumFacing) iblockstate.getValue(FACING)).getIndex();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}

View File

@ -25,8 +25,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -261,22 +259,6 @@ public class BlockHopper extends BlockContainer {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, ENABLED });
}

View File

@ -13,8 +13,6 @@ import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -124,191 +122,6 @@ public class BlockHugeMushroom extends Block {
return ((BlockHugeMushroom.EnumType) iblockstate.getValue(VARIANT)).getMetadata();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
{
case STEM:
break;
case NORTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
case NORTH:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH);
case NORTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
case WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.EAST);
case EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.WEST);
case SOUTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
case SOUTH:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH);
case SOUTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
default:
return state;
}
case COUNTERCLOCKWISE_90:
switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
{
case STEM:
break;
case NORTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
case NORTH:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.WEST);
case NORTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
case WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH);
case EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH);
case SOUTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
case SOUTH:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.EAST);
case SOUTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
default:
return state;
}
case CLOCKWISE_90:
switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
{
case STEM:
break;
case NORTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
case NORTH:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.EAST);
case NORTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
case WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH);
case EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH);
case SOUTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
case SOUTH:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.WEST);
case SOUTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
default:
return state;
}
default:
return state;
}
}
@SuppressWarnings("incomplete-switch")
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
BlockHugeMushroom.EnumType blockhugemushroom$enumtype = (BlockHugeMushroom.EnumType)state.getValue(VARIANT);
switch (mirrorIn)
{
case LEFT_RIGHT:
switch (blockhugemushroom$enumtype)
{
case NORTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
case NORTH:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH);
case NORTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
case WEST:
case EAST:
default:
return super.withMirror(state, mirrorIn);
case SOUTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
case SOUTH:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH);
case SOUTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
}
case FRONT_BACK:
switch (blockhugemushroom$enumtype)
{
case NORTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
case NORTH:
case SOUTH:
default:
break;
case NORTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
case WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.EAST);
case EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.WEST);
case SOUTH_WEST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
case SOUTH_EAST:
return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
}
}
return super.withMirror(state, mirrorIn);
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { VARIANT });
}

View File

@ -11,8 +11,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -171,22 +169,6 @@ public class BlockLadder extends Block {
return ((EnumFacing) iblockstate.getValue(FACING)).getIndex();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}

View File

@ -13,8 +13,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -271,102 +269,6 @@ public class BlockLever extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
switch ((BlockLever.EnumOrientation)state.getValue(FACING))
{
case EAST:
return state.withProperty(FACING, BlockLever.EnumOrientation.WEST);
case WEST:
return state.withProperty(FACING, BlockLever.EnumOrientation.EAST);
case SOUTH:
return state.withProperty(FACING, BlockLever.EnumOrientation.NORTH);
case NORTH:
return state.withProperty(FACING, BlockLever.EnumOrientation.SOUTH);
default:
return state;
}
case COUNTERCLOCKWISE_90:
switch ((BlockLever.EnumOrientation)state.getValue(FACING))
{
case EAST:
return state.withProperty(FACING, BlockLever.EnumOrientation.NORTH);
case WEST:
return state.withProperty(FACING, BlockLever.EnumOrientation.SOUTH);
case SOUTH:
return state.withProperty(FACING, BlockLever.EnumOrientation.EAST);
case NORTH:
return state.withProperty(FACING, BlockLever.EnumOrientation.WEST);
case UP_Z:
return state.withProperty(FACING, BlockLever.EnumOrientation.UP_X);
case UP_X:
return state.withProperty(FACING, BlockLever.EnumOrientation.UP_Z);
case DOWN_X:
return state.withProperty(FACING, BlockLever.EnumOrientation.DOWN_Z);
case DOWN_Z:
return state.withProperty(FACING, BlockLever.EnumOrientation.DOWN_X);
}
case CLOCKWISE_90:
switch ((BlockLever.EnumOrientation)state.getValue(FACING))
{
case EAST:
return state.withProperty(FACING, BlockLever.EnumOrientation.SOUTH);
case WEST:
return state.withProperty(FACING, BlockLever.EnumOrientation.NORTH);
case SOUTH:
return state.withProperty(FACING, BlockLever.EnumOrientation.WEST);
case NORTH:
return state.withProperty(FACING, BlockLever.EnumOrientation.EAST);
case UP_Z:
return state.withProperty(FACING, BlockLever.EnumOrientation.UP_X);
case UP_X:
return state.withProperty(FACING, BlockLever.EnumOrientation.UP_Z);
case DOWN_X:
return state.withProperty(FACING, BlockLever.EnumOrientation.DOWN_Z);
case DOWN_Z:
return state.withProperty(FACING, BlockLever.EnumOrientation.DOWN_X);
}
default:
return state;
}
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation(((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing()));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, POWERED });
}

View File

@ -8,7 +8,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -81,33 +80,6 @@ public abstract class BlockLog extends BlockRotatedPillar {
BlockLog.EnumAxis.fromFacingAxis(enumfacing.getAxis()));
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
{
case X:
return state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
case Z:
return state.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
default:
return state;
}
default:
return state;
}
}
public static enum EnumAxis implements IStringSerializable {
X("x"), Y("y"), Z("z"), NONE("none");

View File

@ -16,8 +16,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -219,47 +217,6 @@ public class BlockPane extends Block {
return 0;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST)).withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH)).withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
}
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
switch (mirrorIn)
{
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
}
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { NORTH, EAST, WEST, SOUTH });
}

View File

@ -20,8 +20,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -459,22 +457,6 @@ public class BlockPistonBase extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, EXTENDED });
}

View File

@ -18,8 +18,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -259,22 +257,6 @@ public class BlockPistonExtension extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, TYPE, SHORT });
}

View File

@ -16,9 +16,7 @@ import net.minecraft.tileentity.TileEntityPiston;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Rotation;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -297,22 +295,6 @@ public class BlockPistonMoving extends BlockContainer {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, TYPE });
}

View File

@ -19,7 +19,6 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -257,33 +256,6 @@ public class BlockPortal extends BlockBreakable {
return getMetaForAxis((EnumFacing.Axis) iblockstate.getValue(AXIS));
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
switch ((EnumFacing.Axis)state.getValue(AXIS))
{
case X:
return state.withProperty(AXIS, EnumFacing.Axis.Z);
case Z:
return state.withProperty(AXIS, EnumFacing.Axis.X);
default:
return state;
}
default:
return state;
}
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { AXIS });
}

View File

@ -19,8 +19,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -168,22 +166,6 @@ public class BlockPumpkin extends BlockDirectional {
return ((EnumFacing) iblockstate.getValue(FACING)).getHorizontalIndex();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}

View File

@ -15,7 +15,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -140,33 +139,6 @@ public class BlockQuartz extends Block {
return ((BlockQuartz.EnumType) iblockstate.getValue(VARIANT)).getMetadata();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
switch ((BlockQuartz.EnumType)state.getValue(VARIANT))
{
case LINES_X:
return state.withProperty(VARIANT, BlockQuartz.EnumType.LINES_Z);
case LINES_Z:
return state.withProperty(VARIANT, BlockQuartz.EnumType.LINES_X);
default:
return state;
}
default:
return state;
}
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { VARIANT });
}

View File

@ -5,8 +5,6 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -79,185 +77,6 @@ public class BlockRail extends BlockRailBase {
return ((BlockRailBase.EnumRailDirection) iblockstate.getValue(SHAPE)).getMetadata();
}
@SuppressWarnings("incomplete-switch")
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
}
case COUNTERCLOCKWISE_90:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case NORTH_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.EAST_WEST);
case EAST_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH);
}
case CLOCKWISE_90:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.EAST_WEST);
case EAST_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH);
}
default:
return state;
}
}
@SuppressWarnings("incomplete-switch")
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(SHAPE);
switch (mirrorIn)
{
case LEFT_RIGHT:
switch (blockrailbase$enumraildirection)
{
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
default:
return super.withMirror(state, mirrorIn);
}
case FRONT_BACK:
switch (blockrailbase$enumraildirection)
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_NORTH:
case ASCENDING_SOUTH:
default:
break;
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
}
}
return super.withMirror(state, mirrorIn);
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { SHAPE });
}

View File

@ -19,8 +19,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EntitySelectors;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -223,185 +221,6 @@ public class BlockRailDetector extends BlockRailBase {
return i;
}
@SuppressWarnings("incomplete-switch")
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
}
case COUNTERCLOCKWISE_90:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case NORTH_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.EAST_WEST);
case EAST_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH);
}
case CLOCKWISE_90:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.EAST_WEST);
case EAST_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH);
}
default:
return state;
}
}
@SuppressWarnings("incomplete-switch")
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(SHAPE);
switch (mirrorIn)
{
case LEFT_RIGHT:
switch (blockrailbase$enumraildirection)
{
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
default:
return super.withMirror(state, mirrorIn);
}
case FRONT_BACK:
switch (blockrailbase$enumraildirection)
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_NORTH:
case ASCENDING_SOUTH:
default:
break;
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
}
}
return super.withMirror(state, mirrorIn);
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { SHAPE, POWERED });
}

View File

@ -8,8 +8,6 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -208,185 +206,6 @@ public class BlockRailPowered extends BlockRailBase {
return i;
}
@SuppressWarnings("incomplete-switch")
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
}
case COUNTERCLOCKWISE_90:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case NORTH_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.EAST_WEST);
case EAST_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH);
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
}
case CLOCKWISE_90:
switch ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE))
{
case NORTH_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.EAST_WEST);
case EAST_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH);
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
}
default:
return state;
}
}
@SuppressWarnings("incomplete-switch")
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(SHAPE);
switch (mirrorIn)
{
case LEFT_RIGHT:
switch (blockrailbase$enumraildirection)
{
case ASCENDING_NORTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_SOUTH);
case ASCENDING_SOUTH:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_NORTH);
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
default:
return super.withMirror(state, mirrorIn);
}
case FRONT_BACK:
switch (blockrailbase$enumraildirection)
{
case ASCENDING_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_WEST);
case ASCENDING_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.ASCENDING_EAST);
case ASCENDING_NORTH:
case ASCENDING_SOUTH:
default:
break;
case SOUTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_WEST);
case SOUTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.SOUTH_EAST);
case NORTH_WEST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_EAST);
case NORTH_EAST:
return state.withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_WEST);
}
}
return super.withMirror(state, mirrorIn);
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { SHAPE, POWERED });
}

View File

@ -24,8 +24,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -305,22 +303,6 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, MODE, POWERED });
}

View File

@ -14,8 +14,6 @@ import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -171,22 +169,6 @@ public class BlockRedstoneRepeater extends BlockRedstoneDiode {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, DELAY, LOCKED });
}

View File

@ -24,8 +24,6 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -481,47 +479,6 @@ public class BlockRedstoneWire extends Block {
return ((Integer) iblockstate.getValue(POWER)).intValue();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST)).withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH)).withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
}
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
switch (mirrorIn)
{
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
}
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { NORTH, EAST, SOUTH, WEST, POWER });
}

View File

@ -4,7 +4,6 @@ import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@ -55,31 +54,4 @@ public class BlockRotatedPillar extends Block {
protected BlockRotatedPillar(Material parMaterial, MapColor parMapColor) {
super(parMaterial, parMapColor);
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
switch ((EnumFacing.Axis)state.getValue(AXIS))
{
case X:
return state.withProperty(AXIS, EnumFacing.Axis.Z);
case Z:
return state.withProperty(AXIS, EnumFacing.Axis.X);
default:
return state;
}
default:
return state;
}
}
}

View File

@ -32,8 +32,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.IBlockAccess;
@ -296,22 +294,6 @@ public class BlockSkull extends BlockContainer {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, NODROP });
}

View File

@ -14,8 +14,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -109,47 +107,6 @@ public class BlockStainedGlassPane extends BlockPane {
public int getMetaFromState(IBlockState iblockstate) {
return ((EnumDyeColor) iblockstate.getValue(COLOR)).getMetadata();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST)).withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH)).withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
}
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
switch (mirrorIn)
{
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
}
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { NORTH, EAST, WEST, SOUTH, COLOR });

View File

@ -22,9 +22,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Rotation;
import net.minecraft.util.Vec3;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
@ -695,78 +693,6 @@ public class BlockStairs extends Block {
return iblockstate;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
@SuppressWarnings("incomplete-switch")
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
BlockStairs.EnumShape blockstairs$enumshape = (BlockStairs.EnumShape)state.getValue(SHAPE);
switch (mirrorIn)
{
case LEFT_RIGHT:
if (enumfacing.getAxis() == EnumFacing.Axis.Z)
{
switch (blockstairs$enumshape)
{
case OUTER_LEFT:
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(SHAPE, BlockStairs.EnumShape.OUTER_RIGHT);
case OUTER_RIGHT:
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(SHAPE, BlockStairs.EnumShape.OUTER_LEFT);
case INNER_RIGHT:
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(SHAPE, BlockStairs.EnumShape.INNER_LEFT);
case INNER_LEFT:
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(SHAPE, BlockStairs.EnumShape.INNER_RIGHT);
default:
return state.withRotation(Rotation.CLOCKWISE_180);
}
}
break;
case FRONT_BACK:
if (enumfacing.getAxis() == EnumFacing.Axis.X)
{
switch (blockstairs$enumshape)
{
case OUTER_LEFT:
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(SHAPE, BlockStairs.EnumShape.OUTER_RIGHT);
case OUTER_RIGHT:
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(SHAPE, BlockStairs.EnumShape.OUTER_LEFT);
case INNER_RIGHT:
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(SHAPE, BlockStairs.EnumShape.INNER_RIGHT);
case INNER_LEFT:
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(SHAPE, BlockStairs.EnumShape.INNER_LEFT);
case STRAIGHT:
return state.withRotation(Rotation.CLOCKWISE_180);
}
}
}
return super.withMirror(state, mirrorIn);
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, HALF, SHAPE });
}

View File

@ -5,8 +5,6 @@ import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.World;
/**
@ -74,22 +72,6 @@ public class BlockStandingSign extends BlockSign {
return ((Integer) iblockstate.getValue(ROTATION)).intValue();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(ROTATION, Integer.valueOf(rot.rotate(((Integer)state.getValue(ROTATION)).intValue(), 16)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withProperty(ROTATION, Integer.valueOf(mirrorIn.mirrorRotation(((Integer)state.getValue(ROTATION)).intValue(), 16)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { ROTATION });
}

View File

@ -17,9 +17,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Rotation;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -284,22 +282,6 @@ public class BlockTorch extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}

View File

@ -16,9 +16,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Rotation;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -280,22 +278,6 @@ public class BlockTrapDoor extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, OPEN, HALF });
}

View File

@ -17,8 +17,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -300,47 +298,6 @@ public class BlockTripWire extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST)).withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH)).withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
}
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
switch (mirrorIn)
{
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
}
}
protected BlockState createBlockState() {
return new BlockState(this,
new IProperty[] { POWERED, SUSPENDED, ATTACHED, DISARMED, NORTH, EAST, WEST, SOUTH });

View File

@ -18,8 +18,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -362,22 +360,6 @@ public class BlockTripWireHook extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING, POWERED, ATTACHED, SUSPENDED });
}

View File

@ -20,8 +20,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -464,47 +462,6 @@ public class BlockVine extends Block {
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST)).withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH)).withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
}
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
switch (mirrorIn)
{
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
}
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { UP, NORTH, EAST, SOUTH, WEST });
}

View File

@ -6,8 +6,6 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -106,22 +104,6 @@ public class BlockWallSign extends BlockSign {
return ((EnumFacing) iblockstate.getValue(FACING)).getIndex();
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}

View File

@ -10,8 +10,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
@ -22,25 +20,17 @@ import com.google.common.collect.ImmutableTable;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.logisticscraft.occlusionculling.util.Vec3d;
import net.hoosiertransfer.Alfheim.ILightInfoProvider;
import net.hoosiertransfer.Alfheim.ILitBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Cartesian;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MapPopulator;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
/**
* +
@ -266,126 +256,6 @@ public class BlockState implements ILightInfoProvider {
return hashmap;
}
public Material getMaterial()
{
return this.block.getMaterial();
}
public boolean isFullBlock()
{
return this.block.isFullBlock();
}
public int getLightOpacity()
{
return this.block.getLightOpacity();
}
public int getLightValue()
{
return this.block.getLightValue();
}
public boolean isTranslucent()
{
return this.block.isTranslucent();
}
public boolean useNeighborBrightness()
{
return this.block.getUseNeighborBrightness();
}
public MapColor getMapColor()
{
return this.block.getMapColor(this);
}
public IBlockState withRotation(Rotation rot)
{
return this.block.withRotation(this, rot);
}
public IBlockState withMirror(Mirror mirrorIn)
{
return this.block.withMirror(this, mirrorIn);
}
public boolean isFullCube()
{
return this.block.isFullCube();
}
public float getAmbientOcclusionLightValue()
{
return this.block.getAmbientOcclusionLightValue();
}
public boolean isBlockNormalCube()
{
return this.block.isBlockNormalCube();
}
public boolean isNormalCube()
{
return this.block.isNormalCube();
}
public boolean canProvidePower()
{
return this.block.canProvidePower();
}
public int getWeakPower(IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return this.block.getWeakPower(blockAccess, pos, this, side);
}
public boolean hasComparatorInputOverride()
{
return this.block.hasComparatorInputOverride();
}
public int getComparatorInputOverride(World worldIn, BlockPos pos)
{
return this.block.getComparatorInputOverride(worldIn, pos);
}
public float getBlockHardness(World worldIn, BlockPos pos)
{
return this.block.getBlockHardness(worldIn, pos);
}
public float getPlayerRelativeBlockHardness(EntityPlayer player, World worldIn, BlockPos pos)
{
return this.block.getPlayerRelativeBlockHardness(player, worldIn, pos);
}
public int getStrongPower(IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return this.block.getStrongPower(blockAccess, pos, this, side);
}
public IBlockState getActualState(IBlockAccess blockAccess, BlockPos pos)
{
return this.block.getActualState(this, blockAccess, pos);
}
public boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, EnumFacing facing)
{
return this.block.shouldSideBeRendered(blockAccess, pos, facing);
}
public boolean isOpaqueCube()
{
return this.block.isOpaqueCube();
}
public boolean isFullyOpaque()
{
return this.block.isFullyOpaque(this);
}
public int alfheim$getLightFor(IBlockAccess iBlockAccess, EnumSkyBlock lightType, BlockPos blockPos) {
return ((ILitBlock) block).alfheim$getLightFor(((IBlockState) this), iBlockAccess, lightType, blockPos);
}

View File

@ -1,69 +0,0 @@
package net.minecraft.block.state;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public interface IBlockProperties
{
Material getMaterial();
boolean isFullBlock();
int getLightOpacity();
int getLightValue();
boolean isTranslucent();
boolean useNeighborBrightness();
MapColor getMapColor();
/**
* Returns the blockstate with the given rotation. If inapplicable, returns itself.
*/
IBlockState withRotation(Rotation rot);
/**
* Returns the blockstate mirrored in the given way. If inapplicable, returns itself.
*/
IBlockState withMirror(Mirror mirrorIn);
boolean isFullCube();
float getAmbientOcclusionLightValue();
boolean isBlockNormalCube();
boolean isNormalCube();
boolean canProvidePower();
boolean hasComparatorInputOverride();
int getComparatorInputOverride(World worldIn, BlockPos pos);
float getBlockHardness(World worldIn, BlockPos pos);
float getPlayerRelativeBlockHardness(EntityPlayer player, World worldIn, BlockPos pos);
int getStrongPower(IBlockAccess blockAccess, BlockPos pos, EnumFacing side);
IBlockState getActualState(IBlockAccess blockAccess, BlockPos pos);
boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, EnumFacing facing);
boolean isOpaqueCube();
boolean isFullyOpaque();
}

View File

@ -38,7 +38,7 @@ import net.minecraft.world.IBlockAccess;
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public interface IBlockState extends IBlockProperties {
public interface IBlockState {
/**
* +
* Get the names of all properties defined for this BlockState

View File

@ -49,10 +49,8 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Mirror;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ReportedException;
import net.minecraft.util.Rotation;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.Explosion;
@ -2657,47 +2655,4 @@ public abstract class Entity implements ICommandSender {
}
return 0.0f;
}
/**
* Transforms the entity's current yaw with the given Rotation and returns it. This does not have a side-effect.
*/
public float getRotatedYaw(Rotation transformRotation)
{
float f = MathHelper.wrapAngleTo180_float(this.rotationYaw);
switch (transformRotation)
{
case CLOCKWISE_180:
return f + 180.0F;
case COUNTERCLOCKWISE_90:
return f + 270.0F;
case CLOCKWISE_90:
return f + 90.0F;
default:
return f;
}
}
/**
* Transforms the entity's current yaw with the given Mirror and returns it. This does not have a side-effect.
*/
public float getMirroredYaw(Mirror transformMirror)
{
float f = MathHelper.wrapAngleTo180_float(this.rotationYaw);
switch (transformMirror)
{
case LEFT_RIGHT:
return -f;
case FRONT_BACK:
return 180.0F - f;
default:
return f;
}
}
}

View File

@ -8,11 +8,8 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.Callable;
import javax.annotation.Nullable;
import com.google.common.collect.Maps;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.util.ReportedException;
@ -134,18 +131,6 @@ public class NBTTagCompound extends NBTBase {
public void setInteger(String key, int value) {
this.tagMap.put(key, new NBTTagInt(value));
}
public void setUniqueId(String key, EaglercraftUUID value)
{
this.setLong(key + "Most", value.getMostSignificantBits());
this.setLong(key + "Least", value.getLeastSignificantBits());
}
@Nullable
public EaglercraftUUID getUniqueId(String key)
{
return new EaglercraftUUID(this.getLong(key + "Most"), this.getLong(key + "Least"));
}
/**
* +

View File

@ -191,18 +191,6 @@ public class NBTTagList extends NBTBase {
}
}
public int getIntAt(int p_186858_1_) {
if (p_186858_1_ >= 0 && p_186858_1_ < this.tagList.size()) {
NBTBase nbtbase = (NBTBase) this.tagList.get(p_186858_1_);
if (nbtbase.getId() == 3) {
return ((NBTTagInt) nbtbase).getInt();
}
}
return 0;
}
public int[] getIntArrayAt(int i) {
if (i >= 0 && i < this.tagList.size()) {
NBTBase nbtbase = (NBTBase) this.tagList.get(i);

View File

@ -1,128 +0,0 @@
package net.minecraft.util;
import net.minecraft.entity.Entity;
public class ChunkPos
{
/** The X position of this Chunk Coordinate Pair */
public final int chunkXPos;
/** The Z position of this Chunk Coordinate Pair */
public final int chunkZPos;
public ChunkPos(int x, int z)
{
this.chunkXPos = x;
this.chunkZPos = z;
}
public ChunkPos(BlockPos pos)
{
this.chunkXPos = pos.getX() >> 4;
this.chunkZPos = pos.getZ() >> 4;
}
/**
* converts a chunk coordinate pair to an integer (suitable for hashing)
*/
public static long chunkXZ2Int(int x, int z)
{
return (long)x & 4294967295L | ((long)z & 4294967295L) << 32;
}
public int hashCode()
{
int i = 1664525 * this.chunkXPos + 1013904223;
int j = 1664525 * (this.chunkZPos ^ -559038737) + 1013904223;
return i ^ j;
}
public boolean equals(Object p_equals_1_)
{
if (this == p_equals_1_)
{
return true;
}
else if (!(p_equals_1_ instanceof ChunkPos))
{
return false;
}
else
{
ChunkPos chunkpos = (ChunkPos)p_equals_1_;
return this.chunkXPos == chunkpos.chunkXPos && this.chunkZPos == chunkpos.chunkZPos;
}
}
public double getDistanceSq(Entity p_185327_1_)
{
double d0 = (double)(this.chunkXPos * 16 + 8);
double d1 = (double)(this.chunkZPos * 16 + 8);
double d2 = d0 - p_185327_1_.posX;
double d3 = d1 - p_185327_1_.posZ;
return d2 * d2 + d3 * d3;
}
public int getCenterXPos()
{
return (this.chunkXPos << 4) + 8;
}
public int getCenterZPosition()
{
return (this.chunkZPos << 4) + 8;
}
/**
* Get the first world X coordinate that belongs to this Chunk
*/
public int getXStart()
{
return this.chunkXPos << 4;
}
/**
* Get the first world Z coordinate that belongs to this Chunk
*/
public int getZStart()
{
return this.chunkZPos << 4;
}
/**
* Get the last world X coordinate that belongs to this Chunk
*/
public int getXEnd()
{
return (this.chunkXPos << 4) + 15;
}
/**
* Get the last world Z coordinate that belongs to this Chunk
*/
public int getZEnd()
{
return (this.chunkZPos << 4) + 15;
}
/**
* Get the World coordinates of the Block with the given Chunk coordinates relative to this chunk
*/
public BlockPos getBlock(int x, int y, int z)
{
return new BlockPos((this.chunkXPos << 4) + x, y, (this.chunkZPos << 4) + z);
}
/**
* Get the coordinates of the Block in the center of this chunk with the given Y coordinate
*/
public BlockPos getCenterBlock(int y)
{
return new BlockPos(this.getCenterXPos(), y, this.getCenterZPosition());
}
public String toString()
{
return "[" + this.chunkXPos + ", " + this.chunkZPos + "]";
}
}

View File

@ -1,98 +0,0 @@
package net.minecraft.util;
public enum Mirror
{
NONE("no_mirror"),
LEFT_RIGHT("mirror_left_right"),
FRONT_BACK("mirror_front_back");
private final String name;
private static String[] mirrorNames = new String[values().length];
private Mirror(String nameIn)
{
this.name = nameIn;
}
/**
* Mirrors the given rotation like specified by this mirror. rotations start at 0 and go up to rotationCount-1. 0 is
* front, rotationCount/2 is back.
*/
public int mirrorRotation(int rotationIn, int rotationCount)
{
int i = rotationCount / 2;
int j = rotationIn > i ? rotationIn - rotationCount : rotationIn;
switch (this)
{
case LEFT_RIGHT:
return (rotationCount - j) % rotationCount;
case FRONT_BACK:
return (i - j + rotationCount) % rotationCount;
default:
return rotationIn;
}
}
/**
* Determines the rotation that is equivalent to this mirror if the rotating object faces in the given direction
*/
public Rotation toRotation(EnumFacing facing)
{
EnumFacing.Axis enumfacing$axis = facing.getAxis();
return (this != LEFT_RIGHT || enumfacing$axis != EnumFacing.Axis.Z) && (this != FRONT_BACK || enumfacing$axis != EnumFacing.Axis.X) ? Rotation.NONE : Rotation.CLOCKWISE_180;
}
/**
* Mirror the given facing according to this mirror
*/
public EnumFacing mirror(EnumFacing facing)
{
switch (this)
{
case LEFT_RIGHT:
if (facing == EnumFacing.WEST)
{
return EnumFacing.EAST;
}
else
{
if (facing == EnumFacing.EAST)
{
return EnumFacing.WEST;
}
return facing;
}
case FRONT_BACK:
if (facing == EnumFacing.NORTH)
{
return EnumFacing.SOUTH;
}
else
{
if (facing == EnumFacing.SOUTH)
{
return EnumFacing.NORTH;
}
return facing;
}
default:
return facing;
}
}
static {
int i = 0;
for (Mirror mirror : values())
{
mirrorNames[i++] = mirror.name;
}
}
}

View File

@ -1,126 +0,0 @@
package net.minecraft.util;
public enum Rotation
{
NONE("rotate_0"),
CLOCKWISE_90("rotate_90"),
CLOCKWISE_180("rotate_180"),
COUNTERCLOCKWISE_90("rotate_270");
private final String name;
private static String[] rotationNames = new String[values().length];
private Rotation(String nameIn)
{
this.name = nameIn;
}
public Rotation add(Rotation rotation)
{
switch (rotation)
{
case CLOCKWISE_180:
switch (this)
{
case NONE:
return CLOCKWISE_180;
case CLOCKWISE_90:
return COUNTERCLOCKWISE_90;
case CLOCKWISE_180:
return NONE;
case COUNTERCLOCKWISE_90:
return CLOCKWISE_90;
}
case COUNTERCLOCKWISE_90:
switch (this)
{
case NONE:
return COUNTERCLOCKWISE_90;
case CLOCKWISE_90:
return NONE;
case CLOCKWISE_180:
return CLOCKWISE_90;
case COUNTERCLOCKWISE_90:
return CLOCKWISE_180;
}
case CLOCKWISE_90:
switch (this)
{
case NONE:
return CLOCKWISE_90;
case CLOCKWISE_90:
return CLOCKWISE_180;
case CLOCKWISE_180:
return COUNTERCLOCKWISE_90;
case COUNTERCLOCKWISE_90:
return NONE;
}
default:
return this;
}
}
public EnumFacing rotate(EnumFacing facing)
{
if (facing.getAxis() == EnumFacing.Axis.Y)
{
return facing;
}
else
{
switch (this)
{
case CLOCKWISE_90:
return facing.rotateY();
case CLOCKWISE_180:
return facing.getOpposite();
case COUNTERCLOCKWISE_90:
return facing.rotateYCCW();
default:
return facing;
}
}
}
public int rotate(int p_185833_1_, int p_185833_2_)
{
switch (this)
{
case CLOCKWISE_90:
return (p_185833_1_ + p_185833_2_ / 4) % p_185833_2_;
case CLOCKWISE_180:
return (p_185833_1_ + p_185833_2_ / 2) % p_185833_2_;
case COUNTERCLOCKWISE_90:
return (p_185833_1_ + p_185833_2_ * 3 / 4) % p_185833_2_;
default:
return p_185833_1_;
}
}
static {
int i = 0;
for (Rotation rotation : values())
{
rotationNames[i++] = rotation.name;
}
}
}

View File

@ -1,146 +0,0 @@
package net.minecraft.world.gen.structure.template;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.ChunkPos;
import net.minecraft.world.gen.structure.StructureBoundingBox;
public class PlacementSettings
{
private Mirror mirror;
private Rotation rotation;
private boolean ignoreEntities;
/**
* the type of block in the world that will get replaced by the structure
*/
private Block replacedBlock;
/** the chunk the structure is within */
private ChunkPos chunk;
/** the bounds the structure is contained within */
private StructureBoundingBox boundingBox;
private boolean ignoreStructureBlock;
public PlacementSettings()
{
this(Mirror.NONE, Rotation.NONE, false, (Block)null, (StructureBoundingBox)null);
}
public PlacementSettings(Mirror mirrorIn, Rotation rotationIn, boolean ignoreEntitiesIn, @Nullable Block replacedBlockIn, @Nullable StructureBoundingBox boundingBoxIn)
{
this.rotation = rotationIn;
this.mirror = mirrorIn;
this.ignoreEntities = ignoreEntitiesIn;
this.replacedBlock = replacedBlockIn;
this.chunk = null;
this.boundingBox = boundingBoxIn;
this.ignoreStructureBlock = true;
}
public PlacementSettings copy()
{
return (new PlacementSettings(this.mirror, this.rotation, this.ignoreEntities, this.replacedBlock, this.boundingBox)).setChunk(this.chunk).setIgnoreStructureBlock(this.ignoreStructureBlock);
}
public PlacementSettings setMirror(Mirror mirrorIn)
{
this.mirror = mirrorIn;
return this;
}
public PlacementSettings setRotation(Rotation rotationIn)
{
this.rotation = rotationIn;
return this;
}
public PlacementSettings setIgnoreEntities(boolean ignoreEntitiesIn)
{
this.ignoreEntities = ignoreEntitiesIn;
return this;
}
public PlacementSettings setReplacedBlock(Block replacedBlockIn)
{
this.replacedBlock = replacedBlockIn;
return this;
}
public PlacementSettings setChunk(ChunkPos chunkPosIn)
{
this.chunk = chunkPosIn;
return this;
}
public PlacementSettings setBoundingBox(StructureBoundingBox boundingBoxIn)
{
this.boundingBox = boundingBoxIn;
return this;
}
public Mirror getMirror()
{
return this.mirror;
}
public PlacementSettings setIgnoreStructureBlock(boolean ignoreStructureBlockIn)
{
this.ignoreStructureBlock = ignoreStructureBlockIn;
return this;
}
public Rotation getRotation()
{
return this.rotation;
}
public boolean getIgnoreEntities()
{
return this.ignoreEntities;
}
public Block getReplacedBlock()
{
return this.replacedBlock;
}
@Nullable
public StructureBoundingBox getBoundingBox()
{
if (this.boundingBox == null && this.chunk != null)
{
this.setBoundingBoxFromChunk();
}
return this.boundingBox;
}
public boolean getIgnoreStructureBlock()
{
return this.ignoreStructureBlock;
}
void setBoundingBoxFromChunk()
{
this.boundingBox = this.getBoundingBoxFromChunk(this.chunk);
}
@Nullable
private StructureBoundingBox getBoundingBoxFromChunk(@Nullable ChunkPos pos)
{
if (pos == null)
{
return null;
}
else
{
int i = pos.chunkXPos * 16;
int j = pos.chunkZPos * 16;
return new StructureBoundingBox(i, 0, j, i + 16 - 1, 255, j + 16 - 1);
}
}
}

View File

@ -1,561 +0,0 @@
package net.minecraft.world.gen.structure.template;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
public class Template
{
private final List<Template.BlockInfo> blocks = Lists.<Template.BlockInfo>newArrayList();
private final List<Template.EntityInfo> entities = Lists.<Template.EntityInfo>newArrayList();
/** size of the structure */
private BlockPos size = BlockPos.ORIGIN;
/** The author of this template. */
private String author = "?";
public BlockPos getSize()
{
return this.size;
}
public void setAuthor(String authorIn)
{
this.author = authorIn;
}
public String getAuthor()
{
return this.author;
}
/**
* takes blocks from the world and puts the data them into this template
*/
public void takeBlocksFromWorld(World worldIn, BlockPos startPos, BlockPos endPos, boolean takeEntities, @Nullable Block p_186254_5_)
{
if (endPos.getX() >= 1 && endPos.getY() >= 1 && endPos.getZ() >= 1)
{
BlockPos blockpos = startPos.add(endPos).add(-1, -1, -1);
List<Template.BlockInfo> list = Lists.<Template.BlockInfo>newArrayList();
List<Template.BlockInfo> list1 = Lists.<Template.BlockInfo>newArrayList();
List<Template.BlockInfo> list2 = Lists.<Template.BlockInfo>newArrayList();
BlockPos blockpos1 = new BlockPos(Math.min(startPos.getX(), blockpos.getX()), Math.min(startPos.getY(), blockpos.getY()), Math.min(startPos.getZ(), blockpos.getZ()));
BlockPos blockpos2 = new BlockPos(Math.max(startPos.getX(), blockpos.getX()), Math.max(startPos.getY(), blockpos.getY()), Math.max(startPos.getZ(), blockpos.getZ()));
this.size = endPos;
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos1, blockpos2))
{
BlockPos blockpos3 = blockpos$mutableblockpos.subtract(blockpos1);
IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos);
if (p_186254_5_ == null || p_186254_5_ != iblockstate.getBlock())
{
TileEntity tileentity = worldIn.getTileEntity(blockpos$mutableblockpos);
if (tileentity != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
tileentity.writeToNBT(nbttagcompound);
nbttagcompound.removeTag("x");
nbttagcompound.removeTag("y");
nbttagcompound.removeTag("z");
list1.add(new Template.BlockInfo(blockpos3, iblockstate, nbttagcompound));
}
else if (!iblockstate.isFullBlock() && !iblockstate.isFullCube())
{
list2.add(new Template.BlockInfo(blockpos3, iblockstate, (NBTTagCompound)null));
}
else
{
list.add(new Template.BlockInfo(blockpos3, iblockstate, (NBTTagCompound)null));
}
}
}
this.blocks.clear();
this.blocks.addAll(list);
this.blocks.addAll(list1);
this.blocks.addAll(list2);
if (takeEntities)
{
this.takeEntitiesFromWorld(worldIn, blockpos1, blockpos2.add(1, 1, 1));
}
else
{
this.entities.clear();
}
}
}
/**
* takes blocks from the world and puts the data them into this template
*/
private void takeEntitiesFromWorld(World worldIn, BlockPos startPos, BlockPos endPos)
{
List<Entity> list = worldIn.<Entity>getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(startPos, endPos), new Predicate<Entity>()
{
public boolean apply(@Nullable Entity p_apply_1_)
{
return !(p_apply_1_ instanceof EntityPlayer);
}
});
this.entities.clear();
for (Entity entity : list)
{
Vec3 vec3d = new Vec3(entity.posX - (double)startPos.getX(), entity.posY - (double)startPos.getY(), entity.posZ - (double)startPos.getZ());
NBTTagCompound nbttagcompound = new NBTTagCompound();
entity.writeToNBTOptional(nbttagcompound);
BlockPos blockpos;
if (entity instanceof EntityPainting)
{
blockpos = ((EntityPainting)entity).getHangingPosition().subtract(startPos);
}
else
{
blockpos = new BlockPos(vec3d);
}
this.entities.add(new Template.EntityInfo(vec3d, blockpos, nbttagcompound));
}
}
public Map<BlockPos, String> getDataBlocks(BlockPos pos, PlacementSettings placementIn)
{
Map<BlockPos, String> map = Maps.<BlockPos, String>newHashMap();
StructureBoundingBox structureboundingbox = placementIn.getBoundingBox();
for (Template.BlockInfo template$blockinfo : this.blocks)
{
BlockPos blockpos = transformedBlockPos(placementIn, template$blockinfo.pos).add(pos);
if (structureboundingbox == null || structureboundingbox.isVecInside(blockpos))
{
IBlockState iblockstate = template$blockinfo.blockState;
// if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK && template$blockinfo.tileentityData != null)
// {
// TileEntityStructure.Mode tileentitystructure$mode = TileEntityStructure.Mode.valueOf(template$blockinfo.tileentityData.getString("mode"));
// if (tileentitystructure$mode == TileEntityStructure.Mode.DATA)
// {
// map.put(blockpos, template$blockinfo.tileentityData.getString("metadata"));
// }
// }
}
}
return map;
}
public BlockPos calculateConnectedPos(PlacementSettings placementIn, BlockPos p_186262_2_, PlacementSettings p_186262_3_, BlockPos p_186262_4_)
{
BlockPos blockpos = transformedBlockPos(placementIn, p_186262_2_);
BlockPos blockpos1 = transformedBlockPos(p_186262_3_, p_186262_4_);
return blockpos.subtract(blockpos1);
}
public static BlockPos transformedBlockPos(PlacementSettings placementIn, BlockPos p_186266_1_)
{
return transformedBlockPos(p_186266_1_, placementIn.getMirror(), placementIn.getRotation());
}
public void addBlocksToWorldChunk(World worldIn, BlockPos pos, PlacementSettings placementIn)
{
placementIn.setBoundingBoxFromChunk();
this.addBlocksToWorld(worldIn, pos, placementIn);
}
/**
* This takes the data stored in this instance and puts them into the world.
*/
public void addBlocksToWorld(World worldIn, BlockPos pos, PlacementSettings placementIn)
{
if (!this.blocks.isEmpty() && this.size.getX() >= 1 && this.size.getY() >= 1 && this.size.getZ() >= 1)
{
Block block = placementIn.getReplacedBlock();
StructureBoundingBox structureboundingbox = placementIn.getBoundingBox();
for (Template.BlockInfo template$blockinfo : this.blocks)
{
Block block1 = template$blockinfo.blockState.getBlock();
if ((block == null || block != block1) && (!placementIn.getIgnoreStructureBlock()))
{
BlockPos blockpos = transformedBlockPos(placementIn, template$blockinfo.pos).add(pos);
if (structureboundingbox == null || structureboundingbox.isVecInside(blockpos))
{
IBlockState iblockstate = template$blockinfo.blockState.withMirror(placementIn.getMirror());
IBlockState iblockstate1 = iblockstate.withRotation(placementIn.getRotation());
if (template$blockinfo.tileentityData != null)
{
TileEntity tileentity = worldIn.getTileEntity(blockpos);
if (tileentity != null)
{
if (tileentity instanceof IInventory)
{
((IInventory)tileentity).clear();
}
worldIn.setBlockState(blockpos, Blocks.barrier.getDefaultState(), 4);
}
}
if (worldIn.setBlockState(blockpos, iblockstate1, 2) && template$blockinfo.tileentityData != null)
{
TileEntity tileentity2 = worldIn.getTileEntity(blockpos);
if (tileentity2 != null)
{
template$blockinfo.tileentityData.setInteger("x", blockpos.getX());
template$blockinfo.tileentityData.setInteger("y", blockpos.getY());
template$blockinfo.tileentityData.setInteger("z", blockpos.getZ());
tileentity2.readFromNBT(template$blockinfo.tileentityData);
}
}
}
}
}
for (Template.BlockInfo template$blockinfo1 : this.blocks)
{
if (block == null || block != template$blockinfo1.blockState.getBlock())
{
BlockPos blockpos1 = transformedBlockPos(placementIn, template$blockinfo1.pos).add(pos);
if (structureboundingbox == null || structureboundingbox.isVecInside(blockpos1))
{
worldIn.notifyNeighborsRespectDebug(blockpos1, template$blockinfo1.blockState.getBlock());
if (template$blockinfo1.tileentityData != null)
{
TileEntity tileentity1 = worldIn.getTileEntity(blockpos1);
if (tileentity1 != null)
{
tileentity1.markDirty();
}
}
}
}
}
if (!placementIn.getIgnoreEntities())
{
this.addEntitiesToWorld(worldIn, pos, placementIn.getMirror(), placementIn.getRotation(), structureboundingbox);
}
}
}
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
for (Template.EntityInfo template$entityinfo : this.entities)
{
BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);
if (aabb == null || aabb.isVecInside(blockpos))
{
NBTTagCompound nbttagcompound = template$entityinfo.entityData;
Vec3 vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
Vec3 vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
NBTTagList nbttaglist = new NBTTagList();
nbttaglist.appendTag(new NBTTagDouble(vec3d1.xCoord));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.yCoord));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.zCoord));
nbttagcompound.setTag("Pos", nbttaglist);
nbttagcompound.setUniqueId("UUID", EaglercraftUUID.randomUUID());
Entity entity;
try
{
entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
}
catch (Exception var15)
{
entity = null;
}
if (entity != null)
{
if (entity instanceof EntityPainting)
{
entity.getMirroredYaw(mirrorIn);
entity.getRotatedYaw(rotationIn);
entity.setPosition((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, entity.rotationYaw, entity.rotationPitch);
}
else
{
float f = entity.getMirroredYaw(mirrorIn);
f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
}
worldIn.spawnEntityInWorld(entity);
}
}
}
}
public BlockPos transformedSize(Rotation rotationIn)
{
switch (rotationIn)
{
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
return new BlockPos(this.size.getZ(), this.size.getY(), this.size.getX());
default:
return this.size;
}
}
private static BlockPos transformedBlockPos(BlockPos pos, Mirror mirrorIn, Rotation rotationIn)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
boolean flag = true;
switch (mirrorIn)
{
case LEFT_RIGHT:
k = -k;
break;
case FRONT_BACK:
i = -i;
break;
default:
flag = false;
}
switch (rotationIn)
{
case COUNTERCLOCKWISE_90:
return new BlockPos(k, j, -i);
case CLOCKWISE_90:
return new BlockPos(-k, j, i);
case CLOCKWISE_180:
return new BlockPos(-i, j, -k);
default:
return flag ? new BlockPos(i, j, k) : pos;
}
}
private static Vec3 transformedVec3d(Vec3 vec, Mirror mirrorIn, Rotation rotationIn)
{
double d0 = vec.xCoord;
double d1 = vec.yCoord;
double d2 = vec.zCoord;
boolean flag = true;
switch (mirrorIn)
{
case LEFT_RIGHT:
d2 = 1.0D - d2;
break;
case FRONT_BACK:
d0 = 1.0D - d0;
break;
default:
flag = false;
}
switch (rotationIn)
{
case COUNTERCLOCKWISE_90:
return new Vec3(d2, d1, 1.0D - d0);
case CLOCKWISE_90:
return new Vec3(1.0D - d2, d1, d0);
case CLOCKWISE_180:
return new Vec3(1.0D - d0, d1, 1.0D - d2);
default:
return flag ? new Vec3(d0, d1, d2) : vec;
}
}
public NBTTagCompound func_189552_a(NBTTagCompound p_189552_1_)
{
NBTTagList nbttaglist = new NBTTagList();
for (Template.BlockInfo template$blockinfo : this.blocks)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setTag("pos", this.writeInts(new int[] {template$blockinfo.pos.getX(), template$blockinfo.pos.getY(), template$blockinfo.pos.getZ()}));
nbttagcompound.setInteger("state", Block.getStateId(template$blockinfo.blockState));
if (template$blockinfo.tileentityData != null)
{
nbttagcompound.setTag("nbt", template$blockinfo.tileentityData);
}
nbttaglist.appendTag(nbttagcompound);
}
NBTTagList nbttaglist1 = new NBTTagList();
for (Template.EntityInfo template$entityinfo : this.entities)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setTag("pos", this.writeDoubles(new double[] {template$entityinfo.pos.xCoord, template$entityinfo.pos.yCoord, template$entityinfo.pos.zCoord}));
nbttagcompound1.setTag("blockPos", this.writeInts(new int[] {template$entityinfo.blockPos.getX(), template$entityinfo.blockPos.getY(), template$entityinfo.blockPos.getZ()}));
if (template$entityinfo.entityData != null)
{
nbttagcompound1.setTag("nbt", template$entityinfo.entityData);
}
nbttaglist1.appendTag(nbttagcompound1);
}
p_189552_1_.setTag("blocks", nbttaglist);
p_189552_1_.setTag("entities", nbttaglist1);
p_189552_1_.setTag("size", this.writeInts(new int[] {this.size.getX(), this.size.getY(), this.size.getZ()}));
p_189552_1_.setInteger("version", 1);
p_189552_1_.setString("author", this.author);
return p_189552_1_;
}
public void read(NBTTagCompound compound)
{
this.blocks.clear();
this.entities.clear();
NBTTagList nbttaglist = compound.getTagList("size", 3);
this.size = new BlockPos(nbttaglist.getIntAt(0), nbttaglist.getIntAt(1), nbttaglist.getIntAt(2));
this.author = compound.getString("author");
NBTTagList nbttaglist1 = compound.getTagList("blocks", 10);
for (int i = 0; i < nbttaglist1.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist1.getCompoundTagAt(i);
NBTTagList nbttaglist2 = nbttagcompound.getTagList("pos", 3);
BlockPos blockpos = new BlockPos(nbttaglist2.getIntAt(0), nbttaglist2.getIntAt(1), nbttaglist2.getIntAt(2));
int j = nbttagcompound.getInteger("state");
IBlockState iblockstate = Block.getStateById(j);
NBTTagCompound nbttagcompound1;
if (nbttagcompound.hasKey("nbt"))
{
nbttagcompound1 = nbttagcompound.getCompoundTag("nbt");
}
else
{
nbttagcompound1 = null;
}
this.blocks.add(new Template.BlockInfo(blockpos, iblockstate, nbttagcompound1));
}
NBTTagList nbttaglist3 = compound.getTagList("entities", 10);
for (int k = 0; k < nbttaglist3.tagCount(); ++k)
{
NBTTagCompound nbttagcompound3 = nbttaglist3.getCompoundTagAt(k);
NBTTagList nbttaglist4 = nbttagcompound3.getTagList("pos", 6);
Vec3 vec3d = new Vec3(nbttaglist4.getDoubleAt(0), nbttaglist4.getDoubleAt(1), nbttaglist4.getDoubleAt(2));
NBTTagList nbttaglist5 = nbttagcompound3.getTagList("blockPos", 3);
BlockPos blockpos1 = new BlockPos(nbttaglist5.getIntAt(0), nbttaglist5.getIntAt(1), nbttaglist5.getIntAt(2));
if (nbttagcompound3.hasKey("nbt"))
{
NBTTagCompound nbttagcompound2 = nbttagcompound3.getCompoundTag("nbt");
this.entities.add(new Template.EntityInfo(vec3d, blockpos1, nbttagcompound2));
}
}
}
private NBTTagList writeInts(int... values)
{
NBTTagList nbttaglist = new NBTTagList();
for (int i : values)
{
nbttaglist.appendTag(new NBTTagInt(i));
}
return nbttaglist;
}
private NBTTagList writeDoubles(double... values)
{
NBTTagList nbttaglist = new NBTTagList();
for (double d0 : values)
{
nbttaglist.appendTag(new NBTTagDouble(d0));
}
return nbttaglist;
}
static class BlockInfo
{
public final BlockPos pos;
public final IBlockState blockState;
public final NBTTagCompound tileentityData;
private BlockInfo(BlockPos posIn, IBlockState stateIn, @Nullable NBTTagCompound compoundIn)
{
this.pos = posIn;
this.blockState = stateIn;
this.tileentityData = compoundIn;
}
}
static class EntityInfo
{
public final Vec3 pos;
public final BlockPos blockPos;
public final NBTTagCompound entityData;
private EntityInfo(Vec3 vecIn, BlockPos posIn, NBTTagCompound compoundIn)
{
this.pos = vecIn;
this.blockPos = posIn;
this.entityData = compoundIn;
}
}
}

View File

@ -1,146 +0,0 @@
package net.minecraft.world.gen.structure.template;
import com.google.common.collect.Maps;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import javax.annotation.Nullable;
import net.hoosiertransfer.ServerAssets;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.IOUtils;
public class TemplateManager
{
private final Map<String, Template> templates;
/**
* the folder in the assets folder where the structure templates are found.
*/
private final String baseFolder;
public TemplateManager()
{
this("structures");
}
public TemplateManager(String basefolderIn)
{
this.templates = Maps.<String, Template>newHashMap();
this.baseFolder = basefolderIn;
}
public Template getTemplate(@Nullable MinecraftServer server, ResourceLocation id)
{
String s = id.getResourcePath();
if (this.templates.containsKey(s))
{
return (Template)this.templates.get(s);
}
else
{
if (server != null)
{
this.readTemplate(server, id);
}
else
{
this.readTemplateFromJar(id);
}
if (this.templates.containsKey(s))
{
return (Template)this.templates.get(s);
}
else
{
Template template = new Template();
this.templates.put(s, template);
return template;
}
}
}
/**
* This reads a structure template from the given location and stores it.
* This first attempts get the template from an external folder.
* If it isn't there then it attempts to take it from the minecraft jar.
*/
public boolean readTemplate(MinecraftServer server, ResourceLocation id)
{
// String s = id.getResourcePath();
// File file1 = server.getFile(this.baseFolder);
// File file2 = new File(file1, s + ".nbt");
// if (!file2.exists())
// {
return this.readTemplateFromJar(id);
// }
// else
// {
// InputStream inputstream = null;
// boolean flag;
// try
// {
// inputstream = new FileInputStream(file2);
// this.readTemplateFromStream(s, inputstream);
// return true;
// }
// catch (Throwable var12)
// {
// flag = false;
// }
// finally
// {
// IOUtils.closeQuietly(inputstream);
// }
// return flag;
// }
}
/**
* reads a template from the minecraft jar
*/
private boolean readTemplateFromJar(ResourceLocation id)
{
String s = id.getResourceDomain();
String s1 = id.getResourcePath();
InputStream inputstream = null;
boolean flag;
try
{
// inputstream = MinecraftServer.class.getResourceAsStream("/assets/" + s + "/structures/" + s1 + ".nbt");
inputstream = ServerAssets.getAssetStream("/assets/" + s + "/server/structures/" + s1 + ".nbt");
this.readTemplateFromStream(s1, inputstream);
return true;
}
catch (Throwable var10)
{
flag = false;
}
finally
{
IOUtils.closeQuietly(inputstream);
}
return flag;
}
/**
* reads a template from an inputstream
*/
private void readTemplateFromStream(String id, InputStream stream) throws IOException
{
NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(stream);
Template template = new Template();
template.read(nbttagcompound);
this.templates.put(id, template);
}
}