diff --git a/elements/Mailbox.mod.json b/elements/Mailbox.mod.json index 4c53d0a..3f60c35 100644 --- a/elements/Mailbox.mod.json +++ b/elements/Mailbox.mod.json @@ -108,7 +108,7 @@ "hasInventory": true, "guiBoundTo": "MailboxGUI", "openGUIOnRightClick": true, - "inventorySize": 18, + "inventorySize": 100, "inventoryStackSize": 64, "inventoryDropWhenDestroyed": true, "inventoryComparatorPower": true, diff --git a/elements/MailboxGUI.mod.json b/elements/MailboxGUI.mod.json index a354951..8a25904 100644 --- a/elements/MailboxGUI.mod.json +++ b/elements/MailboxGUI.mod.json @@ -3,7 +3,7 @@ "_type": "gui", "definition": { "type": 1, - "width": 360, + "width": 240, "height": 180, "inventoryOffsetX": 0, "inventoryOffsetY": 0, @@ -330,90 +330,6 @@ "locked": false } }, - { - "type": "label", - "data": { - "name": "label_x", - "text": { - "fixedValue": "X:" - }, - "color": { - "value": -12829636, - "falpha": 0.0 - }, - "x": 258, - "y": 49, - "locked": false - } - }, - { - "type": "textfield", - "data": { - "placeholder": "0", - "name": "outbox_x_coord", - "width": 120, - "height": 20, - "x": 267, - "y": 44, - "locked": false - } - }, - { - "type": "label", - "data": { - "name": "label_y", - "text": { - "fixedValue": "Y:" - }, - "color": { - "value": -12829636, - "falpha": 0.0 - }, - "x": 258, - "y": 71, - "locked": false - } - }, - { - "type": "textfield", - "data": { - "placeholder": "0", - "name": "outbox_y_coord", - "width": 120, - "height": 20, - "x": 267, - "y": 67, - "locked": false - } - }, - { - "type": "label", - "data": { - "name": "label_z", - "text": { - "fixedValue": "Z:" - }, - "color": { - "value": -12829636, - "falpha": 0.0 - }, - "x": 258, - "y": 94, - "locked": false - } - }, - { - "type": "textfield", - "data": { - "placeholder": "0", - "name": "outbox_z_coord", - "width": 120, - "height": 20, - "x": 267, - "y": 89, - "locked": false - } - }, { "type": "button", "data": { @@ -425,8 +341,32 @@ }, "width": 46, "height": 20, - "x": 303, - "y": 116, + "x": 263, + "y": 85, + "locked": false + } + }, + { + "type": "inputslot", + "data": { + "inputLimit": { + "value": "CUSTOM:ShippingLabel" + }, + "disablePlacement": { + "fixedValue": false, + "name": "MailboxSlot99ShippingLabelInsertionCondition" + }, + "color": { + "value": -16777216, + "falpha": 0.0 + }, + "id": 99, + "disablePickup": { + "fixedValue": false + }, + "dropItemsWhenNotBound": false, + "x": 276, + "y": 58, "locked": false } } diff --git a/elements/MailboxRecipe.mod.json b/elements/MailboxRecipe.mod.json new file mode 100644 index 0000000..70b0b85 --- /dev/null +++ b/elements/MailboxRecipe.mod.json @@ -0,0 +1,48 @@ +{ + "_fv": 73, + "_type": "recipe", + "definition": { + "recipeType": "Crafting", + "recipeRetstackSize": 1, + "group": "", + "cookingBookCategory": "MISC", + "xpReward": 0.0, + "cookingTime": 200, + "craftingBookCategory": "MISC", + "recipeShapeless": false, + "recipeSlots": [ + { + "value": "" + }, + { + "value": "" + }, + { + "value": "" + }, + { + "value": "" + }, + { + "value": "Blocks.IRON_BLOCK" + }, + { + "value": "Blocks.LEVER" + }, + { + "value": "" + }, + { + "value": "Items.STICK" + }, + { + "value": "" + } + ], + "recipeReturnStack": { + "value": "CUSTOM:Mailbox" + }, + "name": "mailbox_recipe", + "namespace": "mod" + } +} \ No newline at end of file diff --git a/elements/MailboxSlot99ShippingLabelInsertionCondition.mod.json b/elements/MailboxSlot99ShippingLabelInsertionCondition.mod.json new file mode 100644 index 0000000..32e461d --- /dev/null +++ b/elements/MailboxSlot99ShippingLabelInsertionCondition.mod.json @@ -0,0 +1,7 @@ +{ + "_fv": 73, + "_type": "procedure", + "definition": { + "procedurexml": "no_ext_triggerANDCUSTOM:ShippingLabelconnectedFALSETRUE" + } +} \ No newline at end of file diff --git a/elements/MailboxSmartSendLogic.mod.json b/elements/MailboxSmartSendLogic.mod.json index d19b0c0..7409865 100644 --- a/elements/MailboxSmartSendLogic.mod.json +++ b/elements/MailboxSmartSendLogic.mod.json @@ -2,6 +2,6 @@ "_fv": 73, "_type": "procedure", "definition": { - "procedurexml": "currInboxItemcurrInboxSlotcurrOutboxSlotcurrInboxSlotRoomcurrRemaindercurrInboxSlot2currInboxItemCountcurrInboxItemCount2no_ext_triggertarget_mailbox_xoutbox_x_coordtarget_mailbox_youtbox_y_coordtarget_mailbox_zoutbox_z_coordtarget_mailbox_xtarget_mailbox_ytarget_mailbox_zCUSTOM:Mailboxlocal:currInboxSlot0local:currOutboxSlot9LTElocal:currInboxSlot8local:currInboxItemlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currInboxItemCountlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zANDlocal:currInboxItemlocal:currOutboxSlotlocal:currOutboxSlotlocal:currOutboxSlotlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currOutboxSlotANDlocal:currInboxItemlocal:currOutboxSlotLTlocal:currInboxItemCountlocal:currInboxItemlocal:currInboxSlotRoomMINUSlocal:currInboxItemlocal:currInboxItemCountLTElocal:currOutboxSlotlocal:currInboxSlotRoomADDlocal:currInboxItemCountlocal:currOutboxSlotlocal:currInboxItemlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currOutboxSlotlocal:currInboxItemlocal:currInboxItemlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currRemainderMINUSlocal:currOutboxSlotlocal:currInboxSlotRoomlocal:currInboxSlot20LTElocal:currInboxSlot28local:currInboxItemCount2local:currInboxSlot2target_mailbox_xtarget_mailbox_ytarget_mailbox_zEQlocal:currInboxItemCount20local:currRemainderlocal:currInboxItemlocal:currInboxSlot2target_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currOutboxSlotlocal:currRemainder0BREAKlocal:currInboxSlot2ADDlocal:currInboxSlot21GTlocal:currRemainder0local:currRemainderlocal:currInboxItemlocal:currOutboxSlotEQlocal:currOutboxSlot0local:currOutboxSlotADDlocal:currOutboxSlot1EQlocal:currInboxItemCountlocal:currInboxItemlocal:currInboxSlotADDlocal:currInboxSlot1EQlocal:currInboxItemCount0local:currOutboxSlotADDlocal:currOutboxSlot1local:currInboxSlotADDlocal:currInboxSlot1" + "procedurexml": "currInboxSlotcurrOutboxSlotcurrInboxSlotRoomcurrRemaindercurrInboxSlot2currInboxItemCountcurrInboxItemCount2currInboxItemshippingLabelno_ext_triggerlocal:shippingLabel99ANDlocal:shippingLabelCUSTOM:ShippingLabelconnectedlocal:shippingLabeltarget_mailbox_xconnected_mailbox_xlocal:shippingLabeltarget_mailbox_yconnected_mailbox_ylocal:shippingLabeltarget_mailbox_zconnected_mailbox_zlocal:shippingLabelMINUS991local:shippingLabel99target_mailbox_xtarget_mailbox_ytarget_mailbox_zCUSTOM:Mailboxlocal:currInboxSlot0local:currOutboxSlot9LTElocal:currInboxSlot8local:currInboxItemlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currInboxItemCountlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zANDlocal:currInboxItemlocal:currOutboxSlotlocal:currOutboxSlotlocal:currOutboxSlotlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currOutboxSlotANDlocal:currInboxItemlocal:currOutboxSlotLTlocal:currInboxItemCountlocal:currInboxItemlocal:currInboxSlotRoomMINUSlocal:currInboxItemlocal:currInboxItemCountLTElocal:currOutboxSlotlocal:currInboxSlotRoomADDlocal:currInboxItemCountlocal:currOutboxSlotlocal:currInboxItemlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currOutboxSlotlocal:currInboxItemlocal:currInboxItemlocal:currInboxSlottarget_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currRemainderMINUSlocal:currOutboxSlotlocal:currInboxSlotRoomlocal:currInboxSlot20LTElocal:currInboxSlot28local:currInboxItemCount2local:currInboxSlot2target_mailbox_xtarget_mailbox_ytarget_mailbox_zEQlocal:currInboxItemCount20local:currRemainderlocal:currInboxItemlocal:currInboxSlot2target_mailbox_xtarget_mailbox_ytarget_mailbox_zlocal:currOutboxSlotlocal:currRemainder0BREAKlocal:currInboxSlot2ADDlocal:currInboxSlot21GTlocal:currRemainder0local:currRemainderlocal:currInboxItemlocal:currOutboxSlotEQlocal:currOutboxSlot0local:currOutboxSlotADDlocal:currOutboxSlot1EQlocal:currInboxItemCountlocal:currInboxItemlocal:currInboxSlotADDlocal:currInboxSlot1EQlocal:currInboxItemCount0local:currOutboxSlotADDlocal:currOutboxSlot1local:currInboxSlotADDlocal:currInboxSlot1" } } \ No newline at end of file diff --git a/elements/ShippingLabel.mod.json b/elements/ShippingLabel.mod.json new file mode 100644 index 0000000..9f9dab1 --- /dev/null +++ b/elements/ShippingLabel.mod.json @@ -0,0 +1,68 @@ +{ + "_fv": 73, + "_type": "item", + "definition": { + "renderType": 0, + "texture": "shipping_label", + "customModelName": "Normal", + "customProperties": {}, + "states": [], + "name": "Shipping Label", + "rarity": "COMMON", + "creativeTabs": [ + { + "value": "TOOLS" + } + ], + "stackSize": 64, + "enchantability": 0, + "useDuration": 0, + "toolType": 1.0, + "damageCount": 0, + "recipeRemainder": { + "value": "" + }, + "destroyAnyBlock": false, + "immuneToFire": false, + "stayInGridWhenCrafting": false, + "damageOnCrafting": false, + "enableMeleeDamage": false, + "damageVsEntity": 0.0, + "specialInformation": { + "fixedValue": [], + "name": "ShippingLabelSpecialInformation" + }, + "glowCondition": { + "fixedValue": false, + "name": "ShippingLabelHasItemGlowingEffect" + }, + "inventorySize": 9, + "inventoryStackSize": 64, + "onRightClickedOnBlock": { + "name": "ShippingLabelRightclickedOnBlock" + }, + "enableRanged": false, + "shootConstantly": false, + "rangedItemChargesPower": false, + "projectile": { + "value": "CUSTOM:ShitProjectile" + }, + "projectileDisableAmmoCheck": false, + "isFood": false, + "nutritionalValue": 4, + "saturation": 0.3, + "eatResultItem": { + "value": "" + }, + "isMeat": false, + "isAlwaysEdible": false, + "animation": "none", + "isMusicDisc": false, + "musicDiscMusic": { + "value": "" + }, + "musicDiscDescription": "", + "musicDiscLengthInTicks": 100, + "musicDiscAnalogOutput": 0 + } +} \ No newline at end of file diff --git a/elements/ShippingLabelHasItemGlowingEffect.mod.json b/elements/ShippingLabelHasItemGlowingEffect.mod.json new file mode 100644 index 0000000..4149257 --- /dev/null +++ b/elements/ShippingLabelHasItemGlowingEffect.mod.json @@ -0,0 +1,7 @@ +{ + "_fv": 73, + "_type": "procedure", + "definition": { + "procedurexml": "no_ext_triggerconnectedTRUEFALSE" + } +} \ No newline at end of file diff --git a/elements/ShippingLabelRecipe.mod.json b/elements/ShippingLabelRecipe.mod.json new file mode 100644 index 0000000..62f1d35 --- /dev/null +++ b/elements/ShippingLabelRecipe.mod.json @@ -0,0 +1,48 @@ +{ + "_fv": 73, + "_type": "recipe", + "definition": { + "recipeType": "Crafting", + "recipeRetstackSize": 1, + "group": "", + "cookingBookCategory": "MISC", + "xpReward": 0.0, + "cookingTime": 200, + "craftingBookCategory": "MISC", + "recipeShapeless": true, + "recipeSlots": [ + { + "value": "Items.PAPER" + }, + { + "value": "Items.DYE#0" + }, + { + "value": "" + }, + { + "value": "" + }, + { + "value": "" + }, + { + "value": "" + }, + { + "value": "" + }, + { + "value": "" + }, + { + "value": "" + } + ], + "recipeReturnStack": { + "value": "CUSTOM:ShippingLabel" + }, + "name": "shipping_label_recipe", + "namespace": "mod" + } +} \ No newline at end of file diff --git a/elements/ShippingLabelRightclickedOnBlock.mod.json b/elements/ShippingLabelRightclickedOnBlock.mod.json new file mode 100644 index 0000000..5781dca --- /dev/null +++ b/elements/ShippingLabelRightclickedOnBlock.mod.json @@ -0,0 +1,7 @@ +{ + "_fv": 73, + "_type": "procedure", + "definition": { + "procedurexml": "no_ext_triggerANDCUSTOM:Mailboxconnected_mailbox_xconnected_mailbox_yconnected_mailbox_zconnectedTRUEentity.player.levelupplayer0.750.951.05" + } +} \ No newline at end of file diff --git a/elements/ShippingLabelSpecialInformation.mod.json b/elements/ShippingLabelSpecialInformation.mod.json new file mode 100644 index 0000000..12b14c1 --- /dev/null +++ b/elements/ShippingLabelSpecialInformation.mod.json @@ -0,0 +1,7 @@ +{ + "_fv": 73, + "_type": "procedure", + "definition": { + "procedurexml": "no_ext_triggerconnectedDest. Mailbox X:connected_mailbox_xDest. Mailbox Y:connected_mailbox_yDest. Mailbox Z:connected_mailbox_zNo assigned destination." + } +} \ No newline at end of file diff --git a/nims_random_bullshit.mcreator b/nims_random_bullshit.mcreator index e2e909f..de3bd6e 100644 --- a/nims_random_bullshit.mcreator +++ b/nims_random_bullshit.mcreator @@ -1424,8 +1424,74 @@ "type": "entity" }, { - "name": "guistate", - "type": "map" + "name": "x", + "type": "number" + }, + { + "name": "y", + "type": "number" + }, + { + "name": "z", + "type": "number" + }, + { + "name": "world", + "type": "world" + } + ] + }, + "path": "~/Mailbox" + }, + { + "name": "MailboxRecipe", + "type": "recipe", + "compiles": true, + "locked_code": false, + "registry_name": "mailbox_recipe", + "metadata": { + "files": [ + "src/main/resources/data/nims_random_bullshit/recipes/mailbox_recipe.json" + ] + }, + "path": "~/Mailbox" + }, + { + "name": "ShippingLabel", + "type": "item", + "compiles": true, + "locked_code": false, + "registry_name": "shipping_label", + "metadata": { + "files": [ + "src/main/resources/assets/nims_random_bullshit/models/item/shipping_label.json", + "src/main/java/net/mcreator/nimsrandombullshit/item/ShippingLabelItem.java" + ] + }, + "path": "~/Mailbox" + }, + { + "name": "ShippingLabelRightclickedOnBlock", + "type": "procedure", + "compiles": true, + "locked_code": false, + "registry_name": "shipping_label_rightclicked_on_block", + "metadata": { + "files": [ + "src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelRightclickedOnBlockProcedure.java" + ], + "dependencies": [ + { + "name": "blockstate", + "type": "blockstate" + }, + { + "name": "entity", + "type": "entity" + }, + { + "name": "itemstack", + "type": "itemstack" }, { "name": "x", @@ -1446,6 +1512,79 @@ ] }, "path": "~/Mailbox" + }, + { + "name": "ShippingLabelHasItemGlowingEffect", + "type": "procedure", + "compiles": true, + "locked_code": false, + "registry_name": "shipping_label_has_item_glowing_effect", + "metadata": { + "return_type": "logic", + "files": [ + "src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelHasItemGlowingEffectProcedure.java" + ], + "dependencies": [ + { + "name": "itemstack", + "type": "itemstack" + } + ] + }, + "path": "~/Mailbox" + }, + { + "name": "ShippingLabelSpecialInformation", + "type": "procedure", + "compiles": true, + "locked_code": false, + "registry_name": "shipping_label_special_information", + "metadata": { + "return_type": "string", + "files": [ + "src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelSpecialInformationProcedure.java" + ], + "dependencies": [ + { + "name": "itemstack", + "type": "itemstack" + } + ] + }, + "path": "~/Mailbox" + }, + { + "name": "ShippingLabelRecipe", + "type": "recipe", + "compiles": true, + "locked_code": false, + "registry_name": "shipping_label_recipe", + "metadata": { + "files": [ + "src/main/resources/data/nims_random_bullshit/recipes/shipping_label_recipe.json" + ] + }, + "path": "~/Mailbox" + }, + { + "name": "MailboxSlot99ShippingLabelInsertionCondition", + "type": "procedure", + "compiles": true, + "locked_code": false, + "registry_name": "mailbox_slot_99_shipping_label_insertion_condition", + "metadata": { + "return_type": "logic", + "files": [ + "src/main/java/net/mcreator/nimsrandombullshit/procedures/MailboxSlot99ShippingLabelInsertionConditionProcedure.java" + ], + "dependencies": [ + { + "name": "itemstack", + "type": "itemstack" + } + ] + }, + "path": "~/Mailbox" } ], "variable_elements": [], @@ -1504,6 +1643,7 @@ "item.nims_random_bullshit.sand_dust": "Sand Dust", "item.nims_random_bullshit.magic_flesh": "Magic Flesh", "item.nims_random_bullshit.ghoul_spawn_egg": "Ghoul Spawn Egg", + "item.nims_random_bullshit.shipping_label": "Shipping Label", "item.nims_random_bullshit.block_eater": "Block Eater", "item.nims_random_bullshit.golden_berries": "Golden Berries", "item.nims_random_bullshit.netherrack_juice_bucket": "Netherrack Juice Bucket", diff --git a/src/main/java/net/mcreator/nimsrandombullshit/block/entity/MailboxBlockEntity.java b/src/main/java/net/mcreator/nimsrandombullshit/block/entity/MailboxBlockEntity.java index 5a796ff..d6eb3e8 100644 --- a/src/main/java/net/mcreator/nimsrandombullshit/block/entity/MailboxBlockEntity.java +++ b/src/main/java/net/mcreator/nimsrandombullshit/block/entity/MailboxBlockEntity.java @@ -31,7 +31,7 @@ import java.util.stream.IntStream; import io.netty.buffer.Unpooled; public class MailboxBlockEntity extends RandomizableContainerBlockEntity implements WorldlyContainer { - private NonNullList stacks = NonNullList.withSize(18, ItemStack.EMPTY); + private NonNullList stacks = NonNullList.withSize(100, ItemStack.EMPTY); private final LazyOptional[] handlers = SidedInvWrapper.create(this, Direction.values()); public MailboxBlockEntity(BlockPos position, BlockState state) { diff --git a/src/main/java/net/mcreator/nimsrandombullshit/client/gui/MailboxGUIScreen.java b/src/main/java/net/mcreator/nimsrandombullshit/client/gui/MailboxGUIScreen.java index a69ca14..985d2e0 100644 --- a/src/main/java/net/mcreator/nimsrandombullshit/client/gui/MailboxGUIScreen.java +++ b/src/main/java/net/mcreator/nimsrandombullshit/client/gui/MailboxGUIScreen.java @@ -6,10 +6,8 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.resources.ResourceLocation; import net.minecraft.network.chat.Component; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; -import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.Minecraft; import net.mcreator.nimsrandombullshit.world.inventory.MailboxGUIMenu; import net.mcreator.nimsrandombullshit.network.MailboxGUIButtonMessage; @@ -24,9 +22,6 @@ public class MailboxGUIScreen extends AbstractContainerScreen { private final Level world; private final int x, y, z; private final Player entity; - EditBox outbox_x_coord; - EditBox outbox_y_coord; - EditBox outbox_z_coord; Button button_send; public MailboxGUIScreen(MailboxGUIMenu container, Inventory inventory, Component text) { @@ -36,7 +31,7 @@ public class MailboxGUIScreen extends AbstractContainerScreen { this.y = container.y; this.z = container.z; this.entity = container.entity; - this.imageWidth = 360; + this.imageWidth = 240; this.imageHeight = 180; } @@ -46,9 +41,6 @@ public class MailboxGUIScreen extends AbstractContainerScreen { public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { this.renderBackground(guiGraphics); super.render(guiGraphics, mouseX, mouseY, partialTicks); - outbox_x_coord.render(guiGraphics, mouseX, mouseY, partialTicks); - outbox_y_coord.render(guiGraphics, mouseX, mouseY, partialTicks); - outbox_z_coord.render(guiGraphics, mouseX, mouseY, partialTicks); this.renderTooltip(guiGraphics, mouseX, mouseY); } @@ -67,121 +59,24 @@ public class MailboxGUIScreen extends AbstractContainerScreen { this.minecraft.player.closeContainer(); return true; } - if (outbox_x_coord.isFocused()) - return outbox_x_coord.keyPressed(key, b, c); - if (outbox_y_coord.isFocused()) - return outbox_y_coord.keyPressed(key, b, c); - if (outbox_z_coord.isFocused()) - return outbox_z_coord.keyPressed(key, b, c); return super.keyPressed(key, b, c); } - @Override - public void containerTick() { - super.containerTick(); - outbox_x_coord.tick(); - outbox_y_coord.tick(); - outbox_z_coord.tick(); - } - - @Override - public void resize(Minecraft minecraft, int width, int height) { - String outbox_x_coordValue = outbox_x_coord.getValue(); - String outbox_y_coordValue = outbox_y_coord.getValue(); - String outbox_z_coordValue = outbox_z_coord.getValue(); - super.resize(minecraft, width, height); - outbox_x_coord.setValue(outbox_x_coordValue); - outbox_y_coord.setValue(outbox_y_coordValue); - outbox_z_coord.setValue(outbox_z_coordValue); - } - @Override protected void renderLabels(GuiGraphics guiGraphics, int mouseX, int mouseY) { - guiGraphics.drawString(this.font, Component.translatable("gui.nims_random_bullshit.mailbox_gui.label_inbox"), 98, 14, -12829636, false); - guiGraphics.drawString(this.font, Component.translatable("gui.nims_random_bullshit.mailbox_gui.label_outbox"), 161, 14, -12829636, false); - guiGraphics.drawString(this.font, Component.translatable("gui.nims_random_bullshit.mailbox_gui.label_x"), 224, 19, -12829636, false); - guiGraphics.drawString(this.font, Component.translatable("gui.nims_random_bullshit.mailbox_gui.label_y"), 224, 41, -12829636, false); - guiGraphics.drawString(this.font, Component.translatable("gui.nims_random_bullshit.mailbox_gui.label_z"), 224, 64, -12829636, false); + guiGraphics.drawString(this.font, Component.translatable("gui.nims_random_bullshit.mailbox_gui.label_inbox"), 38, 14, -12829636, false); + guiGraphics.drawString(this.font, Component.translatable("gui.nims_random_bullshit.mailbox_gui.label_outbox"), 101, 14, -12829636, false); } @Override public void init() { super.init(); - outbox_x_coord = new EditBox(this.font, this.leftPos + 234, this.topPos + 15, 118, 18, Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_x_coord")) { - @Override - public void insertText(String text) { - super.insertText(text); - if (getValue().isEmpty()) - setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_x_coord").getString()); - else - setSuggestion(null); - } - - @Override - public void moveCursorTo(int pos) { - super.moveCursorTo(pos); - if (getValue().isEmpty()) - setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_x_coord").getString()); - else - setSuggestion(null); - } - }; - outbox_x_coord.setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_x_coord").getString()); - outbox_x_coord.setMaxLength(32767); - guistate.put("text:outbox_x_coord", outbox_x_coord); - this.addWidget(this.outbox_x_coord); - outbox_y_coord = new EditBox(this.font, this.leftPos + 234, this.topPos + 38, 118, 18, Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_y_coord")) { - @Override - public void insertText(String text) { - super.insertText(text); - if (getValue().isEmpty()) - setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_y_coord").getString()); - else - setSuggestion(null); - } - - @Override - public void moveCursorTo(int pos) { - super.moveCursorTo(pos); - if (getValue().isEmpty()) - setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_y_coord").getString()); - else - setSuggestion(null); - } - }; - outbox_y_coord.setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_y_coord").getString()); - outbox_y_coord.setMaxLength(32767); - guistate.put("text:outbox_y_coord", outbox_y_coord); - this.addWidget(this.outbox_y_coord); - outbox_z_coord = new EditBox(this.font, this.leftPos + 234, this.topPos + 60, 118, 18, Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_z_coord")) { - @Override - public void insertText(String text) { - super.insertText(text); - if (getValue().isEmpty()) - setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_z_coord").getString()); - else - setSuggestion(null); - } - - @Override - public void moveCursorTo(int pos) { - super.moveCursorTo(pos); - if (getValue().isEmpty()) - setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_z_coord").getString()); - else - setSuggestion(null); - } - }; - outbox_z_coord.setSuggestion(Component.translatable("gui.nims_random_bullshit.mailbox_gui.outbox_z_coord").getString()); - outbox_z_coord.setMaxLength(32767); - guistate.put("text:outbox_z_coord", outbox_z_coord); - this.addWidget(this.outbox_z_coord); button_send = Button.builder(Component.translatable("gui.nims_random_bullshit.mailbox_gui.button_send"), e -> { if (true) { NimsRandomBullshitMod.PACKET_HANDLER.sendToServer(new MailboxGUIButtonMessage(0, x, y, z)); MailboxGUIButtonMessage.handleButtonAction(entity, 0, x, y, z); } - }).bounds(this.leftPos + 269, this.topPos + 86, 46, 20).build(); + }).bounds(this.leftPos + 169, this.topPos + 55, 46, 20).build(); guistate.put("button:button_send", button_send); this.addRenderableWidget(button_send); } diff --git a/src/main/java/net/mcreator/nimsrandombullshit/init/NimsRandomBullshitModItems.java b/src/main/java/net/mcreator/nimsrandombullshit/init/NimsRandomBullshitModItems.java index 537aaa7..848b3a1 100644 --- a/src/main/java/net/mcreator/nimsrandombullshit/init/NimsRandomBullshitModItems.java +++ b/src/main/java/net/mcreator/nimsrandombullshit/init/NimsRandomBullshitModItems.java @@ -16,6 +16,7 @@ import net.minecraft.world.item.BlockItem; import net.mcreator.nimsrandombullshit.item.StarWandItem; import net.mcreator.nimsrandombullshit.item.StarItem; import net.mcreator.nimsrandombullshit.item.ShitItem; +import net.mcreator.nimsrandombullshit.item.ShippingLabelItem; import net.mcreator.nimsrandombullshit.item.SandDustItem; import net.mcreator.nimsrandombullshit.item.NetherrackitePickaxeItem; import net.mcreator.nimsrandombullshit.item.NetherrackiteItem; @@ -53,6 +54,7 @@ public class NimsRandomBullshitModItems { public static final RegistryObject STAR_WAND = REGISTRY.register("star_wand", () -> new StarWandItem()); public static final RegistryObject NETHERRACK_JUICE_BUCKET = REGISTRY.register("netherrack_juice_bucket", () -> new NetherrackJuiceItem()); public static final RegistryObject MAILBOX = block(NimsRandomBullshitModBlocks.MAILBOX); + public static final RegistryObject SHIPPING_LABEL = REGISTRY.register("shipping_label", () -> new ShippingLabelItem()); // Start of user code block custom items // End of user code block custom items diff --git a/src/main/java/net/mcreator/nimsrandombullshit/init/NimsRandomBullshitModTabs.java b/src/main/java/net/mcreator/nimsrandombullshit/init/NimsRandomBullshitModTabs.java index b177dda..b900c9a 100644 --- a/src/main/java/net/mcreator/nimsrandombullshit/init/NimsRandomBullshitModTabs.java +++ b/src/main/java/net/mcreator/nimsrandombullshit/init/NimsRandomBullshitModTabs.java @@ -36,6 +36,7 @@ public class NimsRandomBullshitModTabs { tabData.accept(NimsRandomBullshitModItems.GRAVEDIGGER.get()); tabData.accept(NimsRandomBullshitModItems.STAR_WAND.get()); tabData.accept(NimsRandomBullshitModItems.NETHERRACK_JUICE_BUCKET.get()); + tabData.accept(NimsRandomBullshitModItems.SHIPPING_LABEL.get()); } else if (tabData.getTabKey() == CreativeModeTabs.INGREDIENTS) { tabData.accept(NimsRandomBullshitModItems.NETHERRACKITE.get()); tabData.accept(NimsRandomBullshitModItems.SAND_DUST.get()); diff --git a/src/main/java/net/mcreator/nimsrandombullshit/item/ShippingLabelItem.java b/src/main/java/net/mcreator/nimsrandombullshit/item/ShippingLabelItem.java new file mode 100644 index 0000000..2dfcf50 --- /dev/null +++ b/src/main/java/net/mcreator/nimsrandombullshit/item/ShippingLabelItem.java @@ -0,0 +1,53 @@ + +package net.mcreator.nimsrandombullshit.item; + +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; + +import net.minecraft.world.level.Level; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Item; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.InteractionResult; +import net.minecraft.network.chat.Component; + +import net.mcreator.nimsrandombullshit.procedures.ShippingLabelSpecialInformationProcedure; +import net.mcreator.nimsrandombullshit.procedures.ShippingLabelRightclickedOnBlockProcedure; +import net.mcreator.nimsrandombullshit.procedures.ShippingLabelHasItemGlowingEffectProcedure; + +import java.util.List; + +public class ShippingLabelItem extends Item { + public ShippingLabelItem() { + super(new Item.Properties().stacksTo(64).rarity(Rarity.COMMON)); + } + + @Override + @OnlyIn(Dist.CLIENT) + public boolean isFoil(ItemStack itemstack) { + return ShippingLabelHasItemGlowingEffectProcedure.execute(itemstack); + } + + @Override + public void appendHoverText(ItemStack itemstack, Level level, List list, TooltipFlag flag) { + super.appendHoverText(itemstack, level, list, flag); + Entity entity = itemstack.getEntityRepresentation(); + String hoverText = ShippingLabelSpecialInformationProcedure.execute(itemstack); + if (hoverText != null) { + for (String line : hoverText.split("\n")) { + list.add(Component.literal(line)); + } + } + } + + @Override + public InteractionResult useOn(UseOnContext context) { + super.useOn(context); + ShippingLabelRightclickedOnBlockProcedure.execute(context.getLevel(), context.getClickedPos().getX(), context.getClickedPos().getY(), context.getClickedPos().getZ(), context.getLevel().getBlockState(context.getClickedPos()), + context.getPlayer(), context.getItemInHand()); + return InteractionResult.SUCCESS; + } +} diff --git a/src/main/java/net/mcreator/nimsrandombullshit/network/MailboxGUIButtonMessage.java b/src/main/java/net/mcreator/nimsrandombullshit/network/MailboxGUIButtonMessage.java index 913272d..3570695 100644 --- a/src/main/java/net/mcreator/nimsrandombullshit/network/MailboxGUIButtonMessage.java +++ b/src/main/java/net/mcreator/nimsrandombullshit/network/MailboxGUIButtonMessage.java @@ -64,7 +64,7 @@ public class MailboxGUIButtonMessage { return; if (buttonID == 0) { - MailboxSmartSendLogicProcedure.execute(world, x, y, z, entity, guistate); + MailboxSmartSendLogicProcedure.execute(world, x, y, z, entity); } } diff --git a/src/main/java/net/mcreator/nimsrandombullshit/procedures/MailboxSlot99ShippingLabelInsertionConditionProcedure.java b/src/main/java/net/mcreator/nimsrandombullshit/procedures/MailboxSlot99ShippingLabelInsertionConditionProcedure.java new file mode 100644 index 0000000..5443820 --- /dev/null +++ b/src/main/java/net/mcreator/nimsrandombullshit/procedures/MailboxSlot99ShippingLabelInsertionConditionProcedure.java @@ -0,0 +1,14 @@ +package net.mcreator.nimsrandombullshit.procedures; + +import net.minecraft.world.item.ItemStack; + +import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModItems; + +public class MailboxSlot99ShippingLabelInsertionConditionProcedure { + public static boolean execute(ItemStack itemstack) { + if (itemstack.getItem() == NimsRandomBullshitModItems.SHIPPING_LABEL.get() && itemstack.getOrCreateTag().getBoolean("connected")) { + return false; + } + return true; + } +} diff --git a/src/main/java/net/mcreator/nimsrandombullshit/procedures/MailboxSmartSendLogicProcedure.java b/src/main/java/net/mcreator/nimsrandombullshit/procedures/MailboxSmartSendLogicProcedure.java index 48f2a96..8b1bb0a 100644 --- a/src/main/java/net/mcreator/nimsrandombullshit/procedures/MailboxSmartSendLogicProcedure.java +++ b/src/main/java/net/mcreator/nimsrandombullshit/procedures/MailboxSmartSendLogicProcedure.java @@ -1,7 +1,5 @@ package net.mcreator.nimsrandombullshit.procedures; -import org.checkerframework.checker.units.qual.s; - import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.common.capabilities.ForgeCapabilities; @@ -14,21 +12,19 @@ import net.minecraft.world.inventory.Slot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.core.BlockPos; -import net.minecraft.client.gui.components.EditBox; +import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModItems; import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModBlocks; import java.util.function.Supplier; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicInteger; import java.util.Map; -import java.util.HashMap; public class MailboxSmartSendLogicProcedure { - public static void execute(LevelAccessor world, double x, double y, double z, Entity entity, HashMap guistate) { - if (entity == null || guistate == null) + public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) { + if (entity == null) return; - ItemStack currInboxItem = ItemStack.EMPTY; double currInboxSlot = 0; double currOutboxSlot = 0; double currInboxSlotRoom = 0; @@ -36,387 +32,41 @@ public class MailboxSmartSendLogicProcedure { double currInboxSlot2 = 0; double currInboxItemCount = 0; double currInboxItemCount2 = 0; + ItemStack currInboxItem = ItemStack.EMPTY; + ItemStack shippingLabel = ItemStack.EMPTY; if (!world.isClientSide()) { - if (!world.isClientSide()) { - BlockPos _bp = BlockPos.containing(x, y, z); - BlockEntity _blockEntity = world.getBlockEntity(_bp); - BlockState _bs = world.getBlockState(_bp); - if (_blockEntity != null) - _blockEntity.getPersistentData().putDouble("target_mailbox_x", new Object() { - double convert(String s) { - try { - return Double.parseDouble(s.trim()); - } catch (Exception e) { - } - return 0; - } - }.convert(guistate.containsKey("text:outbox_x_coord") ? ((EditBox) guistate.get("text:outbox_x_coord")).getValue() : "")); - if (world instanceof Level _level) - _level.sendBlockUpdated(_bp, _bs, _bs, 3); - } - if (!world.isClientSide()) { - BlockPos _bp = BlockPos.containing(x, y, z); - BlockEntity _blockEntity = world.getBlockEntity(_bp); - BlockState _bs = world.getBlockState(_bp); - if (_blockEntity != null) - _blockEntity.getPersistentData().putDouble("target_mailbox_y", new Object() { - double convert(String s) { - try { - return Double.parseDouble(s.trim()); - } catch (Exception e) { - } - return 0; - } - }.convert(guistate.containsKey("text:outbox_y_coord") ? ((EditBox) guistate.get("text:outbox_y_coord")).getValue() : "")); - if (world instanceof Level _level) - _level.sendBlockUpdated(_bp, _bs, _bs, 3); - } - if (!world.isClientSide()) { - BlockPos _bp = BlockPos.containing(x, y, z); - BlockEntity _blockEntity = world.getBlockEntity(_bp); - BlockState _bs = world.getBlockState(_bp); - if (_blockEntity != null) - _blockEntity.getPersistentData().putDouble("target_mailbox_z", new Object() { - double convert(String s) { - try { - return Double.parseDouble(s.trim()); - } catch (Exception e) { - } - return 0; - } - }.convert(guistate.containsKey("text:outbox_z_coord") ? ((EditBox) guistate.get("text:outbox_z_coord")).getValue() : "")); - if (world instanceof Level _level) - _level.sendBlockUpdated(_bp, _bs, _bs, 3); - } - if ((world.getBlockState(BlockPos.containing(new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; + shippingLabel = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(99)).getItem() : ItemStack.EMPTY).copy(); + if (shippingLabel.getItem() == NimsRandomBullshitModItems.SHIPPING_LABEL.get() && shippingLabel.getOrCreateTag().getBoolean("connected")) { + if (!world.isClientSide()) { + BlockPos _bp = BlockPos.containing(x, y, z); + BlockEntity _blockEntity = world.getBlockEntity(_bp); + BlockState _bs = world.getBlockState(_bp); + if (_blockEntity != null) + _blockEntity.getPersistentData().putDouble("target_mailbox_x", (shippingLabel.getOrCreateTag().getDouble("connected_mailbox_x"))); + if (world instanceof Level _level) + _level.sendBlockUpdated(_bp, _bs, _bs, 3); } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; + if (!world.isClientSide()) { + BlockPos _bp = BlockPos.containing(x, y, z); + BlockEntity _blockEntity = world.getBlockEntity(_bp); + BlockState _bs = world.getBlockState(_bp); + if (_blockEntity != null) + _blockEntity.getPersistentData().putDouble("target_mailbox_y", (shippingLabel.getOrCreateTag().getDouble("connected_mailbox_y"))); + if (world instanceof Level _level) + _level.sendBlockUpdated(_bp, _bs, _bs, 3); } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; + if (!world.isClientSide()) { + BlockPos _bp = BlockPos.containing(x, y, z); + BlockEntity _blockEntity = world.getBlockEntity(_bp); + BlockState _bs = world.getBlockState(_bp); + if (_blockEntity != null) + _blockEntity.getPersistentData().putDouble("target_mailbox_z", (shippingLabel.getOrCreateTag().getDouble("connected_mailbox_z"))); + if (world instanceof Level _level) + _level.sendBlockUpdated(_bp, _bs, _bs, 3); } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z")))).getBlock() == NimsRandomBullshitModBlocks.MAILBOX.get()) { - currInboxSlot = 0; - currOutboxSlot = 9; - while (currInboxSlot <= 8) { - currInboxItem = (new Object() { - public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) { - AtomicReference _retval = new AtomicReference<>(ItemStack.EMPTY); - BlockEntity _ent = world.getBlockEntity(pos); - if (_ent != null) - _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy())); - return _retval.get(); - } - }.getItemStack(world, BlockPos.containing(new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z")), (int) currInboxSlot)).copy(); - currInboxItemCount = new Object() { - public int getAmount(LevelAccessor world, BlockPos pos, int slotid) { - AtomicInteger _retval = new AtomicInteger(0); - BlockEntity _ent = world.getBlockEntity(pos); - if (_ent != null) - _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount())); - return _retval.get(); - } - }.getAmount(world, BlockPos.containing(new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z")), (int) currInboxSlot); - if (currInboxItem.getItem() == ItemStack.EMPTY.getItem() - && !((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get((int) currOutboxSlot)).getItem() : ItemStack.EMPTY) - .getItem() == ItemStack.EMPTY.getItem())) { - { - BlockEntity _ent = world.getBlockEntity(BlockPos.containing(new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z"))); - if (_ent != null) { - final int _slotid = (int) currInboxSlot; - final ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt - ? ((Slot) _slt.get((int) currOutboxSlot)).getItem() - : ItemStack.EMPTY).copy(); - _setstack.setCount(new Object() { - public int getAmount(int sltid) { - if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { - ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); - if (stack != null) - return stack.getCount(); - } - return 0; - } - }.getAmount((int) currOutboxSlot)); - _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> { - if (capability instanceof IItemHandlerModifiable) - ((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack); - }); - } - } - if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { - ((Slot) _slots.get((int) currOutboxSlot)).set(ItemStack.EMPTY); - _player.containerMenu.broadcastChanges(); - } - } else { - if (currInboxItem - .getItem() == (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get((int) currOutboxSlot)).getItem() : ItemStack.EMPTY) - .getItem() - && currInboxItemCount < currInboxItem.getMaxStackSize()) { - currInboxSlotRoom = currInboxItem.getMaxStackSize() - currInboxItemCount; - if (new Object() { - public int getAmount(int sltid) { - if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { - ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); - if (stack != null) - return stack.getCount(); - } - return 0; - } - }.getAmount((int) currOutboxSlot) <= currInboxSlotRoom) { - { - BlockEntity _ent = world.getBlockEntity(BlockPos.containing(new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z"))); - if (_ent != null) { - final int _slotid = (int) currInboxSlot; - final ItemStack _setstack = currInboxItem.copy(); - _setstack.setCount((int) (currInboxItemCount + new Object() { - public int getAmount(int sltid) { - if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { - ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); - if (stack != null) - return stack.getCount(); - } - return 0; - } - }.getAmount((int) currOutboxSlot))); - _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> { - if (capability instanceof IItemHandlerModifiable) - ((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack); - }); - } - } - if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { - ((Slot) _slots.get((int) currOutboxSlot)).set(ItemStack.EMPTY); - _player.containerMenu.broadcastChanges(); - } - } else { - { - BlockEntity _ent = world.getBlockEntity(BlockPos.containing(new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z"))); - if (_ent != null) { - final int _slotid = (int) currInboxSlot; - final ItemStack _setstack = currInboxItem.copy(); - _setstack.setCount(currInboxItem.getMaxStackSize()); - _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> { - if (capability instanceof IItemHandlerModifiable) - ((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack); - }); - } - } - currRemainder = new Object() { - public int getAmount(int sltid) { - if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { - ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); - if (stack != null) - return stack.getCount(); - } - return 0; - } - }.getAmount((int) currOutboxSlot) - currInboxSlotRoom; - currInboxSlot2 = 0; - while (currInboxSlot2 <= 8) { - currInboxItemCount2 = new Object() { - public int getAmount(LevelAccessor world, BlockPos pos, int slotid) { - AtomicInteger _retval = new AtomicInteger(0); - BlockEntity _ent = world.getBlockEntity(pos); - if (_ent != null) - _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount())); - return _retval.get(); - } - }.getAmount(world, BlockPos.containing(new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z")), (int) currInboxSlot2); - if (currInboxItemCount2 == 0) { - { - BlockEntity _ent = world.getBlockEntity(BlockPos.containing(new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { - public double getValue(LevelAccessor world, BlockPos pos, String tag) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity != null) - return blockEntity.getPersistentData().getDouble(tag); - return -1; - } - }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z"))); - if (_ent != null) { - final int _slotid = (int) currInboxSlot2; - final ItemStack _setstack = currInboxItem.copy(); - _setstack.setCount((int) currRemainder); - _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> { - if (capability instanceof IItemHandlerModifiable) - ((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack); - }); - } - } - if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { - ((Slot) _slots.get((int) currOutboxSlot)).set(ItemStack.EMPTY); - _player.containerMenu.broadcastChanges(); - } - currRemainder = 0; - break; - } - currInboxSlot2 = currInboxSlot2 + 1; - } - if (currRemainder > 0) { - if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { - ItemStack _setstack = currInboxItem.copy(); - _setstack.setCount((int) currRemainder); - ((Slot) _slots.get((int) currOutboxSlot)).set(_setstack); - _player.containerMenu.broadcastChanges(); - } - } - } - } - } - if (new Object() { + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ItemStack _setstack = shippingLabel.copy(); + _setstack.setCount((int) (new Object() { public int getAmount(int sltid) { if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); @@ -425,15 +75,357 @@ public class MailboxSmartSendLogicProcedure { } return 0; } - }.getAmount((int) currOutboxSlot) == 0) { - currOutboxSlot = currOutboxSlot + 1; - if (currInboxItemCount == currInboxItem.getMaxStackSize()) { + }.getAmount(99) - 1)); + ((Slot) _slots.get(99)).set(_setstack); + _player.containerMenu.broadcastChanges(); + } + if ((world.getBlockState(BlockPos.containing(new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z")))).getBlock() == NimsRandomBullshitModBlocks.MAILBOX.get()) { + currInboxSlot = 0; + currOutboxSlot = 9; + while (currInboxSlot <= 8) { + currInboxItem = (new Object() { + public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) { + AtomicReference _retval = new AtomicReference<>(ItemStack.EMPTY); + BlockEntity _ent = world.getBlockEntity(pos); + if (_ent != null) + _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy())); + return _retval.get(); + } + }.getItemStack(world, BlockPos.containing(new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z")), (int) currInboxSlot)).copy(); + currInboxItemCount = new Object() { + public int getAmount(LevelAccessor world, BlockPos pos, int slotid) { + AtomicInteger _retval = new AtomicInteger(0); + BlockEntity _ent = world.getBlockEntity(pos); + if (_ent != null) + _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount())); + return _retval.get(); + } + }.getAmount(world, BlockPos.containing(new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z")), (int) currInboxSlot); + if (currInboxItem.getItem() == ItemStack.EMPTY.getItem() + && !((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get((int) currOutboxSlot)).getItem() : ItemStack.EMPTY) + .getItem() == ItemStack.EMPTY.getItem())) { + { + BlockEntity _ent = world.getBlockEntity(BlockPos.containing(new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z"))); + if (_ent != null) { + final int _slotid = (int) currInboxSlot; + final ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt + ? ((Slot) _slt.get((int) currOutboxSlot)).getItem() + : ItemStack.EMPTY).copy(); + _setstack.setCount(new Object() { + public int getAmount(int sltid) { + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); + if (stack != null) + return stack.getCount(); + } + return 0; + } + }.getAmount((int) currOutboxSlot)); + _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> { + if (capability instanceof IItemHandlerModifiable) + ((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack); + }); + } + } + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ((Slot) _slots.get((int) currOutboxSlot)).set(ItemStack.EMPTY); + _player.containerMenu.broadcastChanges(); + } + } else { + if (currInboxItem + .getItem() == (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get((int) currOutboxSlot)).getItem() : ItemStack.EMPTY) + .getItem() + && currInboxItemCount < currInboxItem.getMaxStackSize()) { + currInboxSlotRoom = currInboxItem.getMaxStackSize() - currInboxItemCount; + if (new Object() { + public int getAmount(int sltid) { + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); + if (stack != null) + return stack.getCount(); + } + return 0; + } + }.getAmount((int) currOutboxSlot) <= currInboxSlotRoom) { + { + BlockEntity _ent = world.getBlockEntity(BlockPos.containing(new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z"))); + if (_ent != null) { + final int _slotid = (int) currInboxSlot; + final ItemStack _setstack = currInboxItem.copy(); + _setstack.setCount((int) (currInboxItemCount + new Object() { + public int getAmount(int sltid) { + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); + if (stack != null) + return stack.getCount(); + } + return 0; + } + }.getAmount((int) currOutboxSlot))); + _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> { + if (capability instanceof IItemHandlerModifiable) + ((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack); + }); + } + } + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ((Slot) _slots.get((int) currOutboxSlot)).set(ItemStack.EMPTY); + _player.containerMenu.broadcastChanges(); + } + } else { + { + BlockEntity _ent = world.getBlockEntity(BlockPos.containing(new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z"))); + if (_ent != null) { + final int _slotid = (int) currInboxSlot; + final ItemStack _setstack = currInboxItem.copy(); + _setstack.setCount(currInboxItem.getMaxStackSize()); + _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> { + if (capability instanceof IItemHandlerModifiable) + ((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack); + }); + } + } + currRemainder = new Object() { + public int getAmount(int sltid) { + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); + if (stack != null) + return stack.getCount(); + } + return 0; + } + }.getAmount((int) currOutboxSlot) - currInboxSlotRoom; + currInboxSlot2 = 0; + while (currInboxSlot2 <= 8) { + currInboxItemCount2 = new Object() { + public int getAmount(LevelAccessor world, BlockPos pos, int slotid) { + AtomicInteger _retval = new AtomicInteger(0); + BlockEntity _ent = world.getBlockEntity(pos); + if (_ent != null) + _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount())); + return _retval.get(); + } + }.getAmount(world, BlockPos.containing(new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z")), (int) currInboxSlot2); + if (currInboxItemCount2 == 0) { + { + BlockEntity _ent = world.getBlockEntity(BlockPos.containing(new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_x"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_y"), new Object() { + public double getValue(LevelAccessor world, BlockPos pos, String tag) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity != null) + return blockEntity.getPersistentData().getDouble(tag); + return -1; + } + }.getValue(world, BlockPos.containing(x, y, z), "target_mailbox_z"))); + if (_ent != null) { + final int _slotid = (int) currInboxSlot2; + final ItemStack _setstack = currInboxItem.copy(); + _setstack.setCount((int) currRemainder); + _ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> { + if (capability instanceof IItemHandlerModifiable) + ((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack); + }); + } + } + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ((Slot) _slots.get((int) currOutboxSlot)).set(ItemStack.EMPTY); + _player.containerMenu.broadcastChanges(); + } + currRemainder = 0; + break; + } + currInboxSlot2 = currInboxSlot2 + 1; + } + if (currRemainder > 0) { + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ItemStack _setstack = currInboxItem.copy(); + _setstack.setCount((int) currRemainder); + ((Slot) _slots.get((int) currOutboxSlot)).set(_setstack); + _player.containerMenu.broadcastChanges(); + } + } + } + } + } + if (new Object() { + public int getAmount(int sltid) { + if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { + ItemStack stack = ((Slot) _slots.get(sltid)).getItem(); + if (stack != null) + return stack.getCount(); + } + return 0; + } + }.getAmount((int) currOutboxSlot) == 0) { + currOutboxSlot = currOutboxSlot + 1; + if (currInboxItemCount == currInboxItem.getMaxStackSize()) { + currInboxSlot = currInboxSlot + 1; + } + } else if (currInboxItemCount == 0) { + currOutboxSlot = currOutboxSlot + 1; + } else { currInboxSlot = currInboxSlot + 1; } - } else if (currInboxItemCount == 0) { - currOutboxSlot = currOutboxSlot + 1; - } else { - currInboxSlot = currInboxSlot + 1; } } } diff --git a/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelHasItemGlowingEffectProcedure.java b/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelHasItemGlowingEffectProcedure.java new file mode 100644 index 0000000..3391f60 --- /dev/null +++ b/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelHasItemGlowingEffectProcedure.java @@ -0,0 +1,12 @@ +package net.mcreator.nimsrandombullshit.procedures; + +import net.minecraft.world.item.ItemStack; + +public class ShippingLabelHasItemGlowingEffectProcedure { + public static boolean execute(ItemStack itemstack) { + if (itemstack.getOrCreateTag().getBoolean("connected")) { + return true; + } + return false; + } +} diff --git a/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelRightclickedOnBlockProcedure.java b/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelRightclickedOnBlockProcedure.java new file mode 100644 index 0000000..9bd6951 --- /dev/null +++ b/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelRightclickedOnBlockProcedure.java @@ -0,0 +1,39 @@ +package net.mcreator.nimsrandombullshit.procedures; + +import net.minecraftforge.registries.ForgeRegistries; + +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.Level; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.Entity; +import net.minecraft.util.RandomSource; +import net.minecraft.util.Mth; +import net.minecraft.sounds.SoundSource; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.BlockPos; + +import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModBlocks; + +public class ShippingLabelRightclickedOnBlockProcedure { + public static void execute(LevelAccessor world, double x, double y, double z, BlockState blockstate, Entity entity, ItemStack itemstack) { + if (entity == null) + return; + if (!world.isClientSide()) { + if (blockstate.getBlock() == NimsRandomBullshitModBlocks.MAILBOX.get() && entity.isShiftKeyDown()) { + itemstack.getOrCreateTag().putDouble("connected_mailbox_x", x); + itemstack.getOrCreateTag().putDouble("connected_mailbox_y", y); + itemstack.getOrCreateTag().putDouble("connected_mailbox_z", z); + itemstack.getOrCreateTag().putBoolean("connected", true); + if (world instanceof Level _level) { + if (!_level.isClientSide()) { + _level.playSound(null, BlockPos.containing(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.player.levelup")), SoundSource.PLAYERS, (float) 0.75, + (float) Mth.nextDouble(RandomSource.create(), 0.95, 1.05)); + } else { + _level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.player.levelup")), SoundSource.PLAYERS, (float) 0.75, (float) Mth.nextDouble(RandomSource.create(), 0.95, 1.05), false); + } + } + } + } + } +} diff --git a/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelSpecialInformationProcedure.java b/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelSpecialInformationProcedure.java new file mode 100644 index 0000000..4be5251 --- /dev/null +++ b/src/main/java/net/mcreator/nimsrandombullshit/procedures/ShippingLabelSpecialInformationProcedure.java @@ -0,0 +1,13 @@ +package net.mcreator.nimsrandombullshit.procedures; + +import net.minecraft.world.item.ItemStack; + +public class ShippingLabelSpecialInformationProcedure { + public static String execute(ItemStack itemstack) { + if (itemstack.getOrCreateTag().getBoolean("connected")) { + return ("Dest. Mailbox X:" + itemstack.getOrCreateTag().getDouble("connected_mailbox_x") + "\n") + "" + ("Dest. Mailbox Y:" + itemstack.getOrCreateTag().getDouble("connected_mailbox_y") + "\n") + + ("Dest. Mailbox Z:" + itemstack.getOrCreateTag().getDouble("connected_mailbox_z") + "\n"); + } + return "No assigned destination."; + } +} diff --git a/src/main/java/net/mcreator/nimsrandombullshit/world/inventory/MailboxGUIMenu.java b/src/main/java/net/mcreator/nimsrandombullshit/world/inventory/MailboxGUIMenu.java index 1a4570a..d8c54af 100644 --- a/src/main/java/net/mcreator/nimsrandombullshit/world/inventory/MailboxGUIMenu.java +++ b/src/main/java/net/mcreator/nimsrandombullshit/world/inventory/MailboxGUIMenu.java @@ -19,6 +19,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.core.BlockPos; +import net.mcreator.nimsrandombullshit.procedures.MailboxSlot99ShippingLabelInsertionConditionProcedure; import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModMenus; import java.util.function.Supplier; @@ -42,7 +43,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier