From f6b962a56f2fc6c20b64b4772bb468dabc0113d9 Mon Sep 17 00:00:00 2001 From: Shnupbups Date: Fri, 25 Feb 2022 16:59:45 +1100 Subject: [PATCH] 1.7.0 - Added Rotator - rotates the block in front of it when receiving a redstone signal. Emits a comparator signal based on the direction said block is currently facing (if property is supported). Can be right clicked to switch from Clockwise to Counter Clockwise - Inverter can now be uninverted to act as simply a one way gate that sends the same signal level as it is receiving - Slightly tweaked appearance of Resistor - Added an alternate recipe for the Analog Redstone Lamp to convert from regular Redstone Lamps - Fixed Copper Button clicks not having subtitles - Fixed crashes related to Breaker ( fixes #21 ) - Appearance of cracks on blocks being broken by Breaker should be more consistent and less janky - We do a little cleanup --- gradle.properties | 16 +- .../shnupbups/redstonebits/RedstoneBits.java | 5 + .../redstonebits/RedstoneBitsClient.java | 2 + .../redstonebits/block/AdderBlock.java | 14 +- ....java => AnalogRedstoneReceiverBlock.java} | 10 +- .../redstonebits/block/BreakerBlock.java | 11 +- .../redstonebits/block/CheckerBlock.java | 4 +- .../block/CopperPressurePlateBlock.java | 3 +- .../redstonebits/block/CounterBlock.java | 12 +- .../redstonebits/block/InverterBlock.java | 60 ++++-- .../redstonebits/block/ModButtonBlock.java | 2 +- .../block/ModWeightedPressurePlateBlock.java | 9 - .../redstonebits/block/ResistorBlock.java | 18 +- .../redstonebits/block/RotatorBlock.java | 179 ++++++++++++++++++ .../blockentity/BreakerBlockEntity.java | 37 ++-- .../blockentity/CheckerBlockEntity.java | 4 +- .../blockentity/PlacerBlockEntity.java | 2 +- .../blockentity/RedstoneGateBlockEntity.java | 2 +- .../container/BreakerScreenHandler.java | 2 +- .../container/CheckerScreenHandler.java | 2 +- .../{ => init}/ModBlockEntities.java | 3 +- .../redstonebits/{ => init}/ModBlocks.java | 28 +-- .../{ => init}/ModScreenHandlers.java | 3 +- .../{ => init}/ModSoundEvents.java | 11 +- .../redstonebits/mixin/RedstoneWireMixin.java | 4 +- .../redstonebits/properties/ResistorMode.java | 4 +- .../redstonebits/blockstates/inverter.json | 48 +++-- .../redstonebits/blockstates/rotator.json | 16 ++ .../assets/redstonebits/lang/en_us.json | 9 +- .../models/block/inverter_no_inverting.json | 7 + .../block/inverter_no_inverting_locked.json | 7 + .../inverter_no_inverting_locked_on.json | 6 + .../block/inverter_no_inverting_on.json | 6 + .../models/block/resistor_halve.json | 77 ++++---- .../models/block/resistor_halve_locked.json | 77 ++++---- .../block/resistor_halve_locked_on.json | 3 +- .../models/block/resistor_halve_on.json | 3 +- .../models/block/resistor_one_point_five.json | 72 ++++--- .../block/resistor_one_point_five_locked.json | 72 ++++--- .../resistor_one_point_five_locked_on.json | 3 +- .../block/resistor_one_point_five_on.json | 3 +- .../models/block/resistor_third.json | 76 ++++---- .../models/block/resistor_third_locked.json | 76 ++++---- .../block/resistor_third_locked_on.json | 3 +- .../models/block/resistor_third_on.json | 3 +- .../redstonebits/models/block/rotator.json | 8 + .../models/block/rotator_inventory.json | 8 + .../models/block/rotator_inverted.json | 8 + .../redstonebits/models/item/rotator.json | 3 + .../resources/assets/redstonebits/sounds.json | 24 +++ .../block/inverter_no_inverting_off.png | Bin 0 -> 288 bytes .../block/inverter_no_inverting_on.png | Bin 0 -> 288 bytes .../textures/block/rotator_side.png | Bin 0 -> 326 bytes .../textures/block/rotator_side_inverted.png | Bin 0 -> 325 bytes .../textures/block/rotator_top.png | Bin 0 -> 274 bytes .../tags/blocks/mineable/pickaxe.json | 1 + .../loot_tables/blocks/rotator.json | 19 ++ .../recipes/analog_redstone_lamp_alt.json | 14 ++ .../data/redstonebits/recipes/rotator.json | 25 +++ src/main/resources/redstonebits.accesswidener | 1 + 60 files changed, 743 insertions(+), 382 deletions(-) rename src/main/java/com/shnupbups/redstonebits/block/{AnalogRedstoneRecieverBlock.java => AnalogRedstoneReceiverBlock.java} (85%) delete mode 100644 src/main/java/com/shnupbups/redstonebits/block/ModWeightedPressurePlateBlock.java create mode 100644 src/main/java/com/shnupbups/redstonebits/block/RotatorBlock.java rename src/main/java/com/shnupbups/redstonebits/{ => init}/ModBlockEntities.java (94%) rename src/main/java/com/shnupbups/redstonebits/{ => init}/ModBlocks.java (87%) rename src/main/java/com/shnupbups/redstonebits/{ => init}/ModScreenHandlers.java (89%) rename src/main/java/com/shnupbups/redstonebits/{ => init}/ModSoundEvents.java (63%) create mode 100644 src/main/resources/assets/redstonebits/blockstates/rotator.json create mode 100644 src/main/resources/assets/redstonebits/models/block/inverter_no_inverting.json create mode 100644 src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_locked.json create mode 100644 src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_locked_on.json create mode 100644 src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_on.json create mode 100644 src/main/resources/assets/redstonebits/models/block/rotator.json create mode 100644 src/main/resources/assets/redstonebits/models/block/rotator_inventory.json create mode 100644 src/main/resources/assets/redstonebits/models/block/rotator_inverted.json create mode 100644 src/main/resources/assets/redstonebits/models/item/rotator.json create mode 100644 src/main/resources/assets/redstonebits/textures/block/inverter_no_inverting_off.png create mode 100644 src/main/resources/assets/redstonebits/textures/block/inverter_no_inverting_on.png create mode 100644 src/main/resources/assets/redstonebits/textures/block/rotator_side.png create mode 100644 src/main/resources/assets/redstonebits/textures/block/rotator_side_inverted.png create mode 100644 src/main/resources/assets/redstonebits/textures/block/rotator_top.png create mode 100644 src/main/resources/data/redstonebits/loot_tables/blocks/rotator.json create mode 100644 src/main/resources/data/redstonebits/recipes/analog_redstone_lamp_alt.json create mode 100644 src/main/resources/data/redstonebits/recipes/rotator.json diff --git a/gradle.properties b/gradle.properties index d10d5d4..1916e8d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,26 +1,26 @@ # Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G + org.gradle.jvmargs=-Xmx1G # Fabric Properties - # check these on https://modmuss50.me/fabric.html + # check these on https://fabricmc.net/develop/ minecraft_version=1.18.1 - yarn_mappings=12 + yarn_mappings=22 tiny_version=2 - loader_version=0.12.12 + loader_version=0.13.3 # Mod Properties - mod_version = 1.6.2 + mod_version = 1.7.0 maven_group = com.shnupbups mod_name = redstone-bits version_meta = fabric-mc1.18 # Dependencies - # check on https://modmuss50.me/fabric.html - fapi_version=0.45.0+1.18 + # check on https://fabricmc.net/develop/ + fapi_version=0.46.4+1.18 # Other Stuff # check on maven at https://maven.shedaniel.me/me/shedaniel/RoughlyEnoughItems-fabric/ - rei_version = 7.1.357 + rei_version = 7.2.425 # check on maven at https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/ modmenu_version = 3.0.1 diff --git a/src/main/java/com/shnupbups/redstonebits/RedstoneBits.java b/src/main/java/com/shnupbups/redstonebits/RedstoneBits.java index 0ab82ea..b770702 100644 --- a/src/main/java/com/shnupbups/redstonebits/RedstoneBits.java +++ b/src/main/java/com/shnupbups/redstonebits/RedstoneBits.java @@ -4,6 +4,11 @@ import net.fabricmc.api.ModInitializer; +import com.shnupbups.redstonebits.init.ModBlockEntities; +import com.shnupbups.redstonebits.init.ModBlocks; +import com.shnupbups.redstonebits.init.ModScreenHandlers; +import com.shnupbups.redstonebits.init.ModSoundEvents; + public class RedstoneBits implements ModInitializer { public static Identifier id(String name) { diff --git a/src/main/java/com/shnupbups/redstonebits/RedstoneBitsClient.java b/src/main/java/com/shnupbups/redstonebits/RedstoneBitsClient.java index dfe4ca3..9c8ae87 100644 --- a/src/main/java/com/shnupbups/redstonebits/RedstoneBitsClient.java +++ b/src/main/java/com/shnupbups/redstonebits/RedstoneBitsClient.java @@ -8,6 +8,8 @@ import com.shnupbups.redstonebits.container.screen.BreakerHandledScreen; import com.shnupbups.redstonebits.container.screen.CheckerHandledScreen; +import com.shnupbups.redstonebits.init.ModBlocks; +import com.shnupbups.redstonebits.init.ModScreenHandlers; @SuppressWarnings("unused") public class RedstoneBitsClient implements ClientModInitializer { diff --git a/src/main/java/com/shnupbups/redstonebits/block/AdderBlock.java b/src/main/java/com/shnupbups/redstonebits/block/AdderBlock.java index 2f5c017..108a440 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/AdderBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/AdderBlock.java @@ -24,7 +24,7 @@ import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; -import com.shnupbups.redstonebits.ModSoundEvents; +import com.shnupbups.redstonebits.init.ModSoundEvents; import com.shnupbups.redstonebits.properties.ModProperties; public class AdderBlock extends AbstractRedstoneGateBlock implements AdvancedRedstoneConnector { @@ -82,9 +82,9 @@ public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Ran world.setBlockState(pos, state.with(POWERED, false), Block.NOTIFY_LISTENERS); } else if (!powered) { int newPower = power; - int recievedPower = this.getPower(world, pos, state); - if (backwards) newPower -= recievedPower; - else newPower += recievedPower; + int receivedPower = this.getPower(world, pos, state); + if (backwards) newPower -= receivedPower; + else newPower += receivedPower; if (newPower > 15) newPower -= 15; else if (newPower < 0) newPower += 15; world.setBlockState(pos, state.with(POWERED, true).with(POWER, newPower), Block.NOTIFY_LISTENERS); @@ -103,8 +103,8 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt boolean backwards = state.get(BACKWARDS); float pitch = backwards ? 0.55F : 0.5F; world.playSound(player, pos, ModSoundEvents.BLOCK_ADDER_CLICK, SoundCategory.BLOCKS, 0.3F, pitch); - world.setBlockState(pos, state.with(BACKWARDS, !backwards), 2); - return ActionResult.SUCCESS; + world.setBlockState(pos, state.with(BACKWARDS, !backwards), Block.NOTIFY_ALL); + return ActionResult.success(world.isClient()); } } @@ -114,7 +114,7 @@ public boolean connectsToRedstoneInDirection(BlockState state, Direction directi Direction facing = state.get(FACING); return direction == facing || direction.getOpposite() == facing; } - return true; + return false; } @Override diff --git a/src/main/java/com/shnupbups/redstonebits/block/AnalogRedstoneRecieverBlock.java b/src/main/java/com/shnupbups/redstonebits/block/AnalogRedstoneReceiverBlock.java similarity index 85% rename from src/main/java/com/shnupbups/redstonebits/block/AnalogRedstoneRecieverBlock.java rename to src/main/java/com/shnupbups/redstonebits/block/AnalogRedstoneReceiverBlock.java index 892277e..a2b7cf8 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/AnalogRedstoneRecieverBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/AnalogRedstoneReceiverBlock.java @@ -12,10 +12,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class AnalogRedstoneRecieverBlock extends Block { +public class AnalogRedstoneReceiverBlock extends Block { public static final IntProperty POWER = Properties.POWER; - public AnalogRedstoneRecieverBlock(Settings settings) { + public AnalogRedstoneReceiverBlock(Settings settings) { super(settings); this.setDefaultState(this.getDefaultState().with(POWER, 0)); } @@ -29,9 +29,9 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { if (!world.isClient) { int power = state.get(POWER); - int recievedPower = world.getReceivedRedstonePower(pos); - if (power != recievedPower) { - if (power > 0 && recievedPower == 0) { + int receivedPower = world.getReceivedRedstonePower(pos); + if (power != receivedPower) { + if (power > 0 && receivedPower == 0) { world.createAndScheduleBlockTick(pos, this, 4); } else { world.setBlockState(pos, state.with(POWER, world.getReceivedRedstonePower(pos)), 2); diff --git a/src/main/java/com/shnupbups/redstonebits/block/BreakerBlock.java b/src/main/java/com/shnupbups/redstonebits/block/BreakerBlock.java index c401965..da7e690 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/BreakerBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/BreakerBlock.java @@ -42,7 +42,7 @@ import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import com.shnupbups.redstonebits.ModBlockEntities; +import com.shnupbups.redstonebits.init.ModBlockEntities; import com.shnupbups.redstonebits.blockentity.BreakerBlockEntity; import com.shnupbups.redstonebits.container.BreakerScreenHandler; import com.shnupbups.redstonebits.properties.ModProperties; @@ -60,7 +60,7 @@ public BreakerBlock(Settings settings) { @Nullable @Override public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - return checkType(type, ModBlockEntities.BREAKER, world.isClient ? BreakerBlockEntity::clientTick : BreakerBlockEntity::serverTick); + return checkType(type, ModBlockEntities.BREAKER, world.isClient ? null : BreakerBlockEntity::serverTick); } @Override @@ -173,7 +173,6 @@ public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity p ((BreakerBlockEntity) blockEntity).setCustomName(itemStack.getName()); } } - } @Override @@ -196,7 +195,11 @@ public boolean hasComparatorOutput(BlockState state) { @Override public int getComparatorOutput(BlockState state, World world, BlockPos pos) { - return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos)); + BlockEntity blockEntity = world.getBlockEntity(pos); + if(blockEntity instanceof BreakerBlockEntity breakerBlockEntity) { + return (int) (breakerBlockEntity.getBreakPercentage() / (100f / 15f)); + } + return 0; } @Override diff --git a/src/main/java/com/shnupbups/redstonebits/block/CheckerBlock.java b/src/main/java/com/shnupbups/redstonebits/block/CheckerBlock.java index 2f4d172..c0d3f49 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/CheckerBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/CheckerBlock.java @@ -38,7 +38,7 @@ import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import com.shnupbups.redstonebits.ModBlockEntities; +import com.shnupbups.redstonebits.init.ModBlockEntities; import com.shnupbups.redstonebits.blockentity.CheckerBlockEntity; import com.shnupbups.redstonebits.container.CheckerScreenHandler; @@ -175,7 +175,7 @@ public boolean connectsToRedstoneInDirection(BlockState state, Direction directi Direction facing = state.get(FACING); return direction == facing; } - return true; + return false; } @Override diff --git a/src/main/java/com/shnupbups/redstonebits/block/CopperPressurePlateBlock.java b/src/main/java/com/shnupbups/redstonebits/block/CopperPressurePlateBlock.java index b86dd61..534e139 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/CopperPressurePlateBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/CopperPressurePlateBlock.java @@ -4,10 +4,11 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Oxidizable; +import net.minecraft.block.WeightedPressurePlateBlock; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; -public class CopperPressurePlateBlock extends ModWeightedPressurePlateBlock implements Oxidizable { +public class CopperPressurePlateBlock extends WeightedPressurePlateBlock implements Oxidizable { private final Oxidizable.OxidationLevel oxidationLevel; public CopperPressurePlateBlock(Oxidizable.OxidationLevel oxidationLevel, int weight, Settings settings) { diff --git a/src/main/java/com/shnupbups/redstonebits/block/CounterBlock.java b/src/main/java/com/shnupbups/redstonebits/block/CounterBlock.java index 0364dc4..73a8bb1 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/CounterBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/CounterBlock.java @@ -24,7 +24,7 @@ import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; -import com.shnupbups.redstonebits.ModSoundEvents; +import com.shnupbups.redstonebits.init.ModSoundEvents; import com.shnupbups.redstonebits.properties.ModProperties; public class CounterBlock extends AbstractRedstoneGateBlock implements AdvancedRedstoneConnector { @@ -52,8 +52,8 @@ public BlockState getStateForNeighborUpdate(BlockState state, Direction directio } @Override - public int getWeakRedstonePower(BlockState state, BlockView view, BlockPos pos, Direction facing) { - return state.get(FACING) == facing ? this.getOutputLevel(view, pos, state) : 0; + public int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction facing) { + return state.get(FACING) == facing ? this.getOutputLevel(world, pos, state) : 0; } @Override @@ -98,8 +98,8 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt boolean backwards = state.get(BACKWARDS); float pitch = backwards ? 0.55F : 0.5F; world.playSound(player, pos, ModSoundEvents.BLOCK_COUNTER_CLICK, SoundCategory.BLOCKS, 0.3F, pitch); - world.setBlockState(pos, state.with(BACKWARDS, !backwards), 2); - return ActionResult.SUCCESS; + world.setBlockState(pos, state.with(BACKWARDS, !backwards), Block.NOTIFY_ALL); + return ActionResult.success(world.isClient()); } } @@ -109,7 +109,7 @@ public boolean connectsToRedstoneInDirection(BlockState state, Direction directi Direction facing = state.get(FACING); return direction == facing || direction.getOpposite() == facing; } - return true; + return false; } @Override diff --git a/src/main/java/com/shnupbups/redstonebits/block/InverterBlock.java b/src/main/java/com/shnupbups/redstonebits/block/InverterBlock.java index 0d309ea..029aa3b 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/InverterBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/InverterBlock.java @@ -7,11 +7,18 @@ import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockView; @@ -20,14 +27,36 @@ import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; +import com.shnupbups.redstonebits.init.ModSoundEvents; import com.shnupbups.redstonebits.blockentity.RedstoneGateBlockEntity; public class InverterBlock extends AbstractRedstoneGateBlock implements AdvancedRedstoneConnector, BlockEntityProvider { public static final BooleanProperty LOCKED = Properties.LOCKED; + public static final BooleanProperty INVERTED = Properties.INVERTED; public InverterBlock(Settings settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(POWERED, false).with(LOCKED, false)); + this.setDefaultState(this.getDefaultState().with(POWERED, false).with(LOCKED, false).with(INVERTED, true)); + } + + @Override + public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + world.createAndScheduleBlockTick(pos, this, 1); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + if (!player.getAbilities().allowModifyWorld) { + return ActionResult.PASS; + } else { + boolean inverted = state.get(INVERTED); + float pitch = inverted ? 0.55F : 0.5F; + world.playSound(player, pos, ModSoundEvents.BLOCK_INVERTER_CLICK, SoundCategory.BLOCKS, 0.3F, pitch); + BlockState newState = state.with(INVERTED, !inverted); + world.setBlockState(pos, newState, Block.NOTIFY_ALL); + this.update(world, pos, newState); + return ActionResult.success(world.isClient()); + } } @Override @@ -46,8 +75,7 @@ public BlockState getStateForNeighborUpdate(BlockState state, Direction directio @Override protected int getOutputLevel(BlockView world, BlockPos pos, BlockState state) { - BlockEntity blockEntity = world.getBlockEntity(pos); - return blockEntity instanceof RedstoneGateBlockEntity ? ((RedstoneGateBlockEntity) blockEntity).getOutputSignal() : 0; + return world.getBlockEntity(pos) instanceof RedstoneGateBlockEntity redstoneGateBlockEntity ? redstoneGateBlockEntity.getOutputSignal() : 0; } @Override @@ -57,7 +85,7 @@ protected int getUpdateDelayInternal(BlockState state) { @Override public void appendProperties(StateManager.Builder builder) { - builder.add(FACING, POWERED, LOCKED); + builder.add(FACING, POWERED, LOCKED, INVERTED); } @Override @@ -66,14 +94,14 @@ public boolean connectsToRedstoneInDirection(BlockState state, Direction directi Direction facing = state.get(FACING); return direction == facing || direction.getOpposite() == facing; } - return true; + return false; } @Override protected void updatePowered(World world, BlockPos pos, BlockState state) { if (!world.getBlockTickScheduler().isTicking(pos, this)) { - TickPriority tickPriority = this.isTargetNotAligned(world, pos, state) ? TickPriority.HIGH : TickPriority.NORMAL; - world.createAndScheduleBlockTick(pos, this, 2, tickPriority); + TickPriority tickPriority = this.isTargetNotAligned(world, pos, state) ? TickPriority.EXTREMELY_HIGH : state.get(POWERED) ? TickPriority.VERY_HIGH : TickPriority.HIGH; + world.createAndScheduleBlockTick(pos, this, this.getUpdateDelayInternal(state), tickPriority); } } @@ -99,9 +127,9 @@ private void update(World world, BlockPos pos, BlockState state) { int output = this.calculateOutputSignal(world, pos, state); BlockEntity blockEntity = world.getBlockEntity(pos); int currentOutput = 0; - if (blockEntity instanceof RedstoneGateBlockEntity resistorBlockEntity) { - currentOutput = resistorBlockEntity.getOutputSignal(); - resistorBlockEntity.setOutputSignal(output); + if (blockEntity instanceof RedstoneGateBlockEntity gateBlockEntity) { + currentOutput = gateBlockEntity.getOutputSignal(); + gateBlockEntity.setOutputSignal(output); } if (currentOutput != output) { @@ -111,6 +139,8 @@ private void update(World world, BlockPos pos, BlockState state) { world.setBlockState(pos, state.with(POWERED, false), Block.NOTIFY_LISTENERS); } else if (!bl2 && bl) { world.setBlockState(pos, state.with(POWERED, true), Block.NOTIFY_LISTENERS); + } else { + world.setBlockState(pos, state, Block.NOTIFY_LISTENERS); } this.updateTarget(world, pos, state); @@ -119,7 +149,8 @@ private void update(World world, BlockPos pos, BlockState state) { } public int calculateOutputSignal(World world, BlockPos pos, BlockState state) { - return 15 - getPower(world, pos, state); + int power = getPower(world, pos, state); + return state.get(INVERTED) ? 15 - power : power; } @Override @@ -133,10 +164,7 @@ protected boolean isValidInput(BlockState state) { } @Override - public int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) { - if (state.get(FACING) == direction) { - return this.getOutputLevel(world, pos, state); - } - return 0; + public int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction facing) { + return state.get(FACING) == facing ? this.getOutputLevel(world, pos, state) : 0; } } diff --git a/src/main/java/com/shnupbups/redstonebits/block/ModButtonBlock.java b/src/main/java/com/shnupbups/redstonebits/block/ModButtonBlock.java index 55d689b..0cd444b 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/ModButtonBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/ModButtonBlock.java @@ -8,7 +8,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import com.shnupbups.redstonebits.ModSoundEvents; +import com.shnupbups.redstonebits.init.ModSoundEvents; public class ModButtonBlock extends AbstractButtonBlock { private final int pressTicks; diff --git a/src/main/java/com/shnupbups/redstonebits/block/ModWeightedPressurePlateBlock.java b/src/main/java/com/shnupbups/redstonebits/block/ModWeightedPressurePlateBlock.java deleted file mode 100644 index 0103a7e..0000000 --- a/src/main/java/com/shnupbups/redstonebits/block/ModWeightedPressurePlateBlock.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.shnupbups.redstonebits.block; - -import net.minecraft.block.WeightedPressurePlateBlock; - -public class ModWeightedPressurePlateBlock extends WeightedPressurePlateBlock { - public ModWeightedPressurePlateBlock(int weight, Settings settings) { - super(weight, settings); - } -} diff --git a/src/main/java/com/shnupbups/redstonebits/block/ResistorBlock.java b/src/main/java/com/shnupbups/redstonebits/block/ResistorBlock.java index 68e7916..ac829f7 100644 --- a/src/main/java/com/shnupbups/redstonebits/block/ResistorBlock.java +++ b/src/main/java/com/shnupbups/redstonebits/block/ResistorBlock.java @@ -26,7 +26,7 @@ import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; -import com.shnupbups.redstonebits.ModSoundEvents; +import com.shnupbups.redstonebits.init.ModSoundEvents; import com.shnupbups.redstonebits.blockentity.RedstoneGateBlockEntity; import com.shnupbups.redstonebits.properties.ModProperties; import com.shnupbups.redstonebits.properties.ResistorMode; @@ -56,8 +56,7 @@ public BlockState getStateForNeighborUpdate(BlockState state, Direction directio @Override protected int getOutputLevel(BlockView world, BlockPos pos, BlockState state) { - BlockEntity blockEntity = world.getBlockEntity(pos); - return blockEntity instanceof RedstoneGateBlockEntity ? ((RedstoneGateBlockEntity) blockEntity).getOutputSignal() : 0; + return world.getBlockEntity(pos) instanceof RedstoneGateBlockEntity redstoneGateBlockEntity ? redstoneGateBlockEntity.getOutputSignal() : 0; } @Override @@ -78,9 +77,9 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt state = state.cycle(MODE); float f = state.get(MODE).getDivisor(); world.playSound(player, pos, ModSoundEvents.BLOCK_RESISTOR_CLICK, SoundCategory.BLOCKS, 0.3F, f); - world.setBlockState(pos, state, Block.NOTIFY_LISTENERS); + world.setBlockState(pos, state, Block.NOTIFY_ALL); this.update(world, pos, state); - return ActionResult.SUCCESS; + return ActionResult.success(world.isClient()); } } @@ -90,14 +89,17 @@ public boolean connectsToRedstoneInDirection(BlockState state, Direction directi Direction facing = state.get(FACING); return direction == facing || direction.getOpposite() == facing; } - return true; + return false; } @Override protected void updatePowered(World world, BlockPos pos, BlockState state) { + if (this.isLocked(world, pos, state)) { + return; + } if (!world.getBlockTickScheduler().isTicking(pos, this)) { - TickPriority tickPriority = this.isTargetNotAligned(world, pos, state) ? TickPriority.HIGH : TickPriority.NORMAL; - world.createAndScheduleBlockTick(pos, this, 2, tickPriority); + TickPriority tickPriority = this.isTargetNotAligned(world, pos, state) ? TickPriority.EXTREMELY_HIGH : state.get(POWERED) ? TickPriority.VERY_HIGH : TickPriority.HIGH; + world.createAndScheduleBlockTick(pos, this, this.getUpdateDelayInternal(state), tickPriority); } } diff --git a/src/main/java/com/shnupbups/redstonebits/block/RotatorBlock.java b/src/main/java/com/shnupbups/redstonebits/block/RotatorBlock.java new file mode 100644 index 0000000..7f4846e --- /dev/null +++ b/src/main/java/com/shnupbups/redstonebits/block/RotatorBlock.java @@ -0,0 +1,179 @@ +package com.shnupbups.redstonebits.block; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.FacingBlock; +import net.minecraft.block.enums.RailShape; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.sound.SoundCategory; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.DirectionProperty; +import net.minecraft.state.property.EnumProperty; +import net.minecraft.state.property.IntProperty; +import net.minecraft.state.property.Properties; +import net.minecraft.state.property.Property; +import net.minecraft.util.ActionResult; +import net.minecraft.util.BlockMirror; +import net.minecraft.util.BlockRotation; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; + +import com.shnupbups.redstonebits.init.ModSoundEvents; + +public class RotatorBlock extends FacingBlock { + public static final BooleanProperty INVERTED = Properties.INVERTED; + public static final BooleanProperty POWERED = Properties.POWERED; + + public static final List> ROTATION_PROPERTIES = List.of( + Properties.FACING, Properties.HOPPER_FACING, Properties.HORIZONTAL_FACING, Properties.VERTICAL_DIRECTION, + Properties.AXIS, Properties.HORIZONTAL_AXIS, + Properties.ROTATION, + Properties.RAIL_SHAPE, Properties.STRAIGHT_RAIL_SHAPE + ); + + public RotatorBlock(Settings settings) { + super(settings); + this.setDefaultState(this.getDefaultState().with(FACING, Direction.UP).with(POWERED, false).with(INVERTED, false)); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + if (!player.getAbilities().allowModifyWorld) { + return ActionResult.PASS; + } else { + boolean inverted = state.get(INVERTED); + float pitch = inverted ? 0.55F : 0.5F; + world.playSound(player, pos, ModSoundEvents.BLOCK_ROTATOR_INVERT, SoundCategory.BLOCKS, 0.3F, pitch); + world.setBlockState(pos, state.with(INVERTED, !inverted), Block.NOTIFY_ALL); + return ActionResult.SUCCESS; + } + } + + @Override + public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos pos2, boolean notify) { + BlockPos facingPos = getFacingPos(state, pos); + BlockState facingState = world.getBlockState(facingPos); + + boolean receivingPower = world.isReceivingRedstonePower(pos) || world.isReceivingRedstonePower(pos.up()); + boolean powered = state.get(POWERED); + + boolean shouldUpdateComparators = pos2.equals(facingPos); + + if(receivingPower && !powered) { + BlockState rotatedState = facingState.rotate(state.get(INVERTED) ? BlockRotation.COUNTERCLOCKWISE_90 : BlockRotation.CLOCKWISE_90); + if(!rotatedState.equals(facingState) && rotatedState.canPlaceAt(world, facingPos)) { + world.setBlockState(facingPos, rotatedState, Block.NOTIFY_ALL); + world.playSound(null, pos, ModSoundEvents.BLOCK_ROTATOR_ROTATE, SoundCategory.BLOCKS, 1.0f, 1.0f); + shouldUpdateComparators = true; + } else { + world.playSound(null, pos, ModSoundEvents.BLOCK_ROTATOR_FAIL, SoundCategory.BLOCKS, 1.0f, 1.2f); + } + world.setBlockState(pos, state.with(POWERED, true), Block.NOTIFY_ALL | Block.NO_REDRAW); + } else if(!receivingPower && powered) { + world.setBlockState(pos, state.with(POWERED, false), Block.NOTIFY_ALL | Block.NO_REDRAW); + } + + if(shouldUpdateComparators) { + world.updateComparators(pos, this); + } + } + + public BlockPos getFacingPos(BlockState state, BlockPos pos) { + return pos.offset(state.get(FACING)); + } + + @Override + public boolean hasComparatorOutput(BlockState state) { + return true; + } + + @Override + public int getComparatorOutput(BlockState state, World world, BlockPos pos) { + BlockState facingState = world.getBlockState(getFacingPos(state, pos)); + + Property rotationProperty = getRotationProperty(facingState); + + if(facingState.contains(rotationProperty)) { + if(rotationProperty instanceof DirectionProperty property) { + return getComparatorValue(facingState.get(property)); + } else if(rotationProperty instanceof EnumProperty property) { + if(facingState.get(property) instanceof Direction.Axis axis) { + return getComparatorValue(axis); + } else if(facingState.get(property) instanceof RailShape railShape) { + return getComparatorValue(railShape); + } + } else if(rotationProperty instanceof IntProperty property) { + return facingState.get(property); + } + } + + return 0; + } + + public static Property getRotationProperty(BlockState state) { + for(Property property : ROTATION_PROPERTIES) { + if(state.contains(property)) return property; + } + return null; + } + + public static int getComparatorValue(Direction direction) { + return switch(direction) { + case SOUTH -> 0; + case WEST -> 4; + case NORTH -> 8; + case EAST -> 12; + default -> 0; + }; + } + + public static int getComparatorValue(Direction.Axis axis) { + return switch(axis) { + case Z -> 0; + case X -> 4; + default -> 0; + }; + } + + public static int getComparatorValue(RailShape railShape) { + return switch(railShape) { + case NORTH_SOUTH -> 0; + case EAST_WEST -> 4; + case ASCENDING_EAST -> 12; + case ASCENDING_WEST -> 4; + case ASCENDING_NORTH -> 8; + case ASCENDING_SOUTH -> 0; + case SOUTH_EAST -> 14; + case SOUTH_WEST -> 2; + case NORTH_WEST -> 6; + case NORTH_EAST -> 10; + }; + } + + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return this.getDefaultState().with(FACING, ctx.getPlayerLookDirection().getOpposite()); + } + + @Override + public BlockState rotate(BlockState state, BlockRotation rotation) { + return state.with(FACING, rotation.rotate(state.get(FACING))); + } + + @Override + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.rotate(mirror.getRotation(state.get(FACING))); + } + + @Override + protected void appendProperties(StateManager.Builder builder) { + builder.add(FACING, POWERED, INVERTED); + } +} diff --git a/src/main/java/com/shnupbups/redstonebits/blockentity/BreakerBlockEntity.java b/src/main/java/com/shnupbups/redstonebits/blockentity/BreakerBlockEntity.java index 242f23e..58e9c35 100644 --- a/src/main/java/com/shnupbups/redstonebits/blockentity/BreakerBlockEntity.java +++ b/src/main/java/com/shnupbups/redstonebits/blockentity/BreakerBlockEntity.java @@ -31,7 +31,7 @@ import net.fabricmc.api.Environment; import com.shnupbups.redstonebits.FakePlayerEntity; -import com.shnupbups.redstonebits.ModBlockEntities; +import com.shnupbups.redstonebits.init.ModBlockEntities; import com.shnupbups.redstonebits.container.BreakerScreenHandler; import com.shnupbups.redstonebits.properties.ModProperties; @@ -48,19 +48,6 @@ public BreakerBlockEntity(BlockPos pos, BlockState state) { this.inventory = DefaultedList.ofSize(1, ItemStack.EMPTY); } - @Environment(EnvType.CLIENT) - public static void clientTick(World world, BlockPos pos, BlockState state, BreakerBlockEntity blockEntity) { - if(blockEntity.getBreakState() == null || blockEntity.getBreakState().isAir()) { - return; - } - if (blockEntity.isBreaking()) { - //System.out.println("breaking! time: " + blockEntity.getBreakTime() + " progress: " + blockEntity.getBreakProgress() + " percent: " + blockEntity.getBreakPercentage() + "%"); - world.setBlockBreakingInfo(blockEntity.getFakePlayer().getId(), blockEntity.getBreakPos(), blockEntity.getBreakPercentage() / 10); - } else { - world.setBlockBreakingInfo(blockEntity.getFakePlayer().getId(), blockEntity.getBreakPos(), -1); - } - } - public static void serverTick(World world, BlockPos pos, BlockState state, BreakerBlockEntity blockEntity) { BlockState currentBreakState = world.getBlockState(blockEntity.getBreakPos()); int prevBreakPercentage = blockEntity.getBreakPercentage(); @@ -78,14 +65,25 @@ public static void serverTick(World world, BlockPos pos, BlockState state, Break blockEntity.continueBreak(); } - if (blockEntity.getBreakPercentage() != prevBreakPercentage) { + int newBreakPercentage = blockEntity.getBreakPercentage(); + + if (newBreakPercentage != prevBreakPercentage) { dirty = true; + world.updateComparators(pos, world.getBlockState(pos).getBlock()); + + if (newBreakPercentage <= 0 || newBreakPercentage >= 100) { + world.setBlockBreakingInfo(blockEntity.getFakePlayer().getId(), blockEntity.getBreakPos(), -1); + } else { + world.setBlockBreakingInfo(blockEntity.getFakePlayer().getId(), blockEntity.getBreakPos(), blockEntity.getBreakPercentage() / 10); + } } } + if (blockEntity.isBreaking() != world.getBlockState(pos).get(ModProperties.BREAKING)) { world.setBlockState(pos, world.getBlockState(pos).with(ModProperties.BREAKING, blockEntity.isBreaking())); dirty = true; } + if (dirty) { ((ServerChunkManager) world.getChunkManager()).markForUpdate(pos); blockEntity.markDirty(); @@ -142,7 +140,7 @@ public int getBreakTime() { float baseTime = this.calcBlockBreakingTime(); float itemMultiplier = stack.getMiningSpeedMultiplier(breakState); int level = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack); - if (level > 0) { + if (level > 0 && itemMultiplier > 1.0f) { itemMultiplier += (level * level + 1); } float time = baseTime / itemMultiplier; @@ -152,8 +150,7 @@ public int getBreakTime() { public boolean isToolEffective() { BlockState breakState = this.getBreakState(); if (breakState == null) return false; - ItemStack item = this.getStack(0); - return !breakState.isToolRequired() || item.isSuitableFor(breakState); + return !breakState.isToolRequired() || this.getTool().isSuitableFor(breakState); } public float calcBlockBreakingTime() { @@ -196,7 +193,7 @@ public boolean isBreaking() { } public Direction getFacing() { - if (this.getWorld() == null) return Direction.NORTH; + if (this.getWorld() == null || !this.getWorld().getBlockState(this.getPos()).contains(Properties.FACING)) return Direction.NORTH; return this.getWorld().getBlockState(this.getPos()).get(Properties.FACING); } @@ -211,7 +208,7 @@ public void breakBlock() { BlockState breakState = this.getBreakState(); PlayerEntity fakePlayer = this.getFakePlayer(); BlockEntity blockEntity = breakState.hasBlockEntity() ? world.getBlockEntity(getBreakPos()) : null; - this.getFakePlayer().setStackInHand(Hand.MAIN_HAND, getBreakStack()); + fakePlayer.setStackInHand(Hand.MAIN_HAND, getBreakStack()); if (getTool().getItem().canMine(breakState, world, getBreakPos(), fakePlayer) && isToolEffective()) { Block.dropStacks(breakState, world, getBreakPos(), blockEntity, fakePlayer, getTool()); } diff --git a/src/main/java/com/shnupbups/redstonebits/blockentity/CheckerBlockEntity.java b/src/main/java/com/shnupbups/redstonebits/blockentity/CheckerBlockEntity.java index d700797..800e13c 100644 --- a/src/main/java/com/shnupbups/redstonebits/blockentity/CheckerBlockEntity.java +++ b/src/main/java/com/shnupbups/redstonebits/blockentity/CheckerBlockEntity.java @@ -17,7 +17,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import com.shnupbups.redstonebits.ModBlockEntities; +import com.shnupbups.redstonebits.init.ModBlockEntities; import com.shnupbups.redstonebits.container.CheckerScreenHandler; public class CheckerBlockEntity extends LockableContainerBlockEntity { @@ -73,7 +73,7 @@ public int size() { @Override public boolean isEmpty() { - Iterator var1 = this.inventory.iterator(); + Iterator var1 = this.inventory.iterator(); ItemStack stack; do { diff --git a/src/main/java/com/shnupbups/redstonebits/blockentity/PlacerBlockEntity.java b/src/main/java/com/shnupbups/redstonebits/blockentity/PlacerBlockEntity.java index 32f7e4c..9f88be1 100644 --- a/src/main/java/com/shnupbups/redstonebits/blockentity/PlacerBlockEntity.java +++ b/src/main/java/com/shnupbups/redstonebits/blockentity/PlacerBlockEntity.java @@ -6,7 +6,7 @@ import net.minecraft.text.TranslatableText; import net.minecraft.util.math.BlockPos; -import com.shnupbups.redstonebits.ModBlockEntities; +import com.shnupbups.redstonebits.init.ModBlockEntities; public class PlacerBlockEntity extends DispenserBlockEntity { public PlacerBlockEntity(BlockPos pos, BlockState state) { diff --git a/src/main/java/com/shnupbups/redstonebits/blockentity/RedstoneGateBlockEntity.java b/src/main/java/com/shnupbups/redstonebits/blockentity/RedstoneGateBlockEntity.java index 7c662ad..c9694eb 100644 --- a/src/main/java/com/shnupbups/redstonebits/blockentity/RedstoneGateBlockEntity.java +++ b/src/main/java/com/shnupbups/redstonebits/blockentity/RedstoneGateBlockEntity.java @@ -5,7 +5,7 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.util.math.BlockPos; -import com.shnupbups.redstonebits.ModBlockEntities; +import com.shnupbups.redstonebits.init.ModBlockEntities; public class RedstoneGateBlockEntity extends BlockEntity { private int outputSignal; diff --git a/src/main/java/com/shnupbups/redstonebits/container/BreakerScreenHandler.java b/src/main/java/com/shnupbups/redstonebits/container/BreakerScreenHandler.java index 2792b6a..0fc62ce 100644 --- a/src/main/java/com/shnupbups/redstonebits/container/BreakerScreenHandler.java +++ b/src/main/java/com/shnupbups/redstonebits/container/BreakerScreenHandler.java @@ -13,7 +13,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import com.shnupbups.redstonebits.ModScreenHandlers; +import com.shnupbups.redstonebits.init.ModScreenHandlers; import com.shnupbups.redstonebits.blockentity.BreakerBlockEntity; public class BreakerScreenHandler extends ScreenHandler { diff --git a/src/main/java/com/shnupbups/redstonebits/container/CheckerScreenHandler.java b/src/main/java/com/shnupbups/redstonebits/container/CheckerScreenHandler.java index 918cea7..1cea8bc 100644 --- a/src/main/java/com/shnupbups/redstonebits/container/CheckerScreenHandler.java +++ b/src/main/java/com/shnupbups/redstonebits/container/CheckerScreenHandler.java @@ -8,7 +8,7 @@ import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.slot.Slot; -import com.shnupbups.redstonebits.ModScreenHandlers; +import com.shnupbups.redstonebits.init.ModScreenHandlers; public class CheckerScreenHandler extends ScreenHandler { public final PlayerInventory playerInventory; diff --git a/src/main/java/com/shnupbups/redstonebits/ModBlockEntities.java b/src/main/java/com/shnupbups/redstonebits/init/ModBlockEntities.java similarity index 94% rename from src/main/java/com/shnupbups/redstonebits/ModBlockEntities.java rename to src/main/java/com/shnupbups/redstonebits/init/ModBlockEntities.java index e480905..e02134e 100644 --- a/src/main/java/com/shnupbups/redstonebits/ModBlockEntities.java +++ b/src/main/java/com/shnupbups/redstonebits/init/ModBlockEntities.java @@ -1,10 +1,11 @@ -package com.shnupbups.redstonebits; +package com.shnupbups.redstonebits.init; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.util.registry.Registry; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; +import com.shnupbups.redstonebits.RedstoneBits; import com.shnupbups.redstonebits.blockentity.BreakerBlockEntity; import com.shnupbups.redstonebits.blockentity.CheckerBlockEntity; import com.shnupbups.redstonebits.blockentity.PlacerBlockEntity; diff --git a/src/main/java/com/shnupbups/redstonebits/ModBlocks.java b/src/main/java/com/shnupbups/redstonebits/init/ModBlocks.java similarity index 87% rename from src/main/java/com/shnupbups/redstonebits/ModBlocks.java rename to src/main/java/com/shnupbups/redstonebits/init/ModBlocks.java index 009f154..03afef4 100644 --- a/src/main/java/com/shnupbups/redstonebits/ModBlocks.java +++ b/src/main/java/com/shnupbups/redstonebits/init/ModBlocks.java @@ -1,10 +1,11 @@ -package com.shnupbups.redstonebits; +package com.shnupbups.redstonebits.init; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.MapColor; import net.minecraft.block.Material; import net.minecraft.block.Oxidizable; +import net.minecraft.block.WeightedPressurePlateBlock; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; @@ -15,6 +16,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.registry.OxidizableBlocksRegistry; +import com.shnupbups.redstonebits.RedstoneBits; import com.shnupbups.redstonebits.block.*; public class ModBlocks { @@ -24,18 +26,20 @@ public class ModBlocks { public static final Block CHECKER = new CheckerBlock(FabricBlockSettings.copyOf(Blocks.OBSERVER)); + public static final Block ROTATOR = new RotatorBlock(FabricBlockSettings.copyOf(Blocks.OBSERVER)); + public static final Block COUNTER = new CounterBlock(FabricBlockSettings.copyOf(Blocks.REPEATER)); public static final Block RESISTOR = new ResistorBlock(FabricBlockSettings.copyOf(Blocks.REPEATER)); public static final Block ADDER = new AdderBlock(FabricBlockSettings.copyOf(Blocks.REPEATER)); public static final Block INVERTER = new InverterBlock(FabricBlockSettings.copyOf(Blocks.REPEATER)); - public static final Block ANALOG_REDSTONE_LAMP = new AnalogRedstoneRecieverBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).luminance((state) -> state.get(AnalogRedstoneRecieverBlock.POWER))); - public static final Block REDSTONE_DISPLAY = new AnalogRedstoneRecieverBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).luminance(0)); + public static final Block ANALOG_REDSTONE_LAMP = new AnalogRedstoneReceiverBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).luminance((state) -> state.get(AnalogRedstoneReceiverBlock.POWER))); + public static final Block REDSTONE_DISPLAY = new AnalogRedstoneReceiverBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).luminance(0)); - private static final FabricBlockSettings UNAFFECTED_COPPER_SETTINGS = FabricBlockSettings.of(Material.METAL, MapColor.ORANGE).requiresTool().strength(3.0F, 6.0F).sounds(BlockSoundGroup.COPPER); - private static final FabricBlockSettings EXPOSED_COPPER_SETTINGS = FabricBlockSettings.of(Material.METAL, MapColor.TERRACOTTA_LIGHT_GRAY).requiresTool().strength(3.0F, 6.0F).sounds(BlockSoundGroup.COPPER); - private static final FabricBlockSettings WEATHERED_COPPER_SETTINGS = FabricBlockSettings.of(Material.METAL, MapColor.DARK_AQUA).requiresTool().strength(3.0F, 6.0F).sounds(BlockSoundGroup.COPPER); - private static final FabricBlockSettings OXIDIZED_COPPER_SETTINGS = FabricBlockSettings.of(Material.METAL, MapColor.TEAL).requiresTool().strength(3.0F, 6.0F).sounds(BlockSoundGroup.COPPER); + private static final FabricBlockSettings UNAFFECTED_COPPER_SETTINGS = FabricBlockSettings.of(Material.METAL, MapColor.ORANGE).requiresTool().noCollision().strength(0.5f).sounds(BlockSoundGroup.COPPER); + private static final FabricBlockSettings EXPOSED_COPPER_SETTINGS = FabricBlockSettings.of(Material.METAL, MapColor.TERRACOTTA_LIGHT_GRAY).requiresTool().noCollision().strength(0.5f).sounds(BlockSoundGroup.COPPER); + private static final FabricBlockSettings WEATHERED_COPPER_SETTINGS = FabricBlockSettings.of(Material.METAL, MapColor.DARK_AQUA).requiresTool().noCollision().strength(0.5f).sounds(BlockSoundGroup.COPPER); + private static final FabricBlockSettings OXIDIZED_COPPER_SETTINGS = FabricBlockSettings.of(Material.METAL, MapColor.TEAL).requiresTool().noCollision().strength(0.5f).sounds(BlockSoundGroup.COPPER); public static final Block COPPER_BUTTON = new CopperButtonBlock(Oxidizable.OxidationLevel.UNAFFECTED, 5, UNAFFECTED_COPPER_SETTINGS); public static final Block EXPOSED_COPPER_BUTTON = new CopperButtonBlock(Oxidizable.OxidationLevel.EXPOSED, 15, EXPOSED_COPPER_SETTINGS); @@ -52,10 +56,10 @@ public class ModBlocks { public static final Block WEATHERED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new CopperPressurePlateBlock(Oxidizable.OxidationLevel.WEATHERED, 90, WEATHERED_COPPER_SETTINGS); public static final Block OXIDIZED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new CopperPressurePlateBlock(Oxidizable.OxidationLevel.OXIDIZED, 120, OXIDIZED_COPPER_SETTINGS); - public static final Block WAXED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new ModWeightedPressurePlateBlock(30, UNAFFECTED_COPPER_SETTINGS); - public static final Block WAXED_EXPOSED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new ModWeightedPressurePlateBlock(60, EXPOSED_COPPER_SETTINGS); - public static final Block WAXED_WEATHERED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new ModWeightedPressurePlateBlock(90, WEATHERED_COPPER_SETTINGS); - public static final Block WAXED_OXIDIZED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new ModWeightedPressurePlateBlock(120, OXIDIZED_COPPER_SETTINGS); + public static final Block WAXED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new WeightedPressurePlateBlock(30, UNAFFECTED_COPPER_SETTINGS); + public static final Block WAXED_EXPOSED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new WeightedPressurePlateBlock(60, EXPOSED_COPPER_SETTINGS); + public static final Block WAXED_WEATHERED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new WeightedPressurePlateBlock(90, WEATHERED_COPPER_SETTINGS); + public static final Block WAXED_OXIDIZED_MEDIUM_WEIGHTED_PRESSURE_PLATE = new WeightedPressurePlateBlock(120, OXIDIZED_COPPER_SETTINGS); public static T register(String name, T block) { T b = Registry.register(Registry.BLOCK, RedstoneBits.id(name), block); @@ -71,6 +75,8 @@ public static void init() { register("checker", CHECKER); + register("rotator", ROTATOR); + register("counter", COUNTER); register("resistor", RESISTOR); register("adder", ADDER); diff --git a/src/main/java/com/shnupbups/redstonebits/ModScreenHandlers.java b/src/main/java/com/shnupbups/redstonebits/init/ModScreenHandlers.java similarity index 89% rename from src/main/java/com/shnupbups/redstonebits/ModScreenHandlers.java rename to src/main/java/com/shnupbups/redstonebits/init/ModScreenHandlers.java index b267fec..53fd9ce 100644 --- a/src/main/java/com/shnupbups/redstonebits/ModScreenHandlers.java +++ b/src/main/java/com/shnupbups/redstonebits/init/ModScreenHandlers.java @@ -1,9 +1,10 @@ -package com.shnupbups.redstonebits; +package com.shnupbups.redstonebits.init; import net.minecraft.screen.ScreenHandlerType; import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; +import com.shnupbups.redstonebits.RedstoneBits; import com.shnupbups.redstonebits.container.BreakerScreenHandler; import com.shnupbups.redstonebits.container.CheckerScreenHandler; diff --git a/src/main/java/com/shnupbups/redstonebits/ModSoundEvents.java b/src/main/java/com/shnupbups/redstonebits/init/ModSoundEvents.java similarity index 63% rename from src/main/java/com/shnupbups/redstonebits/ModSoundEvents.java rename to src/main/java/com/shnupbups/redstonebits/init/ModSoundEvents.java index 8a59b11..cae3d2c 100644 --- a/src/main/java/com/shnupbups/redstonebits/ModSoundEvents.java +++ b/src/main/java/com/shnupbups/redstonebits/init/ModSoundEvents.java @@ -1,15 +1,21 @@ -package com.shnupbups.redstonebits; +package com.shnupbups.redstonebits.init; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; +import com.shnupbups.redstonebits.RedstoneBits; + public class ModSoundEvents { public static final SoundEvent BLOCK_COPPER_BUTTON_CLICK_ON = new SoundEvent(RedstoneBits.id("block.copper_button.click_on")); public static final SoundEvent BLOCK_COPPER_BUTTON_CLICK_OFF = new SoundEvent(RedstoneBits.id("block.copper_button.click_off")); public static final SoundEvent BLOCK_COUNTER_CLICK = new SoundEvent(RedstoneBits.id("block.counter.click")); public static final SoundEvent BLOCK_RESISTOR_CLICK = new SoundEvent(RedstoneBits.id("block.resistor.click")); public static final SoundEvent BLOCK_ADDER_CLICK = new SoundEvent(RedstoneBits.id("block.adder.click")); + public static final SoundEvent BLOCK_INVERTER_CLICK = new SoundEvent(RedstoneBits.id("block.inverter.click")); + public static final SoundEvent BLOCK_ROTATOR_INVERT = new SoundEvent(RedstoneBits.id("block.rotator.invert")); + public static final SoundEvent BLOCK_ROTATOR_ROTATE = new SoundEvent(RedstoneBits.id("block.rotator.rotate")); + public static final SoundEvent BLOCK_ROTATOR_FAIL = new SoundEvent(RedstoneBits.id("block.rotator.fail")); public static SoundEvent register(SoundEvent event) { Identifier identifier = event.getId(); @@ -22,5 +28,8 @@ public static void init() { register(BLOCK_COUNTER_CLICK); register(BLOCK_RESISTOR_CLICK); register(BLOCK_ADDER_CLICK); + register(BLOCK_INVERTER_CLICK); + register(BLOCK_ROTATOR_ROTATE); + register(BLOCK_ROTATOR_FAIL); } } diff --git a/src/main/java/com/shnupbups/redstonebits/mixin/RedstoneWireMixin.java b/src/main/java/com/shnupbups/redstonebits/mixin/RedstoneWireMixin.java index 38a30cd..4995e41 100644 --- a/src/main/java/com/shnupbups/redstonebits/mixin/RedstoneWireMixin.java +++ b/src/main/java/com/shnupbups/redstonebits/mixin/RedstoneWireMixin.java @@ -15,8 +15,8 @@ public class RedstoneWireMixin { @Inject(at = @At(value = "HEAD"), method = "connectsTo(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Direction;)Z", cancellable = true) private static void connectsToMixin(BlockState state, Direction dir, CallbackInfoReturnable cir) { - if (state.getBlock() instanceof AdvancedRedstoneConnector) { - cir.setReturnValue(((AdvancedRedstoneConnector) state.getBlock()).connectsToRedstoneInDirection(state, dir)); + if (state.getBlock() instanceof AdvancedRedstoneConnector arc) { + cir.setReturnValue(arc.connectsToRedstoneInDirection(state, dir)); } } } diff --git a/src/main/java/com/shnupbups/redstonebits/properties/ResistorMode.java b/src/main/java/com/shnupbups/redstonebits/properties/ResistorMode.java index 9929d5d..60142e1 100644 --- a/src/main/java/com/shnupbups/redstonebits/properties/ResistorMode.java +++ b/src/main/java/com/shnupbups/redstonebits/properties/ResistorMode.java @@ -7,7 +7,7 @@ public enum ResistorMode implements StringIdentifiable { HALVE(2), THIRD(3); - public float divisor; + public final float divisor; ResistorMode(float divisor) { this.divisor = divisor; @@ -27,4 +27,4 @@ public int resistPower(int power) { public String asString() { return toString().toLowerCase(); } -} +} \ No newline at end of file diff --git a/src/main/resources/assets/redstonebits/blockstates/inverter.json b/src/main/resources/assets/redstonebits/blockstates/inverter.json index 54053db..0e25ea9 100644 --- a/src/main/resources/assets/redstonebits/blockstates/inverter.json +++ b/src/main/resources/assets/redstonebits/blockstates/inverter.json @@ -1,20 +1,36 @@ { "variants": { - "facing=south,powered=false,locked=false": { "model": "redstonebits:block/inverter" }, - "facing=west,powered=false,locked=false": { "model": "redstonebits:block/inverter", "y": 90 }, - "facing=north,powered=false,locked=false": { "model": "redstonebits:block/inverter", "y": 180 }, - "facing=east,powered=false,locked=false": { "model": "redstonebits:block/inverter", "y": 270 }, - "facing=south,powered=true,locked=false": { "model": "redstonebits:block/inverter_on" }, - "facing=west,powered=true,locked=false": { "model": "redstonebits:block/inverter_on", "y": 90 }, - "facing=north,powered=true,locked=false": { "model": "redstonebits:block/inverter_on", "y": 180 }, - "facing=east,powered=true,locked=false": { "model": "redstonebits:block/inverter_on", "y": 270 }, - "facing=south,powered=false,locked=true": { "model": "redstonebits:block/inverter_locked" }, - "facing=west,powered=false,locked=true": { "model": "redstonebits:block/inverter_locked", "y": 90 }, - "facing=north,powered=false,locked=true": { "model": "redstonebits:block/inverter_locked", "y": 180 }, - "facing=east,powered=false,locked=true": { "model": "redstonebits:block/inverter_locked", "y": 270 }, - "facing=south,powered=true,locked=true": { "model": "redstonebits:block/inverter_locked_on" }, - "facing=west,powered=true,locked=true": { "model": "redstonebits:block/inverter_locked_on", "y": 90 }, - "facing=north,powered=true,locked=true": { "model": "redstonebits:block/inverter_locked_on", "y": 180 }, - "facing=east,powered=true,locked=true": { "model": "redstonebits:block/inverter_locked_on", "y": 270 } + "facing=south,powered=false,locked=false,inverted=true": { "model": "redstonebits:block/inverter" }, + "facing=west,powered=false,locked=false,inverted=true": { "model": "redstonebits:block/inverter", "y": 90 }, + "facing=north,powered=false,locked=false,inverted=true": { "model": "redstonebits:block/inverter", "y": 180 }, + "facing=east,powered=false,locked=false,inverted=true": { "model": "redstonebits:block/inverter", "y": 270 }, + "facing=south,powered=true,locked=false,inverted=true": { "model": "redstonebits:block/inverter_on" }, + "facing=west,powered=true,locked=false,inverted=true": { "model": "redstonebits:block/inverter_on", "y": 90 }, + "facing=north,powered=true,locked=false,inverted=true": { "model": "redstonebits:block/inverter_on", "y": 180 }, + "facing=east,powered=true,locked=false,inverted=true": { "model": "redstonebits:block/inverter_on", "y": 270 }, + "facing=south,powered=false,locked=true,inverted=true": { "model": "redstonebits:block/inverter_locked" }, + "facing=west,powered=false,locked=true,inverted=true": { "model": "redstonebits:block/inverter_locked", "y": 90 }, + "facing=north,powered=false,locked=true,inverted=true": { "model": "redstonebits:block/inverter_locked", "y": 180 }, + "facing=east,powered=false,locked=true,inverted=true": { "model": "redstonebits:block/inverter_locked", "y": 270 }, + "facing=south,powered=true,locked=true,inverted=true": { "model": "redstonebits:block/inverter_locked_on" }, + "facing=west,powered=true,locked=true,inverted=true": { "model": "redstonebits:block/inverter_locked_on", "y": 90 }, + "facing=north,powered=true,locked=true,inverted=true": { "model": "redstonebits:block/inverter_locked_on", "y": 180 }, + "facing=east,powered=true,locked=true,inverted=true": { "model": "redstonebits:block/inverter_locked_on", "y": 270 }, + "facing=south,powered=false,locked=false,inverted=false": { "model": "redstonebits:block/inverter_no_inverting" }, + "facing=west,powered=false,locked=false,inverted=false": { "model": "redstonebits:block/inverter_no_inverting", "y": 90 }, + "facing=north,powered=false,locked=false,inverted=false": { "model": "redstonebits:block/inverter_no_inverting", "y": 180 }, + "facing=east,powered=false,locked=false,inverted=false": { "model": "redstonebits:block/inverter_no_inverting", "y": 270 }, + "facing=south,powered=true,locked=false,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_on" }, + "facing=west,powered=true,locked=false,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_on", "y": 90 }, + "facing=north,powered=true,locked=false,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_on", "y": 180 }, + "facing=east,powered=true,locked=false,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_on", "y": 270 }, + "facing=south,powered=false,locked=true,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_locked" }, + "facing=west,powered=false,locked=true,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_locked", "y": 90 }, + "facing=north,powered=false,locked=true,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_locked", "y": 180 }, + "facing=east,powered=false,locked=true,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_locked", "y": 270 }, + "facing=south,powered=true,locked=true,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_locked_on" }, + "facing=west,powered=true,locked=true,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_locked_on", "y": 90 }, + "facing=north,powered=true,locked=true,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_locked_on", "y": 180 }, + "facing=east,powered=true,locked=true,inverted=false": { "model": "redstonebits:block/inverter_no_inverting_locked_on", "y": 270 } } } diff --git a/src/main/resources/assets/redstonebits/blockstates/rotator.json b/src/main/resources/assets/redstonebits/blockstates/rotator.json new file mode 100644 index 0000000..8693d65 --- /dev/null +++ b/src/main/resources/assets/redstonebits/blockstates/rotator.json @@ -0,0 +1,16 @@ +{ + "variants": { + "facing=down,inverted=false": { "model": "redstonebits:block/rotator", "x": 90 }, + "facing=up,inverted=false": { "model": "redstonebits:block/rotator", "x": 270 }, + "facing=north,inverted=false": { "model": "redstonebits:block/rotator" }, + "facing=south,inverted=false": { "model": "redstonebits:block/rotator", "y": 180 }, + "facing=west,inverted=false": { "model": "redstonebits:block/rotator", "y": 270 }, + "facing=east,inverted=false": { "model": "redstonebits:block/rotator", "y": 90 }, + "facing=down,inverted=true": { "model": "redstonebits:block/rotator_inverted", "x": 90 }, + "facing=up,inverted=true": { "model": "redstonebits:block/rotator_inverted", "x": 270 }, + "facing=north,inverted=true": { "model": "redstonebits:block/rotator_inverted" }, + "facing=south,inverted=true": { "model": "redstonebits:block/rotator_inverted", "y": 180 }, + "facing=west,inverted=true": { "model": "redstonebits:block/rotator_inverted", "y": 270 }, + "facing=east,inverted=true": { "model": "redstonebits:block/rotator_inverted", "y": 90 } + } +} diff --git a/src/main/resources/assets/redstonebits/lang/en_us.json b/src/main/resources/assets/redstonebits/lang/en_us.json index 1dc37f6..5e9a95f 100644 --- a/src/main/resources/assets/redstonebits/lang/en_us.json +++ b/src/main/resources/assets/redstonebits/lang/en_us.json @@ -27,7 +27,14 @@ "block.redstonebits.waxed_exposed_medium_weighted_pressure_plate": "Waxed Exposed Medium Weighted Pressure Plate", "block.redstonebits.waxed_weathered_medium_weighted_pressure_plate": "Waxed Weathered Medium Weighted Pressure Plate", "block.redstonebits.waxed_oxidized_medium_weighted_pressure_plate": "Waxed Oxidized Medium Weighted Pressure Plate", + "block.redstonebits.rotator": "Rotator", "subtitles.block.counter.click": "Counter clicks", "subtitles.block.adder.click": "Adder clicks", - "subtitles.block.resistor.click": "Resistor clicks" + "subtitles.block.resistor.click": "Resistor clicks", + "subtitles.block.inverter.click": "Inverter clicks", + "subtitles.block.copper_button.click_on": "Button clicks", + "subtitles.block.copper_button.click_off": "Button clicks", + "subtitles.block.rotator.rotate": "Rotator rotates", + "subtitles.block.rotator.fail": "Rotator failed", + "subtitles.block.rotator.invert": "Rotator inverted" } \ No newline at end of file diff --git a/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting.json b/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting.json new file mode 100644 index 0000000..21e1313 --- /dev/null +++ b/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting.json @@ -0,0 +1,7 @@ +{ + "parent": "redstonebits:block/inverter", + "textures": { + "top": "redstonebits:block/inverter_no_inverting_off", + "torch": "block/redstone_torch_off" + } +} diff --git a/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_locked.json b/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_locked.json new file mode 100644 index 0000000..14fe87b --- /dev/null +++ b/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_locked.json @@ -0,0 +1,7 @@ +{ + "parent": "redstonebits:block/inverter_locked", + "textures": { + "top": "redstonebits:block/inverter_no_inverting_off", + "torch": "block/redstone_torch_off" + } +} diff --git a/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_locked_on.json b/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_locked_on.json new file mode 100644 index 0000000..3de3045 --- /dev/null +++ b/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_locked_on.json @@ -0,0 +1,6 @@ +{ + "parent": "redstonebits:block/inverter_locked", + "textures": { + "top": "redstonebits:block/inverter_no_inverting_on" + } +} diff --git a/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_on.json b/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_on.json new file mode 100644 index 0000000..69f1572 --- /dev/null +++ b/src/main/resources/assets/redstonebits/models/block/inverter_no_inverting_on.json @@ -0,0 +1,6 @@ +{ + "parent": "redstonebits:block/inverter", + "textures": { + "top": "redstonebits:block/inverter_no_inverting_on" + } +} diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_halve.json b/src/main/resources/assets/redstonebits/models/block/resistor_halve.json index 5373e39..5f3ec72 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_halve.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_halve.json @@ -4,8 +4,7 @@ "slab": "block/smooth_stone", "top": "redstonebits:block/resistor_off", "particle": "#top", - "unlit": "block/redstone_torch_off", - "lit": "block/redstone_torch" + "torch": "block/redstone_torch_off" }, "elements": [ { @@ -21,80 +20,72 @@ } }, { - "from": [2, 7, 9], - "to": [4, 7, 11], + "from": [7, 2, 1], + "to": [9, 8, 5], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [2, 2, 8], - "to": [4, 8, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 8, 6]}, + "from": [6, 2, 2], + "to": [10, 8, 4], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [1, 2, 9], - "to": [5, 8, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 8, 6]}, + "from": [7, 7, 2], + "to": [9, 7, 4], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [12, 7, 9], - "to": [14, 7, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [2, 2, 8], + "to": [4, 8, 12], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [12, 2, 8], - "to": [14, 8, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [1, 2, 9], + "to": [5, 8, 11], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [11, 2, 9], - "to": [15, 8, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [2, 7, 9], + "to": [4, 7, 11], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [7, 7, 2], - "to": [9, 7, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [12, 2, 8], + "to": [14, 8, 12], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#unlit"} + "east": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [7, 2, 1], - "to": [9, 8, 5], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [11, 2, 9], + "to": [15, 8, 11], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#unlit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#unlit"} + "north": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [6, 2, 2], - "to": [10, 8, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [12, 7, 9], + "to": [14, 7, 11], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#unlit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#unlit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } } ] diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_halve_locked.json b/src/main/resources/assets/redstonebits/models/block/resistor_halve_locked.json index 1aa0660..6de9350 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_halve_locked.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_halve_locked.json @@ -4,8 +4,7 @@ "slab": "block/smooth_stone", "top": "redstonebits:block/resistor_off", "particle": "#top", - "unlit": "block/redstone_torch_off", - "lit": "block/redstone_torch", + "torch": "block/redstone_torch_off", "lock": "block/bedrock" }, "elements": [ @@ -22,80 +21,72 @@ } }, { - "from": [2, 7, 9], - "to": [4, 7, 11], + "from": [7, 2, 1], + "to": [9, 8, 5], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [2, 2, 8], - "to": [4, 8, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 8, 6]}, + "from": [6, 2, 2], + "to": [10, 8, 4], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [1, 2, 9], - "to": [5, 8, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 8, 6]}, + "from": [7, 7, 2], + "to": [9, 7, 4], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [12, 7, 9], - "to": [14, 7, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [2, 2, 8], + "to": [4, 8, 12], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [12, 2, 8], - "to": [14, 8, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [1, 2, 9], + "to": [5, 8, 11], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [11, 2, 9], - "to": [15, 8, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [2, 7, 9], + "to": [4, 7, 11], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [7, 7, 2], - "to": [9, 7, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [12, 2, 8], + "to": [14, 8, 12], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#unlit"} + "east": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [7, 2, 1], - "to": [9, 8, 5], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [11, 2, 9], + "to": [15, 8, 11], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#unlit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#unlit"} + "north": {"uv": [6, 5, 10, 11], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 11], "texture": "#torch"} } }, { - "from": [6, 2, 2], - "to": [10, 8, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [12, 7, 9], + "to": [14, 7, 11], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#unlit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#unlit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { "from": [ 2, 2, 6 ], diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_halve_locked_on.json b/src/main/resources/assets/redstonebits/models/block/resistor_halve_locked_on.json index ed2212c..0d37bb8 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_halve_locked_on.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_halve_locked_on.json @@ -1,6 +1,7 @@ { "parent": "redstonebits:block/resistor_halve_locked", "textures": { - "top": "redstonebits:block/resistor_on" + "top": "redstonebits:block/resistor_on", + "torch": "block/redstone_torch" } } diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_halve_on.json b/src/main/resources/assets/redstonebits/models/block/resistor_halve_on.json index dbc872a..62e5746 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_halve_on.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_halve_on.json @@ -1,6 +1,7 @@ { "parent": "redstonebits:block/resistor_halve", "textures": { - "top": "redstonebits:block/resistor_on" + "top": "redstonebits:block/resistor_on", + "torch": "block/redstone_torch" } } diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five.json b/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five.json index c5d8454..7fd2ce5 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five.json @@ -4,7 +4,7 @@ "slab": "block/smooth_stone", "top": "redstonebits:block/resistor_off", "particle": "#top", - "lit": "block/redstone_torch" + "torch": "block/redstone_torch_off" }, "elements": [ { @@ -19,79 +19,73 @@ "down": {"uv": [0, 0, 16, 16], "texture": "#slab", "cullface": "down"} } }, - { - "from": [7, 5, 2], - "to": [9, 5, 4], - "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} - } - }, { "from": [7, 2, 1], "to": [9, 6, 5], "faces": { - "east": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { "from": [6, 2, 2], "to": [10, 6, 4], "faces": { - "north": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { - "from": [12, 5, 9], - "to": [14, 5, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [13, 8, 15]}, + "from": [7, 7, 2], + "to": [9, 5, 4], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [12, 2, 8], - "to": [14, 6, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [13, 8, 15]}, + "from": [2, 2, 8], + "to": [4, 6, 12], "faces": { - "east": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { - "from": [11, 2, 9], - "to": [15, 6, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [13, 8, 15]}, + "from": [1, 2, 9], + "to": [5, 6, 11], "faces": { - "north": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { - "from": [2, 5, 9], + "from": [2, 7, 9], "to": [4, 5, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [3, 8, 15]}, "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [2, 2, 8], - "to": [4, 6, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [3, 8, 15]}, + "from": [12, 2, 8], + "to": [14, 6, 12], "faces": { - "east": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { - "from": [1, 2, 9], - "to": [5, 6, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [3, 8, 15]}, + "from": [11, 2, 9], + "to": [15, 6, 11], + "faces": { + "north": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 9], "texture": "#torch"} + } + }, + { + "from": [12, 7, 9], + "to": [14, 5, 11], "faces": { - "north": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } } ] diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_locked.json b/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_locked.json index caa68c9..b96e16b 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_locked.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_locked.json @@ -4,7 +4,7 @@ "slab": "block/smooth_stone", "top": "redstonebits:block/resistor_off", "particle": "#top", - "lit": "block/redstone_torch", + "torch": "block/redstone_torch_off", "lock": "block/bedrock" }, "elements": [ @@ -20,79 +20,73 @@ "down": {"uv": [0, 0, 16, 16], "texture": "#slab", "cullface": "down"} } }, - { - "from": [7, 5, 2], - "to": [9, 5, 4], - "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} - } - }, { "from": [7, 2, 1], "to": [9, 6, 5], "faces": { - "east": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { "from": [6, 2, 2], "to": [10, 6, 4], "faces": { - "north": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { - "from": [12, 5, 9], - "to": [14, 5, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [13, 8, 15]}, + "from": [7, 7, 2], + "to": [9, 5, 4], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [12, 2, 8], - "to": [14, 6, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [13, 8, 15]}, + "from": [2, 2, 8], + "to": [4, 6, 12], "faces": { - "east": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { - "from": [11, 2, 9], - "to": [15, 6, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [13, 8, 15]}, + "from": [1, 2, 9], + "to": [5, 6, 11], "faces": { - "north": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { - "from": [2, 5, 9], + "from": [2, 7, 9], "to": [4, 5, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [3, 8, 15]}, "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [2, 2, 8], - "to": [4, 6, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [3, 8, 15]}, + "from": [12, 2, 8], + "to": [14, 6, 12], "faces": { - "east": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 9], "texture": "#torch"} } }, { - "from": [1, 2, 9], - "to": [5, 6, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [3, 8, 15]}, + "from": [11, 2, 9], + "to": [15, 6, 11], + "faces": { + "north": {"uv": [6, 5, 10, 9], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 9], "texture": "#torch"} + } + }, + { + "from": [12, 7, 9], + "to": [14, 5, 11], "faces": { - "north": {"uv": [6, 5, 10, 9], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 9], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { "from": [ 2, 2, 6 ], diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_locked_on.json b/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_locked_on.json index 8e6fdc5..6594b04 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_locked_on.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_locked_on.json @@ -1,6 +1,7 @@ { "parent": "redstonebits:block/resistor_one_point_five_locked", "textures": { - "top": "redstonebits:block/resistor_on" + "top": "redstonebits:block/resistor_on", + "torch": "block/redstone_torch" } } diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_on.json b/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_on.json index 123e35a..969884e 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_on.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_one_point_five_on.json @@ -1,6 +1,7 @@ { "parent": "redstonebits:block/resistor_one_point_five", "textures": { - "top": "redstonebits:block/resistor_on" + "top": "redstonebits:block/resistor_on", + "torch": "block/redstone_torch" } } diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_third.json b/src/main/resources/assets/redstonebits/models/block/resistor_third.json index 03182ce..53bc297 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_third.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_third.json @@ -4,7 +4,7 @@ "slab": "block/smooth_stone", "top": "redstonebits:block/resistor_off", "particle": "#top", - "lit": "block/redstone_torch" + "torch": "block/redstone_torch_off" }, "elements": [ { @@ -20,80 +20,72 @@ } }, { - "from": [2, 7, 9], - "to": [4, 7, 11], + "from": [7, 2, 1], + "to": [9, 7, 5], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [2, 2, 8], - "to": [4, 8, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 8, 6]}, + "from": [6, 2, 2], + "to": [10, 7, 4], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [1, 2, 9], - "to": [5, 8, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 8, 6]}, + "from": [7, 7, 2], + "to": [9, 6, 4], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [12, 7, 9], - "to": [14, 7, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [2, 2, 8], + "to": [4, 7, 12], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [12, 2, 8], - "to": [14, 8, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [1, 2, 9], + "to": [5, 7, 11], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [11, 2, 9], - "to": [15, 8, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [2, 7, 9], + "to": [4, 6, 11], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [7, 7, 2], - "to": [9, 7, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [12, 2, 8], + "to": [14, 7, 12], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [7, 2, 1], - "to": [9, 8, 5], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [11, 2, 9], + "to": [15, 7, 11], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [6, 2, 2], - "to": [10, 8, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [12, 7, 9], + "to": [14, 6, 11], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } } ] diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_third_locked.json b/src/main/resources/assets/redstonebits/models/block/resistor_third_locked.json index 60b0077..fd7c415 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_third_locked.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_third_locked.json @@ -4,7 +4,7 @@ "slab": "block/smooth_stone", "top": "redstonebits:block/resistor_off", "particle": "#top", - "lit": "block/redstone_torch", + "torch": "block/redstone_torch_off", "lock": "block/bedrock" }, "elements": [ @@ -21,80 +21,72 @@ } }, { - "from": [2, 7, 9], - "to": [4, 7, 11], + "from": [7, 2, 1], + "to": [9, 7, 5], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [2, 2, 8], - "to": [4, 8, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 8, 6]}, + "from": [6, 2, 2], + "to": [10, 7, 4], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [1, 2, 9], - "to": [5, 8, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 8, 6]}, + "from": [7, 7, 2], + "to": [9, 6, 4], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [12, 7, 9], - "to": [14, 7, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [2, 2, 8], + "to": [4, 7, 12], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [12, 2, 8], - "to": [14, 8, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [1, 2, 9], + "to": [5, 7, 11], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [11, 2, 9], - "to": [15, 8, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 6]}, + "from": [2, 7, 9], + "to": [4, 6, 11], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { - "from": [7, 7, 2], - "to": [9, 7, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [12, 2, 8], + "to": [14, 7, 12], "faces": { - "up": {"uv": [7, 6, 9, 8], "texture": "#lit"} + "east": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "west": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [7, 2, 1], - "to": [9, 8, 5], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [11, 2, 9], + "to": [15, 7, 11], "faces": { - "east": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "west": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "north": {"uv": [6, 5, 10, 10], "texture": "#torch"}, + "south": {"uv": [6, 5, 10, 10], "texture": "#torch"} } }, { - "from": [6, 2, 2], - "to": [10, 8, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 8, -1]}, + "from": [12, 7, 9], + "to": [14, 6, 11], "faces": { - "north": {"uv": [6, 5, 10, 11], "texture": "#lit"}, - "south": {"uv": [6, 5, 10, 11], "texture": "#lit"} + "up": {"uv": [7, 6, 9, 8], "texture": "#torch"} } }, { "from": [ 2, 2, 6 ], diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_third_locked_on.json b/src/main/resources/assets/redstonebits/models/block/resistor_third_locked_on.json index e0547bd..4854871 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_third_locked_on.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_third_locked_on.json @@ -1,6 +1,7 @@ { "parent": "redstonebits:block/resistor_third_locked", "textures": { - "top": "redstonebits:block/resistor_on" + "top": "redstonebits:block/resistor_on", + "torch": "block/redstone_torch" } } diff --git a/src/main/resources/assets/redstonebits/models/block/resistor_third_on.json b/src/main/resources/assets/redstonebits/models/block/resistor_third_on.json index b7013a7..c49db9f 100644 --- a/src/main/resources/assets/redstonebits/models/block/resistor_third_on.json +++ b/src/main/resources/assets/redstonebits/models/block/resistor_third_on.json @@ -1,6 +1,7 @@ { "parent": "redstonebits:block/resistor_third", "textures": { - "top": "redstonebits:block/resistor_on" + "top": "redstonebits:block/resistor_on", + "torch": "block/redstone_torch" } } diff --git a/src/main/resources/assets/redstonebits/models/block/rotator.json b/src/main/resources/assets/redstonebits/models/block/rotator.json new file mode 100644 index 0000000..827d533 --- /dev/null +++ b/src/main/resources/assets/redstonebits/models/block/rotator.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/template_piston", + "textures": { + "platform": "redstonebits:block/rotator_top", + "bottom": "minecraft:block/piston_bottom", + "side": "redstonebits:block/rotator_side" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/redstonebits/models/block/rotator_inventory.json b/src/main/resources/assets/redstonebits/models/block/rotator_inventory.json new file mode 100644 index 0000000..4b26ebb --- /dev/null +++ b/src/main/resources/assets/redstonebits/models/block/rotator_inventory.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/cube_bottom_top", + "textures": { + "top": "redstonebits:block/rotator_top", + "bottom": "minecraft:block/piston_bottom", + "side": "redstonebits:block/rotator_side" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/redstonebits/models/block/rotator_inverted.json b/src/main/resources/assets/redstonebits/models/block/rotator_inverted.json new file mode 100644 index 0000000..617830c --- /dev/null +++ b/src/main/resources/assets/redstonebits/models/block/rotator_inverted.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/template_piston", + "textures": { + "platform": "redstonebits:block/rotator_top", + "bottom": "minecraft:block/piston_bottom", + "side": "redstonebits:block/rotator_side_inverted" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/redstonebits/models/item/rotator.json b/src/main/resources/assets/redstonebits/models/item/rotator.json new file mode 100644 index 0000000..016878f --- /dev/null +++ b/src/main/resources/assets/redstonebits/models/item/rotator.json @@ -0,0 +1,3 @@ +{ + "parent": "redstonebits:block/rotator_inventory" +} diff --git a/src/main/resources/assets/redstonebits/sounds.json b/src/main/resources/assets/redstonebits/sounds.json index 73b35fd..14be091 100644 --- a/src/main/resources/assets/redstonebits/sounds.json +++ b/src/main/resources/assets/redstonebits/sounds.json @@ -28,5 +28,29 @@ "random/click" ], "subtitle": "subtitles.block.adder.click" + }, + "block.inverter.click": { + "sounds": [ + "random/click" + ], + "subtitle": "subtitles.block.inverter.click" + }, + "block.rotator.rotate": { + "sounds": [ + "random/click" + ], + "subtitle": "subtitles.block.rotator.rotate" + }, + "block.rotator.fail": { + "sounds": [ + "random/click" + ], + "subtitle": "subtitles.block.rotator.fail" + }, + "block.rotator.invert": { + "sounds": [ + "random/click" + ], + "subtitle": "subtitles.block.rotator.invert" } } diff --git a/src/main/resources/assets/redstonebits/textures/block/inverter_no_inverting_off.png b/src/main/resources/assets/redstonebits/textures/block/inverter_no_inverting_off.png new file mode 100644 index 0000000000000000000000000000000000000000..a962c6a76b098f18113332a6eacc22c038580cd6 GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPF(^;I1GR7#ctjR6Fz_7&Va6R3v)=**n><|{LnJQC`km%&HV`Rx*!y{wm%!IaEi2L| zwO8eT5qrV4!O{JNhGgr>UtPM9pAO1P{F=-mTkI2Lye2E<+>Wa&CNP|Sl^j#h`}yhK z=?rVuf82bQp|tLgo!FrO_UrRjH;O!ty2)zxW!=YV7ptrD=a{^!w6e%dTy=TkD@(} literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redstonebits/textures/block/inverter_no_inverting_on.png b/src/main/resources/assets/redstonebits/textures/block/inverter_no_inverting_on.png new file mode 100644 index 0000000000000000000000000000000000000000..f06866de84655b28ad35a59e93588d887c464621 GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPF zPG?xN{^RDe45f8{?8FWQuwS3Ix>4kD)J;~iFY7)|yI5VFKgZ-NS%G}Z0G|-oYt_-4lHB*qNIJ7DXL*#v=AOXWg($V2L@(jWVE)nmY0`LoH$XR+qoQQ2xoyuWHAE+-(e7DJf6QI1t>Vp)5S4FBiPn2 zTIh%Zhqty~ZXnD1`Ww8rXP#xR>~U;(Y!jWWa<1%x_x~^VJdbFyyXY_Kz7#*5E98B9 zKy99rXqwrvIn6N=Gu~-mn!bK-aV4vy^nrWUGyEi)MHEi&Ke$Ld^}bgUE(*^OEO%=Of&Uk Qfi7h5boFyt=akR{06Qpj0{{R3 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redstonebits/textures/block/rotator_side_inverted.png b/src/main/resources/assets/redstonebits/textures/block/rotator_side_inverted.png new file mode 100644 index 0000000000000000000000000000000000000000..da8cee20fc115e44ffaefb0861e73693c91f19f4 GIT binary patch literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}Z0G|-oYt_-4lHB*qNIJ7DXL*#v=AOXWg($V2L@(jWVE)nmY0`LoH$XR+qoQQ2xoyuWHAE+-(e7DJf6QI1t>Vx)5S4FBiPn2 zTBzB9qgyXJBuwt!{|&rl%YG^-Ix{5P{%*+DS(@`EweHy*m89vsi`WfaZ_2lGg`DpW z*z4ycnzrp)t$tDR!?J!I{{H7HKbUDnGkWYY?{VAP#?pSfL#x6;A^*sx**=BWiWX1Q zUAcQ(pk&jElt<#7A4Kj6EMFD(>Ljny)V~)GJ(~JNXXVt!`t|?spMJxADwiu+Ipf7K QpaU5^UHx3vIVCg!01Ul&aR2}S literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/redstonebits/textures/block/rotator_top.png b/src/main/resources/assets/redstonebits/textures/block/rotator_top.png new file mode 100644 index 0000000000000000000000000000000000000000..4c13ae8612efe9e17e85623ec93e36d21ccf4be6 GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFU34ZFVdQ&MBb@072$!2><{9 literal 0 HcmV?d00001 diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json index 9d45ad0..1492ea0 100644 --- a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -4,6 +4,7 @@ "redstonebits:checker", "redstonebits:breaker", "redstonebits:placer", + "redstonebits:rotator", "#redstonebits:copper_buttons", "#redstonebits:copper_pressure_plates" ] diff --git a/src/main/resources/data/redstonebits/loot_tables/blocks/rotator.json b/src/main/resources/data/redstonebits/loot_tables/blocks/rotator.json new file mode 100644 index 0000000..d8f668f --- /dev/null +++ b/src/main/resources/data/redstonebits/loot_tables/blocks/rotator.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "redstonebits:rotator" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/redstonebits/recipes/analog_redstone_lamp_alt.json b/src/main/resources/data/redstonebits/recipes/analog_redstone_lamp_alt.json new file mode 100644 index 0000000..be909b0 --- /dev/null +++ b/src/main/resources/data/redstonebits/recipes/analog_redstone_lamp_alt.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:redstone_lamp" + }, + { + "item": "minecraft:quartz" + } + ], + "result": { + "item": "redstonebits:analog_redstone_lamp" + } +} diff --git a/src/main/resources/data/redstonebits/recipes/rotator.json b/src/main/resources/data/redstonebits/recipes/rotator.json new file mode 100644 index 0000000..84b66df --- /dev/null +++ b/src/main/resources/data/redstonebits/recipes/rotator.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "TTT", + "X#X", + "#R#" + ], + "key": { + "R": { + "item": "minecraft:redstone" + }, + "#": { + "item": "minecraft:cobblestone" + }, + "T": { + "tag": "minecraft:planks" + }, + "X": { + "item": "minecraft:copper_ingot" + } + }, + "result": { + "item": "redstonebits:rotator" + } +} \ No newline at end of file diff --git a/src/main/resources/redstonebits.accesswidener b/src/main/resources/redstonebits.accesswidener index 58ea6be..0b32e1a 100644 --- a/src/main/resources/redstonebits.accesswidener +++ b/src/main/resources/redstonebits.accesswidener @@ -1,3 +1,4 @@ accessWidener v1 named +accessible method net/minecraft/block/WeightedPressurePlateBlock (ILnet/minecraft/block/AbstractBlock$Settings;)V extendable method net/minecraft/block/AbstractButtonBlock getPressTicks ()I \ No newline at end of file