From 8ffe8357c1c945450c8100bc2e840cc1120667b8 Mon Sep 17 00:00:00 2001 From: Danielxs01 Date: Thu, 6 Jan 2022 21:43:08 +0100 Subject: [PATCH] [#23/#25] Fixed BlockSenderGUI (it opens now) Added ButtonReceiver (not functional right now) Added Button partly (also not functional) --- .../BlockButtonReceiverFunctionEntity.java | 2 +- .../function/BlockSenderFunctionEntity.java | 10 +- .../BlockButtonReceiverStorageEntity.java | 8 +- .../stellwand/content/guis/SelectItem.java | 43 +- .../stellwand/content/items/CustomItems.java | 7 +- .../content/items/ItemBlockButton.java | 259 ++++++++++++ .../items/ItemBlockButtonReceiver.java | 8 +- .../items/connector/ItemConnectorSender.java | 2 + .../content/network/OpenSenderGui.java | 20 +- .../stellwand/contentpacks/Content.java | 15 +- .../entries/button/BlockButtonEntry.java | 42 ++ .../entries/button/BlockButtonEntryBlock.java | 15 + .../entries/button/BlockButtonEntryItem.java | 9 + ...try.java => BlockButtonReceiverEntry.java} | 16 +- ...ava => BlockButtonReceiverEntryBlock.java} | 6 +- ...java => BlockButtonReceiverEntryItem.java} | 4 +- .../contentpacks/loader/StaticLoader.java | 16 +- .../contentpacks/types/EntryType.java | 37 +- .../utils/compact/SignalContainer.java | 18 +- .../utils/mapper/SignalContainerMapper.java | 7 +- .../block/blockbutton/lamp_red/gray.png | Bin 0 -> 87 bytes .../blockbutton/lamp_red/lampred.bbmodel | 1 + .../block/blockbutton/lamp_red/lampred.mtl | 10 + .../block/blockbutton/lamp_red/lampred.obj | 398 ++++++++++++++++++ .../block/blockbutton/lamp_red/offglass.png | Bin 0 -> 87 bytes .../block/blockbutton/lamp_red/onglass.png | Bin 0 -> 87 bytes .../block/blockbutton/lamp_red/texture.png | Bin 0 -> 87 bytes 27 files changed, 857 insertions(+), 96 deletions(-) create mode 100644 src/main/java/net/landofrails/stellwand/content/items/ItemBlockButton.java create mode 100644 src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntry.java create mode 100644 src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntryBlock.java create mode 100644 src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntryItem.java rename src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/{BlockReceiverEntry.java => BlockButtonReceiverEntry.java} (67%) rename src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/{BlockReceiverEntryBlock.java => BlockButtonReceiverEntryBlock.java} (67%) rename src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/{BlockReceiverEntryItem.java => BlockButtonReceiverEntryItem.java} (53%) create mode 100644 src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/gray.png create mode 100644 src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.bbmodel create mode 100644 src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.mtl create mode 100644 src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.obj create mode 100644 src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/offglass.png create mode 100644 src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/onglass.png create mode 100644 src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/texture.png diff --git a/src/main/java/net/landofrails/stellwand/content/entities/function/BlockButtonReceiverFunctionEntity.java b/src/main/java/net/landofrails/stellwand/content/entities/function/BlockButtonReceiverFunctionEntity.java index 001644d6..894b5451 100644 --- a/src/main/java/net/landofrails/stellwand/content/entities/function/BlockButtonReceiverFunctionEntity.java +++ b/src/main/java/net/landofrails/stellwand/content/entities/function/BlockButtonReceiverFunctionEntity.java @@ -20,7 +20,7 @@ protected BlockButtonReceiverFunctionEntity() { @Override public ItemStack onPick() { - ItemStack is = new ItemStack(CustomItems.ITEMBLOCKRECEIVER, 1); + ItemStack is = new ItemStack(CustomItems.ITEMBLOCKBUTTONRECEIVER, 1); TagCompound tag = is.getTagCompound(); tag.setString("itemId", entity.getContentPackBlockId()); is.setTagCompound(tag); diff --git a/src/main/java/net/landofrails/stellwand/content/entities/function/BlockSenderFunctionEntity.java b/src/main/java/net/landofrails/stellwand/content/entities/function/BlockSenderFunctionEntity.java index df78a484..3c687b53 100644 --- a/src/main/java/net/landofrails/stellwand/content/entities/function/BlockSenderFunctionEntity.java +++ b/src/main/java/net/landofrails/stellwand/content/entities/function/BlockSenderFunctionEntity.java @@ -70,13 +70,9 @@ public boolean onClick(Player player, Hand hand, Facing facing, Vec3d hit) { if (signalPos != null) { getWorld().keepLoaded(signalPos); - if (getWorld().hasBlockEntity(signalPos, BlockSignalStorageEntity.class)) { - BlockSignalStorageEntity signalEntity = getWorld().getBlockEntity(signalPos, BlockSignalStorageEntity.class); - OpenSenderGui packet = new OpenSenderGui(getPos(), SignalContainer.of(signalEntity)); - packet.sendToPlayer(player); - } else if (getWorld().hasBlockEntity(signalPos, BlockMultisignalStorageEntity.class)) { - BlockMultisignalStorageEntity signalEntity = getWorld().getBlockEntity(signalPos, BlockMultisignalStorageEntity.class); - OpenSenderGui packet = new OpenSenderGui(getPos(), SignalContainer.of(signalEntity)); + + if (SignalContainer.isSignal(getWorld(), signalPos)) { + OpenSenderGui packet = new OpenSenderGui(getPos(), SignalContainer.of(getWorld(), signalPos)); packet.sendToPlayer(player); } else { entity.signals.remove(signalPos); diff --git a/src/main/java/net/landofrails/stellwand/content/entities/storage/BlockButtonReceiverStorageEntity.java b/src/main/java/net/landofrails/stellwand/content/entities/storage/BlockButtonReceiverStorageEntity.java index 188a5108..4d97dd12 100644 --- a/src/main/java/net/landofrails/stellwand/content/entities/storage/BlockButtonReceiverStorageEntity.java +++ b/src/main/java/net/landofrails/stellwand/content/entities/storage/BlockButtonReceiverStorageEntity.java @@ -11,7 +11,7 @@ import net.landofrails.stellwand.content.entities.rendering.BlockButtonReceiverRenderEntity; import net.landofrails.stellwand.content.entities.storage.versionmapper.VersionMapper; import net.landofrails.stellwand.contentpacks.Content; -import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockReceiverEntryBlock; +import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockButtonReceiverEntryBlock; import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntry; import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryBlock; import net.landofrails.stellwand.utils.StellwandUtils; @@ -73,7 +73,7 @@ public static void prepare() { ModCore.Mod.error("Error while loading blocknotfound.obj: %s", e.getMessage()); } // Add contentpack stuff - for (Map.Entry entry : Content.getBlockReceivers().entrySet()) { + for (Map.Entry entry : Content.getBlockButtonReceivers().entrySet()) { String name = null; String type = null; ContentPackEntryBlock cpeb = null; @@ -84,7 +84,7 @@ public static void prepare() { cpeb = entry.getKey().getBlock(); name = blockId; type = cpe.getType() != null ? cpe.getType().name() : "null"; - BlockReceiverEntryBlock block = cpe.getBlock(BlockReceiverEntryBlock.class); + BlockButtonReceiverEntryBlock block = cpe.getBlock(BlockButtonReceiverEntryBlock.class); String objPath = cpe.getModel(); Identifier id = new Identifier("stellwand", objPath); OBJModel m = new OBJModel(id, 0); @@ -122,7 +122,7 @@ public boolean getActive() { } public void setWallMounted(boolean wallMounted) { - if (wallMountable.containsKey(contentPackBlockId) && wallMountable.get(contentPackBlockId).booleanValue()) + if (wallMountable.containsKey(contentPackBlockId) && Boolean.TRUE.equals(wallMountable.get(contentPackBlockId))) this.wallMounted = wallMounted; } diff --git a/src/main/java/net/landofrails/stellwand/content/guis/SelectItem.java b/src/main/java/net/landofrails/stellwand/content/guis/SelectItem.java index 93806670..433438e7 100644 --- a/src/main/java/net/landofrails/stellwand/content/guis/SelectItem.java +++ b/src/main/java/net/landofrails/stellwand/content/guis/SelectItem.java @@ -7,14 +7,11 @@ import cam72cam.mod.gui.screen.Button; import cam72cam.mod.gui.screen.IScreen; import cam72cam.mod.gui.screen.IScreenBuilder; -import cam72cam.mod.item.CustomItem; import cam72cam.mod.item.ItemStack; import cam72cam.mod.serialization.TagCompound; -import net.landofrails.stellwand.content.items.CustomItems; import net.landofrails.stellwand.contentpacks.Content; import net.landofrails.stellwand.contentpacks.entries.ContentPack; import net.landofrails.stellwand.contentpacks.types.EntryType; -import net.landofrails.stellwand.utils.exceptions.ContentPackException; import java.util.*; import java.util.function.Consumer; @@ -39,12 +36,9 @@ public static void setEntryType(EntryType type, Map.Entry getItemStackForContentPack(ContentPack pack, EntryType type) { List items = new ArrayList<>(); Content.getBlocks(pack, type).forEach((cpe, value) -> { - ItemStack is = new ItemStack(getCustomItemForEntryType(Objects.requireNonNull(type)), 1); + ItemStack is = new ItemStack(type.getCustomItem(), 1); TagCompound tag = is.getTagCompound(); tag.setString("itemId", cpe.getBlockId(value)); is.setTagCompound(tag); @@ -79,23 +72,6 @@ private List getItemStackForContentPack(ContentPack pack, EntryType t return items; } - private CustomItem getCustomItemForEntryType(EntryType type) { - switch (type) { - case BLOCKMULTISIGNAL: - return CustomItems.ITEMBLOCKMULTISIGNAL; - case BLOCKSENDER: - return CustomItems.ITEMBLOCKSENDER; - case BLOCKSIGNAL: - return CustomItems.ITEMBLOCKSIGNAL; - case BLOCKFILLER: - return CustomItems.ITEMBLOCKFILLER; - case BLOCKRECEIVER: - return CustomItems.ITEMBLOCKRECEIVER; - default: - throw new ContentPackException("I must have forgot to add this EntryType to this method: " + type); - } - } - private void generateContentPackButtons(IScreenBuilder screen, Collection contentPacks) { int index = 0; for (ContentPack contentPack : contentPacks) { @@ -122,21 +98,6 @@ public void onClick(Player.Hand hand) { } } - private EntryType getEntryTypeFromItem(ItemStack itemStack) { - if (itemStack.is(CustomItems.ITEMBLOCKFILLER)) { - return EntryType.BLOCKFILLER; - } else if (itemStack.is(CustomItems.ITEMBLOCKMULTISIGNAL)) { - return EntryType.BLOCKMULTISIGNAL; - } else if (itemStack.is(CustomItems.ITEMBLOCKRECEIVER)) { - return EntryType.BLOCKRECEIVER; - } else if (itemStack.is(CustomItems.ITEMBLOCKSENDER)) { - return EntryType.BLOCKSENDER; - } else if (itemStack.is(CustomItems.ITEMBLOCKSIGNAL)) { - return EntryType.BLOCKSIGNAL; - } - return null; - } - /** * Method to open this GUI with arguments * diff --git a/src/main/java/net/landofrails/stellwand/content/items/CustomItems.java b/src/main/java/net/landofrails/stellwand/content/items/CustomItems.java index 86c90686..e9b85879 100644 --- a/src/main/java/net/landofrails/stellwand/content/items/CustomItems.java +++ b/src/main/java/net/landofrails/stellwand/content/items/CustomItems.java @@ -12,6 +12,7 @@ public class CustomItems { + private CustomItems() { } @@ -27,7 +28,9 @@ private CustomItems() { public static final ItemBlockSignal ITEMBLOCKSIGNAL = new ItemBlockSignal(); public static final ItemBlockSender ITEMBLOCKSENDER = new ItemBlockSender(); public static final ItemBlockMultisignal ITEMBLOCKMULTISIGNAL = new ItemBlockMultisignal(); - public static final ItemBlockButtonReceiver ITEMBLOCKRECEIVER = new ItemBlockButtonReceiver(); + // TODO: Implement + public static final ItemBlockButton ITEMBLOCKBUTTON = null; + public static final ItemBlockButtonReceiver ITEMBLOCKBUTTONRECEIVER = new ItemBlockButtonReceiver(); public static void register() { itemList.add(ITEMCONNECTOR1); @@ -39,7 +42,7 @@ public static void register() { ItemRender.register(ITEMBLOCKSIGNAL, ItemBlockSignal.getModelFor()); ItemRender.register(ITEMBLOCKSENDER, ItemBlockSender.getModelFor()); ItemRender.register(ITEMBLOCKMULTISIGNAL, ItemBlockMultisignal.getModelFor()); - ItemRender.register(ITEMBLOCKRECEIVER, ItemBlockButtonReceiver.getModelFor()); + ItemRender.register(ITEMBLOCKBUTTONRECEIVER, ItemBlockButtonReceiver.getModelFor()); } diff --git a/src/main/java/net/landofrails/stellwand/content/items/ItemBlockButton.java b/src/main/java/net/landofrails/stellwand/content/items/ItemBlockButton.java new file mode 100644 index 00000000..9b8d47ff --- /dev/null +++ b/src/main/java/net/landofrails/stellwand/content/items/ItemBlockButton.java @@ -0,0 +1,259 @@ +package net.landofrails.stellwand.content.items; + +import cam72cam.mod.block.BlockTypeEntity; +import cam72cam.mod.entity.Player; +import cam72cam.mod.item.ClickResult; +import cam72cam.mod.item.CreativeTab; +import cam72cam.mod.item.CustomItem; +import cam72cam.mod.item.ItemStack; +import cam72cam.mod.math.Vec3d; +import cam72cam.mod.math.Vec3i; +import cam72cam.mod.model.obj.OBJModel; +import cam72cam.mod.render.ItemRender; +import cam72cam.mod.render.OpenGL; +import cam72cam.mod.render.StandardModel; +import cam72cam.mod.render.obj.OBJRender; +import cam72cam.mod.resource.Identifier; +import cam72cam.mod.serialization.TagCompound; +import cam72cam.mod.util.Facing; +import cam72cam.mod.world.World; +import net.landofrails.landofsignals.LandOfSignals; +import net.landofrails.stellwand.Stellwand; +import net.landofrails.stellwand.content.blocks.CustomBlocks; +import net.landofrails.stellwand.content.entities.storage.BlockButtonReceiverStorageEntity; +import net.landofrails.stellwand.content.guis.SelectItem; +import net.landofrails.stellwand.content.network.ChangeHandHeldItem; +import net.landofrails.stellwand.content.tabs.CustomTabs; +import net.landofrails.stellwand.contentpacks.Content; +import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntry; +import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryItem; +import net.landofrails.stellwand.contentpacks.types.EntryType; +import org.lwjgl.opengl.GL11; + +import java.util.*; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +public class ItemBlockButton extends CustomItem { + + private static final String ITEMID = "itemId"; + + // VARIABLES + public static final String MISSING = "missing"; + private static Map models = new HashMap<>(); + private static Map renderers = new HashMap<>(); + private static Map rotations = new HashMap<>(); + private static Map translations = new HashMap<>(); + private static Map scales = new HashMap<>(); + private static Map modes = new HashMap<>(); + + public ItemBlockButton() { + super(LandOfSignals.MODID, "stellwand.itemblockbutton"); + } + + // Only for Clientside + public static void init() { + if (models.isEmpty()) { + try { + Identifier id = new Identifier(Stellwand.DOMAIN, "models/block/others/blocknotfound/blocknotfound.obj"); + OBJModel model = new OBJModel(id, 0); + models.put(MISSING, model); + // Renderers in render function + rotations.put(MISSING, new float[]{15, 195, 0}); + translations.put(MISSING, new float[]{0.5f, 0.5f, 0.5f}); + scales.put(MISSING, 0.7f); + modes.put(MISSING, null); + } catch (Exception e) { + e.printStackTrace(); + } + + // ContentPack + for (Entry entry : Content.getBlockButtons().entrySet()) { + try { + ContentPackEntry cpe = entry.getKey(); + String packId = entry.getValue(); + String itemName = cpe.getBlockId(packId); + ContentPackEntryItem item = cpe.getItem(); + Identifier id = new Identifier("stellwand", item.getModel()); + OBJModel model = new OBJModel(id, 0); + + models.put(itemName, model); + // Renderers in render function + rotations.put(itemName, item.getRotation()); + translations.put(itemName, item.getTranslation()); + scales.put(itemName, item.getScale()); + modes.put(itemName, item.getMode()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + } + + @Override + public List getCreativeTabs() { + return Collections.singletonList(CustomTabs.STELLWAND_TAB); + } + + @Override + public List getItemVariants(CreativeTab creativeTab) { + List items = new ArrayList<>(); + + if (creativeTab != null && !creativeTab.equals(CustomTabs.STELLWAND_TAB)) + return items; + + if (getFirstVarient() != null) + items.add(getFirstVarient()); + + return items; + } + + public ItemStack getFirstVarient() { + ItemStack is = null; + Iterator> it = Content.getBlockButtonReceivers().entrySet().iterator(); + if (it.hasNext()) { + Entry entry = it.next(); + + ContentPackEntry cpe = entry.getKey(); + is = new ItemStack(CustomItems.ITEMBLOCKBUTTONRECEIVER, 1); + TagCompound tag = is.getTagCompound(); + tag.setString(ITEMID, cpe.getBlockId(entry.getValue())); + is.setTagCompound(tag); + + } + return is; + } + + @Override + public void onClickAir(Player player, World world, Player.Hand hand) { + + if (world.isServer) { + return; + } + + int sizeInHand = player.getHeldItem(hand).getCount(); + SelectItem.open(player, EntryType.BLOCKBUTTONRECEIVER, new ItemStack(CustomItems.ITEMBLOCKBUTTONRECEIVER, 1), item -> { + if (item != null) { + player.setHeldItem(hand, item); + item.setCount(sizeInHand); + ChangeHandHeldItem packet = new ChangeHandHeldItem(player, item, hand); + packet.sendToServer(); + } + }); + + } + + public static ItemRender.IItemModel getModelFor() { + + return (world, stack) -> new StandardModel().addCustom(() -> { + + ItemBlockButtonReceiver.init(); + + TagCompound tag = stack.getTagCompound(); + String itemId = tag.getString(ITEMID); + if (itemId == null || !models.containsKey(itemId)) { + itemId = MISSING; + } + + if (renderers.get(itemId) == null) { + OBJModel model = models.get(itemId); + renderers.put(itemId, new OBJRender(model)); + } + + OBJRender renderer = renderers.get(itemId); + + float[] translate = translations.get(itemId); + float[] rotation = rotations.get(itemId); + // Enables the gui to display different modes + String customMode = stack.getTagCompound().getString("customMode"); + String mode = customMode != null ? customMode : modes.get(itemId); + float scale = scales.get(itemId); + OBJModel model = models.get(itemId); + try (OpenGL.With ignored = OpenGL.matrix(); OpenGL.With ignored1 = renderer.bindTexture()) { + GL11.glTranslated(translate[0], translate[1], translate[2]); + GL11.glRotatef(rotation[0], 1, 0, 0); + GL11.glRotatef(rotation[1], 0, 1, 0); + GL11.glRotatef(rotation[2], 0, 0, 1); + GL11.glScaled(scale, scale, scale); + + if (mode == null) { + + renderer.draw(); + + } else { + + ArrayList modes = model.groups().stream().filter(s -> s.startsWith(mode)) + .collect(Collectors.toCollection(ArrayList::new)); + + if (!modes.isEmpty()) { + ArrayList generals = model.groups().stream().filter(s -> s.startsWith("general")) + .collect(Collectors.toCollection(ArrayList::new)); + modes.addAll(generals); + renderer.drawGroups(modes); + } else { + renderer.drawGroups(model.groups()); + } + + } + } + }); + } + + @Override + public ClickResult onClickBlock(Player player, World world, Vec3i pos, Player.Hand hand, Facing facing, Vec3d inBlockPos) { + Vec3i target = world.isReplaceable(pos) ? pos : pos.offset(facing); + + if (isStandingInBlock(player.getBlockPosition().subtract(target))) + return ClickResult.REJECTED; + + if (world.isAir(target) || world.isReplaceable(target)) { + + BlockTypeEntity block = CustomBlocks.BLOCKRECEIVER; + + world.setBlock(target, block); + if (!player.isCreative()) { + ItemStack is = player.getHeldItem(hand); + is.shrink(1); + player.setHeldItem(hand, is); + } + BlockButtonReceiverStorageEntity blockEntity = world.getBlockEntity(target, + BlockButtonReceiverStorageEntity.class); + // Set ContentPackBlockId + ItemStack item = player.getHeldItem(hand); + TagCompound tag = item.getTagCompound(); + if (blockEntity != null) { + if (tag != null && !tag.isEmpty()) + blockEntity + .setContentBlockId(tag.hasKey(ITEMID) + ? tag.getString(ITEMID) + : MISSING); + else + blockEntity.setContentBlockId(MISSING); + blockEntity.renderEntity + .setRotation(player.getRotationYawHead()); + blockEntity.setWallMounted(!facing.equals(Facing.DOWN) && !facing.equals(Facing.UP)); + } + // + + return ClickResult.ACCEPTED; + } + + return ClickResult.REJECTED; + } + + private boolean isStandingInBlock(Vec3i vec3i) { + return vec3i.x == 0 && vec3i.z == 0 && (vec3i.y == 0 || vec3i.y == -1); + } + + @Override + public List getTooltip(ItemStack itemStack) { + String lore = ""; + TagCompound tag = itemStack.getTagCompound(); + if (tag.hasKey(ITEMID)) { + String itemId = tag.getString(ITEMID); + lore = Content.getNameForId(itemId); + } + return Collections.singletonList(lore); + } +} diff --git a/src/main/java/net/landofrails/stellwand/content/items/ItemBlockButtonReceiver.java b/src/main/java/net/landofrails/stellwand/content/items/ItemBlockButtonReceiver.java index 500033be..57b12d8a 100644 --- a/src/main/java/net/landofrails/stellwand/content/items/ItemBlockButtonReceiver.java +++ b/src/main/java/net/landofrails/stellwand/content/items/ItemBlockButtonReceiver.java @@ -68,7 +68,7 @@ public static void init() { } // ContentPack - for (Entry entry : Content.getBlockReceivers().entrySet()) { + for (Entry entry : Content.getBlockButtonReceivers().entrySet()) { try { ContentPackEntry cpe = entry.getKey(); String packId = entry.getValue(); @@ -111,12 +111,12 @@ public List getItemVariants(CreativeTab creativeTab) { public ItemStack getFirstVarient() { ItemStack is = null; - Iterator> it = Content.getBlockReceivers().entrySet().iterator(); + Iterator> it = Content.getBlockButtonReceivers().entrySet().iterator(); if (it.hasNext()) { Entry entry = it.next(); ContentPackEntry cpe = entry.getKey(); - is = new ItemStack(CustomItems.ITEMBLOCKRECEIVER, 1); + is = new ItemStack(CustomItems.ITEMBLOCKBUTTONRECEIVER, 1); TagCompound tag = is.getTagCompound(); tag.setString(ITEMID, cpe.getBlockId(entry.getValue())); is.setTagCompound(tag); @@ -133,7 +133,7 @@ public void onClickAir(Player player, World world, Player.Hand hand) { } int sizeInHand = player.getHeldItem(hand).getCount(); - SelectItem.open(player, EntryType.BLOCKRECEIVER, new ItemStack(CustomItems.ITEMBLOCKRECEIVER, 1), item -> { + SelectItem.open(player, EntryType.BLOCKBUTTONRECEIVER, new ItemStack(CustomItems.ITEMBLOCKBUTTONRECEIVER, 1), item -> { if (item != null) { player.setHeldItem(hand, item); item.setCount(sizeInHand); diff --git a/src/main/java/net/landofrails/stellwand/content/items/connector/ItemConnectorSender.java b/src/main/java/net/landofrails/stellwand/content/items/connector/ItemConnectorSender.java index f921a99c..c9604d49 100644 --- a/src/main/java/net/landofrails/stellwand/content/items/connector/ItemConnectorSender.java +++ b/src/main/java/net/landofrails/stellwand/content/items/connector/ItemConnectorSender.java @@ -74,6 +74,8 @@ protected boolean connect(World world, Vec3i pos, Player player, Player.Hand han sender.updateSignals(); sender.markDirty(); return true; + + } else { ServerMessagePacket.send(player, EMessage.MESSAGE_SIGNALS_MUST_BE_EQUAL); } diff --git a/src/main/java/net/landofrails/stellwand/content/network/OpenSenderGui.java b/src/main/java/net/landofrails/stellwand/content/network/OpenSenderGui.java index 7fc98738..2b7e670e 100644 --- a/src/main/java/net/landofrails/stellwand/content/network/OpenSenderGui.java +++ b/src/main/java/net/landofrails/stellwand/content/network/OpenSenderGui.java @@ -1,9 +1,11 @@ package net.landofrails.stellwand.content.network; import cam72cam.mod.block.BlockEntity; +import cam72cam.mod.entity.Player; import cam72cam.mod.math.Vec3i; import cam72cam.mod.net.Packet; import cam72cam.mod.serialization.TagField; +import cam72cam.mod.text.PlayerMessage; import net.landofrails.stellwand.Stellwand; import net.landofrails.stellwand.content.entities.storage.BlockSenderStorageEntity; import net.landofrails.stellwand.content.guis.CustomGuis; @@ -27,14 +29,26 @@ public OpenSenderGui(Vec3i senderPos, SignalContainer signalTile) { this.signalTile = signalTile; } + @Override + public void sendToPlayer(Player player) { + if (signalTile == null) { + player.sendMessage(PlayerMessage.direct("SignalContainer is empty! This is a technical error.")); + } + super.sendToPlayer(player); + } + @Override protected void handle() { Stellwand.info("Opening SelectSenderModesGui"); - BlockSenderStorageEntity sender = getWorld().getBlockEntity(senderPos, BlockSenderStorageEntity.class); - sender.setSignal(signalTile); - CustomGuis.selectSenderModes.open(getPlayer(), senderPos); + if (signalTile != null) { + BlockSenderStorageEntity sender = getWorld().getBlockEntity(senderPos, BlockSenderStorageEntity.class); + sender.setSignal(signalTile); + CustomGuis.selectSenderModes.open(getPlayer(), senderPos); + } else { + getPlayer().sendMessage(PlayerMessage.direct("No signalentity transmitted. This seems to be a technical error.")); + } } diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/Content.java b/src/main/java/net/landofrails/stellwand/contentpacks/Content.java index 9feafa8e..69d1f1c3 100644 --- a/src/main/java/net/landofrails/stellwand/contentpacks/Content.java +++ b/src/main/java/net/landofrails/stellwand/contentpacks/Content.java @@ -81,11 +81,21 @@ public static Map getBlockMultisignals() { return entries; } - public static Map getBlockReceivers() { + public static Map getBlockButtonReceivers() { Map entries = new LinkedHashMap<>(); for (ContentPack pack : contentPacks) { for (ContentPackEntry entry : pack.getEntries()) - if (entry.isType(EntryType.BLOCKRECEIVER)) + if (entry.isType(EntryType.BLOCKBUTTONRECEIVER)) + entries.put(entry, pack.getId()); + } + return entries; + } + + public static Map getBlockButtons() { + Map entries = new LinkedHashMap<>(); + for (ContentPack pack : contentPacks) { + for (ContentPackEntry entry : pack.getEntries()) + if (entry.isType(EntryType.BLOCKBUTTON)) entries.put(entry, pack.getId()); } return entries; @@ -126,4 +136,5 @@ public static Map getBlocks(ContentPack pack, EntryTyp ); // @formatter:on } + } diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntry.java b/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntry.java new file mode 100644 index 00000000..a174b96c --- /dev/null +++ b/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntry.java @@ -0,0 +1,42 @@ +package net.landofrails.stellwand.contentpacks.entries.button; + +import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntry; +import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryBlock; +import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryItem; +import net.landofrails.stellwand.contentpacks.types.EntryType; + +public class BlockButtonEntry extends ContentPackEntry { + + private BlockButtonEntryBlock block; + private BlockButtonEntryItem item; + + public BlockButtonEntry() { + + } + + public BlockButtonEntry( + String name, + String model, + BlockButtonEntryBlock block, + BlockButtonEntryItem item + ) { + super(name, model); + this.block = block; + this.item = item; + } + + @Override + public ContentPackEntryBlock getBlock() { + return block; + } + + @Override + public ContentPackEntryItem getItem() { + return item; + } + + @Override + public EntryType getType() { + return EntryType.BLOCKBUTTON; + } +} diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntryBlock.java b/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntryBlock.java new file mode 100644 index 00000000..a836d35d --- /dev/null +++ b/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntryBlock.java @@ -0,0 +1,15 @@ +package net.landofrails.stellwand.contentpacks.entries.button; + +import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryBlock; + +public class BlockButtonEntryBlock extends ContentPackEntryBlock { + + + public BlockButtonEntryBlock() { + } + + public BlockButtonEntryBlock(float[] rotation, float[] translation, Boolean wallMountable) { + super(rotation, translation); + } + +} diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntryItem.java b/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntryItem.java new file mode 100644 index 00000000..4a050b2d --- /dev/null +++ b/src/main/java/net/landofrails/stellwand/contentpacks/entries/button/BlockButtonEntryItem.java @@ -0,0 +1,9 @@ +package net.landofrails.stellwand.contentpacks.entries.button; + +import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryItem; + +public class BlockButtonEntryItem extends ContentPackEntryItem { + public BlockButtonEntryItem(float[] rotation, float[] translation, float scale, String model, String mode) { + super(rotation, translation, scale, model, mode); + } +} diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntry.java b/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntry.java similarity index 67% rename from src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntry.java rename to src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntry.java index fc516f61..db72037c 100644 --- a/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntry.java +++ b/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntry.java @@ -5,20 +5,20 @@ import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryItem; import net.landofrails.stellwand.contentpacks.types.EntryType; -public class BlockReceiverEntry extends ContentPackEntry { +public class BlockButtonReceiverEntry extends ContentPackEntry { - private BlockReceiverEntryBlock block; - private BlockReceiverEntryItem item; + private BlockButtonReceiverEntryBlock block; + private BlockButtonReceiverEntryItem item; - public BlockReceiverEntry() { + public BlockButtonReceiverEntry() { } - public BlockReceiverEntry( + public BlockButtonReceiverEntry( String name, String model, - BlockReceiverEntryBlock block, - BlockReceiverEntryItem item + BlockButtonReceiverEntryBlock block, + BlockButtonReceiverEntryItem item ) { super(name, model); this.block = block; @@ -37,6 +37,6 @@ public ContentPackEntryItem getItem() { @Override public EntryType getType() { - return EntryType.BLOCKRECEIVER; + return EntryType.BLOCKBUTTONRECEIVER; } } diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntryBlock.java b/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntryBlock.java similarity index 67% rename from src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntryBlock.java rename to src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntryBlock.java index ed996413..aad34797 100644 --- a/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntryBlock.java +++ b/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntryBlock.java @@ -2,15 +2,15 @@ import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryBlock; -public class BlockReceiverEntryBlock extends ContentPackEntryBlock { +public class BlockButtonReceiverEntryBlock extends ContentPackEntryBlock { private Boolean wallMountable; - public BlockReceiverEntryBlock() { + public BlockButtonReceiverEntryBlock() { wallMountable = false; } - public BlockReceiverEntryBlock(float[] rotation, float[] translation, Boolean wallMountable) { + public BlockButtonReceiverEntryBlock(float[] rotation, float[] translation, Boolean wallMountable) { super(rotation, translation); this.wallMountable = wallMountable; } diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntryItem.java b/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntryItem.java similarity index 53% rename from src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntryItem.java rename to src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntryItem.java index 9635a896..06a5708b 100644 --- a/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockReceiverEntryItem.java +++ b/src/main/java/net/landofrails/stellwand/contentpacks/entries/buttonreceiver/BlockButtonReceiverEntryItem.java @@ -2,8 +2,8 @@ import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntryItem; -public class BlockReceiverEntryItem extends ContentPackEntryItem { - public BlockReceiverEntryItem(float[] rotation, float[] translation, float scale, String model, String mode) { +public class BlockButtonReceiverEntryItem extends ContentPackEntryItem { + public BlockButtonReceiverEntryItem(float[] rotation, float[] translation, float scale, String model, String mode) { super(rotation, translation, scale, model, mode); } } diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/loader/StaticLoader.java b/src/main/java/net/landofrails/stellwand/contentpacks/loader/StaticLoader.java index 1f351199..750d019a 100644 --- a/src/main/java/net/landofrails/stellwand/contentpacks/loader/StaticLoader.java +++ b/src/main/java/net/landofrails/stellwand/contentpacks/loader/StaticLoader.java @@ -5,9 +5,9 @@ import net.landofrails.stellwand.Stellwand; import net.landofrails.stellwand.contentpacks.Content; import net.landofrails.stellwand.contentpacks.entries.ContentPack; -import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockReceiverEntry; -import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockReceiverEntryBlock; -import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockReceiverEntryItem; +import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockButtonReceiverEntry; +import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockButtonReceiverEntryBlock; +import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockButtonReceiverEntryItem; import net.landofrails.stellwand.contentpacks.entries.filler.BlockFillerEntry; import net.landofrails.stellwand.contentpacks.entries.filler.BlockFillerEntryBlock; import net.landofrails.stellwand.contentpacks.entries.filler.BlockFillerEntryItem; @@ -255,7 +255,7 @@ private static List getEntries() { // Blockreceiver prop = new Properties().setName("Blockreceiver"); - prop.setType(EntryType.BLOCKRECEIVER).setWallMountable(true); + prop.setType(EntryType.BLOCKBUTTONRECEIVER).setWallMountable(true); prop.setModel("models/block/blockbuttonreceiver/blockbuttonreceiver/blockreceiver.obj"); prop.setBlockTranslation(.5f, 0, .5f); prop.setItemMode("on").setItemTranslation(.5f, .1625f, .5f); @@ -383,10 +383,10 @@ public ContentPackEntry toEntry() { BlockMultisignalEntryBlock multisignalBlock = new BlockMultisignalEntryBlock(blockRotation, blockTranslation, modesList); BlockMultisignalEntryItem multisignalItem = new BlockMultisignalEntryItem(itemRotation, itemTranslation, scale, model, itemMode); return new BlockMultisignalEntry(name, model, multisignalBlock, multisignalItem); - case BLOCKRECEIVER: - BlockReceiverEntryBlock receiverEntryBlock = new BlockReceiverEntryBlock(blockRotation, blockTranslation, wallMountable); - BlockReceiverEntryItem receiverEntryItem = new BlockReceiverEntryItem(itemRotation, itemTranslation, scale, model, itemMode); - return new BlockReceiverEntry(name, model, receiverEntryBlock, receiverEntryItem); + case BLOCKBUTTONRECEIVER: + BlockButtonReceiverEntryBlock receiverEntryBlock = new BlockButtonReceiverEntryBlock(blockRotation, blockTranslation, wallMountable); + BlockButtonReceiverEntryItem receiverEntryItem = new BlockButtonReceiverEntryItem(itemRotation, itemTranslation, scale, model, itemMode); + return new BlockButtonReceiverEntry(name, model, receiverEntryBlock, receiverEntryItem); default: return null; } diff --git a/src/main/java/net/landofrails/stellwand/contentpacks/types/EntryType.java b/src/main/java/net/landofrails/stellwand/contentpacks/types/EntryType.java index 001bbada..8b66611b 100644 --- a/src/main/java/net/landofrails/stellwand/contentpacks/types/EntryType.java +++ b/src/main/java/net/landofrails/stellwand/contentpacks/types/EntryType.java @@ -1,23 +1,52 @@ package net.landofrails.stellwand.contentpacks.types; +import cam72cam.mod.item.CustomItem; +import cam72cam.mod.item.ItemStack; +import net.landofrails.stellwand.content.items.CustomItems; +import net.landofrails.stellwand.contentpacks.entries.button.BlockButtonEntry; +import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockButtonReceiverEntry; import net.landofrails.stellwand.contentpacks.entries.filler.BlockFillerEntry; import net.landofrails.stellwand.contentpacks.entries.multisignal.BlockMultisignalEntry; import net.landofrails.stellwand.contentpacks.entries.parent.ContentPackEntry; -import net.landofrails.stellwand.contentpacks.entries.buttonreceiver.BlockReceiverEntry; import net.landofrails.stellwand.contentpacks.entries.sender.BlockSenderEntry; import net.landofrails.stellwand.contentpacks.entries.signal.BlockSignalEntry; +import java.util.function.Supplier; + public enum EntryType { - BLOCKSIGNAL(BlockSignalEntry.class), BLOCKSENDER(BlockSenderEntry.class), BLOCKFILLER(BlockFillerEntry.class), BLOCKMULTISIGNAL(BlockMultisignalEntry.class), BLOCKRECEIVER(BlockReceiverEntry.class); - private Class typeClass; + // @formatter:off + BLOCKSIGNAL(BlockSignalEntry.class, () -> CustomItems.ITEMBLOCKSIGNAL), + BLOCKSENDER(BlockSenderEntry.class, () -> CustomItems.ITEMBLOCKSENDER), + BLOCKFILLER(BlockFillerEntry.class, () -> CustomItems.ITEMBLOCKFILLER), + BLOCKMULTISIGNAL(BlockMultisignalEntry.class, () -> CustomItems.ITEMBLOCKMULTISIGNAL), + BLOCKBUTTON(BlockButtonEntry.class, () -> CustomItems.ITEMBLOCKBUTTON), + BLOCKBUTTONRECEIVER(BlockButtonReceiverEntry.class, () -> CustomItems.ITEMBLOCKBUTTONRECEIVER); + // @formatter:on + private final Class typeClass; + private final Supplier itemSupplier; - EntryType(Class typeClass) { + EntryType(Class typeClass, Supplier itemSupplier) { this.typeClass = typeClass; + this.itemSupplier = itemSupplier; } public Class getTypeClass() { return typeClass; } + public CustomItem getCustomItem() { + return itemSupplier.get(); + } + + public static EntryType getEntryTypeFromItem(ItemStack itemStack) { + + for (EntryType type : values()) { + if (itemStack.is(type.getCustomItem())) + return type; + } + + return null; + } + } diff --git a/src/main/java/net/landofrails/stellwand/utils/compact/SignalContainer.java b/src/main/java/net/landofrails/stellwand/utils/compact/SignalContainer.java index adafa183..67e34389 100644 --- a/src/main/java/net/landofrails/stellwand/utils/compact/SignalContainer.java +++ b/src/main/java/net/landofrails/stellwand/utils/compact/SignalContainer.java @@ -52,10 +52,12 @@ public static SignalContainer of(TagCompound tag) { EntryType type = tag.getEnum("type", EntryType.class); if (type.equals(EntryType.BLOCKSIGNAL)) { BlockSignalStorageEntity entity = tag.getTile(TILEENTITY, tag.getBoolean(ISCLIENT)); - return of(entity); + if (entity != null) + return of(entity); } else if (type.equals(EntryType.BLOCKMULTISIGNAL)) { BlockMultisignalStorageEntity entity = tag.getTile(TILEENTITY, tag.getBoolean(ISCLIENT)); - return of(entity); + if (entity != null) + return of(entity); } return null; } @@ -149,12 +151,20 @@ public EntryType getEntryType() { return null; } + /** + * Turns the SignalContainer to a TagCompound. + * isTargetClient needs to specify if the tileentity is to be + * extracted on client or server side. + * + * @param isTargetClient is target client? + * @return TagCompound containing tileentity and additional information + */ @SuppressWarnings("java:S1192") - public TagCompound toTagCompound() { + public TagCompound toTagCompound(boolean isTargetClient) { TagCompound tag = new TagCompound(); tag.setEnum("type", getEntryType()); tag.setTile(TILEENTITY, getAs(getSignalClass())); - tag.setBoolean(ISCLIENT, getRawInstance().getWorld().isClient); + tag.setBoolean(ISCLIENT, isTargetClient); return tag; } diff --git a/src/main/java/net/landofrails/stellwand/utils/mapper/SignalContainerMapper.java b/src/main/java/net/landofrails/stellwand/utils/mapper/SignalContainerMapper.java index 081b25a3..54db0483 100644 --- a/src/main/java/net/landofrails/stellwand/utils/mapper/SignalContainerMapper.java +++ b/src/main/java/net/landofrails/stellwand/utils/mapper/SignalContainerMapper.java @@ -1,18 +1,19 @@ package net.landofrails.stellwand.utils.mapper; +import cam72cam.mod.block.BlockEntity; import cam72cam.mod.serialization.TagField; import cam72cam.mod.serialization.TagMapper; import net.landofrails.stellwand.utils.compact.SignalContainer; -public class SignalContainerMapper implements TagMapper> { +public class SignalContainerMapper implements TagMapper> { @Override - public TagAccessor> apply(Class> type, String fieldName, TagField tag) { + public TagAccessor> apply(Class> type, String fieldName, TagField tag) { return new TagAccessor<>( (nbt, container) -> { // From Container to Tag if (container != null) - nbt.set(fieldName, container.toTagCompound()); + nbt.set(fieldName, container.toTagCompound(true)); }, // From Tag to Container nbt -> SignalContainer.of(nbt.get(fieldName)) diff --git a/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/gray.png b/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/gray.png new file mode 100644 index 0000000000000000000000000000000000000000..ff6890835d12072d24e7f0347be53b8e9f13cafc GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`a-J@ZAr}70Ir;hj&pR+C$e1=H jn(#=t9d1aBXklbHz@Qn}dLv*nP$h$>tDnm{r-UW|H0BmQ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.bbmodel b/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.bbmodel new file mode 100644 index 00000000..fccca38e --- /dev/null +++ b/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"3.6","creation_time":1637697835,"model_format":"free","box_uv":false},"name":"lampred","geometry_name":"","visible_box":[1,1,0],"resolution":{"width":16,"height":16},"elements":[{"name":"generalMount","rescale":false,"from":[-1.5,6.5,7],"to":[1.5,9.5,8],"autouv":1,"color":0,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,3,3],"texture":0},"east":{"uv":[0,0,1,3],"texture":0},"south":{"uv":[0,0,3,3],"texture":0},"west":{"uv":[0,0,1,3],"texture":0},"up":{"uv":[0,0,3,1],"texture":0},"down":{"uv":[0,0,3,1],"texture":0}},"uuid":"5bf25c79-c349-aec6-a67c-fd5da24baaea"},{"name":"offGlass","rescale":false,"from":[-1,7,4.5],"to":[1,9,7],"autouv":1,"color":1,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,2,2],"texture":1},"east":{"uv":[0,0,2.5,2],"texture":1},"south":{"uv":[0,0,2,2],"texture":1},"west":{"uv":[0,0,2.5,2],"texture":1},"up":{"uv":[0,0,2,2.5],"texture":1},"down":{"uv":[0,0,2,2.5],"texture":1}},"uuid":"d1974c16-4a0a-aa3a-3b0c-48c8fac6f5ed"},{"name":"buttonColor","rescale":false,"from":[-0.5,7.5,4.4],"to":[0.5,8.5,4.5],"autouv":1,"color":3,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,1,1],"texture":3},"east":{"uv":[0,0,0.09999999999999964,1],"texture":3},"south":{"uv":[0,0,1,1],"texture":3},"west":{"uv":[0,0,0.09999999999999964,1],"texture":3},"up":{"uv":[0,0,1,0.09999999999999964],"texture":3},"down":{"uv":[0,0,1,0.09999999999999964],"texture":3}},"uuid":"1952ac01-53ee-9d64-ca43-85772032c746"},{"name":"onGlass","rescale":false,"from":[-1,7,4.5],"to":[1,9,7],"autouv":1,"color":1,"locked":false,"visibility":false,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,2,2],"texture":2},"east":{"uv":[0,0,2.5,2],"texture":2},"south":{"uv":[0,0,2,2],"texture":2},"west":{"uv":[0,0,2.5,2],"texture":2},"up":{"uv":[0,0,2,2.5],"texture":2},"down":{"uv":[0,0,2,2.5],"texture":2}},"uuid":"1bb52a0d-ff75-e5cb-51f7-4dd593b9243c"}],"outliner":["5bf25c79-c349-aec6-a67c-fd5da24baaea","d1974c16-4a0a-aa3a-3b0c-48c8fac6f5ed","1bb52a0d-ff75-e5cb-51f7-4dd593b9243c","1952ac01-53ee-9d64-ca43-85772032c746"],"textures":[{"path":"","name":"gray","folder":"block","namespace":"","id":"0","particle":false,"visible":true,"mode":"bitmap","saved":false,"uuid":"009d013a-8ea5-7d51-ad5c-cb7fb847bd32","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAHklEQVQ4T2Nsb2//z0ABYBw1gGE0DBhGw4BhWIQBAMAAKVGF2FCzAAAAAElFTkSuQmCC"},{"path":"","name":"offglass","folder":"block","namespace":"","id":"4","particle":false,"visible":true,"mode":"bitmap","saved":false,"uuid":"aa24b298-6cc6-1b14-552c-086f5f32f54c","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAHklEQVQ4T2PctWvXfgYKAOOoAQyjYcAwGgYMwyIMAL7cLuEWMDICAAAAAElFTkSuQmCC"},{"path":"","name":"onglass","folder":"block","namespace":"","id":"3","particle":false,"visible":true,"mode":"bitmap","saved":false,"uuid":"993cf7e5-39ce-2024-e19e-8cf6cde88005","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAHklEQVQ4T2N89+7dfgYKAOOoAQyjYcAwGgYMwyIMALd3OKHfNAo0AAAAAElFTkSuQmCC"},{"path":"","name":"texture","folder":"block","namespace":"","id":"2","particle":false,"visible":true,"mode":"bitmap","saved":false,"uuid":"18ec5e72-ef63-198c-3b16-099a51125f41","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAHklEQVQ4T2Ncw8//n4ECwDhqAMNoGDCMhgHDsAgDAH/DHKGHtuP1AAAAAElFTkSuQmCC"}]} \ No newline at end of file diff --git a/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.mtl b/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.mtl new file mode 100644 index 00000000..911d357a --- /dev/null +++ b/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.mtl @@ -0,0 +1,10 @@ +# Made in Blockbench 3.8.4 +newmtl m_0 +map_Kd gray +newmtl m_2 +map_Kd texture +newmtl m_3 +map_Kd onglass +newmtl m_4 +map_Kd offglass +newmtl none \ No newline at end of file diff --git a/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.obj b/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.obj new file mode 100644 index 00000000..b052055d --- /dev/null +++ b/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/lampred.obj @@ -0,0 +1,398 @@ +# Made in Blockbench 3.8.4 +mtllib lampred.mtl +o generalMount +v 0.09375 0.59375 0.5 +v 0.09375 0.59375 0.4375 +v 0.09375 0.40625 0.5 +v 0.09375 0.40625 0.4375 +v -0.09375 0.59375 0.4375 +v -0.09375 0.59375 0.5 +v -0.09375 0.40625 0.4375 +v -0.09375 0.40625 0.5 +vt 0 1 +vt 0 0.8125 +vt 0.0625 1 +vt 0 0.8125 +vt 0.0625 0.8125 +vt 0.0625 1 +vt 0 1 +vt 0 0.8125 +vt 0.0625 1 +vt 0 0.8125 +vt 0.0625 0.8125 +vt 0.0625 1 +vt 0 1 +vt 0 0.9375 +vt 0.1875 1 +vt 0 0.9375 +vt 0.1875 0.9375 +vt 0.1875 1 +vt 0 1 +vt 0 0.9375 +vt 0.1875 1 +vt 0 0.9375 +vt 0.1875 0.9375 +vt 0.1875 1 +vt 0 1 +vt 0 0.8125 +vt 0.1875 1 +vt 0 0.8125 +vt 0.1875 0.8125 +vt 0.1875 1 +vt 0 1 +vt 0 0.8125 +vt 0.1875 1 +vt 0 0.8125 +vt 0.1875 0.8125 +vt 0.1875 1 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +usemtl m_0 +f 1/1/1 3/2/2 2/3/3 +f 3/4/4 4/5/5 2/6/6 +usemtl m_0 +f 5/7/7 7/8/8 6/9/9 +f 7/10/10 8/11/11 6/12/12 +usemtl m_0 +f 5/13/13 6/14/14 2/15/15 +f 6/16/16 1/17/17 2/18/18 +usemtl m_0 +f 8/19/19 7/20/20 3/21/21 +f 7/22/22 4/23/23 3/24/24 +usemtl m_0 +f 6/25/25 8/26/26 1/27/27 +f 8/28/28 3/29/29 1/30/30 +usemtl m_0 +f 2/31/31 4/32/32 5/33/33 +f 4/34/34 7/35/35 5/36/36 +o offGlass +v 0.0625 0.5625 0.4375 +v 0.0625 0.5625 0.28125 +v 0.0625 0.4375 0.4375 +v 0.0625 0.4375 0.28125 +v -0.0625 0.5625 0.28125 +v -0.0625 0.5625 0.4375 +v -0.0625 0.4375 0.28125 +v -0.0625 0.4375 0.4375 +vt 0 1 +vt 0 0.875 +vt 0.15625 1 +vt 0 0.875 +vt 0.15625 0.875 +vt 0.15625 1 +vt 0 1 +vt 0 0.875 +vt 0.15625 1 +vt 0 0.875 +vt 0.15625 0.875 +vt 0.15625 1 +vt 0 1 +vt 0 0.84375 +vt 0.125 1 +vt 0 0.84375 +vt 0.125 0.84375 +vt 0.125 1 +vt 0 1 +vt 0 0.84375 +vt 0.125 1 +vt 0 0.84375 +vt 0.125 0.84375 +vt 0.125 1 +vt 0 1 +vt 0 0.875 +vt 0.125 1 +vt 0 0.875 +vt 0.125 0.875 +vt 0.125 1 +vt 0 1 +vt 0 0.875 +vt 0.125 1 +vt 0 0.875 +vt 0.125 0.875 +vt 0.125 1 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +usemtl m_4 +f 9/37/37 11/38/38 10/39/39 +f 11/40/40 12/41/41 10/42/42 +usemtl m_4 +f 13/43/43 15/44/44 14/45/45 +f 15/46/46 16/47/47 14/48/48 +usemtl m_4 +f 13/49/49 14/50/50 10/51/51 +f 14/52/52 9/53/53 10/54/54 +usemtl m_4 +f 16/55/55 15/56/56 11/57/57 +f 15/58/58 12/59/59 11/60/60 +usemtl m_4 +f 14/61/61 16/62/62 9/63/63 +f 16/64/64 11/65/65 9/66/66 +usemtl m_4 +f 10/67/67 12/68/68 13/69/69 +f 12/70/70 15/71/71 13/72/72 +o buttonColor +v 0.03125 0.53125 0.28125 +v 0.03125 0.53125 0.275 +v 0.03125 0.46875 0.28125 +v 0.03125 0.46875 0.275 +v -0.03125 0.53125 0.275 +v -0.03125 0.53125 0.28125 +v -0.03125 0.46875 0.275 +v -0.03125 0.46875 0.28125 +vt 0 1 +vt 0 0.9375 +vt 0.006249999999999978 1 +vt 0 0.9375 +vt 0.006249999999999978 0.9375 +vt 0.006249999999999978 1 +vt 0 1 +vt 0 0.9375 +vt 0.006249999999999978 1 +vt 0 0.9375 +vt 0.006249999999999978 0.9375 +vt 0.006249999999999978 1 +vt 0 1 +vt 0 0.99375 +vt 0.0625 1 +vt 0 0.99375 +vt 0.0625 0.99375 +vt 0.0625 1 +vt 0 1 +vt 0 0.99375 +vt 0.0625 1 +vt 0 0.99375 +vt 0.0625 0.99375 +vt 0.0625 1 +vt 0 1 +vt 0 0.9375 +vt 0.0625 1 +vt 0 0.9375 +vt 0.0625 0.9375 +vt 0.0625 1 +vt 0 1 +vt 0 0.9375 +vt 0.0625 1 +vt 0 0.9375 +vt 0.0625 0.9375 +vt 0.0625 1 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +usemtl m_2 +f 17/73/73 19/74/74 18/75/75 +f 19/76/76 20/77/77 18/78/78 +usemtl m_2 +f 21/79/79 23/80/80 22/81/81 +f 23/82/82 24/83/83 22/84/84 +usemtl m_2 +f 21/85/85 22/86/86 18/87/87 +f 22/88/88 17/89/89 18/90/90 +usemtl m_2 +f 24/91/91 23/92/92 19/93/93 +f 23/94/94 20/95/95 19/96/96 +usemtl m_2 +f 22/97/97 24/98/98 17/99/99 +f 24/100/100 19/101/101 17/102/102 +usemtl m_2 +f 18/103/103 20/104/104 21/105/105 +f 20/106/106 23/107/107 21/108/108 +o onGlass +v 0.0625 0.5625 0.4375 +v 0.0625 0.5625 0.28125 +v 0.0625 0.4375 0.4375 +v 0.0625 0.4375 0.28125 +v -0.0625 0.5625 0.28125 +v -0.0625 0.5625 0.4375 +v -0.0625 0.4375 0.28125 +v -0.0625 0.4375 0.4375 +vt 0 1 +vt 0 0.875 +vt 0.15625 1 +vt 0 0.875 +vt 0.15625 0.875 +vt 0.15625 1 +vt 0 1 +vt 0 0.875 +vt 0.15625 1 +vt 0 0.875 +vt 0.15625 0.875 +vt 0.15625 1 +vt 0 1 +vt 0 0.84375 +vt 0.125 1 +vt 0 0.84375 +vt 0.125 0.84375 +vt 0.125 1 +vt 0 1 +vt 0 0.84375 +vt 0.125 1 +vt 0 0.84375 +vt 0.125 0.84375 +vt 0.125 1 +vt 0 1 +vt 0 0.875 +vt 0.125 1 +vt 0 0.875 +vt 0.125 0.875 +vt 0.125 1 +vt 0 1 +vt 0 0.875 +vt 0.125 1 +vt 0 0.875 +vt 0.125 0.875 +vt 0.125 1 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn 1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn -1 0 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 -1 0 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +vn 0 0 -1 +usemtl m_3 +f 25/109/109 27/110/110 26/111/111 +f 27/112/112 28/113/113 26/114/114 +usemtl m_3 +f 29/115/115 31/116/116 30/117/117 +f 31/118/118 32/119/119 30/120/120 +usemtl m_3 +f 29/121/121 30/122/122 26/123/123 +f 30/124/124 25/125/125 26/126/126 +usemtl m_3 +f 32/127/127 31/128/128 27/129/129 +f 31/130/130 28/131/131 27/132/132 +usemtl m_3 +f 30/133/133 32/134/134 25/135/135 +f 32/136/136 27/137/137 25/138/138 +usemtl m_3 +f 26/139/139 28/140/140 29/141/141 +f 28/142/142 31/143/143 29/144/144 diff --git a/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/offglass.png b/src/main/resources/assets/stellwand/models/block/blockbutton/lamp_red/offglass.png new file mode 100644 index 0000000000000000000000000000000000000000..abaf0b07deab8611561ea600f7d4cd0d8493d83b GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`a-J@ZAr}70ceZ9