diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 0000000..d7f1598 --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,18 @@ +### What I did: +_Description of your setup (how devices where configured, connected etc.) and what you did (eventually a screenshot)_ + +### What happened: +_Description of what happened, how things behaved and/or crash report (if any) or log entries (only the relevant parts if any)_ + +### What should have happened: +_The behavior you expected or would like to have (obsolete for crashes)_ + +_Personal ideas, notes, suggestions, etc. (optional)_ + +### Used Versions: +- Minecraft-?.?.? +- AutomatedRedstone-?.?.? +- CD4017BE_lib-?.?.? +- Forge-?.?.?.? +- _other installed mods (optional / only if relevant)_ +- _relevant changes to config (if any)_ diff --git a/src/java/cd4017be/circuits/RedstoneCircuits.java b/src/java/cd4017be/circuits/RedstoneCircuits.java index 7122b26..df3be5c 100644 --- a/src/java/cd4017be/circuits/RedstoneCircuits.java +++ b/src/java/cd4017be/circuits/RedstoneCircuits.java @@ -28,7 +28,7 @@ public class RedstoneCircuits { public static CommonProxy proxy; public RedstoneCircuits() { - RecipeScriptContext.scriptRegistry.add(new Version("automatedRedstone", 409, "/assets/" + ID + "/config/recipes.rcp")); + RecipeScriptContext.scriptRegistry.add(new Version("automatedRedstone", 411, "/assets/" + ID + "/config/recipes.rcp")); } @Mod.EventHandler diff --git a/src/java/cd4017be/circuits/tileEntity/Circuit.java b/src/java/cd4017be/circuits/tileEntity/Circuit.java index f72999d..de25b0b 100644 --- a/src/java/cd4017be/circuits/tileEntity/Circuit.java +++ b/src/java/cd4017be/circuits/tileEntity/Circuit.java @@ -193,8 +193,8 @@ private int[] cpuTick() { int a = getNum(ram[++readIdx]); x = a >= 0 ? sqrt(a) : -sqrt(-a); } break; - case C_BSR: x = getNum(ram[++readIdx]) >>> getNum(ram[++readIdx]); break; - case C_BSL: x = getNum(ram[++readIdx]) << getNum(ram[++readIdx]); break; + case C_BSR: x = getNumU(ram[++readIdx]) >>> getNum(ram[++readIdx]); break; + case C_BSL: x = getNumU(ram[++readIdx]) << getNum(ram[++readIdx]); break; case C_COMB: x = 0; s = s * 2 + 1; for (int mask = 1; s >= 0; s--, mask <<= 1) x |= read8bit() & mask; ram[n++] = (byte)x; @@ -291,6 +291,16 @@ public int getNum(int idx) { } } + public int getNumU(int idx) { + int p = idx & 0x3f; + switch(idx & 0xc0) { + case 0x00: return ram[p] & 0xff; + case 0x40: return ram[p] & 0xff | ram[++p] << 8 & 0xff00; + case 0x80: return ram[p] & 0xff | ram[++p] << 8 & 0xff00 | ram[++p] << 16 & 0xff0000; + default: return ram[p] & 0xff | ram[++p] << 8 & 0xff00 | ram[++p] << 16 & 0xff0000 | ram[++p] << 24; + } + } + public int getMinInterval() { return ClockSpeed[getBlockMetadata() % ClockSpeed.length]; } @@ -335,14 +345,21 @@ public void onPacketFromClient(PacketBuffer data, EntityPlayer sender) throws IO } } else if (cmd == 3) { for (int i = startIdx, j = 0; i < ram.length; i++) { + //get op byte b = ram[i]; + if (b == C_SKIP) { + j += ram[++i] & 0x3f; + continue; + } ModuleType mt = ModuleType.values()[b & 0x3f]; + //skip extra data int w = mt.varInAm ? ((b >> 6 & 3) + 1) * mt.group : mt.cons(); for (int k = 0; k < w; k++) if (Assembler.extraByte(ram[++i], mt.conType(k))) i++; + //get size int k = mt.isNum ? j + (b >> 6 & 3) : j + mt.size - 1; - if (mt.cons() == 0) j = k + 1; - else { + if (mt.cons() == 0) j = k + 1; //don't reset constants + else {//reset bytes if (k >= startIdx) k = startIdx - 1; while (j <= k) ram[j++] = 0; } diff --git a/src/java/multiblock/IntegerComp.java b/src/java/multiblock/IntegerComp.java index 7f30898..355567d 100644 --- a/src/java/multiblock/IntegerComp.java +++ b/src/java/multiblock/IntegerComp.java @@ -26,12 +26,8 @@ public IntegerComp(IAbstractTile tile, int bitSize) { public short rsIO; public void setUID(long uid) { - if (this.uid != 0) return; - this.uid = uid; - if (network != null) { - network.components.remove(0L); - network.components.put(uid, this); - } else new SharedInteger(this); + super.setUID(uid); + if (network == null) new SharedInteger(this); network.setIO(this, rsIO); } @@ -65,7 +61,7 @@ public IntegerComp getNeighbor(byte side) { public void readFromNBT(NBTTagCompound nbt) { con = nbt.getByte("con"); rsIO = nbt.getShort("io"); - if (uid != 0) network.setIO(this, rsIO); + if (network != null) network.setIO(this, rsIO); inputState = nbt.getInteger("state"); } diff --git a/src/resources/assets/circuits/config/recipes.rcp b/src/resources/assets/circuits/config/recipes.rcp index e840e08..43f3003 100644 --- a/src/resources/assets/circuits/config/recipes.rcp +++ b/src/resources/assets/circuits/config/recipes.rcp @@ -1,4 +1,4 @@ -VERSION = 409; +VERSION = 411; { circuit_ticks = [20, 5, 1]#; !min operation delay in ticks for each tier of circuit casing Loc range = 20; !maximum range for sensor modules in blocks @@ -21,7 +21,7 @@ PRE_INIT() { INIT() { Loc WILDCARD = 32767; Loc slab = it("minecraft:stone_slab"); - Loc nbt = "#IO,#Cap,#Gate,#Calc,#data,#name,#io,#ofs";!<- DON'T EDIT (bad things would happen) + Loc nbt = "#IO,#Cap,#Gate,#Calc,#data,#name,#io,#ofs,#used";!<- DON'T EDIT (bad things would happen) add("shapeless", it("item.circuit_plan"), it("item.circuit_plan")); add("shaped", it("item.circuit_plan"), "0/1/2", "dyeBlack", it("minecraft:paper"), it("minecraft:glass_pane")); add("shaped", it("tile.designer"), "010/232", "dustRedstone", it("item.circuit_plan"), slab, it("minecraft:crafting_table")); @@ -51,8 +51,8 @@ INIT() { add("shapeless", it("item.time_sensor"), it("m.empty_sensor"), it("minecraft:clock")); add("shapeless", it("item.energy_sensor"), it("m.empty_sensor"), it("minecraft:piston")); add("shapeless", it("item.remote_comp"), it("m.empty_sensor"), "gemQuartz"); - add("shaped", it("m.io_relay", 16), "021", it("rsp1bitI"), it("rsp1bitO"), it("minecraft:lever")); - add("shaped", it("m.ram_plate", 4), " 1 /000", slab, it("tile.rsp_32bit")); - add("shaped", it("m.logic_prc", 8), "010/121/010", "dustRedstone", it("minecraft:redstone_torch"), "ingotIron"); + add("shaped", it("m.io_relay", 32), "021", it("rsp1bitI"), it("rsp1bitO"), it("minecraft:lever")); + add("shaped", it("m.ram_plate", 2), "1/0", slab, it("rsp1bitN")); + add("shaped", it("m.logic_prc", 8), "010/121/010", "dustRedstone", it("minecraft:redstone_torch"), "stone"); add("shaped", it("m.calc_prc", 2), "010/010/222", it("m.logic_prc"), "gemQuartz", "nuggetGold"); }