net.minecraft.block.ShulkerBoxBlock Java Examples
The following examples show how to use
net.minecraft.block.ShulkerBoxBlock.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Peek.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public void drawShulkerToolTip(Slot slot, int mX, int mY) { if (!(slot.getStack().getItem() instanceof BlockItem)) return; if (!(((BlockItem) slot.getStack().getItem()).getBlock() instanceof ShulkerBoxBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof ChestBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof DispenserBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof HopperBlock)) return; List<ItemStack> items = ItemContentUtils.getItemsInContainer(slot.getStack()); Block block = ((BlockItem) slot.getStack().getItem()).getBlock(); int count = block instanceof HopperBlock || block instanceof DispenserBlock ? 18 : 0; if (block instanceof HopperBlock) renderTooltipBox(mX, mY - 21, 13, 82, true); else if (block instanceof DispenserBlock) renderTooltipBox(mX, mY - 21, 13, 150, true); else renderTooltipBox(mX, mY - 55, 47, 150, true); for (ItemStack i: items) { if (count > 26) break; int x = mX + 10 + (17 * (count % 9)); int y = mY - 69 + (17 * (count / 9)); mc.getItemRenderer().renderGuiItem(i, x, y); mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, i, x, y, i.getCount() > 1 ? i.getCount() + "" : ""); count++; } }
Example #2
Source File: Peek.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public void drawShulkerToolTip(Slot slot, int mX, int mY) { if (!(slot.getStack().getItem() instanceof BlockItem)) return; if (!(((BlockItem) slot.getStack().getItem()).getBlock() instanceof ShulkerBoxBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof ChestBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof DispenserBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof HopperBlock)) return; List<ItemStack> items = ItemContentUtils.getItemsInContainer(slot.getStack()); Block block = ((BlockItem) slot.getStack().getItem()).getBlock(); int count = block instanceof HopperBlock || block instanceof DispenserBlock ? 18 : 0; if (block instanceof HopperBlock) renderTooltipBox(mX, mY - 21, 13, 82, true); else if (block instanceof DispenserBlock) renderTooltipBox(mX, mY - 21, 13, 150, true); else renderTooltipBox(mX, mY - 55, 47, 150, true); for (ItemStack i: items) { if (count > 26) break; int x = mX + 10 + (17 * (count % 9)); int y = mY - 69 + (17 * (count / 9)); mc.getItemRenderer().renderGuiItemIcon(i, x, y); mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, i, x, y, i.getCount() > 1 ? i.getCount() + "" : ""); count++; } }
Example #3
Source File: Peek.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public void drawShulkerToolTip(Slot slot, int mX, int mY) { if (!(slot.getStack().getItem() instanceof BlockItem)) return; if (!(((BlockItem) slot.getStack().getItem()).getBlock() instanceof ShulkerBoxBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof ChestBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof DispenserBlock) && !(((BlockItem) slot.getStack().getItem()).getBlock() instanceof HopperBlock)) return; List<ItemStack> items = ItemContentUtils.getItemsInContainer(slot.getStack()); Block block = ((BlockItem) slot.getStack().getItem()).getBlock(); int count = block instanceof HopperBlock || block instanceof DispenserBlock ? 18 : 0; if (block instanceof HopperBlock) renderTooltipBox(mX, mY - 21, 13, 82, true); else if (block instanceof DispenserBlock) renderTooltipBox(mX, mY - 21, 13, 150, true); else renderTooltipBox(mX, mY - 55, 47, 150, true); for (ItemStack i: items) { if (count > 26) break; int x = mX + 10 + (17 * (count % 9)); int y = mY - 69 + (17 * (count / 9)); mc.getItemRenderer().renderGuiItem(i, x, y); mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, i, x, y, i.getCount() > 1 ? i.getCount() + "" : ""); count++; } }
Example #4
Source File: Protocol_1_10.java From multiconnect with MIT License | 5 votes |
@Override public List<RecipeInfo<?>> getCraftingRecipes() { List<RecipeInfo<?>> recipes = super.getCraftingRecipes(); recipes.removeIf(recipe -> recipe.getOutput().getItem() instanceof BlockItem && ((BlockItem) recipe.getOutput().getItem()).getBlock() instanceof ShulkerBoxBlock); recipes.removeIf(recipe -> recipe.getOutput().getItem() == Items.OBSERVER); return recipes; }
Example #5
Source File: CmdPeek.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { ItemStack item = mc.player.inventory.getMainHandStack(); if (!(item.getItem() instanceof BlockItem)) { BleachLogger.errorMessage("Must be holding a containter to peek."); return; } if (!(((BlockItem) item.getItem()).getBlock() instanceof ShulkerBoxBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof ChestBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof DispenserBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof HopperBlock)) { BleachLogger.errorMessage("Must be holding a containter to peek."); return; } List<ItemStack> items = ItemContentUtils.getItemsInContainer(item); BasicInventory inv = new BasicInventory(items.toArray(new ItemStack[27])); BleachQueue.queue.add(() -> { mc.openScreen(new ShulkerBoxScreen( new ShulkerBoxContainer(420, mc.player.inventory, inv), mc.player.inventory, item.getName())); }); }
Example #6
Source File: CmdPeek.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { ItemStack item = mc.player.inventory.getMainHandStack(); if (!(item.getItem() instanceof BlockItem)) { BleachLogger.errorMessage("Must be holding a containter to peek."); return; } if (!(((BlockItem) item.getItem()).getBlock() instanceof ShulkerBoxBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof ChestBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof DispenserBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof HopperBlock)) { BleachLogger.errorMessage("Must be holding a containter to peek."); return; } List<ItemStack> items = ItemContentUtils.getItemsInContainer(item); SimpleInventory inv = new SimpleInventory(items.toArray(new ItemStack[27])); BleachQueue.queue.add(() -> { mc.openScreen(new ShulkerBoxScreen( new ShulkerBoxScreenHandler(420, mc.player.inventory, inv), mc.player.inventory, item.getName())); }); }
Example #7
Source File: CmdPeek.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { ItemStack item = mc.player.inventory.getMainHandStack(); if (!(item.getItem() instanceof BlockItem)) { BleachLogger.errorMessage("Must be holding a containter to peek."); return; } if (!(((BlockItem) item.getItem()).getBlock() instanceof ShulkerBoxBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof ChestBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof DispenserBlock) && !(((BlockItem) item.getItem()).getBlock() instanceof HopperBlock)) { BleachLogger.errorMessage("Must be holding a containter to peek."); return; } List<ItemStack> items = ItemContentUtils.getItemsInContainer(item); BasicInventory inv = new BasicInventory(items.toArray(new ItemStack[27])); BleachQueue.queue.add(() -> { mc.openScreen(new ShulkerBoxScreen( new ShulkerBoxContainer(420, mc.player.inventory, inv), mc.player.inventory, item.getName())); }); }
Example #8
Source File: ItemEntityMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method="<init>(Lnet/minecraft/world/World;DDDLnet/minecraft/item/ItemStack;)V", at = @At("RETURN")) private void removeEmptyShulkerBoxTags(World worldIn, double x, double y, double z, ItemStack stack, CallbackInfo ci) { if (CarpetSettings.stackableShulkerBoxes && stack.getItem() instanceof BlockItem && ((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock) { if (InventoryHelper.cleanUpShulkerBoxTag(stack)) { ((ItemEntity) (Object) this).setStack(stack); } } }
Example #9
Source File: ItemEntityMixin.java From fabric-carpet with MIT License | 5 votes |
@Redirect( method = "canMerge", at = @At( value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getMaxCount()I" ) ) private int getItemStackMaxAmount(ItemStack stack) { if (CarpetSettings.stackableShulkerBoxes && stack.getItem() instanceof BlockItem && ((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock) return SHULKERBOX_MAX_STACK_AMOUNT; return stack.getMaxCount(); }
Example #10
Source File: ItemEntityMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject( method = "tryMerge(Lnet/minecraft/entity/ItemEntity;)V", at = @At("HEAD"), cancellable = true ) private void tryStackShulkerBoxes(ItemEntity other, CallbackInfo ci) { ItemEntity self = (ItemEntity)(Object)this; ItemStack selfStack = self.getStack(); if (!CarpetSettings.stackableShulkerBoxes || !(selfStack.getItem() instanceof BlockItem) || !(((BlockItem)selfStack.getItem()).getBlock() instanceof ShulkerBoxBlock)) { return; } ItemStack otherStack = other.getStack(); if (selfStack.getItem() == otherStack.getItem() && !InventoryHelper.shulkerBoxHasItems(selfStack) && !InventoryHelper.shulkerBoxHasItems(otherStack) && selfStack.hasTag() == otherStack.hasTag() && selfStack.getCount() + otherStack.getCount() <= SHULKERBOX_MAX_STACK_AMOUNT) { int amount = Math.min(otherStack.getCount(), SHULKERBOX_MAX_STACK_AMOUNT - selfStack.getCount()); selfStack.increment(amount); self.setStack(selfStack); this.pickupDelay = Math.max(((ItemEntityInterface)other).getPickupDelayCM(), this.pickupDelay); this.age = Math.min(((ItemEntityInterface)other).getAgeCM(), this.age); otherStack.decrement(amount); if (otherStack.isEmpty()) { other.remove(); } else { other.setStack(otherStack); } ci.cancel(); } }