diff --git a/CHANGELOG.md b/CHANGELOG.md index e459665..b70a787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +**Beta 0.0.8** +* Add Phase Shifter Block +* Fix Bugs +* Add Circuit Board To REI + **Beta 0.0.7** * Fix Structure Generation diff --git a/docs/BLOCKS.md b/docs/BLOCKS.md index 3ac2abf..75d2047 100644 --- a/docs/BLOCKS.md +++ b/docs/BLOCKS.md @@ -92,4 +92,14 @@ ## Infuser - Uses Energy To Attempt To Convert An Item To A Different Item -- Each Item Has Multiple Outcomes And May Require Different Amount Of Energy \ No newline at end of file +- Each Item Has Multiple Outcomes And May Require Different Amount Of Energy + +## Phase Shifter +- Two Modes: Input And Output +- Mode Is Toggled By Redstone Input +- Can Be Dyed +- Input Blocks Phase Items +- The More Phased Items, The More Power An Input Requires +- The Longer An Item Is Phased, The Higher Its Range Is +- Periodically, Phased Items Are Rolled +- When Phased Items Are Rolled, There Is A 10% Chance Of Success, If It Succeeds it Will Transfer The Phased Item To An Output With Range That Is The Same Color \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 90a823a..eba8bb6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G fabric_loader_version = 0.9.0+build.204 # Mod Properties - mod_version = 0.0.7 + mod_version = 0.0.8 maven_group = com.thebrokenrail # Dependencies diff --git a/src/main/java/com/thebrokenrail/energonrelics/EnergonRelics.java b/src/main/java/com/thebrokenrail/energonrelics/EnergonRelics.java index 79c784f..386d916 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/EnergonRelics.java +++ b/src/main/java/com/thebrokenrail/energonrelics/EnergonRelics.java @@ -5,6 +5,7 @@ import com.thebrokenrail.energonrelics.block.CreativeEnergySourceBlock; import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock; import com.thebrokenrail.energonrelics.block.HolographicSkyBlock; import com.thebrokenrail.energonrelics.block.InfuserBlock; +import com.thebrokenrail.energonrelics.block.PhaseShifterBlock; import com.thebrokenrail.energonrelics.block.lightning.LightningRodBaseBlock; import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldProjectorBlock; import com.thebrokenrail.energonrelics.block.forcefield.laser.IndustrialLaserProjectorBlock; @@ -126,6 +127,8 @@ public final class EnergonRelics implements ModInitializer { public static final EnergyProjectorBlock ENERGY_PROJECTOR_BLOCK = new EnergyProjectorBlock(); public static final Item VERIDIUM_ORB_ITEM = new Item(new Item.Settings().group(ITEM_GROUP).rarity(Rarity.UNCOMMON)); + public static final PhaseShifterBlock PHASE_SHIFTER_BLOCK = new PhaseShifterBlock(); + @Override public void onInitialize() { Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "veridium_ingot"), VERIDIUM_INGOT_ITEM); @@ -190,6 +193,8 @@ public final class EnergonRelics implements ModInitializer { ENERGY_BEAM_BLOCK.register("energy_beam"); ENERGY_PORTAL_BLOCK.register("energy_portal"); ENERGY_PROJECTOR_BLOCK.register("energy_projector"); + + PHASE_SHIFTER_BLOCK.register("phase_shifter"); } public static void playBeep(World world, BlockPos pos) { diff --git a/src/main/java/com/thebrokenrail/energonrelics/api/block/SimpleBlockWithEntity.java b/src/main/java/com/thebrokenrail/energonrelics/api/block/SimpleBlockWithEntity.java index 57f176a..ea96bea 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/api/block/SimpleBlockWithEntity.java +++ b/src/main/java/com/thebrokenrail/energonrelics/api/block/SimpleBlockWithEntity.java @@ -1,17 +1,25 @@ package com.thebrokenrail.energonrelics.api.block; import net.minecraft.block.BlockEntityProvider; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.inventory.Inventory; +import net.minecraft.screen.ScreenHandler; import net.minecraft.util.Identifier; +import net.minecraft.util.ItemScatterer; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; import net.minecraft.world.BlockView; +import net.minecraft.world.World; +import org.jetbrains.annotations.ApiStatus; import java.util.function.Function; /** * Simple Block With Entity */ +@SuppressWarnings("deprecation") public abstract class SimpleBlockWithEntity extends SimpleBlock implements BlockEntityProvider { protected BlockEntityType type; @@ -35,4 +43,35 @@ public abstract class SimpleBlockWithEntity extends SimpleBlock implements Block public BlockEntity createBlockEntity(BlockView world) { return getFactory().apply(type); } + + /** + * Does This Block's Block Entity Have An Inventory + * @return Has Inventory + */ + @ApiStatus.OverrideOnly + protected boolean hasInventory() { + return false; + } + + @Override + public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { + if (state.getBlock() != newState.getBlock() && hasInventory()) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity instanceof Inventory) { + ItemScatterer.spawn(world, pos, (Inventory) blockEntity); + world.updateComparators(pos, this); + } + } + super.onStateReplaced(state, world, pos, newState, moved); + } + + @Override + public boolean hasComparatorOutput(BlockState state) { + return hasInventory(); + } + + @Override + public int getComparatorOutput(BlockState state, World world, BlockPos pos) { + return hasInventory() ? ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos)) : 0; + } } diff --git a/src/main/java/com/thebrokenrail/energonrelics/api/energy/tick/EnergyTicker.java b/src/main/java/com/thebrokenrail/energonrelics/api/energy/tick/EnergyTicker.java index cb9c185..7768be5 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/api/energy/tick/EnergyTicker.java +++ b/src/main/java/com/thebrokenrail/energonrelics/api/energy/tick/EnergyTicker.java @@ -18,6 +18,11 @@ import java.util.Objects; public class EnergyTicker { private static final List scheduled = new ArrayList<>(); + /** + * List of All Loaded Energy Tickers + */ + public static List allLoaded = Collections.emptyList(); + /** * Schedule For Next Energy Tick * @param tickable Object To Tick @@ -56,6 +61,8 @@ public class EnergyTicker { temp2.clear(); } + allLoaded = Collections.unmodifiableList(started); + Collections.shuffle(started, world.random); for (EnergyTickable tickable : started) { world.getProfiler().push(() -> tickable.getID() + " logicTick"); @@ -68,5 +75,7 @@ public class EnergyTicker { world.getProfiler().pop(); } scheduled.clear(); + + allLoaded = Collections.emptyList(); } } diff --git a/src/main/java/com/thebrokenrail/energonrelics/api/item/MultimeterExtra.java b/src/main/java/com/thebrokenrail/energonrelics/api/item/MultimeterExtra.java new file mode 100644 index 0000000..f3b8102 --- /dev/null +++ b/src/main/java/com/thebrokenrail/energonrelics/api/item/MultimeterExtra.java @@ -0,0 +1,14 @@ +package com.thebrokenrail.energonrelics.api.item; + +import net.minecraft.text.MutableText; + +/** + * Implement To provide Extra Information In Multimeter + */ +public interface MultimeterExtra { + /** + * Get Extra Information + * @return Text + */ + MutableText getExtra(); +} diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/PhaseShifterBlock.java b/src/main/java/com/thebrokenrail/energonrelics/block/PhaseShifterBlock.java new file mode 100644 index 0000000..de42cfe --- /dev/null +++ b/src/main/java/com/thebrokenrail/energonrelics/block/PhaseShifterBlock.java @@ -0,0 +1,115 @@ +package com.thebrokenrail.energonrelics.block; + +import com.thebrokenrail.energonrelics.EnergonRelics; +import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock; +import com.thebrokenrail.energonrelics.block.entity.shifter.PhaseShifterBlockEntity; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.DyeItem; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.HopperScreenHandler; +import net.minecraft.screen.SimpleNamedScreenHandlerFactory; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.EnumProperty; +import net.minecraft.state.property.Properties; +import net.minecraft.text.TranslatableText; +import net.minecraft.util.ActionResult; +import net.minecraft.util.DyeColor; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import java.util.Random; +import java.util.function.Function; + +@SuppressWarnings("deprecation") +public class PhaseShifterBlock extends EnergyBlock { + public static final BooleanProperty POWERED = Properties.POWERED; + public static final BooleanProperty IS_OUTPUT = BooleanProperty.of("is_output"); + public static final EnumProperty COLOR = EnumProperty.of("color", DyeColor.class); + + public PhaseShifterBlock() { + super(FabricBlockSettings.copy(Blocks.IRON_BLOCK).lightLevel(state -> state.get(POWERED) ? 13 : 0).emissiveLighting((state, world, pos) -> state.get(POWERED))); + setDefaultState(getDefaultState().with(POWERED, false).with(IS_OUTPUT, false).with(COLOR, DyeColor.WHITE)); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + super.appendProperties(builder); + builder.add(POWERED, IS_OUTPUT, COLOR); + } + + @Override + protected Function, BlockEntity> getFactory() { + return PhaseShifterBlockEntity::new; + } + + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return getDefaultState().with(IS_OUTPUT, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())); + } + + @Override + public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { + if (!world.isClient()) { + boolean bl = state.get(IS_OUTPUT); + if (bl != world.isReceivingRedstonePower(pos)) { + if (bl) { + world.getBlockTickScheduler().schedule(pos, this, 4); + } else { + world.setBlockState(pos, state.cycle(IS_OUTPUT), 2); + } + } + } + } + + @Override + public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + if (state.get(IS_OUTPUT) && !world.isReceivingRedstonePower(pos)) { + world.setBlockState(pos, state.cycle(IS_OUTPUT), 2); + } + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + ItemStack stack = player.getStackInHand(hand); + BlockEntity entity = world.getBlockEntity(pos); + + if (stack.getItem() instanceof DyeItem) { + DyeColor newColor = ((DyeItem) stack.getItem()).getColor(); + if (state.get(COLOR) != newColor) { + world.setBlockState(pos, state.with(COLOR, newColor)); + if (!player.isCreative()) { + stack.decrement(1); + } + return ActionResult.SUCCESS; + } else { + return ActionResult.PASS; + } + } else { + if (entity instanceof Inventory) { + if (!world.isClient()) { + player.openHandledScreen(new SimpleNamedScreenHandlerFactory((i, inv, player2) -> new HopperScreenHandler(i, inv, (Inventory) entity), new TranslatableText("block." + EnergonRelics.NAMESPACE + ".phase_shifter"))); + } + return ActionResult.SUCCESS; + } else { + return ActionResult.FAIL; + } + } + } + + @Override + protected boolean hasInventory() { + return true; + } +} diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/SwitchBlock.java b/src/main/java/com/thebrokenrail/energonrelics/block/SwitchBlock.java index b10a79e..8448423 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/block/SwitchBlock.java +++ b/src/main/java/com/thebrokenrail/energonrelics/block/SwitchBlock.java @@ -22,26 +22,27 @@ import java.util.function.Function; @SuppressWarnings("deprecation") public class SwitchBlock extends EnergyBlock { public static final BooleanProperty POWERED = Properties.POWERED; + public static final BooleanProperty ACTIVE = BooleanProperty.of("active"); public SwitchBlock() { super(FabricBlockSettings.of(Material.STONE).requiresTool().strength(1.5f, 6.0f)); - setDefaultState(getDefaultState().with(POWERED, false)); + setDefaultState(getDefaultState().with(POWERED, false).with(ACTIVE, false)); } @Override public BlockState getPlacementState(ItemPlacementContext ctx) { - return getDefaultState().with(POWERED, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())); + return getDefaultState().with(ACTIVE, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())); } @Override public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { if (!world.isClient()) { - boolean bl = state.get(POWERED); + boolean bl = state.get(ACTIVE); if (bl != world.isReceivingRedstonePower(pos)) { if (bl) { world.getBlockTickScheduler().schedule(pos, this, 4); } else { - world.setBlockState(pos, state.cycle(POWERED), 2); + world.setBlockState(pos, state.cycle(ACTIVE), 2); } } } @@ -49,14 +50,14 @@ public class SwitchBlock extends EnergyBlock { @Override public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (state.get(POWERED) && !world.isReceivingRedstonePower(pos)) { - world.setBlockState(pos, state.cycle(POWERED), 2); + if (state.get(ACTIVE) && !world.isReceivingRedstonePower(pos)) { + world.setBlockState(pos, state.cycle(ACTIVE), 2); } } @Override protected void appendProperties(StateManager.Builder builder) { - builder.add(POWERED); + builder.add(POWERED, ACTIVE); } @Override diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java b/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java index afc6fcc..445f66a 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java +++ b/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java @@ -3,6 +3,7 @@ package com.thebrokenrail.energonrelics.block.entity; import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity; import com.thebrokenrail.energonrelics.api.energy.Action; import com.thebrokenrail.energonrelics.block.SwitchBlock; +import com.thebrokenrail.energonrelics.config.HardcodedConfig; import net.minecraft.block.entity.BlockEntityType; public class SwitchBlockEntity extends EnergyReceiverBlockEntity { @@ -12,6 +13,7 @@ public class SwitchBlockEntity extends EnergyReceiverBlockEntity { @Override protected void energyTick() { + addAction(Action.createBlockStatePropertyAction(HardcodedConfig.SWITCH_ENERGY_REQUIRED, SwitchBlock.POWERED, true, false)); } @Override @@ -31,6 +33,6 @@ public class SwitchBlockEntity extends EnergyReceiverBlockEntity { } private boolean isActive() { - return getCachedState().get(SwitchBlock.POWERED); + return getCachedState().get(SwitchBlock.ACTIVE) && getCachedState().get(SwitchBlock.POWERED); } } diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/entity/infuser/InfuserBlockEntity.java b/src/main/java/com/thebrokenrail/energonrelics/block/entity/infuser/InfuserBlockEntity.java index b94e140..8941e1e 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/block/entity/infuser/InfuserBlockEntity.java +++ b/src/main/java/com/thebrokenrail/energonrelics/block/entity/infuser/InfuserBlockEntity.java @@ -3,9 +3,9 @@ package com.thebrokenrail.energonrelics.block.entity.infuser; import com.thebrokenrail.energonrelics.EnergonRelics; import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity; import com.thebrokenrail.energonrelics.api.energy.Action; +import com.thebrokenrail.energonrelics.api.item.MultimeterExtra; import com.thebrokenrail.energonrelics.block.InfuserBlock; import com.thebrokenrail.energonrelics.config.HardcodedConfig; -import com.thebrokenrail.energonrelics.item.MultimeterItem; import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserAction; import com.thebrokenrail.energonrelics.registry.infuser.data.InfuserEntry; import com.thebrokenrail.energonrelics.registry.infuser.InfuserRegistry; @@ -20,7 +20,7 @@ import net.minecraft.util.Formatting; import java.util.Objects; -public class InfuserBlockEntity extends EnergyReceiverBlockEntity implements MultimeterItem.MultimeterExtra { +public class InfuserBlockEntity extends EnergyReceiverBlockEntity implements MultimeterExtra { public InfuserBlockEntity(BlockEntityType type) { super(type); } diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/entity/reactor/ReactorInputBlockEntity.java b/src/main/java/com/thebrokenrail/energonrelics/block/entity/reactor/ReactorInputBlockEntity.java index bf0efdc..cefb555 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/block/entity/reactor/ReactorInputBlockEntity.java +++ b/src/main/java/com/thebrokenrail/energonrelics/block/entity/reactor/ReactorInputBlockEntity.java @@ -17,7 +17,7 @@ public class ReactorInputBlockEntity extends BlockEntity implements Inventory { super(type); } - private final int INVENTORY_SIZE = 5; + public final static int INVENTORY_SIZE = 5; private final DefaultedList inv = DefaultedList.ofSize(INVENTORY_SIZE, ItemStack.EMPTY); diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/entity/shifter/PhaseShifterBlockEntity.java b/src/main/java/com/thebrokenrail/energonrelics/block/entity/shifter/PhaseShifterBlockEntity.java new file mode 100644 index 0000000..e4c4898 --- /dev/null +++ b/src/main/java/com/thebrokenrail/energonrelics/block/entity/shifter/PhaseShifterBlockEntity.java @@ -0,0 +1,267 @@ +package com.thebrokenrail.energonrelics.block.entity.shifter; + +import com.thebrokenrail.energonrelics.EnergonRelics; +import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity; +import com.thebrokenrail.energonrelics.api.energy.Action; +import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTickable; +import com.thebrokenrail.energonrelics.api.energy.tick.EnergyTicker; +import com.thebrokenrail.energonrelics.api.item.MultimeterExtra; +import com.thebrokenrail.energonrelics.block.PhaseShifterBlock; +import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorInputBlockEntity; +import com.thebrokenrail.energonrelics.config.HardcodedConfig; +import com.thebrokenrail.energonrelics.util.WeightedList; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventories; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.text.LiteralText; +import net.minecraft.text.MutableText; +import net.minecraft.text.TranslatableText; +import net.minecraft.util.Formatting; +import net.minecraft.util.collection.DefaultedList; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class PhaseShifterBlockEntity extends EnergyReceiverBlockEntity implements Inventory, MultimeterExtra { + private final static int INVENTORY_SIZE = ReactorInputBlockEntity.INVENTORY_SIZE; + + private final DefaultedList inv = DefaultedList.ofSize(INVENTORY_SIZE, ItemStack.EMPTY); + + private int cooldown = 0; + + public PhaseShifterBlockEntity(BlockEntityType type) { + super(type); + } + + @Override + public int size() { + return inv.size(); + } + + @Override + public boolean isEmpty() { + boolean empty = false; + for (ItemStack stack : inv) { + if (stack.isEmpty()) { + empty = true; + break; + } + } + return empty; + } + + @Override + public ItemStack getStack(int slot) { + return inv.get(slot); + } + + @Override + public ItemStack removeStack(int slot, int amount) { + ItemStack stack = Inventories.splitStack(inv, slot, amount); + if (!stack.isEmpty()) { + markDirty(); + } + return stack; + } + + @Override + public ItemStack removeStack(int slot) { + return Inventories.removeStack(inv, slot); + } + + @Override + public void setStack(int slot, ItemStack stack) { + inv.set(slot, stack); + if (stack.getCount() > getMaxCountPerStack()) { + stack.setCount(getMaxCountPerStack()); + } + } + + @Override + public boolean canPlayerUse(PlayerEntity player) { + if (Objects.requireNonNull(getWorld()).getBlockEntity(getPos()) != this) { + return false; + } else { + return player.squaredDistanceTo((double) getPos().getX() + 0.5D, (double) getPos().getY() + 0.5D, (double) getPos().getZ() + 0.5D) <= 64.0D; + } + } + + @Override + public void clear() { + inv.clear(); + } + + private final List phasedItems = new ArrayList<>(); + + @Override + public void fromTag(BlockState state, CompoundTag tag) { + super.fromTag(state, tag); + inv.clear(); + Inventories.fromTag(tag, inv); + cooldown = tag.getInt("Cooldown"); + + phasedItems.clear(); + Tag list = tag.get("PhasedItems"); + if (list instanceof ListTag) { + ListTag itemsTag = (ListTag) list; + for (int i = 0; i < itemsTag.size(); i++) { + phasedItems.add(PhasedItem.fromTag(itemsTag.getCompound(i))); + } + } + } + + private int canInsert(ItemStack stack) { + if (stack.getCount() <= getMaxCountPerStack()) { + for (int slot = 0; slot < size(); slot++) { + ItemStack oldStack = getStack(slot); + if (oldStack.isItemEqual(stack)) { + int newCount = oldStack.getCount() + stack.getCount(); + if (newCount <= Math.min(oldStack.getMaxCount(), getMaxCountPerStack())) { + return slot; + } + } + } + + for (int slot = 0; slot < size(); slot++) { + ItemStack oldStack = getStack(slot); + if (oldStack.isEmpty()) { + return slot; + } + } + } + return -1; + } + + private long getCost() { + return getCachedState().get(PhaseShifterBlock.IS_OUTPUT) ? HardcodedConfig.PHASE_SHIFTER_OUTPUT_ENERGY_REQUIRED : HardcodedConfig.PHASE_SHIFTER_INPUT_ENERGY_REQUIRED_BASE + (HardcodedConfig.PHASE_SHIFTER_INPUT_ENERGY_REQUIRED_PER_ITEM * phasedItems.size()); + } + + @Override + protected void energyTick() { + assert getWorld() != null; + + addAction(Action.createBlockStatePropertyAction(getCost(), PhaseShifterBlock.POWERED, true, false)); + + boolean dirty = false; + + if (cooldown > 0) { + cooldown--; + dirty = true; + } + + if (getCachedState().get(PhaseShifterBlock.POWERED) && !getCachedState().get(PhaseShifterBlock.IS_OUTPUT)) { + List outputs = new ArrayList<>(); + for (EnergyTickable tickable : EnergyTicker.allLoaded) { + if (tickable instanceof PhaseShifterBlockEntity && ((PhaseShifterBlockEntity) tickable).getCachedState().get(PhaseShifterBlock.IS_OUTPUT) && Objects.requireNonNull(((PhaseShifterBlockEntity) tickable).getWorld()).getRegistryKey() == getWorld().getRegistryKey() && ((PhaseShifterBlockEntity) tickable).cooldown == 0 && ((PhaseShifterBlockEntity) tickable).getCachedState().get(PhaseShifterBlock.COLOR) == getCachedState().get(PhaseShifterBlock.COLOR)) { + outputs.add((PhaseShifterBlockEntity) tickable); + } + } + + if (phasedItems.size() > 0) { + dirty = true; + } + + Iterator iterator = phasedItems.iterator(); + while (iterator.hasNext()) { + PhasedItem item = iterator.next(); + + if (item.cooldown > 0) { + item.cooldown--; + } else { + Map validOutputs = new HashMap<>(); + for (PhaseShifterBlockEntity output : outputs) { + int slot = output.canInsert(item.item); + if (slot != -1 && output.getPos().isWithinDistance(getPos(), item.getRange())) { + validOutputs.put(output, slot); + } + } + + boolean success = validOutputs.size() > 0 && HardcodedConfig.PHASE_SHIFTER_SUCCESS_CHANCE >= getWorld().random.nextFloat(); + + if (success) { + WeightedList weightedList = new WeightedList<>(); + for (PhaseShifterBlockEntity output : validOutputs.keySet()) { + weightedList.add(1, output); + } + + PhaseShifterBlockEntity output = weightedList.pick(getWorld().random); + + int slot = validOutputs.get(output); + + ItemStack stack = item.item.copy(); + stack.increment(output.getStack(slot).getCount()); + + output.setStack(slot, stack); + + output.resetCooldown(); + + output.markDirty(); + + iterator.remove(); + } else { + item.roll++; + item.cooldown = HardcodedConfig.PHASE_SHIFTER_INPUT_ROLL_COOLDOWN; + } + } + } + + if (cooldown == 0) { + ItemStack next = ItemStack.EMPTY; + + for (int slot = 0; slot < size(); slot++) { + ItemStack stack = getStack(slot); + if (!stack.isEmpty()) { + next = stack.split(1); + } + } + + if (!next.isEmpty()) { + phasedItems.add(new PhasedItem(next)); + resetCooldown(); + dirty = true; + } + } + } else if (phasedItems.size() > 0) { + phasedItems.clear(); + dirty = true; + } + + if (dirty) { + markDirty(); + } + } + + private void resetCooldown() { + cooldown = getCachedState().get(PhaseShifterBlock.IS_OUTPUT) ? HardcodedConfig.PHASE_SHIFTER_OUTPUT_COOLDOWN : HardcodedConfig.PHASE_SHIFTER_INPUT_COOLDOWN; + } + + @Override + public CompoundTag toTag(CompoundTag tag) { + super.toTag(tag); + Inventories.toTag(tag, inv); + tag.putInt("Cooldown", cooldown); + + ListTag itemsTag = new ListTag(); + for (PhasedItem item : phasedItems) { + itemsTag.add(item.toTag()); + } + tag.put("PhasedItems", itemsTag); + + return tag; + } + + @Override + public MutableText getExtra() { + return getCachedState().get(PhaseShifterBlock.IS_OUTPUT) ? null : new TranslatableText("text." + EnergonRelics.NAMESPACE + ".phase_shifter_extra", new LiteralText(String.valueOf(phasedItems.size())).formatted(Formatting.WHITE)); + } +} diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/entity/shifter/PhasedItem.java b/src/main/java/com/thebrokenrail/energonrelics/block/entity/shifter/PhasedItem.java new file mode 100644 index 0000000..372da36 --- /dev/null +++ b/src/main/java/com/thebrokenrail/energonrelics/block/entity/shifter/PhasedItem.java @@ -0,0 +1,34 @@ +package com.thebrokenrail.energonrelics.block.entity.shifter; + +import com.thebrokenrail.energonrelics.config.HardcodedConfig; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundTag; + +class PhasedItem { + final ItemStack item; + int cooldown = 0; + int roll = 0; + + PhasedItem(ItemStack item) { + this.item = item; + } + + int getRange() { + return HardcodedConfig.PHASE_SHIFTER_INPUT_RANGE_BASE + (roll * HardcodedConfig.PHASE_SHIFTER_INPUT_RANGE_INCREMENT); + } + + CompoundTag toTag() { + CompoundTag tag = new CompoundTag(); + tag.put("Item", item.toTag(new CompoundTag())); + tag.putInt("Cooldown", cooldown); + tag.putInt("Roll", roll); + return tag; + } + + static PhasedItem fromTag(CompoundTag tag) { + PhasedItem item = new PhasedItem(ItemStack.fromTag(tag.getCompound("Item"))); + item.cooldown = tag.getInt("Cooldown"); + item.roll = tag.getInt("Roll"); + return item; + } +} diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/reactor/ReactorInputBlock.java b/src/main/java/com/thebrokenrail/energonrelics/block/reactor/ReactorInputBlock.java index e283387..f569465 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/block/reactor/ReactorInputBlock.java +++ b/src/main/java/com/thebrokenrail/energonrelics/block/reactor/ReactorInputBlock.java @@ -22,6 +22,7 @@ import net.minecraft.world.World; import java.util.function.Function; +@SuppressWarnings("deprecation") public class ReactorInputBlock extends SimpleBlockWithEntity { public ReactorInputBlock() { super(FabricBlockSettings.of(Material.STONE, MaterialColor.YELLOW_TERRACOTTA).requiresTool().strength(1.5f, 6.0f)); @@ -33,7 +34,6 @@ public class ReactorInputBlock extends SimpleBlockWithEntity { } @Override - @SuppressWarnings("deprecation") public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { BlockEntity entity = world.getBlockEntity(pos); if (entity instanceof Inventory) { @@ -45,4 +45,9 @@ public class ReactorInputBlock extends SimpleBlockWithEntity { return ActionResult.FAIL; } } + + @Override + protected boolean hasInventory() { + return true; + } } diff --git a/src/main/java/com/thebrokenrail/energonrelics/client/EnergonRelicsClient.java b/src/main/java/com/thebrokenrail/energonrelics/client/EnergonRelicsClient.java index 44ebafd..8e188e3 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/client/EnergonRelicsClient.java +++ b/src/main/java/com/thebrokenrail/energonrelics/client/EnergonRelicsClient.java @@ -1,9 +1,11 @@ package com.thebrokenrail.energonrelics.client; import com.thebrokenrail.energonrelics.EnergonRelics; +import com.thebrokenrail.energonrelics.block.PhaseShifterBlock; import com.thebrokenrail.energonrelics.block.forcefield.util.AbstractFieldBlock; import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock; import com.thebrokenrail.energonrelics.client.config.UserConfig; +import com.thebrokenrail.energonrelics.config.HardcodedConfig; import me.sargunvohra.mcmods.autoconfig1u.AutoConfig; import me.sargunvohra.mcmods.autoconfig1u.ConfigData; import me.sargunvohra.mcmods.autoconfig1u.annotation.Config; @@ -12,6 +14,7 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; +import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.event.player.AttackBlockCallback; import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; @@ -51,6 +54,10 @@ public final class EnergonRelicsClient implements ClientModInitializer { BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.ENERGY_PORTAL_BLOCK, RenderLayer.getTranslucent()); BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.ENERGY_BEAM_BLOCK, RenderLayer.getTranslucent()); + BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.PHASE_SHIFTER_BLOCK, RenderLayer.getCutoutMipped()); + ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> state.get(PhaseShifterBlock.COLOR).getFireworkColor(), EnergonRelics.PHASE_SHIFTER_BLOCK); + ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex == 0 ? HardcodedConfig.PHASE_SHIFTER_DEFAULT_COLOR.getFireworkColor() : -1); + AutoConfig.register(UserConfig.class, ReloadSerializer::new); AttackBlockCallback.EVENT.register((playerEntity, world, hand, blockPos, direction) -> { diff --git a/src/main/java/com/thebrokenrail/energonrelics/client/rei/EnergonRelicsPlugin.java b/src/main/java/com/thebrokenrail/energonrelics/client/rei/EnergonRelicsPlugin.java index 15b89fe..67e15c9 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/client/rei/EnergonRelicsPlugin.java +++ b/src/main/java/com/thebrokenrail/energonrelics/client/rei/EnergonRelicsPlugin.java @@ -3,13 +3,19 @@ package com.thebrokenrail.energonrelics.client.rei; import com.thebrokenrail.energonrelics.EnergonRelics; import com.thebrokenrail.energonrelics.client.rei.infuser.InfuserCategory; import com.thebrokenrail.energonrelics.client.rei.reactor.ReactorFuelCategory; +import me.shedaniel.rei.api.BuiltinPlugin; import me.shedaniel.rei.api.EntryStack; import me.shedaniel.rei.api.RecipeHelper; import me.shedaniel.rei.api.plugins.REIPluginV0; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; +import java.util.ArrayList; +import java.util.List; + @Environment(EnvType.CLIENT) public final class EnergonRelicsPlugin implements REIPluginV0 { public static final Identifier INFUSING = new Identifier(EnergonRelics.NAMESPACE, "plugin/infusing"); @@ -27,6 +33,12 @@ public final class EnergonRelicsPlugin implements REIPluginV0 { recipeHelper.removeAutoCraftButton(INFUSING); recipeHelper.removeAutoCraftButton(REACTOR_FUEL); + + BuiltinPlugin.getInstance().registerInformation(EntryStack.create(EnergonRelics.CIRCUIT_BOARD_ITEM), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".information.structure_generation.title"), texts -> { + List newTexts = new ArrayList<>(texts); + newTexts.add(new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".information.structure_generation.research_complex")); + return newTexts; + }); } @Override diff --git a/src/main/java/com/thebrokenrail/energonrelics/config/HardcodedConfig.java b/src/main/java/com/thebrokenrail/energonrelics/config/HardcodedConfig.java index 53bc7f7..b3a7e85 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/config/HardcodedConfig.java +++ b/src/main/java/com/thebrokenrail/energonrelics/config/HardcodedConfig.java @@ -2,6 +2,7 @@ package com.thebrokenrail.energonrelics.config; import net.minecraft.item.Item; import net.minecraft.item.Items; +import net.minecraft.util.DyeColor; /** * Hardcoded Configuration Values @@ -9,6 +10,8 @@ import net.minecraft.item.Items; public final class HardcodedConfig { public static final int POWER_RANGE = 64; + public static final long SWITCH_ENERGY_REQUIRED = 2; + public static final int ENERGON_LIGHT_ENERGY_REQUIRED = 5; public static final long SOLAR_PANEL_MAX_ENERGY_OUTPUT = 50; @@ -53,4 +56,15 @@ public final class HardcodedConfig { public static final int ENERGY_PORTAL_MULTIPLIER = 16; public static final int ENERGY_PORTAL_Y_PADDING = 4; public static final int ENERGY_PORTAL_Y_PADDING_EXTRA_TOP = 3; + + public static final long PHASE_SHIFTER_INPUT_ENERGY_REQUIRED_BASE = 112; + public static final long PHASE_SHIFTER_INPUT_ENERGY_REQUIRED_PER_ITEM = 19; + public static final int PHASE_SHIFTER_INPUT_COOLDOWN = 16; + public static final int PHASE_SHIFTER_INPUT_ROLL_COOLDOWN = 6; + public static final int PHASE_SHIFTER_INPUT_RANGE_BASE = 21; + public static final int PHASE_SHIFTER_INPUT_RANGE_INCREMENT = 9; + public static final float PHASE_SHIFTER_SUCCESS_CHANCE = 0.1f; + public static final long PHASE_SHIFTER_OUTPUT_ENERGY_REQUIRED = 28; + public static final int PHASE_SHIFTER_OUTPUT_COOLDOWN = 21; + public static final DyeColor PHASE_SHIFTER_DEFAULT_COLOR = DyeColor.WHITE; } \ No newline at end of file diff --git a/src/main/java/com/thebrokenrail/energonrelics/item/MultimeterItem.java b/src/main/java/com/thebrokenrail/energonrelics/item/MultimeterItem.java index b0d22e5..100565a 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/item/MultimeterItem.java +++ b/src/main/java/com/thebrokenrail/energonrelics/item/MultimeterItem.java @@ -3,6 +3,7 @@ package com.thebrokenrail.energonrelics.item; import com.thebrokenrail.energonrelics.EnergonRelics; import com.thebrokenrail.energonrelics.api.block.entity.core.EnergyReceiverBlockEntity; import com.thebrokenrail.energonrelics.api.block.entity.helper.EnergyGenerator; +import com.thebrokenrail.energonrelics.api.item.MultimeterExtra; import net.minecraft.block.entity.BlockEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemUsageContext; @@ -21,10 +22,6 @@ public class MultimeterItem extends Item { super(new Settings().maxCount(1).group(EnergonRelics.ITEM_GROUP)); } - public interface MultimeterExtra { - MutableText getExtra(); - } - public static MutableText format(long value) { String str; if (value >= Long.MAX_VALUE) { @@ -61,10 +58,13 @@ public class MultimeterItem extends Item { } if (entity instanceof MultimeterExtra) { if (!world.isClient() && context.getPlayer() != null) { - if (success) { - text.append(separator); + MutableText extraText = ((MultimeterExtra) entity).getExtra(); + if (extraText != null) { + if (success) { + text.append(separator); + } + text.append(extraText.formatted(Formatting.YELLOW)); } - text.append(((MultimeterExtra) entity).getExtra().formatted(Formatting.YELLOW)); } success = true; } diff --git a/src/main/resources/assets/energonrelics/blockstates/phase_shifter.json b/src/main/resources/assets/energonrelics/blockstates/phase_shifter.json new file mode 100644 index 0000000..3e929aa --- /dev/null +++ b/src/main/resources/assets/energonrelics/blockstates/phase_shifter.json @@ -0,0 +1,16 @@ +{ + "variants": { + "powered=false,is_output=false": { + "model": "energonrelics:block/phase_shifter_off_input" + }, + "powered=true,is_output=false": { + "model": "energonrelics:block/phase_shifter_on_input" + }, + "powered=false,is_output=true": { + "model": "energonrelics:block/phase_shifter_off_output" + }, + "powered=true,is_output=true": { + "model": "energonrelics:block/phase_shifter_on_output" + } + } +} diff --git a/src/main/resources/assets/energonrelics/blockstates/switch.json b/src/main/resources/assets/energonrelics/blockstates/switch.json index 15431ce..470c962 100644 --- a/src/main/resources/assets/energonrelics/blockstates/switch.json +++ b/src/main/resources/assets/energonrelics/blockstates/switch.json @@ -1,9 +1,9 @@ { "variants": { - "powered=false": { + "active=false": { "model": "energonrelics:block/switch_off" }, - "powered=true": { + "active=true": { "model": "energonrelics:block/switch_on" } } diff --git a/src/main/resources/assets/energonrelics/lang/en_us.json b/src/main/resources/assets/energonrelics/lang/en_us.json index 6a7494c..b903fe5 100644 --- a/src/main/resources/assets/energonrelics/lang/en_us.json +++ b/src/main/resources/assets/energonrelics/lang/en_us.json @@ -61,5 +61,9 @@ "category.rei.energonrelics.infusing.display_item.minecraft.tnt": "Explosion", "category.rei.energonrelics.infusing.display_item.minecraft.fire_charge": "Nothing", "category.rei.energonrelics.reactor_fuel.name": "Reactor Fuel", - "category.rei.energonrelics.reactor_fuel.multiplier": "%sx Reaction" + "category.rei.energonrelics.reactor_fuel.multiplier": "%sx Reaction", + "block.energonrelics.phase_shifter": "Phase Shifter", + "text.energonrelics.phase_shifter_extra": "Phased Items: %s", + "category.rei.energonrelics.information.structure_generation.title": "Structures", + "category.rei.energonrelics.information.structure_generation.research_complex": "Found In The Research Complex Underground Structure" } \ No newline at end of file diff --git a/src/main/resources/assets/energonrelics/models/block/phase_shifter.json b/src/main/resources/assets/energonrelics/models/block/phase_shifter.json new file mode 100644 index 0000000..8228131 --- /dev/null +++ b/src/main/resources/assets/energonrelics/models/block/phase_shifter.json @@ -0,0 +1,33 @@ +{ + "parent": "minecraft:block/block", + "textures": { + "particle": "#all", + "tint": "energonrelics:block/phase_shifter_tint" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up"}, + "north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east"} + } + }, + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "down": {"uv": [0, 0, 16, 16], "texture": "#tint", "cullface": "down", "tintindex": 0}, + "up": {"uv": [0, 0, 16, 16], "texture": "#tint", "cullface": "up", "tintindex": 0}, + "north": {"uv": [0, 0, 16, 16], "texture": "#tint", "cullface": "north", "tintindex": 0}, + "south": {"uv": [0, 0, 16, 16], "texture": "#tint", "cullface": "south", "tintindex": 0}, + "west": {"uv": [0, 0, 16, 16], "texture": "#tint", "cullface": "west", "tintindex": 0}, + "east": {"uv": [0, 0, 16, 16], "texture": "#tint", "cullface": "east", "tintindex": 0} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/energonrelics/models/block/phase_shifter_off_input.json b/src/main/resources/assets/energonrelics/models/block/phase_shifter_off_input.json new file mode 100644 index 0000000..3e3f698 --- /dev/null +++ b/src/main/resources/assets/energonrelics/models/block/phase_shifter_off_input.json @@ -0,0 +1,6 @@ +{ + "parent": "energonrelics:block/phase_shifter", + "textures": { + "all": "energonrelics:block/phase_shifter_off_input" + } +} diff --git a/src/main/resources/assets/energonrelics/models/block/phase_shifter_off_output.json b/src/main/resources/assets/energonrelics/models/block/phase_shifter_off_output.json new file mode 100644 index 0000000..50e9696 --- /dev/null +++ b/src/main/resources/assets/energonrelics/models/block/phase_shifter_off_output.json @@ -0,0 +1,6 @@ +{ + "parent": "energonrelics:block/phase_shifter", + "textures": { + "all": "energonrelics:block/phase_shifter_off_output" + } +} diff --git a/src/main/resources/assets/energonrelics/models/block/phase_shifter_on_input.json b/src/main/resources/assets/energonrelics/models/block/phase_shifter_on_input.json new file mode 100644 index 0000000..0ddfea7 --- /dev/null +++ b/src/main/resources/assets/energonrelics/models/block/phase_shifter_on_input.json @@ -0,0 +1,6 @@ +{ + "parent": "energonrelics:block/phase_shifter", + "textures": { + "all": "energonrelics:block/phase_shifter_on_input" + } +} diff --git a/src/main/resources/assets/energonrelics/models/block/phase_shifter_on_output.json b/src/main/resources/assets/energonrelics/models/block/phase_shifter_on_output.json new file mode 100644 index 0000000..f1cb83e --- /dev/null +++ b/src/main/resources/assets/energonrelics/models/block/phase_shifter_on_output.json @@ -0,0 +1,6 @@ +{ + "parent": "energonrelics:block/phase_shifter", + "textures": { + "all": "energonrelics:block/phase_shifter_on_output" + } +} diff --git a/src/main/resources/assets/energonrelics/models/item/phase_shifter.json b/src/main/resources/assets/energonrelics/models/item/phase_shifter.json new file mode 100644 index 0000000..a97b949 --- /dev/null +++ b/src/main/resources/assets/energonrelics/models/item/phase_shifter.json @@ -0,0 +1,3 @@ +{ + "parent": "energonrelics:block/phase_shifter_off_input" +} diff --git a/src/main/resources/assets/energonrelics/textures/block/phase_shifter_off_input.png b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_off_input.png new file mode 100644 index 0000000..94a6589 Binary files /dev/null and b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_off_input.png differ diff --git a/src/main/resources/assets/energonrelics/textures/block/phase_shifter_off_output.png b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_off_output.png new file mode 100644 index 0000000..6022223 Binary files /dev/null and b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_off_output.png differ diff --git a/src/main/resources/assets/energonrelics/textures/block/phase_shifter_on_input.png b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_on_input.png new file mode 100644 index 0000000..958136d Binary files /dev/null and b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_on_input.png differ diff --git a/src/main/resources/assets/energonrelics/textures/block/phase_shifter_on_output.png b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_on_output.png new file mode 100644 index 0000000..1905289 Binary files /dev/null and b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_on_output.png differ diff --git a/src/main/resources/assets/energonrelics/textures/block/phase_shifter_tint.png b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_tint.png new file mode 100644 index 0000000..002bb83 Binary files /dev/null and b/src/main/resources/assets/energonrelics/textures/block/phase_shifter_tint.png differ diff --git a/src/main/resources/data/energonrelics/loot_tables/blocks/phase_shifter.json b/src/main/resources/data/energonrelics/loot_tables/blocks/phase_shifter.json new file mode 100644 index 0000000..ecc10c8 --- /dev/null +++ b/src/main/resources/data/energonrelics/loot_tables/blocks/phase_shifter.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "energonrelics:phase_shifter" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/energonrelics/recipes/energon_light.json b/src/main/resources/data/energonrelics/recipes/energon_light.json index 15ce6fc..f6f5ef9 100644 --- a/src/main/resources/data/energonrelics/recipes/energon_light.json +++ b/src/main/resources/data/energonrelics/recipes/energon_light.json @@ -1,18 +1,18 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - "#I#", - "IGI", - "#I#" + "#G#", + "GSG", + "#G#" ], "key": { "#": { "item": "energonrelics:circuit_board" }, - "I": { - "item": "minecraft:iron_ingot" - }, "G": { + "item": "minecraft:glass" + }, + "S": { "item": "minecraft:glowstone" } }, diff --git a/src/main/resources/data/energonrelics/recipes/forcefield_projector.json b/src/main/resources/data/energonrelics/recipes/forcefield_projector.json index 6151633..d32da61 100644 --- a/src/main/resources/data/energonrelics/recipes/forcefield_projector.json +++ b/src/main/resources/data/energonrelics/recipes/forcefield_projector.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shaped", "pattern": [ "#I#", - "IGI", + "IMI", "#I#" ], "key": { @@ -12,8 +12,8 @@ "I": { "item": "minecraft:iron_ingot" }, - "G": { - "item": "minecraft:glowstone" + "M": { + "item": "minecraft:magma_block" } }, "result": { diff --git a/src/main/resources/data/energonrelics/recipes/phase_shifter.json b/src/main/resources/data/energonrelics/recipes/phase_shifter.json new file mode 100644 index 0000000..3067a0f --- /dev/null +++ b/src/main/resources/data/energonrelics/recipes/phase_shifter.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "#I#", + "IEI", + "#I#" + ], + "key": { + "#": { + "item": "energonrelics:circuit_board" + }, + "I": { + "item": "minecraft:iron_ingot" + }, + "E": { + "item": "minecraft:ender_pearl" + } + }, + "result": { + "item": "energonrelics:phase_shifter", + "count": 2 + } +} \ No newline at end of file