Browse files

Added random 3/5 bit ICs.

  • Loading branch information...
me4502 committed Jun 29, 2017
1 parent 74f4d75 commit abb08b519a497ab9fc06a75fba1ff2f16e0d7ef2
@@ -85,6 +85,8 @@
registerICType(new ICType<>("MC1421", "CLOCK", "Clock", "Outputs high every X ticks when input is high.", new Clock.Factory()));
registerICType(new ICType<>("MC2020", "RANDOM 3", "Random 3-Bit", "Randomly sets the outputs on high.", new RandomBit.Factory(), "SI3O"));
registerICType(new ICType<>("MC2300", "ROM GET", "ROM Get", "Gets the memory state from a file for usage in the MemorySetter/Access IC group.", new MemoryAccess.Factory(), "SI3O"));
@@ -113,6 +115,8 @@
registerICType(new ICType<>("MC4100", "FULL SUBTR", "Full Subtractor", "A compact full-subtractor", new FullSubtractor.Factory(), "3I3O"));
registerICType(new ICType<>("MC4110", "HALF SUBTR", "Half Subtractor", "A compact half-subtractor", new HalfSubtractor.Factory(), "3I3O"));
registerICType(new ICType<>("MC4200", "DISPATCH", "Dispatcher", "Outputs the centre input on the appropriate outputs when input is high.", new Dispatcher.Factory(), "3I3O"));
registerICType(new ICType<>("MC6020", "RANDOM 5", "Random 5-Bit", "Randomly sets the outputs on high.", new RandomBit.Factory(), "SI5O"));
public static void registerICType(ICType<? extends IC> ic) {
@@ -106,6 +106,7 @@ public RandomBit createInstance(Location<World> location) {
public String[][] getPinHelp() {
return new String[][] {
new String[] {
"High to output random state"
@@ -0,0 +1,60 @@
* CraftBook Copyright (C) 2010-2017 sk89q <>
* CraftBook Copyright (C) 2011-2017 me4502 <>
* CraftBook Copyright (C) Contributors
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program. If not,
* see <>.
package com.sk89q.craftbook.sponge.mechanics.ics.pinsets;
import com.sk89q.craftbook.sponge.mechanics.ics.IC;
import com.sk89q.craftbook.sponge.util.SignUtil;
public class PinsSI5O extends PinSet {
public int getInputCount() {
return 1;
public int getOutputCount() {
return 5;
public String getName() {
return "SI5O";
public Location<World> getPinLocation(int id, IC ic) {
switch(id) {
case 0:
return ic.getBlock().getRelative(SignUtil.getFront(ic.getBlock()));
case 1:
return ic.getBlock().getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock()));
case 2:
return ic.getBlock().getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getLeft(ic.getBlock()));
case 3:
return ic.getBlock().getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getRight(ic.getBlock()));
case 4:
return ic.getBlock().getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getLeft(ic.getBlock()));
case 5:
return ic.getBlock().getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getBack(ic.getBlock())).getRelative(SignUtil.getRight(ic.getBlock()));
return null;

0 comments on commit abb08b5

Please sign in to comment.