feature: add shipping label for mailbox

This commit is contained in:
nimsolated
2026-03-05 11:24:25 -08:00
parent ec2d412b36
commit e2dff17444
28 changed files with 968 additions and 620 deletions

View File

@@ -108,7 +108,7 @@
"hasInventory": true, "hasInventory": true,
"guiBoundTo": "MailboxGUI", "guiBoundTo": "MailboxGUI",
"openGUIOnRightClick": true, "openGUIOnRightClick": true,
"inventorySize": 18, "inventorySize": 100,
"inventoryStackSize": 64, "inventoryStackSize": 64,
"inventoryDropWhenDestroyed": true, "inventoryDropWhenDestroyed": true,
"inventoryComparatorPower": true, "inventoryComparatorPower": true,

View File

@@ -3,7 +3,7 @@
"_type": "gui", "_type": "gui",
"definition": { "definition": {
"type": 1, "type": 1,
"width": 360, "width": 240,
"height": 180, "height": 180,
"inventoryOffsetX": 0, "inventoryOffsetX": 0,
"inventoryOffsetY": 0, "inventoryOffsetY": 0,
@@ -330,90 +330,6 @@
"locked": false "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", "type": "button",
"data": { "data": {
@@ -425,8 +341,32 @@
}, },
"width": 46, "width": 46,
"height": 20, "height": 20,
"x": 303, "x": 263,
"y": 116, "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 "locked": false
} }
} }

View File

@@ -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"
}
}

View File

@@ -0,0 +1,7 @@
{
"_fv": 73,
"_type": "procedure",
"definition": {
"procedurexml": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"event_trigger\" deletable=\"false\" x=\"178\" y=\"147\"><field name=\"trigger\">no_ext_trigger</field><next><block type=\"controls_if\"><value name=\"IF0\"><block type=\"logic_binary_ops\" inline=\"false\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"compare_mcitems\"><value name=\"a\"><block type=\"itemstack_to_mcitem\"></block></value><value name=\"b\"><block type=\"mcitem_all\"><field name=\"value\">CUSTOM:ShippingLabel</field></block></value></block></value><value name=\"B\"><block type=\"item_nbt_logic_get\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value></block></value></block></value><statement name=\"DO0\"><block type=\"return_logic\"><value name=\"return\"><block type=\"logic_boolean\"><field name=\"BOOL\">FALSE</field></block></value></block></statement><next><block type=\"return_logic\"><value name=\"return\"><block type=\"logic_boolean\"><field name=\"BOOL\">TRUE</field></block></value></block></next></block></next></block></xml>"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -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
}
}

View File

@@ -0,0 +1,7 @@
{
"_fv": 73,
"_type": "procedure",
"definition": {
"procedurexml": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"event_trigger\" deletable=\"false\" x=\"40\" y=\"40\"><field name=\"trigger\">no_ext_trigger</field><next><block type=\"controls_if\"><value name=\"IF0\"><block type=\"item_nbt_logic_get\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value></block></value><statement name=\"DO0\"><block type=\"return_logic\"><value name=\"return\"><block type=\"logic_boolean\"><field name=\"BOOL\">TRUE</field></block></value></block></statement><next><block type=\"return_logic\"><value name=\"return\"><block type=\"logic_boolean\"><field name=\"BOOL\">FALSE</field></block></value></block></next></block></next></block></xml>"
}
}

View File

@@ -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"
}
}

View File

@@ -0,0 +1,7 @@
{
"_fv": 73,
"_type": "procedure",
"definition": {
"procedurexml": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"event_trigger\" deletable=\"false\" x=\"40\" y=\"40\"><field name=\"trigger\">no_ext_trigger</field><next><block type=\"controls_if\"><value name=\"IF0\"><block type=\"logic_negate\"><value name=\"BOOL\"><block type=\"world_data_isremote\"></block></value></block></value><statement name=\"DO0\"><block type=\"controls_if\"><value name=\"IF0\"><block type=\"logic_binary_ops\" inline=\"false\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"compare_mcblocks\"><value name=\"a\"><block type=\"blockstate_from_deps\"></block></value><value name=\"b\"><block type=\"mcitem_allblocks\"><field name=\"value\">CUSTOM:Mailbox</field></block></value></block></value><value name=\"B\"><block type=\"entity_issneaking\"><value name=\"entity\"><block type=\"entity_from_deps\"></block></value></block></value></block></value><statement name=\"DO0\"><block type=\"item_nbt_num_set\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected_mailbox_x</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value><value name=\"tagValue\"><block type=\"coord_x\"></block></value><next><block type=\"item_nbt_num_set\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected_mailbox_y</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value><value name=\"tagValue\"><block type=\"coord_y\"></block></value><next><block type=\"item_nbt_num_set\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected_mailbox_z</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value><value name=\"tagValue\"><block type=\"coord_z\"></block></value><next><block type=\"item_nbt_logic_set\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value><value name=\"tagValue\"><block type=\"logic_boolean\"><field name=\"BOOL\">TRUE</field></block></value><next><block type=\"play_sound\"><field name=\"sound\">entity.player.levelup</field><field name=\"soundcategory\">player</field><value name=\"x\"><block type=\"coord_x\"></block></value><value name=\"y\"><block type=\"coord_y\"></block></value><value name=\"z\"><block type=\"coord_z\"></block></value><value name=\"level\"><block type=\"math_number\"><field name=\"NUM\">0.75</field></block></value><value name=\"pitch\"><block type=\"math_random_number_between\"><value name=\"min\"><block type=\"math_number\"><field name=\"NUM\">0.95</field></block></value><value name=\"max\"><block type=\"math_number\"><field name=\"NUM\">1.05</field></block></value></block></value></block></next></block></next></block></next></block></next></block></statement></block></statement></block></next></block></xml>"
}
}

View File

@@ -0,0 +1,7 @@
{
"_fv": 73,
"_type": "procedure",
"definition": {
"procedurexml": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"event_trigger\" deletable=\"false\" x=\"240\" y=\"202\"><field name=\"trigger\">no_ext_trigger</field><next><block type=\"controls_if\"><value name=\"IF0\"><block type=\"item_nbt_logic_get\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value></block></value><statement name=\"DO0\"><block type=\"return_string\"><value name=\"return\"><block type=\"text_join\"><mutation items=\"3\"></mutation><value name=\"ADD0\"><block type=\"text_join\"><mutation items=\"3\"></mutation><value name=\"ADD0\"><block type=\"text\"><field name=\"TEXT\">Dest. Mailbox X:</field></block></value><value name=\"ADD1\"><block type=\"item_nbt_num_get\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected_mailbox_x</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value></block></value><value name=\"ADD2\"><block type=\"text_new_line\"></block></value></block></value><value name=\"ADD1\"><block type=\"text_join\"><mutation items=\"3\"></mutation><value name=\"ADD0\"><block type=\"text\"><field name=\"TEXT\">Dest. Mailbox Y:</field></block></value><value name=\"ADD1\"><block type=\"item_nbt_num_get\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected_mailbox_y</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value></block></value><value name=\"ADD2\"><block type=\"text_new_line\"></block></value></block></value><value name=\"ADD2\"><block type=\"text_join\"><mutation items=\"3\"></mutation><value name=\"ADD0\"><block type=\"text\"><field name=\"TEXT\">Dest. Mailbox Z:</field></block></value><value name=\"ADD1\"><block type=\"item_nbt_num_get\"><value name=\"tagName\"><block type=\"text\"><field name=\"TEXT\">connected_mailbox_z</field></block></value><value name=\"item\"><block type=\"itemstack_to_mcitem\"></block></value></block></value><value name=\"ADD2\"><block type=\"text_new_line\"></block></value></block></value></block></value></block></statement><next><block type=\"return_string\"><value name=\"return\"><block type=\"text\"><field name=\"TEXT\">No assigned destination.</field></block></value></block></next></block></next></block></xml>"
}
}

View File

@@ -1424,8 +1424,74 @@
"type": "entity" "type": "entity"
}, },
{ {
"name": "guistate", "name": "x",
"type": "map" "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", "name": "x",
@@ -1446,6 +1512,79 @@
] ]
}, },
"path": "~/Mailbox" "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": [], "variable_elements": [],
@@ -1504,6 +1643,7 @@
"item.nims_random_bullshit.sand_dust": "Sand Dust", "item.nims_random_bullshit.sand_dust": "Sand Dust",
"item.nims_random_bullshit.magic_flesh": "Magic Flesh", "item.nims_random_bullshit.magic_flesh": "Magic Flesh",
"item.nims_random_bullshit.ghoul_spawn_egg": "Ghoul Spawn Egg", "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.block_eater": "Block Eater",
"item.nims_random_bullshit.golden_berries": "Golden Berries", "item.nims_random_bullshit.golden_berries": "Golden Berries",
"item.nims_random_bullshit.netherrack_juice_bucket": "Netherrack Juice Bucket", "item.nims_random_bullshit.netherrack_juice_bucket": "Netherrack Juice Bucket",

View File

@@ -31,7 +31,7 @@ import java.util.stream.IntStream;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
public class MailboxBlockEntity extends RandomizableContainerBlockEntity implements WorldlyContainer { public class MailboxBlockEntity extends RandomizableContainerBlockEntity implements WorldlyContainer {
private NonNullList<ItemStack> stacks = NonNullList.<ItemStack>withSize(18, ItemStack.EMPTY); private NonNullList<ItemStack> stacks = NonNullList.<ItemStack>withSize(100, ItemStack.EMPTY);
private final LazyOptional<? extends IItemHandler>[] handlers = SidedInvWrapper.create(this, Direction.values()); private final LazyOptional<? extends IItemHandler>[] handlers = SidedInvWrapper.create(this, Direction.values());
public MailboxBlockEntity(BlockPos position, BlockState state) { public MailboxBlockEntity(BlockPos position, BlockState state) {

View File

@@ -6,10 +6,8 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; 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.components.Button;
import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.Minecraft;
import net.mcreator.nimsrandombullshit.world.inventory.MailboxGUIMenu; import net.mcreator.nimsrandombullshit.world.inventory.MailboxGUIMenu;
import net.mcreator.nimsrandombullshit.network.MailboxGUIButtonMessage; import net.mcreator.nimsrandombullshit.network.MailboxGUIButtonMessage;
@@ -24,9 +22,6 @@ public class MailboxGUIScreen extends AbstractContainerScreen<MailboxGUIMenu> {
private final Level world; private final Level world;
private final int x, y, z; private final int x, y, z;
private final Player entity; private final Player entity;
EditBox outbox_x_coord;
EditBox outbox_y_coord;
EditBox outbox_z_coord;
Button button_send; Button button_send;
public MailboxGUIScreen(MailboxGUIMenu container, Inventory inventory, Component text) { public MailboxGUIScreen(MailboxGUIMenu container, Inventory inventory, Component text) {
@@ -36,7 +31,7 @@ public class MailboxGUIScreen extends AbstractContainerScreen<MailboxGUIMenu> {
this.y = container.y; this.y = container.y;
this.z = container.z; this.z = container.z;
this.entity = container.entity; this.entity = container.entity;
this.imageWidth = 360; this.imageWidth = 240;
this.imageHeight = 180; this.imageHeight = 180;
} }
@@ -46,9 +41,6 @@ public class MailboxGUIScreen extends AbstractContainerScreen<MailboxGUIMenu> {
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(guiGraphics); this.renderBackground(guiGraphics);
super.render(guiGraphics, mouseX, mouseY, partialTicks); 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); this.renderTooltip(guiGraphics, mouseX, mouseY);
} }
@@ -67,121 +59,24 @@ public class MailboxGUIScreen extends AbstractContainerScreen<MailboxGUIMenu> {
this.minecraft.player.closeContainer(); this.minecraft.player.closeContainer();
return true; 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); 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 @Override
protected void renderLabels(GuiGraphics guiGraphics, int mouseX, int mouseY) { 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_inbox"), 38, 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_outbox"), 101, 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);
} }
@Override @Override
public void init() { public void init() {
super.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 -> { button_send = Button.builder(Component.translatable("gui.nims_random_bullshit.mailbox_gui.button_send"), e -> {
if (true) { if (true) {
NimsRandomBullshitMod.PACKET_HANDLER.sendToServer(new MailboxGUIButtonMessage(0, x, y, z)); NimsRandomBullshitMod.PACKET_HANDLER.sendToServer(new MailboxGUIButtonMessage(0, x, y, z));
MailboxGUIButtonMessage.handleButtonAction(entity, 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); guistate.put("button:button_send", button_send);
this.addRenderableWidget(button_send); this.addRenderableWidget(button_send);
} }

View File

@@ -16,6 +16,7 @@ import net.minecraft.world.item.BlockItem;
import net.mcreator.nimsrandombullshit.item.StarWandItem; import net.mcreator.nimsrandombullshit.item.StarWandItem;
import net.mcreator.nimsrandombullshit.item.StarItem; import net.mcreator.nimsrandombullshit.item.StarItem;
import net.mcreator.nimsrandombullshit.item.ShitItem; import net.mcreator.nimsrandombullshit.item.ShitItem;
import net.mcreator.nimsrandombullshit.item.ShippingLabelItem;
import net.mcreator.nimsrandombullshit.item.SandDustItem; import net.mcreator.nimsrandombullshit.item.SandDustItem;
import net.mcreator.nimsrandombullshit.item.NetherrackitePickaxeItem; import net.mcreator.nimsrandombullshit.item.NetherrackitePickaxeItem;
import net.mcreator.nimsrandombullshit.item.NetherrackiteItem; import net.mcreator.nimsrandombullshit.item.NetherrackiteItem;
@@ -53,6 +54,7 @@ public class NimsRandomBullshitModItems {
public static final RegistryObject<Item> STAR_WAND = REGISTRY.register("star_wand", () -> new StarWandItem()); public static final RegistryObject<Item> STAR_WAND = REGISTRY.register("star_wand", () -> new StarWandItem());
public static final RegistryObject<Item> NETHERRACK_JUICE_BUCKET = REGISTRY.register("netherrack_juice_bucket", () -> new NetherrackJuiceItem()); public static final RegistryObject<Item> NETHERRACK_JUICE_BUCKET = REGISTRY.register("netherrack_juice_bucket", () -> new NetherrackJuiceItem());
public static final RegistryObject<Item> MAILBOX = block(NimsRandomBullshitModBlocks.MAILBOX); public static final RegistryObject<Item> MAILBOX = block(NimsRandomBullshitModBlocks.MAILBOX);
public static final RegistryObject<Item> SHIPPING_LABEL = REGISTRY.register("shipping_label", () -> new ShippingLabelItem());
// Start of user code block custom items // Start of user code block custom items
// End of user code block custom items // End of user code block custom items

View File

@@ -36,6 +36,7 @@ public class NimsRandomBullshitModTabs {
tabData.accept(NimsRandomBullshitModItems.GRAVEDIGGER.get()); tabData.accept(NimsRandomBullshitModItems.GRAVEDIGGER.get());
tabData.accept(NimsRandomBullshitModItems.STAR_WAND.get()); tabData.accept(NimsRandomBullshitModItems.STAR_WAND.get());
tabData.accept(NimsRandomBullshitModItems.NETHERRACK_JUICE_BUCKET.get()); tabData.accept(NimsRandomBullshitModItems.NETHERRACK_JUICE_BUCKET.get());
tabData.accept(NimsRandomBullshitModItems.SHIPPING_LABEL.get());
} else if (tabData.getTabKey() == CreativeModeTabs.INGREDIENTS) { } else if (tabData.getTabKey() == CreativeModeTabs.INGREDIENTS) {
tabData.accept(NimsRandomBullshitModItems.NETHERRACKITE.get()); tabData.accept(NimsRandomBullshitModItems.NETHERRACKITE.get());
tabData.accept(NimsRandomBullshitModItems.SAND_DUST.get()); tabData.accept(NimsRandomBullshitModItems.SAND_DUST.get());

View File

@@ -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<Component> 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;
}
}

View File

@@ -64,7 +64,7 @@ public class MailboxGUIButtonMessage {
return; return;
if (buttonID == 0) { if (buttonID == 0) {
MailboxSmartSendLogicProcedure.execute(world, x, y, z, entity, guistate); MailboxSmartSendLogicProcedure.execute(world, x, y, z, entity);
} }
} }

View File

@@ -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;
}
}

View File

@@ -1,7 +1,5 @@
package net.mcreator.nimsrandombullshit.procedures; package net.mcreator.nimsrandombullshit.procedures;
import org.checkerframework.checker.units.qual.s;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.common.capabilities.ForgeCapabilities; 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.player.Player;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.core.BlockPos; 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 net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModBlocks;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.Map; import java.util.Map;
import java.util.HashMap;
public class MailboxSmartSendLogicProcedure { public class MailboxSmartSendLogicProcedure {
public static void execute(LevelAccessor world, double x, double y, double z, Entity entity, HashMap guistate) { public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) {
if (entity == null || guistate == null) if (entity == null)
return; return;
ItemStack currInboxItem = ItemStack.EMPTY;
double currInboxSlot = 0; double currInboxSlot = 0;
double currOutboxSlot = 0; double currOutboxSlot = 0;
double currInboxSlotRoom = 0; double currInboxSlotRoom = 0;
@@ -36,21 +32,17 @@ public class MailboxSmartSendLogicProcedure {
double currInboxSlot2 = 0; double currInboxSlot2 = 0;
double currInboxItemCount = 0; double currInboxItemCount = 0;
double currInboxItemCount2 = 0; double currInboxItemCount2 = 0;
ItemStack currInboxItem = ItemStack.EMPTY;
ItemStack shippingLabel = ItemStack.EMPTY;
if (!world.isClientSide()) { if (!world.isClientSide()) {
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()) { if (!world.isClientSide()) {
BlockPos _bp = BlockPos.containing(x, y, z); BlockPos _bp = BlockPos.containing(x, y, z);
BlockEntity _blockEntity = world.getBlockEntity(_bp); BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp); BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null) if (_blockEntity != null)
_blockEntity.getPersistentData().putDouble("target_mailbox_x", new Object() { _blockEntity.getPersistentData().putDouble("target_mailbox_x", (shippingLabel.getOrCreateTag().getDouble("connected_mailbox_x")));
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) if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3); _level.sendBlockUpdated(_bp, _bs, _bs, 3);
} }
@@ -59,15 +51,7 @@ public class MailboxSmartSendLogicProcedure {
BlockEntity _blockEntity = world.getBlockEntity(_bp); BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp); BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null) if (_blockEntity != null)
_blockEntity.getPersistentData().putDouble("target_mailbox_y", new Object() { _blockEntity.getPersistentData().putDouble("target_mailbox_y", (shippingLabel.getOrCreateTag().getDouble("connected_mailbox_y")));
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) if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3); _level.sendBlockUpdated(_bp, _bs, _bs, 3);
} }
@@ -76,17 +60,24 @@ public class MailboxSmartSendLogicProcedure {
BlockEntity _blockEntity = world.getBlockEntity(_bp); BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp); BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null) if (_blockEntity != null)
_blockEntity.getPersistentData().putDouble("target_mailbox_z", new Object() { _blockEntity.getPersistentData().putDouble("target_mailbox_z", (shippingLabel.getOrCreateTag().getDouble("connected_mailbox_z")));
double convert(String s) { if (world instanceof Level _level)
try { _level.sendBlockUpdated(_bp, _bs, _bs, 3);
return Double.parseDouble(s.trim()); }
} catch (Exception e) { 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();
if (stack != null)
return stack.getCount();
} }
return 0; return 0;
} }
}.convert(guistate.containsKey("text:outbox_z_coord") ? ((EditBox) guistate.get("text:outbox_z_coord")).getValue() : "")); }.getAmount(99) - 1));
if (world instanceof Level _level) ((Slot) _slots.get(99)).set(_setstack);
_level.sendBlockUpdated(_bp, _bs, _bs, 3); _player.containerMenu.broadcastChanges();
} }
if ((world.getBlockState(BlockPos.containing(new Object() { if ((world.getBlockState(BlockPos.containing(new Object() {
public double getValue(LevelAccessor world, BlockPos pos, String tag) { public double getValue(LevelAccessor world, BlockPos pos, String tag) {
@@ -439,4 +430,5 @@ public class MailboxSmartSendLogicProcedure {
} }
} }
} }
}
} }

View File

@@ -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;
}
}

View File

@@ -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);
}
}
}
}
}
}

View File

@@ -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.";
}
}

View File

@@ -19,6 +19,7 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.mcreator.nimsrandombullshit.procedures.MailboxSlot99ShippingLabelInsertionConditionProcedure;
import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModMenus; import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModMenus;
import java.util.function.Supplier; import java.util.function.Supplier;
@@ -42,7 +43,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
super(NimsRandomBullshitModMenus.MAILBOX_GUI.get(), id); super(NimsRandomBullshitModMenus.MAILBOX_GUI.get(), id);
this.entity = inv.player; this.entity = inv.player;
this.world = inv.player.level(); this.world = inv.player.level();
this.internal = new ItemStackHandler(18); this.internal = new ItemStackHandler(100);
BlockPos pos = null; BlockPos pos = null;
if (extraData != null) { if (extraData != null) {
pos = extraData.readBlockPos(); pos = extraData.readBlockPos();
@@ -77,7 +78,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
}); });
} }
} }
this.customSlots.put(0, this.addSlot(new SlotItemHandler(internal, 0, 99, 29) { this.customSlots.put(0, this.addSlot(new SlotItemHandler(internal, 0, 39, 29) {
private final int slot = 0; private final int slot = 0;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -87,7 +88,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(1, this.addSlot(new SlotItemHandler(internal, 1, 117, 29) { this.customSlots.put(1, this.addSlot(new SlotItemHandler(internal, 1, 57, 29) {
private final int slot = 1; private final int slot = 1;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -97,7 +98,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(2, this.addSlot(new SlotItemHandler(internal, 2, 135, 29) { this.customSlots.put(2, this.addSlot(new SlotItemHandler(internal, 2, 75, 29) {
private final int slot = 2; private final int slot = 2;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -107,7 +108,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(3, this.addSlot(new SlotItemHandler(internal, 3, 99, 47) { this.customSlots.put(3, this.addSlot(new SlotItemHandler(internal, 3, 39, 47) {
private final int slot = 3; private final int slot = 3;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -117,7 +118,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(4, this.addSlot(new SlotItemHandler(internal, 4, 117, 47) { this.customSlots.put(4, this.addSlot(new SlotItemHandler(internal, 4, 57, 47) {
private final int slot = 4; private final int slot = 4;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -127,7 +128,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(5, this.addSlot(new SlotItemHandler(internal, 5, 135, 47) { this.customSlots.put(5, this.addSlot(new SlotItemHandler(internal, 5, 75, 47) {
private final int slot = 5; private final int slot = 5;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -137,7 +138,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(6, this.addSlot(new SlotItemHandler(internal, 6, 99, 65) { this.customSlots.put(6, this.addSlot(new SlotItemHandler(internal, 6, 39, 65) {
private final int slot = 6; private final int slot = 6;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -147,7 +148,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(7, this.addSlot(new SlotItemHandler(internal, 7, 117, 65) { this.customSlots.put(7, this.addSlot(new SlotItemHandler(internal, 7, 57, 65) {
private final int slot = 7; private final int slot = 7;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -157,7 +158,7 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(8, this.addSlot(new SlotItemHandler(internal, 8, 135, 65) { this.customSlots.put(8, this.addSlot(new SlotItemHandler(internal, 8, 75, 65) {
private final int slot = 8; private final int slot = 8;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
@@ -167,56 +168,66 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
return false; return false;
} }
})); }));
this.customSlots.put(9, this.addSlot(new SlotItemHandler(internal, 9, 162, 29) { this.customSlots.put(9, this.addSlot(new SlotItemHandler(internal, 9, 102, 29) {
private final int slot = 9; private final int slot = 9;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(10, this.addSlot(new SlotItemHandler(internal, 10, 180, 29) { this.customSlots.put(10, this.addSlot(new SlotItemHandler(internal, 10, 120, 29) {
private final int slot = 10; private final int slot = 10;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(11, this.addSlot(new SlotItemHandler(internal, 11, 198, 29) { this.customSlots.put(11, this.addSlot(new SlotItemHandler(internal, 11, 138, 29) {
private final int slot = 11; private final int slot = 11;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(12, this.addSlot(new SlotItemHandler(internal, 12, 162, 47) { this.customSlots.put(12, this.addSlot(new SlotItemHandler(internal, 12, 102, 47) {
private final int slot = 12; private final int slot = 12;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(13, this.addSlot(new SlotItemHandler(internal, 13, 180, 47) { this.customSlots.put(13, this.addSlot(new SlotItemHandler(internal, 13, 120, 47) {
private final int slot = 13; private final int slot = 13;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(14, this.addSlot(new SlotItemHandler(internal, 14, 198, 47) { this.customSlots.put(14, this.addSlot(new SlotItemHandler(internal, 14, 138, 47) {
private final int slot = 14; private final int slot = 14;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(15, this.addSlot(new SlotItemHandler(internal, 15, 162, 65) { this.customSlots.put(15, this.addSlot(new SlotItemHandler(internal, 15, 102, 65) {
private final int slot = 15; private final int slot = 15;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(16, this.addSlot(new SlotItemHandler(internal, 16, 180, 65) { this.customSlots.put(16, this.addSlot(new SlotItemHandler(internal, 16, 120, 65) {
private final int slot = 16; private final int slot = 16;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(17, this.addSlot(new SlotItemHandler(internal, 17, 198, 65) { this.customSlots.put(17, this.addSlot(new SlotItemHandler(internal, 17, 138, 65) {
private final int slot = 17; private final int slot = 17;
private int x = MailboxGUIMenu.this.x; private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y; private int y = MailboxGUIMenu.this.y;
})); }));
this.customSlots.put(99, this.addSlot(new SlotItemHandler(internal, 99, 183, 29) {
private final int slot = 99;
private int x = MailboxGUIMenu.this.x;
private int y = MailboxGUIMenu.this.y;
@Override
public boolean mayPlace(ItemStack itemstack) {
return !MailboxSlot99ShippingLabelInsertionConditionProcedure.execute(itemstack);
}
}));
for (int si = 0; si < 3; ++si) for (int si = 0; si < 3; ++si)
for (int sj = 0; sj < 9; ++sj) for (int sj = 0; sj < 9; ++sj)
this.addSlot(new Slot(inv, sj + (si + 1) * 9, 92 + 8 + sj * 18, 7 + 84 + si * 18)); this.addSlot(new Slot(inv, sj + (si + 1) * 9, 32 + 8 + sj * 18, 7 + 84 + si * 18));
for (int si = 0; si < 9; ++si) for (int si = 0; si < 9; ++si)
this.addSlot(new Slot(inv, si, 92 + 8 + si * 18, 7 + 142)); this.addSlot(new Slot(inv, si, 32 + 8 + si * 18, 7 + 142));
} }
@Override @Override
@@ -239,16 +250,16 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
if (slot != null && slot.hasItem()) { if (slot != null && slot.hasItem()) {
ItemStack itemstack1 = slot.getItem(); ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.copy(); itemstack = itemstack1.copy();
if (index < 18) { if (index < 19) {
if (!this.moveItemStackTo(itemstack1, 18, this.slots.size(), true)) if (!this.moveItemStackTo(itemstack1, 19, this.slots.size(), true))
return ItemStack.EMPTY; return ItemStack.EMPTY;
slot.onQuickCraft(itemstack1, itemstack); slot.onQuickCraft(itemstack1, itemstack);
} else if (!this.moveItemStackTo(itemstack1, 0, 18, false)) { } else if (!this.moveItemStackTo(itemstack1, 0, 19, false)) {
if (index < 18 + 27) { if (index < 19 + 27) {
if (!this.moveItemStackTo(itemstack1, 18 + 27, this.slots.size(), true)) if (!this.moveItemStackTo(itemstack1, 19 + 27, this.slots.size(), true))
return ItemStack.EMPTY; return ItemStack.EMPTY;
} else { } else {
if (!this.moveItemStackTo(itemstack1, 18, 18 + 27, false)) if (!this.moveItemStackTo(itemstack1, 19, 19 + 27, false))
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
return ItemStack.EMPTY; return ItemStack.EMPTY;
@@ -366,6 +377,8 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
continue; continue;
if (j == 9) if (j == 9)
continue; continue;
if (j == 99)
continue;
playerIn.drop(internal.extractItem(j, internal.getStackInSlot(j).getCount(), false), false); playerIn.drop(internal.extractItem(j, internal.getStackInSlot(j).getCount(), false), false);
} }
} else { } else {
@@ -390,6 +403,8 @@ public class MailboxGUIMenu extends AbstractContainerMenu implements Supplier<Ma
continue; continue;
if (i == 9) if (i == 9)
continue; continue;
if (i == 99)
continue;
playerIn.getInventory().placeItemBackInInventory(internal.extractItem(i, internal.getStackInSlot(i).getCount(), false)); playerIn.getInventory().placeItemBackInInventory(internal.extractItem(i, internal.getStackInSlot(i).getCount(), false));
} }
} }

View File

@@ -22,6 +22,7 @@
"item.nims_random_bullshit.sand_dust": "Sand Dust", "item.nims_random_bullshit.sand_dust": "Sand Dust",
"item.nims_random_bullshit.magic_flesh": "Magic Flesh", "item.nims_random_bullshit.magic_flesh": "Magic Flesh",
"item.nims_random_bullshit.ghoul_spawn_egg": "Ghoul Spawn Egg", "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.block_eater": "Block Eater",
"item.nims_random_bullshit.golden_berries": "Golden Berries", "item.nims_random_bullshit.golden_berries": "Golden Berries",
"item.nims_random_bullshit.netherrack_juice_bucket": "Netherrack Juice Bucket", "item.nims_random_bullshit.netherrack_juice_bucket": "Netherrack Juice Bucket",

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,23 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"pattern": [
"ab",
"c "
],
"key": {
"a": {
"item": "minecraft:iron_block"
},
"b": {
"item": "minecraft:lever"
},
"c": {
"item": "minecraft:stick"
}
},
"result": {
"item": "nims_random_bullshit:mailbox",
"count": 1
}
}

View File

@@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "minecraft:paper"
},
{
"item": "minecraft:ink_sac"
}
],
"result": {
"item": "nims_random_bullshit:shipping_label",
"count": 1
}
}