mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 12:20:11 +00:00
Add hook to allow any block to respond to filtered block updates like the Observer block (#3547)
This commit is contained in:
1 parent
e9143859c0
commit
9010f1d7e7
3 files changed
+42
-2
No files matched your search
@@ -197,7 +197,7 @@
|
||||
public SoundType func_185467_w()
|
||||
{
|
||||
return this.field_149762_H;
|
||||
@@ -908,6 +932,1166 @@
|
||||
@@ -908,6 +932,1177 @@
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1130,6 +1130,17 @@
|
||||
+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){}
|
||||
+
|
||||
+ /**
|
||||
+ * Called on an Observer block whenever an update for an Observer is received.
|
||||
+ *
|
||||
+ * @param observerState The Observer block's state.
|
||||
+ * @param world The current world.
|
||||
+ * @param observerPos The Observer block's position.
|
||||
+ * @param changedBlock The updated block.
|
||||
+ * @param changedBlockPos The updated block's position.
|
||||
+ */
|
||||
+ public void observedNeighborChange(IBlockState observerState, World world, BlockPos observerPos, Block changedBlock, BlockPos changedBlockPos){}
|
||||
+
|
||||
+ /**
|
||||
+ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules.
|
||||
+ * @param world The world
|
||||
+ * @param pos Block position in world
|
||||
@@ -1364,7 +1375,7 @@
|
||||
public static void func_149671_p()
|
||||
{
|
||||
func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air"));
|
||||
@@ -1201,14 +2385,7 @@
|
||||
@@ -1201,14 +2396,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockObserver.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockObserver.java
|
||||
@@ -145,4 +145,12 @@
|
||||
{
|
||||
return this.func_176223_P().func_177226_a(field_176387_N, EnumFacing.func_82600_a(p_176203_1_ & 7));
|
||||
}
|
||||
+
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+ @Override
|
||||
+ public void observedNeighborChange(IBlockState observerState, World world, BlockPos observerPos, Block changedBlock, BlockPos changedBlockPos)
|
||||
+ {
|
||||
+ func_190962_b(observerState, world, observerPos, changedBlock, changedBlockPos);
|
||||
+ }
|
||||
+ /* ========================================= FORGE END ======================================*/
|
||||
}
|
||||
@@ -153,6 +153,20 @@
|
||||
if (p_175695_3_ != EnumFacing.WEST)
|
||||
{
|
||||
this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_);
|
||||
@@ -521,11 +572,11 @@
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(p_190529_1_);
|
||||
|
||||
- if (iblockstate.func_177230_c() == Blocks.field_190976_dk)
|
||||
+ if (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
- ((BlockObserver)iblockstate.func_177230_c()).func_190962_b(iblockstate, this, p_190529_1_, p_190529_2_, p_190529_3_);
|
||||
+ iblockstate.func_177230_c().observedNeighborChange(iblockstate, this, p_190529_1_, p_190529_2_, p_190529_3_);
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
@@ -582,7 +633,7 @@
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(blockpos);
|
||||
|
||||
Reference in new issue
Block a user