mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-23 21:49:46 +00:00
Add piston push reaction overrides to Block class (#9538)
This commit is contained in:
1 parent
060889656b
commit
5318d70c18
2 files changed
+30
No files matched your search
@@ -92,6 +92,15 @@
|
||||
public BlockState m_60717_(Rotation p_60718_) {
|
||||
return this.m_60734_().m_6843_(this.m_7160_(), p_60718_);
|
||||
}
|
||||
@@ -623,6 +_,8 @@
|
||||
}
|
||||
|
||||
public PushReaction m_60811_() {
|
||||
+ PushReaction reaction = m_60734_().getPistonPushReaction(m_7160_());
|
||||
+ if (reaction != null) return reaction;
|
||||
return this.f_278134_;
|
||||
}
|
||||
|
||||
@@ -972,8 +_,9 @@
|
||||
boolean f_243850_ = true;
|
||||
NoteBlockInstrument f_279538_ = NoteBlockInstrument.HARP;
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraft.world.level.pathfinder.BlockPathTypes;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -971,4 +972,24 @@ public interface IForgeBlock
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reaction of the block when pushed or pulled by a piston. This method should be not called directly, instead via {@link BlockState#getPistonPushReaction()}.
|
||||
* <ul>
|
||||
* <li>NORMAL: is pushable and pullable by sticky pistons</li>
|
||||
* <li>DESTROY: is being destroyed on pushing and pulling</li>
|
||||
* <li>BLOCK: is not being able to be moved</li>
|
||||
* <li>IGNORE: only usable by entities</li>
|
||||
* <li>PUSH_ONLY: can only be pushed, blocks on trying to be pulled</li>
|
||||
* <li>{@code null}: use the PistonPushReaction from the BlockBehaviour.Properties passed into the Block Constructor</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param state The state of this block
|
||||
* @return the PushReaction of this state or {@code null} if the one passed into the block properties should be used
|
||||
*/
|
||||
@Nullable
|
||||
default PushReaction getPistonPushReaction(BlockState state)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user