-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hanging Festive Rubber Ladders Enhancement
Festive Rubber Variant Map Colors Bump Version
- Loading branch information
1 parent
4ac227a
commit 9e8b270
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/mmodding/extravaganza/block/RubberLadderBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.mmodding.extravaganza.block; | ||
|
||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.LadderBlock; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldView; | ||
|
||
public class RubberLadderBlock extends LadderBlock { | ||
|
||
public RubberLadderBlock(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { | ||
return world.getBlockState(pos.up()).getBlock() instanceof RubberLadderBlock || super.canPlaceAt(state, world, pos); | ||
} | ||
|
||
@Override | ||
protected void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { | ||
BlockState downState = world.getBlockState(pos.down()); | ||
if (!(newState.getBlock() instanceof RubberLadderBlock) && downState.getBlock() instanceof RubberLadderBlock && !state.canPlaceAt(world, pos.down())) { | ||
world.breakBlock(pos.down(), true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters