Files
CatServer/patches/net/minecraft/block/BlockHugeMushroom.java.patch
2019-02-24 22:29:41 +08:00

270 lines
13 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java
@@ -20,13 +20,13 @@
public class BlockHugeMushroom extends Block
{
- public static final PropertyEnum<BlockHugeMushroom.EnumType> VARIANT = PropertyEnum.<BlockHugeMushroom.EnumType>create("variant", BlockHugeMushroom.EnumType.class);
+ public static final PropertyEnum<EnumType> VARIANT = PropertyEnum.<EnumType>create("variant", EnumType.class);
private final Block smallBlock;
public BlockHugeMushroom(Material materialIn, MapColor color, Block smallBlockIn)
{
super(materialIn, color);
- this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockHugeMushroom.EnumType.ALL_OUTSIDE));
+ this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, EnumType.ALL_OUTSIDE));
this.smallBlock = smallBlockIn;
}
@@ -37,7 +37,7 @@
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
- switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
+ switch ((EnumType)state.getValue(VARIANT))
{
case ALL_STEM:
return MapColor.CLOTH;
@@ -67,12 +67,12 @@
public IBlockState getStateFromMeta(int meta)
{
- return this.getDefaultState().withProperty(VARIANT, BlockHugeMushroom.EnumType.byMetadata(meta));
+ return this.getDefaultState().withProperty(VARIANT, EnumType.byMetadata(meta));
}
public int getMetaFromState(IBlockState state)
{
- return ((BlockHugeMushroom.EnumType)state.getValue(VARIANT)).getMetadata();
+ return ((EnumType)state.getValue(VARIANT)).getMetadata();
}
public IBlockState withRotation(IBlockState state, Rotation rot)
@@ -81,78 +81,78 @@
{
case CLOCKWISE_180:
- switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
+ switch ((EnumType)state.getValue(VARIANT))
{
case STEM:
break;
case NORTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_EAST);
case NORTH:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH);
+ return state.withProperty(VARIANT, EnumType.SOUTH);
case NORTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_WEST);
case WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.EAST);
+ return state.withProperty(VARIANT, EnumType.EAST);
case EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.WEST);
+ return state.withProperty(VARIANT, EnumType.WEST);
case SOUTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
+ return state.withProperty(VARIANT, EnumType.NORTH_EAST);
case SOUTH:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH);
+ return state.withProperty(VARIANT, EnumType.NORTH);
case SOUTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
+ return state.withProperty(VARIANT, EnumType.NORTH_WEST);
default:
return state;
}
case COUNTERCLOCKWISE_90:
- switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
+ switch ((EnumType)state.getValue(VARIANT))
{
case STEM:
break;
case NORTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_WEST);
case NORTH:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.WEST);
+ return state.withProperty(VARIANT, EnumType.WEST);
case NORTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
+ return state.withProperty(VARIANT, EnumType.NORTH_WEST);
case WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH);
+ return state.withProperty(VARIANT, EnumType.SOUTH);
case EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH);
+ return state.withProperty(VARIANT, EnumType.NORTH);
case SOUTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_EAST);
case SOUTH:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.EAST);
+ return state.withProperty(VARIANT, EnumType.EAST);
case SOUTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
+ return state.withProperty(VARIANT, EnumType.NORTH_EAST);
default:
return state;
}
case CLOCKWISE_90:
- switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
+ switch ((EnumType)state.getValue(VARIANT))
{
case STEM:
break;
case NORTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
+ return state.withProperty(VARIANT, EnumType.NORTH_EAST);
case NORTH:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.EAST);
+ return state.withProperty(VARIANT, EnumType.EAST);
case NORTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_EAST);
case WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH);
+ return state.withProperty(VARIANT, EnumType.NORTH);
case EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH);
+ return state.withProperty(VARIANT, EnumType.SOUTH);
case SOUTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
+ return state.withProperty(VARIANT, EnumType.NORTH_WEST);
case SOUTH:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.WEST);
+ return state.withProperty(VARIANT, EnumType.WEST);
case SOUTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_WEST);
default:
return state;
}
@@ -165,7 +165,7 @@
@SuppressWarnings("incomplete-switch")
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
- BlockHugeMushroom.EnumType blockhugemushroom$enumtype = (BlockHugeMushroom.EnumType)state.getValue(VARIANT);
+ EnumType blockhugemushroom$enumtype = (EnumType)state.getValue(VARIANT);
switch (mirrorIn)
{
@@ -174,21 +174,21 @@
switch (blockhugemushroom$enumtype)
{
case NORTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_WEST);
case NORTH:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH);
+ return state.withProperty(VARIANT, EnumType.SOUTH);
case NORTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_EAST);
case WEST:
case EAST:
default:
return super.withMirror(state, mirrorIn);
case SOUTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
+ return state.withProperty(VARIANT, EnumType.NORTH_WEST);
case SOUTH:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH);
+ return state.withProperty(VARIANT, EnumType.NORTH);
case SOUTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
+ return state.withProperty(VARIANT, EnumType.NORTH_EAST);
}
case FRONT_BACK:
@@ -196,21 +196,21 @@
switch (blockhugemushroom$enumtype)
{
case NORTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_EAST);
+ return state.withProperty(VARIANT, EnumType.NORTH_EAST);
case NORTH:
case SOUTH:
default:
break;
case NORTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.NORTH_WEST);
+ return state.withProperty(VARIANT, EnumType.NORTH_WEST);
case WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.EAST);
+ return state.withProperty(VARIANT, EnumType.EAST);
case EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.WEST);
+ return state.withProperty(VARIANT, EnumType.WEST);
case SOUTH_WEST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_EAST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_EAST);
case SOUTH_EAST:
- return state.withProperty(VARIANT, BlockHugeMushroom.EnumType.SOUTH_WEST);
+ return state.withProperty(VARIANT, EnumType.SOUTH_WEST);
}
}
@@ -222,6 +222,20 @@
return new BlockStateContainer(this, new IProperty[] {VARIANT});
}
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty<?>>)state.getProperties().keySet())
+ {
+ if (prop.getName().equals("variant"))
+ {
+ world.setBlockState(pos, state.cycleProperty(prop));
+ return true;
+ }
+ }
+ return false;
+ }
+
public static enum EnumType implements IStringSerializable
{
NORTH_WEST(1, "north_west"),
@@ -238,7 +252,7 @@
ALL_OUTSIDE(14, "all_outside"),
ALL_STEM(15, "all_stem");
- private static final BlockHugeMushroom.EnumType[] META_LOOKUP = new BlockHugeMushroom.EnumType[16];
+ private static final EnumType[] META_LOOKUP = new EnumType[16];
private final int meta;
private final String name;
@@ -258,14 +272,14 @@
return this.name;
}
- public static BlockHugeMushroom.EnumType byMetadata(int meta)
+ public static EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
{
meta = 0;
}
- BlockHugeMushroom.EnumType blockhugemushroom$enumtype = META_LOOKUP[meta];
+ EnumType blockhugemushroom$enumtype = META_LOOKUP[meta];
return blockhugemushroom$enumtype == null ? META_LOOKUP[0] : blockhugemushroom$enumtype;
}
@@ -276,7 +290,7 @@
static
{
- for (BlockHugeMushroom.EnumType blockhugemushroom$enumtype : values())
+ for (EnumType blockhugemushroom$enumtype : values())
{
META_LOOKUP[blockhugemushroom$enumtype.getMetadata()] = blockhugemushroom$enumtype;
}