1.0.4
EnergonRelics/pipeline/head This commit looks good Details

This commit is contained in:
TheBrokenRail 2020-09-10 19:10:56 -04:00
parent 40de5445d1
commit 9dde7b4288
3 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.0.4**
* Fix Crash When Sneak-Using Dye On A Block
**1.0.3** **1.0.3**
* Fix Gravity Crash * Fix Gravity Crash

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.9.2+build.206 fabric_loader_version = 0.9.2+build.206
# Mod Properties # Mod Properties
mod_version = 1.0.3 mod_version = 1.0.4
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
# Dependencies # Dependencies

View File

@ -106,15 +106,17 @@ public class PhaseShifterBlock extends EnergyBlock {
UseBlockCallback.EVENT.register((player, world, hand, hit) -> { UseBlockCallback.EVENT.register((player, world, hand, hit) -> {
if (!player.isSpectator() && player.shouldCancelInteraction()) { if (!player.isSpectator() && player.shouldCancelInteraction()) {
BlockState state = world.getBlockState(hit.getBlockPos()); BlockState state = world.getBlockState(hit.getBlockPos());
ItemStack stack = player.getStackInHand(hand); if (state.getBlock() == PhaseShifterBlock.this) {
if (stack.getItem() instanceof DyeItem) { ItemStack stack = player.getStackInHand(hand);
DyeColor newColor = ((DyeItem) stack.getItem()).getColor(); if (stack.getItem() instanceof DyeItem) {
if (state.get(PhaseShifterBlock.COLOR) != newColor) { DyeColor newColor = ((DyeItem) stack.getItem()).getColor();
world.setBlockState(hit.getBlockPos(), state.with(PhaseShifterBlock.COLOR, newColor)); if (state.get(PhaseShifterBlock.COLOR) != newColor) {
if (!player.isCreative()) { world.setBlockState(hit.getBlockPos(), state.with(PhaseShifterBlock.COLOR, newColor));
stack.decrement(1); if (!player.isCreative()) {
stack.decrement(1);
}
return ActionResult.SUCCESS;
} }
return ActionResult.SUCCESS;
} }
} }
} }