mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Add vanilla block rotation support back in for certain blocks that were missed in 1.8 update. Closes #1903
This commit is contained in:
1 parent
bf63879a92
commit
030084f2b3
5 files changed
+114
-8
No files matched your search
@@ -962,7 +962,7 @@
|
||||
+ IBlockState state = world.func_180495_p(pos);
|
||||
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
|
||||
+ {
|
||||
+ if (prop.func_177701_a().equals("facing"))
|
||||
+ if (prop.func_177701_a().equals("facing") || prop.func_177701_a().equals("rotation"))
|
||||
+ {
|
||||
+ world.func_175656_a(pos, state.func_177231_a(prop));
|
||||
+ return true;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java
|
||||
@@ -64,6 +64,20 @@
|
||||
return new BlockState(this, new IProperty[] {field_176380_a});
|
||||
}
|
||||
|
||||
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||
+ {
|
||||
+ IBlockState state = world.func_180495_p(pos);
|
||||
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
|
||||
+ {
|
||||
+ if (prop.func_177701_a().equals("variant"))
|
||||
+ {
|
||||
+ world.func_175656_a(pos, state.func_177231_a(prop));
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
public static enum EnumType implements IStringSerializable
|
||||
{
|
||||
NORTH_WEST(1, "north_west"),
|
||||
@@ -0,0 +1,29 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java
|
||||
@@ -91,6 +91,26 @@
|
||||
return new BlockState(this, new IProperty[] {field_176335_a});
|
||||
}
|
||||
|
||||
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||
+ {
|
||||
+ IBlockState state = world.func_180495_p(pos);
|
||||
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
|
||||
+ {
|
||||
+ if (prop.func_177701_a().equals("variant") && prop.func_177699_b() == EnumType.class)
|
||||
+ {
|
||||
+ EnumType current = (EnumType)state.func_177229_b(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.func_175656_a(pos, state.func_177226_a(prop, next));
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
public static enum EnumType implements IStringSerializable
|
||||
{
|
||||
DEFAULT(0, "default", "default"),
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
protected BlockRailBase(boolean p_i45389_1_)
|
||||
@@ -174,7 +174,56 @@
|
||||
@@ -174,7 +174,81 @@
|
||||
}
|
||||
|
||||
public abstract IProperty func_176560_l();
|
||||
@@ -61,12 +61,37 @@
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit).
|
||||
+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the
|
||||
+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations.
|
||||
+ * The method should return true if the rotation was successful though.
|
||||
+ *
|
||||
+ * @param world The world
|
||||
+ * @param pos Block position in world
|
||||
+ * @param axis The axis to rotate around
|
||||
+ * @return True if the rotation was successful, False if the rotation failed, or is not possible
|
||||
+ */
|
||||
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||
+ {
|
||||
+ IBlockState state = world.func_180495_p(pos);
|
||||
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
|
||||
+ {
|
||||
+ if (prop.func_177701_a().equals("shape"))
|
||||
+ {
|
||||
+ world.func_175656_a(pos, state.func_177231_a(prop));
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* ======================================== FORGE END =====================================*/
|
||||
+
|
||||
public static enum EnumRailDirection implements IStringSerializable
|
||||
{
|
||||
NORTH_SOUTH(0, "north_south"),
|
||||
@@ -251,6 +300,7 @@
|
||||
@@ -251,6 +325,7 @@
|
||||
private final boolean field_150656_f;
|
||||
private final List field_150657_g = Lists.newArrayList();
|
||||
private static final String __OBFID = "CL_00000196";
|
||||
@@ -74,7 +99,7 @@
|
||||
|
||||
public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_)
|
||||
{
|
||||
@@ -259,7 +309,8 @@
|
||||
@@ -259,7 +334,8 @@
|
||||
this.field_180366_e = p_i45739_4_;
|
||||
this.field_180365_d = (BlockRailBase)p_i45739_4_.func_177230_c();
|
||||
BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(BlockRailBase.this.func_176560_l());
|
||||
@@ -84,7 +109,7 @@
|
||||
this.func_180360_a(enumraildirection);
|
||||
}
|
||||
|
||||
@@ -448,7 +499,7 @@
|
||||
@@ -448,7 +524,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +118,7 @@
|
||||
{
|
||||
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
|
||||
{
|
||||
@@ -461,7 +512,7 @@
|
||||
@@ -461,7 +537,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +127,7 @@
|
||||
{
|
||||
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a()))
|
||||
{
|
||||
@@ -604,7 +655,7 @@
|
||||
@@ -604,7 +680,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +136,7 @@
|
||||
{
|
||||
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
|
||||
{
|
||||
@@ -617,7 +668,7 @@
|
||||
@@ -617,7 +693,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
+import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public abstract class BlockRotatedPillar extends Block
|
||||
@@ -13,4 +14,18 @@
|
||||
{
|
||||
super(p_i45425_1_);
|
||||
}
|
||||
+
|
||||
+ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis)
|
||||
+ {
|
||||
+ IBlockState state = world.func_180495_p(pos);
|
||||
+ for (net.minecraft.block.properties.IProperty prop : (java.util.Set<net.minecraft.block.properties.IProperty>)state.func_177228_b().keySet())
|
||||
+ {
|
||||
+ if (prop.func_177701_a().equals("axis"))
|
||||
+ {
|
||||
+ world.func_175656_a(pos, state.func_177231_a(prop));
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
}
|
||||
Reference in new issue
Block a user