mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
153 lines
7.5 KiB
Diff
153 lines
7.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java
|
|
@@ -20,50 +20,50 @@
|
|
|
|
public class BlockQuartz extends Block
|
|
{
|
|
- public static final PropertyEnum<BlockQuartz.EnumType> VARIANT = PropertyEnum.<BlockQuartz.EnumType>create("variant", BlockQuartz.EnumType.class);
|
|
+ public static final PropertyEnum<EnumType> VARIANT = PropertyEnum.<EnumType>create("variant", EnumType.class);
|
|
|
|
public BlockQuartz()
|
|
{
|
|
super(Material.ROCK);
|
|
- this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockQuartz.EnumType.DEFAULT));
|
|
+ this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, EnumType.DEFAULT));
|
|
this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
|
}
|
|
|
|
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
|
{
|
|
- if (meta == BlockQuartz.EnumType.LINES_Y.getMetadata())
|
|
+ if (meta == EnumType.LINES_Y.getMetadata())
|
|
{
|
|
switch (facing.getAxis())
|
|
{
|
|
case Z:
|
|
- return this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_Z);
|
|
+ return this.getDefaultState().withProperty(VARIANT, EnumType.LINES_Z);
|
|
case X:
|
|
- return this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_X);
|
|
+ return this.getDefaultState().withProperty(VARIANT, EnumType.LINES_X);
|
|
case Y:
|
|
- return this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_Y);
|
|
+ return this.getDefaultState().withProperty(VARIANT, EnumType.LINES_Y);
|
|
}
|
|
}
|
|
|
|
- return meta == BlockQuartz.EnumType.CHISELED.getMetadata() ? this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.CHISELED) : this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.DEFAULT);
|
|
+ return meta == EnumType.CHISELED.getMetadata() ? this.getDefaultState().withProperty(VARIANT, EnumType.CHISELED) : this.getDefaultState().withProperty(VARIANT, EnumType.DEFAULT);
|
|
}
|
|
|
|
public int damageDropped(IBlockState state)
|
|
{
|
|
- BlockQuartz.EnumType blockquartz$enumtype = (BlockQuartz.EnumType)state.getValue(VARIANT);
|
|
- return blockquartz$enumtype != BlockQuartz.EnumType.LINES_X && blockquartz$enumtype != BlockQuartz.EnumType.LINES_Z ? blockquartz$enumtype.getMetadata() : BlockQuartz.EnumType.LINES_Y.getMetadata();
|
|
+ EnumType blockquartz$enumtype = (EnumType)state.getValue(VARIANT);
|
|
+ return blockquartz$enumtype != EnumType.LINES_X && blockquartz$enumtype != EnumType.LINES_Z ? blockquartz$enumtype.getMetadata() : EnumType.LINES_Y.getMetadata();
|
|
}
|
|
|
|
protected ItemStack getSilkTouchDrop(IBlockState state)
|
|
{
|
|
- BlockQuartz.EnumType blockquartz$enumtype = (BlockQuartz.EnumType)state.getValue(VARIANT);
|
|
- return blockquartz$enumtype != BlockQuartz.EnumType.LINES_X && blockquartz$enumtype != BlockQuartz.EnumType.LINES_Z ? super.getSilkTouchDrop(state) : new ItemStack(Item.getItemFromBlock(this), 1, BlockQuartz.EnumType.LINES_Y.getMetadata());
|
|
+ EnumType blockquartz$enumtype = (EnumType)state.getValue(VARIANT);
|
|
+ return blockquartz$enumtype != EnumType.LINES_X && blockquartz$enumtype != EnumType.LINES_Z ? super.getSilkTouchDrop(state) : new ItemStack(Item.getItemFromBlock(this), 1, EnumType.LINES_Y.getMetadata());
|
|
}
|
|
|
|
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items)
|
|
{
|
|
- items.add(new ItemStack(this, 1, BlockQuartz.EnumType.DEFAULT.getMetadata()));
|
|
- items.add(new ItemStack(this, 1, BlockQuartz.EnumType.CHISELED.getMetadata()));
|
|
- items.add(new ItemStack(this, 1, BlockQuartz.EnumType.LINES_Y.getMetadata()));
|
|
+ items.add(new ItemStack(this, 1, EnumType.DEFAULT.getMetadata()));
|
|
+ items.add(new ItemStack(this, 1, EnumType.CHISELED.getMetadata()));
|
|
+ items.add(new ItemStack(this, 1, EnumType.LINES_Y.getMetadata()));
|
|
}
|
|
|
|
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
|
@@ -73,12 +73,12 @@
|
|
|
|
public IBlockState getStateFromMeta(int meta)
|
|
{
|
|
- return this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.byMetadata(meta));
|
|
+ return this.getDefaultState().withProperty(VARIANT, EnumType.byMetadata(meta));
|
|
}
|
|
|
|
public int getMetaFromState(IBlockState state)
|
|
{
|
|
- return ((BlockQuartz.EnumType)state.getValue(VARIANT)).getMetadata();
|
|
+ return ((EnumType)state.getValue(VARIANT)).getMetadata();
|
|
}
|
|
|
|
public IBlockState withRotation(IBlockState state, Rotation rot)
|
|
@@ -88,12 +88,12 @@
|
|
case COUNTERCLOCKWISE_90:
|
|
case CLOCKWISE_90:
|
|
|
|
- switch ((BlockQuartz.EnumType)state.getValue(VARIANT))
|
|
+ switch ((EnumType)state.getValue(VARIANT))
|
|
{
|
|
case LINES_X:
|
|
- return state.withProperty(VARIANT, BlockQuartz.EnumType.LINES_Z);
|
|
+ return state.withProperty(VARIANT, EnumType.LINES_Z);
|
|
case LINES_Z:
|
|
- return state.withProperty(VARIANT, BlockQuartz.EnumType.LINES_X);
|
|
+ return state.withProperty(VARIANT, EnumType.LINES_X);
|
|
default:
|
|
return state;
|
|
}
|
|
@@ -108,6 +108,26 @@
|
|
return new BlockStateContainer(this, new IProperty[] {VARIANT});
|
|
}
|
|
|
|
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
|
+ {
|
|
+ IBlockState state = world.getBlockState(pos);
|
|
+ for (IProperty prop : state.getProperties().keySet())
|
|
+ {
|
|
+ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class)
|
|
+ {
|
|
+ EnumType current = (EnumType)state.getValue(prop);
|
|
+ EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y :
|
|
+ current == EnumType.LINES_Y ? EnumType.LINES_Z :
|
|
+ current == EnumType.LINES_Z ? EnumType.LINES_X : current;
|
|
+ if (next == current)
|
|
+ return false;
|
|
+ world.setBlockState(pos, state.withProperty(prop, next));
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
+
|
|
public static enum EnumType implements IStringSerializable
|
|
{
|
|
DEFAULT(0, "default", "default"),
|
|
@@ -116,7 +136,7 @@
|
|
LINES_X(3, "lines_x", "lines"),
|
|
LINES_Z(4, "lines_z", "lines");
|
|
|
|
- private static final BlockQuartz.EnumType[] META_LOOKUP = new BlockQuartz.EnumType[values().length];
|
|
+ private static final EnumType[] META_LOOKUP = new EnumType[values().length];
|
|
private final int meta;
|
|
private final String serializedName;
|
|
private final String unlocalizedName;
|
|
@@ -138,7 +158,7 @@
|
|
return this.unlocalizedName;
|
|
}
|
|
|
|
- public static BlockQuartz.EnumType byMetadata(int meta)
|
|
+ public static EnumType byMetadata(int meta)
|
|
{
|
|
if (meta < 0 || meta >= META_LOOKUP.length)
|
|
{
|
|
@@ -155,7 +175,7 @@
|
|
|
|
static
|
|
{
|
|
- for (BlockQuartz.EnumType blockquartz$enumtype : values())
|
|
+ for (EnumType blockquartz$enumtype : values())
|
|
{
|
|
META_LOOKUP[blockquartz$enumtype.getMetadata()] = blockquartz$enumtype;
|
|
}
|