diff --git a/src/main/java/net/montoyo/wd/block/BlockPeripheral.java b/src/main/java/net/montoyo/wd/block/BlockPeripheral.java index 0a39030..442d27f 100644 --- a/src/main/java/net/montoyo/wd/block/BlockPeripheral.java +++ b/src/main/java/net/montoyo/wd/block/BlockPeripheral.java @@ -68,29 +68,35 @@ public class BlockPeripheral extends WDBlockContainer { @Override public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing rrezozei, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { int rot = MathHelper.floor(((double) (placer.rotationYaw * 4.0f / 360.0f)) + 2.5) & 3; - return getDefaultState().withProperty(type, DefaultPeripheral.values()[meta]).withProperty(facing, rot); + return getDefaultState().withProperty(type, DefaultPeripheral.fromMetadata(meta)).withProperty(facing, rot); } @Override public void getSubBlocks(CreativeTabs tab, NonNullList list) { for(DefaultPeripheral dp : DefaultPeripheral.values()) - list.add(new ItemStack(getItem(), 1, dp.ordinal())); + list.add(new ItemStack(getItem(), 1, dp.toMetadata(0))); } @Override public IBlockState getStateFromMeta(int meta) { - return getDefaultState().withProperty(type, DefaultPeripheral.values()[meta & 3]).withProperty(facing, (meta >> 2) & 3); + DefaultPeripheral dp = DefaultPeripheral.fromMetadata(meta); + IBlockState state = getDefaultState().withProperty(type, dp); + + if(dp.hasFacing()) + state = state.withProperty(facing, (meta >> 2) & 3); + + return state; } @Override public int getMetaFromState(IBlockState state) { - return state.getValue(type).ordinal() | (state.getValue(facing) << 2); + return state.getValue(type).toMetadata(state.getValue(facing)); } @Nullable @Override public TileEntity createNewTileEntity(World world, int meta) { - Class cls = DefaultPeripheral.values()[meta & 3].getTEClass(); + Class cls = DefaultPeripheral.fromMetadata(meta).getTEClass(); if(cls == null) return null; @@ -204,6 +210,10 @@ public class BlockPeripheral extends WDBlockContainer { @Override public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborType, BlockPos neighbor) { + TileEntity te = world.getTileEntity(pos); + if(te != null && te instanceof TileEntityPeripheralBase) + ((TileEntityPeripheralBase) te).onNeighborChange(neighborType, neighbor); + if(world.isRemote || state.getValue(type) != DefaultPeripheral.KEYBOARD) return; diff --git a/src/main/java/net/montoyo/wd/client/ClientProxy.java b/src/main/java/net/montoyo/wd/client/ClientProxy.java index 3c6d319..a64fd7b 100644 --- a/src/main/java/net/montoyo/wd/client/ClientProxy.java +++ b/src/main/java/net/montoyo/wd/client/ClientProxy.java @@ -252,9 +252,10 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi registerItemModel(wd.blockScreen.getItem(), 0, "inventory"); ModelLoader.setCustomModelResourceLocation(wd.blockPeripheral.getItem(), 0, new ModelResourceLocation("webdisplays:kb_inv", "normal")); - registerItemModel(wd.blockPeripheral.getItem(), 1, "facing=0,type=remotectrl"); - registerItemModel(wd.blockPeripheral.getItem(), 2, "facing=2,type=ccinterface"); - registerItemModel(wd.blockPeripheral.getItem(), 3, "facing=2,type=cointerface"); + registerItemModel(wd.blockPeripheral.getItem(), 1, "facing=2,type=ccinterface"); + registerItemModel(wd.blockPeripheral.getItem(), 2, "facing=2,type=cointerface"); + registerItemModel(wd.blockPeripheral.getItem(), 3, "facing=0,type=remotectrl"); + registerItemModel(wd.blockPeripheral.getItem(), 7, "facing=0,type=redstonectrl"); registerItemModel(wd.itemScreenCfg, 0, "normal"); registerItemModel(wd.itemOwnerThief, 0, "normal"); registerItemModel(wd.itemLinker, 0, "normal"); diff --git a/src/main/java/net/montoyo/wd/client/gui/GuiRedstoneCtrl.java b/src/main/java/net/montoyo/wd/client/gui/GuiRedstoneCtrl.java new file mode 100644 index 0000000..4f31b0a --- /dev/null +++ b/src/main/java/net/montoyo/wd/client/gui/GuiRedstoneCtrl.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.client.gui; + +import net.minecraft.util.ResourceLocation; +import net.montoyo.wd.WebDisplays; +import net.montoyo.wd.client.gui.controls.Button; +import net.montoyo.wd.client.gui.controls.TextField; +import net.montoyo.wd.client.gui.loading.FillControl; +import net.montoyo.wd.net.SMessageRedstoneCtrl; +import net.montoyo.wd.utilities.Vector3i; + +public class GuiRedstoneCtrl extends WDScreen { + + private int dimension; + private Vector3i pos; + private String risingEdgeURL; + private String fallingEdgeURL; + + @FillControl + private TextField tfRisingEdge; + + @FillControl + private TextField tfFallingEdge; + + @FillControl + private Button btnOk; + + public GuiRedstoneCtrl() { + } + + public GuiRedstoneCtrl(int d, Vector3i p, String r, String f) { + dimension = d; + pos = p; + risingEdgeURL = r; + fallingEdgeURL = f; + } + + @Override + public void initGui() { + super.initGui(); + loadFrom(new ResourceLocation("webdisplays", "gui/redstonectrl.json")); + tfRisingEdge.setText(risingEdgeURL); + tfFallingEdge.setText(fallingEdgeURL); + } + + @GuiSubscribe + public void onClick(Button.ClickEvent ev) { + if(ev.getSource() == btnOk) + WebDisplays.NET_HANDLER.sendToServer(new SMessageRedstoneCtrl(dimension, pos, tfRisingEdge.getText(), tfFallingEdge.getText())); + + mc.displayGuiScreen(null); + } + +} 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 000a754..578a7df 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 @@ -7,6 +7,7 @@ package net.montoyo.wd.client.gui.controls; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.I18n; @@ -144,7 +145,7 @@ public abstract class Control { public void bindTexture(ResourceLocation resLoc) { if(resLoc == null) - glBindTexture(GL_TEXTURE_2D, 0); + GlStateManager.bindTexture(0); //Damn state manager else mc.renderEngine.bindTexture(resLoc); } 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 new file mode 100644 index 0000000..cef7eaf --- /dev/null +++ b/src/main/java/net/montoyo/wd/client/gui/controls/Icon.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.client.gui.controls; + +import net.minecraft.util.ResourceLocation; +import net.montoyo.wd.client.gui.loading.JsonOWrapper; +import org.lwjgl.opengl.GL11; + +public class Icon extends BasicControl { + + protected int width; + protected int height; + protected double u1; + protected double v1; + protected double u2; + protected double v2; + protected ResourceLocation texture; + + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + + @Override + public void load(JsonOWrapper json) { + super.load(json); + + width = json.getInt("width", 16); + height = json.getInt("height", 16); + u1 = json.getDouble("u1", 0.0); + v1 = json.getDouble("v1", 0.0); + u2 = json.getDouble("u2", 1.0); + v2 = json.getDouble("v2", 1.0); + texture = new ResourceLocation(json.getString("resourceLocation", "")); + } + + @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); + } + +} 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 722ee86..d962c56 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 @@ -41,6 +41,7 @@ public class GuiLoader { register(Label.class); register(List.class); register(TextField.class); + register(Icon.class); } public static Control create(JsonOWrapper json) { diff --git a/src/main/java/net/montoyo/wd/core/DefaultPeripheral.java b/src/main/java/net/montoyo/wd/core/DefaultPeripheral.java index f1cd9c8..9c38d65 100644 --- a/src/main/java/net/montoyo/wd/core/DefaultPeripheral.java +++ b/src/main/java/net/montoyo/wd/core/DefaultPeripheral.java @@ -8,13 +8,15 @@ import net.minecraft.util.IStringSerializable; import net.montoyo.wd.entity.TileEntityKeyboard; import net.montoyo.wd.entity.TileEntityPeripheralBase; import net.montoyo.wd.entity.TileEntityRCtrl; +import net.montoyo.wd.entity.TileEntityRedCtrl; public enum DefaultPeripheral implements IStringSerializable { - KEYBOARD("keyboard", TileEntityKeyboard.class), - REMOTE_CONTROLLER("remotectrl", TileEntityRCtrl.class), + KEYBOARD("keyboard", TileEntityKeyboard.class), //WITH FACING (< 3) CC_INTERFACE("ccinterface", null), - OC_INTERFACE("cointerface", null); + OC_INTERFACE("cointerface", null), + REMOTE_CONTROLLER("remotectrl", TileEntityRCtrl.class), //WITHOUT FACING (>= 3) + REDSTONE_CONTROLLER("redstonectrl", TileEntityRedCtrl.class); private final String name; private final Class teClass; @@ -24,6 +26,13 @@ public enum DefaultPeripheral implements IStringSerializable { teClass = te; } + public static DefaultPeripheral fromMetadata(int meta) { + if((meta & 3) == 3) + return values()[(((meta >> 2) & 3) | 4) - 1]; //Without facing + else + return values()[meta & 3]; //With facing + } + @Override public String getName() { return name; @@ -33,4 +42,18 @@ public enum DefaultPeripheral implements IStringSerializable { return teClass; } + public boolean hasFacing() { + return ordinal() < 3; + } + + public int toMetadata(int facing) { + int ret = ordinal(); + if(ret < 3) //With facing + ret |= facing << 2; + else //Without facing + ret = (((ret + 1) & 3) << 2) | 3; + + return ret; + } + } diff --git a/src/main/java/net/montoyo/wd/data/GuiData.java b/src/main/java/net/montoyo/wd/data/GuiData.java index aaf0b6f..122861b 100644 --- a/src/main/java/net/montoyo/wd/data/GuiData.java +++ b/src/main/java/net/montoyo/wd/data/GuiData.java @@ -21,6 +21,7 @@ public abstract class GuiData { dataTable.put("SetURL", SetURLData.class); dataTable.put("ScreenConfig", ScreenConfigData.class); dataTable.put("Keyboard", KeyboardData.class); + dataTable.put("RedstoneCtrl", RedstoneCtrlData.class); } public static Class classOf(String name) { diff --git a/src/main/java/net/montoyo/wd/data/RedstoneCtrlData.java b/src/main/java/net/montoyo/wd/data/RedstoneCtrlData.java new file mode 100644 index 0000000..43bf149 --- /dev/null +++ b/src/main/java/net/montoyo/wd/data/RedstoneCtrlData.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.data; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import net.montoyo.wd.client.gui.GuiRedstoneCtrl; +import net.montoyo.wd.utilities.Vector3i; + +public class RedstoneCtrlData extends GuiData { + + public int dimension; + public Vector3i pos; + public String risingEdgeURL; + public String fallingEdgeURL; + + public RedstoneCtrlData() { + } + + public RedstoneCtrlData(int d, BlockPos p, String r, String f) { + dimension = d; + pos = new Vector3i(p); + risingEdgeURL = r; + fallingEdgeURL = f; + } + + @SideOnly(Side.CLIENT) + @Override + public GuiScreen createGui(GuiScreen old, World world) { + return new GuiRedstoneCtrl(dimension, pos, risingEdgeURL, fallingEdgeURL); + } + + @Override + public String getName() { + return "RedstoneCtrl"; + } + +} diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityPeripheralBase.java b/src/main/java/net/montoyo/wd/entity/TileEntityPeripheralBase.java index b75e322..f957b3e 100644 --- a/src/main/java/net/montoyo/wd/entity/TileEntityPeripheralBase.java +++ b/src/main/java/net/montoyo/wd/entity/TileEntityPeripheralBase.java @@ -4,6 +4,7 @@ package net.montoyo.wd.entity; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -116,4 +117,7 @@ public abstract class TileEntityPeripheralBase extends TileEntity implements IPe return false; } + public void onNeighborChange(Block neighborType, BlockPos neighborPos) { + } + } diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityRedCtrl.java b/src/main/java/net/montoyo/wd/entity/TileEntityRedCtrl.java new file mode 100644 index 0000000..68599c5 --- /dev/null +++ b/src/main/java/net/montoyo/wd/entity/TileEntityRedCtrl.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.entity; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.montoyo.wd.core.ScreenRights; +import net.montoyo.wd.data.RedstoneCtrlData; +import net.montoyo.wd.utilities.BlockSide; +import net.montoyo.wd.utilities.Util; + +public class TileEntityRedCtrl extends TileEntityPeripheralBase { + + private String risingEdgeURL = ""; + private String fallingEdgeURL = ""; + private boolean state = false; + + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + + risingEdgeURL = tag.getString("RisingEdgeURL"); + fallingEdgeURL = tag.getString("FallingEdgeURL"); + state = tag.getBoolean("Powered"); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound tag) { + super.writeToNBT(tag); + + tag.setString("RisingEdgeURL", risingEdgeURL); + tag.setString("FallingEdgeURL", fallingEdgeURL); + tag.setBoolean("Powered", state); + return tag; + } + + @Override + public boolean onRightClick(EntityPlayer player, EnumHand hand, BlockSide side) { + if(world.isRemote) + return true; + + if(!isScreenChunkLoaded()) { + Util.toast(player, "chunkUnloaded"); + return true; + } + + TileEntityScreen tes = getConnectedScreen(); + if(tes == null) { + Util.toast(player, "notLinked"); + return true; + } + + TileEntityScreen.Screen scr = tes.getScreen(screenSide); + if((scr.rightsFor(player) & ScreenRights.CHANGE_URL) == 0) { + Util.toast(player, "restrictions"); + return true; + } + + (new RedstoneCtrlData(world.provider.getDimension(), pos, risingEdgeURL, fallingEdgeURL)).sendTo((EntityPlayerMP) player); + return true; + } + + @Override + public void onNeighborChange(Block neighborType, BlockPos neighborPos) { + boolean hasPower = (world.isBlockPowered(pos) || world.isBlockPowered(pos.up())); //Same as dispenser + + if(hasPower != state) { + state = hasPower; + + if(state) //Rising edge + changeURL(risingEdgeURL); + else //Falling edge + changeURL(fallingEdgeURL); + } + } + + public void setURLs(String r, String f) { + risingEdgeURL = r.trim(); + fallingEdgeURL = f.trim(); + markDirty(); + } + + private void changeURL(String url) { + if(world.isRemote || url.isEmpty()) + return; + + if(isScreenChunkLoaded()) { + TileEntityScreen tes = getConnectedScreen(); + + if(tes != null) + tes.setScreenURL(screenSide, url); + } + } + +} diff --git a/src/main/java/net/montoyo/wd/item/ItemPeripheral.java b/src/main/java/net/montoyo/wd/item/ItemPeripheral.java index ea12d85..470668a 100644 --- a/src/main/java/net/montoyo/wd/item/ItemPeripheral.java +++ b/src/main/java/net/montoyo/wd/item/ItemPeripheral.java @@ -4,7 +4,10 @@ package net.montoyo.wd.item; +import com.mojang.realmsclient.gui.ChatFormatting; import net.minecraft.block.Block; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemMultiTexture; import net.minecraft.item.ItemStack; @@ -16,15 +19,18 @@ import net.minecraft.world.World; import net.montoyo.wd.block.BlockKeyboardRight; import net.montoyo.wd.core.DefaultPeripheral; +import javax.annotation.Nullable; +import java.util.List; + public class ItemPeripheral extends ItemMultiTexture { public ItemPeripheral(Block block) { - super(block, block, (is) -> DefaultPeripheral.values()[is.getMetadata()].getName()); + super(block, block, (is) -> DefaultPeripheral.fromMetadata(is.getMetadata()).getName()); } @Override public boolean canPlaceBlockOnSide(World world, BlockPos pos_, EnumFacing side, EntityPlayer player, ItemStack stack) { - if(stack.getMetadata() != 0) + if(stack.getMetadata() != 0) //Keyboard return true; //Special checks for the keyboard @@ -43,4 +49,10 @@ public class ItemPeripheral extends ItemMultiTexture { return world.isAirBlock(left) && !world.isAirBlock(left.down()) && BlockKeyboardRight.checkNeighborhood(world, left, null); } + @Override + public void addInformation(ItemStack is, @Nullable World world, List tt, ITooltipFlag ttFlags) { + if(is.getMetadata() == 1) //CC Interface + tt.add("" + ChatFormatting.RED + I18n.format("webdisplays.message.missingCC")); //CC is not available for 1.12.2 + } + } diff --git a/src/main/java/net/montoyo/wd/net/Messages.java b/src/main/java/net/montoyo/wd/net/Messages.java index f25fbb8..f55ae72 100644 --- a/src/main/java/net/montoyo/wd/net/Messages.java +++ b/src/main/java/net/montoyo/wd/net/Messages.java @@ -25,6 +25,7 @@ public class Messages { l.add(SMessageACQuery.class); l.add(CMessageACResult.class); l.add(SMessagePadCtrl.class); + l.add(SMessageRedstoneCtrl.class); messages = l.toArray(new Class[0]); } diff --git a/src/main/java/net/montoyo/wd/net/SMessageRedstoneCtrl.java b/src/main/java/net/montoyo/wd/net/SMessageRedstoneCtrl.java new file mode 100644 index 0000000..2679b8c --- /dev/null +++ b/src/main/java/net/montoyo/wd/net/SMessageRedstoneCtrl.java @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2018 BARBOTIN Nicolas + */ + +package net.montoyo.wd.net; + +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.fml.common.network.ByteBufUtils; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.relauncher.Side; +import net.montoyo.wd.core.ScreenRights; +import net.montoyo.wd.entity.TileEntityRedCtrl; +import net.montoyo.wd.entity.TileEntityScreen; +import net.montoyo.wd.utilities.Util; +import net.montoyo.wd.utilities.Vector3i; + +@Message(messageId = 8, side = Side.SERVER) +public class SMessageRedstoneCtrl implements IMessage, Runnable { + + private EntityPlayer player; + private int dimension; + private Vector3i pos; + private String risingEdgeURL; + private String fallingEdgeURL; + + public SMessageRedstoneCtrl() { + } + + public SMessageRedstoneCtrl(int d, Vector3i p, String r, String f) { + dimension = d; + pos = p; + risingEdgeURL = r; + fallingEdgeURL = f; + } + + @Override + public void run() { + World world = player.world; + BlockPos blockPos = pos.toBlock(); + final double maxRange = player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue(); + + if(world.provider.getDimension() != dimension || player.getDistanceSq(blockPos) > maxRange * maxRange) + return; + + TileEntity te = player.world.getTileEntity(blockPos); + if(te == null || !(te instanceof TileEntityRedCtrl)) + return; + + TileEntityRedCtrl redCtrl = (TileEntityRedCtrl) te; + if(!redCtrl.isScreenChunkLoaded()) { + Util.toast(player, "chunkUnloaded"); + return; + } + + TileEntityScreen tes = redCtrl.getConnectedScreen(); + if(tes == null) + return; + + if((tes.getScreen(redCtrl.getScreenSide()).rightsFor(player) & ScreenRights.CHANGE_URL) == 0) + return; + + redCtrl.setURLs(risingEdgeURL, fallingEdgeURL); + } + + @Override + public void fromBytes(ByteBuf buf) { + dimension = buf.readInt(); + pos = new Vector3i(buf); + risingEdgeURL = ByteBufUtils.readUTF8String(buf); + fallingEdgeURL = ByteBufUtils.readUTF8String(buf); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(dimension); + pos.writeTo(buf); + ByteBufUtils.writeUTF8String(buf, risingEdgeURL); + ByteBufUtils.writeUTF8String(buf, fallingEdgeURL); + } + + public static class Handler implements IMessageHandler { + + @Override + public IMessage onMessage(SMessageRedstoneCtrl msg, MessageContext ctx) { + msg.player = ctx.getServerHandler().player; + ((WorldServer) msg.player.world).addScheduledTask(msg); + return null; + } + + } +} diff --git a/src/main/resources/assets/webdisplays/blockstates/peripheral.json b/src/main/resources/assets/webdisplays/blockstates/peripheral.json index 5b2f9a1..2dfa416 100644 --- a/src/main/resources/assets/webdisplays/blockstates/peripheral.json +++ b/src/main/resources/assets/webdisplays/blockstates/peripheral.json @@ -5,11 +5,6 @@ "facing=2,type=keyboard": { "model": "webdisplays:kb_left", "y": 180.0 }, "facing=3,type=keyboard": { "model": "webdisplays:kb_left", "y": 270.0 }, - "facing=0,type=remotectrl": { "model": "webdisplays:rctrl" }, - "facing=1,type=remotectrl": { "model": "webdisplays:rctrl" }, - "facing=2,type=remotectrl": { "model": "webdisplays:rctrl" }, - "facing=3,type=remotectrl": { "model": "webdisplays:rctrl" }, - "facing=0,type=ccinterface": { "model": "webdisplays:ccinterface", "y": 180.0 }, "facing=1,type=ccinterface": { "model": "webdisplays:ccinterface", "y": 270.0 }, "facing=2,type=ccinterface": { "model": "webdisplays:ccinterface" }, @@ -18,6 +13,16 @@ "facing=0,type=cointerface": { "model": "webdisplays:ocinterface", "y": 180.0 }, "facing=1,type=cointerface": { "model": "webdisplays:ocinterface", "y": 270.0 }, "facing=2,type=cointerface": { "model": "webdisplays:ocinterface" }, - "facing=3,type=cointerface": { "model": "webdisplays:ocinterface", "y": 90.0 } + "facing=3,type=cointerface": { "model": "webdisplays:ocinterface", "y": 90.0 }, + + "facing=0,type=remotectrl": { "model": "webdisplays:rctrl" }, + "facing=1,type=remotectrl": { "model": "webdisplays:rctrl" }, + "facing=2,type=remotectrl": { "model": "webdisplays:rctrl" }, + "facing=3,type=remotectrl": { "model": "webdisplays:rctrl" }, + + "facing=0,type=redstonectrl": { "model": "webdisplays:redctrl" }, + "facing=1,type=redstonectrl": { "model": "webdisplays:redctrl" }, + "facing=2,type=redstonectrl": { "model": "webdisplays:redctrl" }, + "facing=3,type=redstonectrl": { "model": "webdisplays:redctrl" } } } diff --git a/src/main/resources/assets/webdisplays/gui/redstonectrl.json b/src/main/resources/assets/webdisplays/gui/redstonectrl.json new file mode 100644 index 0000000..e0d6b62 --- /dev/null +++ b/src/main/resources/assets/webdisplays/gui/redstonectrl.json @@ -0,0 +1,56 @@ +{ + "controls": [ + { + "type": "Icon", + "resourceLocation": "webdisplays:textures/gui/edges.png", + "x": 0, + "y": 1, + "width": 16, + "height": 16, + "v1": 0.0, + "v2": 0.5 + }, + { + "type": "TextField", + "name": "tfRisingEdge", + "x": 20, + "y": 0, + "width": 280 + }, + { + "type": "Icon", + "resourceLocation": "webdisplays:textures/gui/edges.png", + "x": 0, + "y": 26, + "width": 16, + "height": 16, + "v1": 0.5, + "v2": 1.0 + }, + { + "type": "TextField", + "name": "tfFallingEdge", + "x": 20, + "y": 24, + "width": 280 + }, + { + "type": "Button", + "name": "btnOk", + "label": "$webdisplays.gui.seturl.ok", + "x": 20, + "y": 48, + "width": 137 + }, + { + "type": "Button", + "name": "btnCancel", + "label": "$webdisplays.gui.seturl.cancel", + "x": 163, + "y": 48, + "width": 137 + } + ], + + "center": true +} diff --git a/src/main/resources/assets/webdisplays/lang/en_us.lang b/src/main/resources/assets/webdisplays/lang/en_us.lang index ba105ed..713fe7b 100644 --- a/src/main/resources/assets/webdisplays/lang/en_us.lang +++ b/src/main/resources/assets/webdisplays/lang/en_us.lang @@ -4,6 +4,7 @@ tile.webdisplays.peripheral.keyboard.name=Keyboard tile.webdisplays.peripheral.remotectrl.name=Remote Controller tile.webdisplays.peripheral.ccinterface.name=ComputerCraft Interface tile.webdisplays.peripheral.cointerface.name=OpenComputers Interface +tile.webdisplays.peripheral.redstonectrl.name=Redstone Controller item.webdisplays.screencfg.name=Screen Configurator item.webdisplays.ownerthief.name=Ownership Thief [ADMIN] item.webdisplays.linker.name=Linking Tool @@ -20,8 +21,10 @@ webdisplays.message.linked=Linked! webdisplays.message.linkError=Link error :( Check logs... webdisplays.message.notAScreen=Please right click on the screen first... webdisplays.message.screenSet2=Screen set! Now right click on the peripheral... -webdisplays.message.chunkUnloaded=The chunk the screen in placed it is not loaded! +webdisplays.message.chunkUnloaded=The chunk the screen is placed in is not loaded! 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.gui.screencfg.owner=Screen owner: webdisplays.gui.screencfg.friends=Friends: webdisplays.gui.screencfg.permissions=Permissions: diff --git a/src/main/resources/assets/webdisplays/models/block/redctrl.json b/src/main/resources/assets/webdisplays/models/block/redctrl.json new file mode 100644 index 0000000..bf34100 --- /dev/null +++ b/src/main/resources/assets/webdisplays/models/block/redctrl.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "webdisplays:blocks/redctrl" + } +} diff --git a/src/main/resources/assets/webdisplays/recipes/ccinterface.json b/src/main/resources/assets/webdisplays/recipes/ccinterface.json index 3916e35..9fda532 100644 --- a/src/main/resources/assets/webdisplays/recipes/ccinterface.json +++ b/src/main/resources/assets/webdisplays/recipes/ccinterface.json @@ -16,6 +16,6 @@ }, "result": { "item": "webdisplays:peripheral", - "data": 2 + "data": 1 } } diff --git a/src/main/resources/assets/webdisplays/recipes/ocinterface.json b/src/main/resources/assets/webdisplays/recipes/ocinterface.json index 8d3d264..e90d1de 100644 --- a/src/main/resources/assets/webdisplays/recipes/ocinterface.json +++ b/src/main/resources/assets/webdisplays/recipes/ocinterface.json @@ -16,6 +16,6 @@ }, "result": { "item": "webdisplays:peripheral", - "data": 3 + "data": 2 } } diff --git a/src/main/resources/assets/webdisplays/recipes/rctrl.json b/src/main/resources/assets/webdisplays/recipes/rctrl.json index 10d9346..9c11cd0 100644 --- a/src/main/resources/assets/webdisplays/recipes/rctrl.json +++ b/src/main/resources/assets/webdisplays/recipes/rctrl.json @@ -14,6 +14,6 @@ }, "result": { "item": "webdisplays:peripheral", - "data": 1 + "data": 3 } } diff --git a/src/main/resources/assets/webdisplays/recipes/redctrl1.json b/src/main/resources/assets/webdisplays/recipes/redctrl1.json new file mode 100644 index 0000000..253aa38 --- /dev/null +++ b/src/main/resources/assets/webdisplays/recipes/redctrl1.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "RRR", + "RER", + "BBB" + ], + "key": { + "R": { + "item": "minecraft:redstone" + }, + "E": { + "item": "minecraft:ender_pearl" + }, + "B": { + "item": "minecraft:wooden_button" + } + }, + "result": { + "item": "webdisplays:peripheral", + "data": 7 + } +} diff --git a/src/main/resources/assets/webdisplays/recipes/redctrl2.json b/src/main/resources/assets/webdisplays/recipes/redctrl2.json new file mode 100644 index 0000000..11ea2c1 --- /dev/null +++ b/src/main/resources/assets/webdisplays/recipes/redctrl2.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "RRR", + "RPR" + ], + "key": { + "R": { + "item": "minecraft:redstone" + }, + "P": { + "item": "webdisplays:peripheral", + "data": 3 + } + }, + "result": { + "item": "webdisplays:peripheral", + "data": 7 + } +} diff --git a/src/main/resources/assets/webdisplays/textures/gui/edges.png b/src/main/resources/assets/webdisplays/textures/gui/edges.png new file mode 100644 index 0000000..3ddd3b1 Binary files /dev/null and b/src/main/resources/assets/webdisplays/textures/gui/edges.png differ