Skip to content

Commit

Permalink
fix crash when right clicking howler with any gtmetaitem
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyfts committed Apr 17, 2024
1 parent 7c4056a commit 3e0cfc0
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,23 +403,24 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p
float f3) {
int blockType = world.getBlockMetadata(x, y, z);
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityHowlerAlarm) {
if (tileEntity instanceof TileEntityHowlerAlarm tileHowler) {
if (player.getCurrentEquippedItem() != null && DyeUtil.isADye(player.getCurrentEquippedItem())) {
((TileEntityHowlerAlarm) tileEntity)
.setColor(ItemDye.field_150922_c[DyeUtil.getDyeId(player.getCurrentEquippedItem())]);
world.markBlockForUpdate(x, y, z);
if (!player.capabilities.isCreativeMode) {
if (player.inventory.getCurrentItem().stackSize == 1) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
} else {
player.inventory.getCurrentItem().stackSize--;
int dyeId = DyeUtil.getDyeId(player.getCurrentEquippedItem());
if(dyeId >= 0){
tileHowler.setColor(ItemDye.field_150922_c[dyeId]);
world.markBlockForUpdate(x, y, z);
if (!player.capabilities.isCreativeMode) {
if (player.inventory.getCurrentItem().stackSize == 1) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
} else {
player.inventory.getCurrentItem().stackSize--;
}
}
return true;
}
return true;
} else if (player.getCurrentEquippedItem() != null) {
if (player.getCurrentEquippedItem().getItem() instanceof ItemToolPainter) {
ItemToolPainter p = (ItemToolPainter) player.getCurrentEquippedItem().getItem();
((TileEntityHowlerAlarm) tileEntity).setColor(ItemDye.field_150922_c[p.color]);
if (player.getCurrentEquippedItem().getItem() instanceof ItemToolPainter toolPainter) {
tileHowler.setColor(ItemDye.field_150922_c[toolPainter.color]);
world.markBlockForUpdate(x, y, z);
player.getCurrentEquippedItem().damageItem(1, player);
return true;
Expand Down

0 comments on commit 3e0cfc0

Please sign in to comment.