diff --git a/README.md b/README.md index b509dfd..45518b1 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This is the unfinished port of the WebDisplays mod for Minecraft 1.12.2. The tex * minePad management: check GuiContainer.draggedStack for minePad * Enhance crafts * Enhance models +* minePad item texture seems to be transparent in some corners... ### Config elements * Site blacklist diff --git a/src/main/java/net/montoyo/wd/WebDisplays.java b/src/main/java/net/montoyo/wd/WebDisplays.java index e1cb854..272f183 100644 --- a/src/main/java/net/montoyo/wd/WebDisplays.java +++ b/src/main/java/net/montoyo/wd/WebDisplays.java @@ -26,10 +26,7 @@ import net.montoyo.wd.block.BlockScreen; import net.montoyo.wd.core.DefaultPeripheral; import net.montoyo.wd.core.WDCreativeTab; import net.montoyo.wd.entity.TileEntityScreen; -import net.montoyo.wd.item.ItemLinker; -import net.montoyo.wd.item.ItemMinePad2; -import net.montoyo.wd.item.ItemOwnershipThief; -import net.montoyo.wd.item.ItemScreenConfigurator; +import net.montoyo.wd.item.*; import net.montoyo.wd.net.Messages; import net.montoyo.wd.utilities.Log; import net.montoyo.wd.utilities.Util; @@ -61,6 +58,7 @@ public class WebDisplays { public ItemLinker itemLinker; public Item itemStoneKey; public ItemMinePad2 itemMinePad; + public ItemUpgrade itemUpgrade; //Sounds public SoundEvent soundTyping; @@ -95,6 +93,7 @@ public class WebDisplays { itemOwnerThief = new ItemOwnershipThief(); itemLinker = new ItemLinker(); itemMinePad = new ItemMinePad2(); + itemUpgrade = new ItemUpgrade(); itemStoneKey = new Item(); itemStoneKey.setCreativeTab(CREATIVE_TAB); @@ -133,7 +132,7 @@ public class WebDisplays { @SubscribeEvent public void onRegisterItems(RegistryEvent.Register ev) { ev.getRegistry().registerAll(blockScreen.getItem(), blockPeripheral.getItem()); - ev.getRegistry().registerAll(itemScreenCfg, itemOwnerThief, itemLinker, itemStoneKey, itemMinePad); + ev.getRegistry().registerAll(itemScreenCfg, itemOwnerThief, itemLinker, itemStoneKey, itemMinePad, itemUpgrade); } @SubscribeEvent diff --git a/src/main/java/net/montoyo/wd/block/BlockScreen.java b/src/main/java/net/montoyo/wd/block/BlockScreen.java index f36908e..8250224 100644 --- a/src/main/java/net/montoyo/wd/block/BlockScreen.java +++ b/src/main/java/net/montoyo/wd/block/BlockScreen.java @@ -20,6 +20,7 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -135,9 +136,13 @@ public class BlockScreen extends WDBlockContainer { return true; } - te.addUpgrade(side, heldItem); - if(!player.isCreative()) - heldItem.shrink(1); + if(te.addUpgrade(side, heldItem, false)) { + if(!player.isCreative()) + heldItem.shrink(1); + + Util.toast(player, TextFormatting.AQUA, "upgradeOk"); + } else + Util.toast(player, "upgradeError"); return true; } else { //Click diff --git a/src/main/java/net/montoyo/wd/client/ClientProxy.java b/src/main/java/net/montoyo/wd/client/ClientProxy.java index a64fd7b..d5cc1b0 100644 --- a/src/main/java/net/montoyo/wd/client/ClientProxy.java +++ b/src/main/java/net/montoyo/wd/client/ClientProxy.java @@ -44,10 +44,12 @@ import net.montoyo.wd.client.renderers.IModelBaker; import net.montoyo.wd.client.renderers.MinePadRenderer; import net.montoyo.wd.client.renderers.ScreenBaker; import net.montoyo.wd.client.renderers.ScreenRenderer; +import net.montoyo.wd.core.DefaultUpgrade; import net.montoyo.wd.data.GuiData; import net.montoyo.wd.entity.TileEntityScreen; import net.montoyo.wd.net.SMessagePadCtrl; import net.montoyo.wd.utilities.*; +import scala.tools.nsc.doc.model.Def; import java.util.ArrayList; import java.util.HashMap; @@ -261,6 +263,10 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi registerItemModel(wd.itemLinker, 0, "normal"); registerItemModel(wd.itemStoneKey, 0, "normal"); registerItemModel(wd.itemMinePad, 0, "normal"); + + DefaultUpgrade[] upgrades = DefaultUpgrade.values(); + for(int i = 0; i < upgrades.length; i++) + ModelLoader.setCustomModelResourceLocation(wd.itemUpgrade, i, new ModelResourceLocation("webdisplays:upgrade_" + upgrades[i].getName(), "normal")); } @SubscribeEvent diff --git a/src/main/java/net/montoyo/wd/client/gui/GuiScreenConfig.java b/src/main/java/net/montoyo/wd/client/gui/GuiScreenConfig.java index ab06bee..67c4cb8 100644 --- a/src/main/java/net/montoyo/wd/client/gui/GuiScreenConfig.java +++ b/src/main/java/net/montoyo/wd/client/gui/GuiScreenConfig.java @@ -91,6 +91,9 @@ public class GuiScreenConfig extends WDScreen { @FillControl private Button btnSetRes; + @FillControl + private UpgradeGroup ugUpgrades; + private CheckBox[] friendBoxes; private CheckBox[] otherBoxes; @@ -126,6 +129,9 @@ public class GuiScreenConfig extends WDScreen { if(scr != null) { tfResX.setText("" + scr.resolution.x); tfResY.setText("" + scr.resolution.y); + + //Hopefully upgrades have been synchronized... + ugUpgrades.setUpgrades(scr.upgrades); } lblOwner.setLabel(lblOwner.getLabel() + owner.name); diff --git a/src/main/java/net/montoyo/wd/client/gui/WDScreen.java b/src/main/java/net/montoyo/wd/client/gui/WDScreen.java index b9a6ca5..82828cb 100644 --- a/src/main/java/net/montoyo/wd/client/gui/WDScreen.java +++ b/src/main/java/net/montoyo/wd/client/gui/WDScreen.java @@ -9,6 +9,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.montoyo.wd.WebDisplays; import net.montoyo.wd.client.gui.controls.Container; @@ -37,6 +38,7 @@ public abstract class WDScreen extends GuiScreen { public static WDScreen CURRENT_SCREEN = null; protected ArrayList controls = new ArrayList<>(); + protected ArrayList postDrawList = new ArrayList<>(); private HashMap, Method> eventMap = new HashMap<>(); protected boolean quitOnEscape = true; protected boolean defaultBackground = true; @@ -131,6 +133,9 @@ public abstract class WDScreen extends GuiScreen { for(Control ctrl: controls) ctrl.draw(mouseX, mouseY, ptt); + + for(Control ctrl: postDrawList) + ctrl.postDraw(mouseX, mouseY, ptt); } @Override @@ -350,4 +355,13 @@ public abstract class WDScreen extends GuiScreen { } } + public void drawItemStackTooltip(ItemStack is, int x, int y) { + renderToolTip(is, x, y); //Since it's protected... + } + + public void requirePostDraw(Control ctrl) { + if(!postDrawList.contains(ctrl)) + postDrawList.add(ctrl); + } + } diff --git a/src/main/java/net/montoyo/wd/client/gui/controls/Control.java b/src/main/java/net/montoyo/wd/client/gui/controls/Control.java index 578a7df..57b4c70 100644 --- a/src/main/java/net/montoyo/wd/client/gui/controls/Control.java +++ b/src/main/java/net/montoyo/wd/client/gui/controls/Control.java @@ -82,6 +82,9 @@ public abstract class Control { public void draw(int mouseX, int mouseY, float ptt) { } + public void postDraw(int mouseX, int mouseY, float ptt) { + } + public void destroy() { } diff --git a/src/main/java/net/montoyo/wd/client/gui/controls/Icon.java b/src/main/java/net/montoyo/wd/client/gui/controls/Icon.java index cef7eaf..e921aae 100644 --- a/src/main/java/net/montoyo/wd/client/gui/controls/Icon.java +++ b/src/main/java/net/montoyo/wd/client/gui/controls/Icon.java @@ -43,12 +43,49 @@ public class Icon extends BasicControl { @Override public void draw(int mouseX, int mouseY, float ptt) { - GL11.glEnable(GL11.GL_TEXTURE_2D); - bindTexture(texture); - blend(true); - fillTexturedRect(x, y, width, height, u1, v1, u2, v2); - blend(false); - bindTexture(null); + if(texture != null) { + GL11.glEnable(GL11.GL_TEXTURE_2D); + bindTexture(texture); + blend(true); + fillTexturedRect(x, y, width, height, u1, v1, u2, v2); + blend(false); + bindTexture(null); + } + } + + public void setWidth(int width) { + this.width = width; + } + + public void setHeight(int height) { + this.height = height; + } + + public void setTextureCoordinates(double u1, double v1, double u2, double v2) { + this.u1 = u1; + this.v1 = v1; + this.u2 = u2; + this.v2 = v2; + } + + public void setTexture(ResourceLocation texture) { + this.texture = texture; + } + + public double getU1() { + return u1; + } + + public double getV1() { + return v1; + } + + public double getU2() { + return u2; + } + + public double getV2() { + return v2; } } diff --git a/src/main/java/net/montoyo/wd/client/gui/controls/UpgradeGroup.java b/src/main/java/net/montoyo/wd/client/gui/controls/UpgradeGroup.java new file mode 100644 index 0000000..0a1ab89 --- /dev/null +++ b/src/main/java/net/montoyo/wd/client/gui/controls/UpgradeGroup.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.client.gui.controls; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderItem; +import net.minecraft.item.ItemStack; +import net.montoyo.wd.client.gui.loading.JsonOWrapper; + +import java.util.ArrayList; + +public class UpgradeGroup extends BasicControl { + + private int width; + private int height; + private ArrayList upgrades; + private ItemStack overStack; + private final RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); + + public UpgradeGroup() { + parent.requirePostDraw(this); + } + + @Override + public void draw(int mouseX, int mouseY, float ptt) { + if(upgrades != null) { + int x = this.x; + + for(ItemStack is: upgrades) { + renderItem.renderItemAndEffectIntoGUI(mc.player, is, x, y); + renderItem.renderItemOverlayIntoGUI(font, is, x, y, null); + x += 18; + } + } + } + + @Override + public void postDraw(int mouseX, int mouseY, float ptt) { + if(overStack != null) + parent.drawItemStackTooltip(overStack, mouseX, mouseY); + } + + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + + public void setWidth(int w) { + width = w; + } + + public void setHeight(int h) { + height = h; + } + + public void setUpgrades(ArrayList upgrades) { + this.upgrades = upgrades; + } + + public ArrayList getUpgrades() { + return upgrades; + } + + @Override + public void load(JsonOWrapper json) { + super.load(json); + width = json.getInt("width", 0); + height = json.getInt("height", 16); + } + + @Override + public void mouseMove(int mouseX, int mouseY) { + overStack = null; + + if(mouseY >= y && mouseY <= y + 16 && mouseX >= x) { + mouseX -= x; + int sel = mouseX / 18; + + if(sel < upgrades.size() && mouseX % 18 <= 16) + overStack = upgrades.get(sel); + } + } + +} diff --git a/src/main/java/net/montoyo/wd/client/gui/loading/GuiLoader.java b/src/main/java/net/montoyo/wd/client/gui/loading/GuiLoader.java index d962c56..190cce2 100644 --- a/src/main/java/net/montoyo/wd/client/gui/loading/GuiLoader.java +++ b/src/main/java/net/montoyo/wd/client/gui/loading/GuiLoader.java @@ -42,6 +42,7 @@ public class GuiLoader { register(List.class); register(TextField.class); register(Icon.class); + register(UpgradeGroup.class); } public static Control create(JsonOWrapper json) { @@ -51,10 +52,10 @@ public class GuiLoader { ret = controls.get(json.getString("type", null)).newInstance(); } catch(InstantiationException e) { Log.errorEx("Could not create control from JSON: instantiation exception", e); - throw Throwables.propagate(e); + throw new RuntimeException(e); } catch(IllegalAccessException e) { Log.errorEx("Could not create control from JSON: access denied", e); - throw Throwables.propagate(e); + throw new RuntimeException(e); } ret.load(json); @@ -70,7 +71,7 @@ public class GuiLoader { resource = Minecraft.getMinecraft().getResourceManager().getResource(resLoc); } catch(IOException e) { Log.errorEx("Couldn't load JSON UI from file", e); - throw Throwables.propagate(e); + throw new RuntimeException(e); } JsonParser parser = new JsonParser(); diff --git a/src/main/java/net/montoyo/wd/core/DefaultUpgrade.java b/src/main/java/net/montoyo/wd/core/DefaultUpgrade.java new file mode 100644 index 0000000..92d0a8a --- /dev/null +++ b/src/main/java/net/montoyo/wd/core/DefaultUpgrade.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.core; + +public enum DefaultUpgrade { + + LASER_MOUSE("lasermouse"), + REDSTONE_INPUT("redinput"), + REDSTONE_OUTPUT("redoutput"); + + private final String name; + + DefaultUpgrade(String n) { + name = n; + } + + public String getName() { + return name; + } + +} diff --git a/src/main/java/net/montoyo/wd/core/IUpgrade.java b/src/main/java/net/montoyo/wd/core/IUpgrade.java index a71f402..d0d0731 100644 --- a/src/main/java/net/montoyo/wd/core/IUpgrade.java +++ b/src/main/java/net/montoyo/wd/core/IUpgrade.java @@ -16,6 +16,6 @@ public interface IUpgrade { void onInstall(@Nonnull TileEntityScreen tes, @Nonnull BlockSide screenSide, @Nullable EntityPlayer player, @Nonnull ItemStack is); boolean onRemove(@Nonnull TileEntityScreen tes, @Nonnull BlockSide screenSide, @Nullable EntityPlayer player, @Nonnull ItemStack is); //Return true to prevent dropping - void updateUpgrade(@Nonnull TileEntityScreen tes, @Nonnull BlockSide screenSide, @Nonnull ItemStack is); + boolean isSameUpgrade(@Nonnull ItemStack myStack, @Nonnull ItemStack otherStack); //myStack.getItem() is an instance of this class } diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityScreen.java b/src/main/java/net/montoyo/wd/entity/TileEntityScreen.java index a36f1b9..6d58f66 100644 --- a/src/main/java/net/montoyo/wd/entity/TileEntityScreen.java +++ b/src/main/java/net/montoyo/wd/entity/TileEntityScreen.java @@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -94,6 +95,8 @@ public class TileEntityScreen extends TileEntity { for(int i = 0; i < upgrades.tagCount(); i++) ret.upgrades.add(new ItemStack(upgrades.getCompoundTagAt(i))); + System.out.println("Read " + ret.upgrades.size() + " upgrades from NBT"); //TODO: Remove me + return ret; } @@ -130,6 +133,7 @@ public class TileEntityScreen extends TileEntity { for(ItemStack is: upgrades) list.appendTag(is.writeToNBT(new NBTTagCompound())); + System.out.println("Saved " + list.tagCount() + " upgrades"); //TODO: Remove me tag.setTag("Upgrades", list); return tag; } @@ -570,9 +574,13 @@ public class TileEntityScreen extends TileEntity { Collections.addAll(scr.upgrades, upgrades); } + private static String safeName(ItemStack is) { + ResourceLocation rl = is.getItem().getRegistryName(); + return (rl == null) ? "[NO NAME, WTF?!]" : rl.toString(); + } + //If equal is null, no duplicate check is preformed - public boolean addUpgrade(BlockSide side, ItemStack is, @Nullable Predicate equal) { - //TODO: Remove Predicate. It should be obtained from IUpgrade. + public boolean addUpgrade(BlockSide side, ItemStack is, boolean abortIfExisting) { if(world.isRemote) return false; @@ -583,40 +591,36 @@ public class TileEntityScreen extends TileEntity { } if(!(is.getItem() instanceof IUpgrade)) { - Log.error("Tried to add a non-upgrade item %s to screen (%s does not implement IUpgrade)", is.getItem().getRegistryName().toString(), is.getItem().getClass().getCanonicalName()); + Log.error("Tried to add a non-upgrade item %s to screen (%s does not implement IUpgrade)", safeName(is), is.getItem().getClass().getCanonicalName()); return false; } - if(equal != null && scr.upgrades.stream().anyMatch(equal)) + if(scr.upgrades.size() >= 16) { + Log.error("Can't insert upgrade %s in screen %s at %s: too many upgrades already!", safeName(is), side.toString(), pos.toString()); + return false; + } + + IUpgrade itemAsUpgrade = (IUpgrade) is.getItem(); + if(abortIfExisting && scr.upgrades.stream().anyMatch((otherStack) -> itemAsUpgrade.isSameUpgrade(is, otherStack))) return false; //Upgrade already exists scr.upgrades.add(is); WebDisplays.NET_HANDLER.sendToAllAround(CMessageScreenUpdate.upgrade(this, side), point()); - ((IUpgrade) is.getItem()).onInstall(this, side, null, is); + itemAsUpgrade.onInstall(this, side, null, is); return true; } - //Uses the default item stack comparing (same Item & metadata) - public boolean addUpgrade(BlockSide side, ItemStack is) { - return addUpgrade(side, is, (other) -> other.getItem() == is.getItem() && other.getMetadata() == is.getMetadata()); - } - //Uses the default item stack comparing (same Item & metadata) public boolean hasUpgrade(BlockSide side, ItemStack is) { Screen scr = getScreen(side); if(scr == null) return false; - return scr.upgrades.stream().anyMatch((other) -> other.getItem() == is.getItem() && other.getMetadata() == is.getMetadata()); - } - - public boolean hasUpgrade(BlockSide side, Predicate equal) { - //TODO: Remove Predicate. It should be obtained from IUpgrade. - Screen scr = getScreen(side); - if(scr == null) + if(!(is.getItem() instanceof IUpgrade)) return false; - return scr.upgrades.stream().anyMatch(equal); + IUpgrade itemAsUpgrade = (IUpgrade) is.getItem(); + return scr.upgrades.stream().anyMatch((otherStack) -> itemAsUpgrade.isSameUpgrade(is, otherStack)); } } diff --git a/src/main/java/net/montoyo/wd/item/ItemUpgrade.java b/src/main/java/net/montoyo/wd/item/ItemUpgrade.java new file mode 100644 index 0000000..d7e6724 --- /dev/null +++ b/src/main/java/net/montoyo/wd/item/ItemUpgrade.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.item; + +import net.minecraft.client.resources.I18n; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import net.minecraft.world.World; +import net.montoyo.wd.WebDisplays; +import net.montoyo.wd.core.DefaultUpgrade; +import net.montoyo.wd.core.IUpgrade; +import net.montoyo.wd.entity.TileEntityScreen; +import net.montoyo.wd.utilities.BlockSide; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; + +public class ItemUpgrade extends Item implements IUpgrade { + + public ItemUpgrade() { + setUnlocalizedName("webdisplays.upgrade"); + setRegistryName("upgrade"); + setHasSubtypes(true); + setMaxDamage(0); + setCreativeTab(WebDisplays.CREATIVE_TAB); + } + + @Override + public void onInstall(@Nonnull TileEntityScreen tes, @Nonnull BlockSide screenSide, @Nullable EntityPlayer player, @Nonnull ItemStack is) { + } + + @Override + public boolean onRemove(@Nonnull TileEntityScreen tes, @Nonnull BlockSide screenSide, @Nullable EntityPlayer player, @Nonnull ItemStack is) { + return false; + } + + @Override + public boolean isSameUpgrade(@Nonnull ItemStack myStack, @Nonnull ItemStack otherStack) { + return otherStack.getItem() == this && otherStack.getMetadata() == myStack.getMetadata(); + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + int meta = stack.getMetadata(); + DefaultUpgrade[] names = DefaultUpgrade.values(); + String ret = getUnlocalizedName(); + + if(meta >= 0 && meta < names.length) + return ret + '.' + names[meta].getName(); + else + return ret; + } + + @Override + public void addInformation(ItemStack is, @Nullable World world, List tt, ITooltipFlag ttFlags) { + tt.add(I18n.format("item.webdisplays.upgrade.name")); + } + + @Override + public void getSubItems(CreativeTabs tab, NonNullList items) { + if(isInCreativeTab(tab)) { + int cnt = DefaultUpgrade.values().length; + + for(int i = 0; i < cnt; i++) + items.add(new ItemStack(this, 1, i)); + } + } + +} diff --git a/src/main/java/net/montoyo/wd/net/CMessageAddScreen.java b/src/main/java/net/montoyo/wd/net/CMessageAddScreen.java index 09cf1fb..a32a6c9 100644 --- a/src/main/java/net/montoyo/wd/net/CMessageAddScreen.java +++ b/src/main/java/net/montoyo/wd/net/CMessageAddScreen.java @@ -101,6 +101,7 @@ public class CMessageAddScreen implements IMessage, Runnable { for(TileEntityScreen.Screen entry: screens) { TileEntityScreen.Screen scr = tes.addScreen(entry.side, entry.size, entry.resolution, false); scr.url = entry.url; + scr.upgrades = entry.upgrades; if(scr.browser != null) scr.browser.loadURL(entry.url); diff --git a/src/main/java/net/montoyo/wd/net/CMessageScreenUpdate.java b/src/main/java/net/montoyo/wd/net/CMessageScreenUpdate.java index 00943b0..a8ec487 100644 --- a/src/main/java/net/montoyo/wd/net/CMessageScreenUpdate.java +++ b/src/main/java/net/montoyo/wd/net/CMessageScreenUpdate.java @@ -172,6 +172,8 @@ public class CMessageScreenUpdate implements IMessage, Runnable { tes.setResolution(side, resolution); else if(action == UPDATE_TYPE) tes.type(side, text, null); + else if(action == UPDATE_UPGRADES) + tes.updateUpgrades(side, upgrades); else Log.warning("===> TODO"); //TODO } diff --git a/src/main/resources/assets/webdisplays/gui/screencfg.json b/src/main/resources/assets/webdisplays/gui/screencfg.json index c9b6304..7ac56e8 100644 --- a/src/main/resources/assets/webdisplays/gui/screencfg.json +++ b/src/main/resources/assets/webdisplays/gui/screencfg.json @@ -143,17 +143,23 @@ "y": 12, "label": "$webdisplays.gui.screencfg.upgrades" }, + { + "type": "UpgradeGroup", + "name": "ugUpgrades", + "x": 258, + "y": 23 + }, { "type": "Label", "x": 258, - "y": 40, + "y": 42, "label": "$webdisplays.gui.screencfg.resolution" }, { "type": "TextField", "name": "tfResX", "x": 260, - "y": 52, + "y": 54, "width": 40, "maxLength": 4 }, @@ -161,7 +167,7 @@ "type": "TextField", "name": "tfResY", "x": 304, - "y": 52, + "y": 54, "width": 40, "maxLength": 4 }, diff --git a/src/main/resources/assets/webdisplays/lang/en_us.lang b/src/main/resources/assets/webdisplays/lang/en_us.lang index 713fe7b..22469e6 100644 --- a/src/main/resources/assets/webdisplays/lang/en_us.lang +++ b/src/main/resources/assets/webdisplays/lang/en_us.lang @@ -1,5 +1,6 @@ itemGroup.webdisplays=ยง5Web Displays tile.webdisplays.screen.name=Web Screen +tile.webdisplays.peripheral.name=Peripheral tile.webdisplays.peripheral.keyboard.name=Keyboard tile.webdisplays.peripheral.remotectrl.name=Remote Controller tile.webdisplays.peripheral.ccinterface.name=ComputerCraft Interface @@ -10,6 +11,10 @@ item.webdisplays.ownerthief.name=Ownership Thief [ADMIN] item.webdisplays.linker.name=Linking Tool item.webdisplays.stonekey.name=Stone Key item.webdisplays.minepad.name=minePad +item.webdisplays.upgrade.name=Screen Upgrade +item.webdisplays.upgrade.lasermouse.name=Laser Sensor +item.webdisplays.upgrade.redinput.name=Redstone Input Port +item.webdisplays.upgrade.redoutput.name=Redstone Output Port webdisplays.message.tooSmall=Too small! Minimum size is 2x2. webdisplays.message.invalid=Structure is invalid; look at %s. webdisplays.message.turnOn=You need to turn the screen on first! @@ -25,6 +30,8 @@ webdisplays.message.chunkUnloaded=The chunk the screen is placed in is not loade webdisplays.message.notLinked=This peripheral has not been linked yet. webdisplays.message.missingCC=ComputerCraft is not available. webdisplays.message.missingOC=OpenComputers is not available. +webdisplays.message.upgradeError=Upgrade error :( Check logs... +webdisplays.message.upgradeOk=Upgrade installed! webdisplays.gui.screencfg.owner=Screen owner: webdisplays.gui.screencfg.friends=Friends: webdisplays.gui.screencfg.permissions=Permissions: diff --git a/src/main/resources/assets/webdisplays/models/item/upgrade_lasermouse.json b/src/main/resources/assets/webdisplays/models/item/upgrade_lasermouse.json new file mode 100644 index 0000000..26bc6f7 --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/item/upgrade_lasermouse.json @@ -0,0 +1,7 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "webdisplays:items/upgrade", + "layer1": "webdisplays:items/laserpointer" + } +} diff --git a/src/main/resources/assets/webdisplays/models/item/upgrade_redinput.json b/src/main/resources/assets/webdisplays/models/item/upgrade_redinput.json new file mode 100644 index 0000000..23fa0d0 --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/item/upgrade_redinput.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "webdisplays:items/upgrade" + } +} diff --git a/src/main/resources/assets/webdisplays/models/item/upgrade_redoutput.json b/src/main/resources/assets/webdisplays/models/item/upgrade_redoutput.json new file mode 100644 index 0000000..23fa0d0 --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/item/upgrade_redoutput.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "webdisplays:items/upgrade" + } +} diff --git a/src/main/resources/assets/webdisplays/textures/items/laserpointer.png b/src/main/resources/assets/webdisplays/textures/items/laserpointer.png new file mode 100644 index 0000000..13f915b Binary files /dev/null and b/src/main/resources/assets/webdisplays/textures/items/laserpointer.png differ diff --git a/src/main/resources/assets/webdisplays/textures/items/laserpointer2.png b/src/main/resources/assets/webdisplays/textures/items/laserpointer2.png new file mode 100644 index 0000000..64bf7da Binary files /dev/null and b/src/main/resources/assets/webdisplays/textures/items/laserpointer2.png differ diff --git a/src/main/resources/assets/webdisplays/textures/items/minepad.png b/src/main/resources/assets/webdisplays/textures/items/minepad.png index f11d021..23c391c 100644 Binary files a/src/main/resources/assets/webdisplays/textures/items/minepad.png and b/src/main/resources/assets/webdisplays/textures/items/minepad.png differ diff --git a/src/main/resources/assets/webdisplays/textures/items/upgrade.png b/src/main/resources/assets/webdisplays/textures/items/upgrade.png new file mode 100644 index 0000000..da821e1 Binary files /dev/null and b/src/main/resources/assets/webdisplays/textures/items/upgrade.png differ diff --git a/src/main/resources/assets/webdisplays/textures/items/upgrade.png.mcmeta b/src/main/resources/assets/webdisplays/textures/items/upgrade.png.mcmeta new file mode 100644 index 0000000..2cc08b8 --- /dev/null +++ b/src/main/resources/assets/webdisplays/textures/items/upgrade.png.mcmeta @@ -0,0 +1,9 @@ +{ + "animation": { + "interpolate": false, + "width": 1, + "height": 9, + "frametime": 2, + "frames": [ 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8 ] + } +}