1.0.4
All checks were successful
EnergonRelics/pipeline/head This commit looks good

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
**1.0.4**
* Fix Crash When Sneak-Using Dye On A Block
**1.0.3**
* Fix Gravity Crash

View File

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

View File

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