diff --git a/build.gradle b/build.gradle index e408188..f185da9 100755 --- a/build.gradle +++ b/build.gradle @@ -38,9 +38,9 @@ repositories { dependencies { minecraft "com.mojang:minecraft:18w50a" - mappings "net.fabricmc:yarn:18w50a.68" - modCompile "net.fabricmc:fabric-loader:0.3.0.74" - modCompile "net.fabricmc:fabric:0.1.2.63" + mappings "net.fabricmc:yarn:18w50a.71" + modCompile "net.fabricmc:fabric-loader:0.3.0.75" + modCompile "net.fabricmc:fabric:0.1.2.64" implementation 'org.jetbrains:annotations:15.0' modCompile "io.github.prospector.silk:SilkAPI:1.0.0-25" modCompile name: "qcommon-architect-1.0.0" diff --git a/libs/qcommon-architect-1.0.0.jar b/libs/qcommon-architect-1.0.0.jar index cf7a2cf..42c1562 100644 Binary files a/libs/qcommon-architect-1.0.0.jar and b/libs/qcommon-architect-1.0.0.jar differ diff --git a/src/main/java/com/elytradev/infraredstone/InfraRedstone.java b/src/main/java/com/elytradev/infraredstone/InfraRedstone.java index 32f492b..660fe43 100755 --- a/src/main/java/com/elytradev/infraredstone/InfraRedstone.java +++ b/src/main/java/com/elytradev/infraredstone/InfraRedstone.java @@ -2,48 +2,20 @@ import com.elytradev.infraredstone.Container.OscillatorContainer; import com.elytradev.infraredstone.block.ModBlocks; -import com.elytradev.infraredstone.block.entity.IRComponentBlockEntity; import com.elytradev.infraredstone.item.ModItems; import com.elytradev.infraredstone.logic.InRedLogic; import com.elytradev.infraredstone.util.CommonProxy; -import io.netty.buffer.Unpooled; -import net.fabricmc.api.DedicatedServerModInitializer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; import net.fabricmc.fabric.api.container.ContainerProviderRegistry; -import net.fabricmc.fabric.block.FabricBlockSettings; import net.fabricmc.fabric.events.TickEvent; -import net.fabricmc.fabric.networking.CustomPayloadPacketRegistry; -import net.minecraft.block.Block; -import net.minecraft.block.Material; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.packet.CustomPayloadClientPacket; -import net.minecraft.client.resource.language.I18n; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.ArmorMaterials; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.block.BlockItem; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.network.packet.CustomPayloadServerPacket; +import net.minecraft.item.*; import net.minecraft.util.Identifier; -import net.minecraft.util.PacketByteBuf; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; - -import java.util.function.Consumer; -import java.util.function.Supplier; public class InfraRedstone implements ModInitializer { - public static final ItemGroup inRedGroup = ItemGroup.REDSTONE; + public static final ItemGroup inRedGroup = FabricItemGroupBuilder.build(new Identifier("infraredstone:infra_redstone_tab"), () -> new ItemStack(ModBlocks.INFRA_REDSTONE)); public static CommonProxy proxy; public static final Identifier OSCILLATOR_CONTAINER = new Identifier("infraredstone:oscillator_container"); diff --git a/src/main/java/com/elytradev/infraredstone/block/EncoderBlock.java b/src/main/java/com/elytradev/infraredstone/block/EncoderBlock.java index 8822b29..5863d9e 100644 --- a/src/main/java/com/elytradev/infraredstone/block/EncoderBlock.java +++ b/src/main/java/com/elytradev/infraredstone/block/EncoderBlock.java @@ -93,7 +93,4 @@ public void neighborUpdate(BlockState state, World world, BlockPos pos, Block bl } } - public boolean canBlockStay(World world, BlockPos pos) { - return world.getBlockState(pos.down()).hasSolidTopSurface(world, pos.down()); - } } diff --git a/src/main/java/com/elytradev/infraredstone/block/InfraRedstoneScaffold.java b/src/main/java/com/elytradev/infraredstone/block/InfraRedstoneScaffold.java index 8647ba7..55503bf 100644 --- a/src/main/java/com/elytradev/infraredstone/block/InfraRedstoneScaffold.java +++ b/src/main/java/com/elytradev/infraredstone/block/InfraRedstoneScaffold.java @@ -66,7 +66,7 @@ public VoxelShape getCollisionShape(BlockState blockState, BlockView blockView, @Override public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { if (entity instanceof ItemEntity) return; - if (entity.horizontalCollision) { //TODO: find out what this actually is + if (entity.horizontalCollision) { entity.velocityY = 0.35; } else if (entity.isSneaking()) { entity.velocityY = 0.08; //Stop, but also counteract EntityLivingBase-applied microgravity diff --git a/src/main/java/com/elytradev/infraredstone/block/ModBlocks.java b/src/main/java/com/elytradev/infraredstone/block/ModBlocks.java index a50d6ee..94ad92f 100644 --- a/src/main/java/com/elytradev/infraredstone/block/ModBlocks.java +++ b/src/main/java/com/elytradev/infraredstone/block/ModBlocks.java @@ -13,8 +13,9 @@ import java.util.function.Supplier; + + public class ModBlocks { - //TODO: properly implement public static final Block INFRA_REDSTONE = register(new InfraRedstoneCable(), InfraRedstone.inRedGroup); public static final Block IN_RED_SCAFFOLD = register(new InfraRedstoneScaffold(), InfraRedstone.inRedGroup); public static final Block IN_RED_BLOCK = register(new InfraRedstoneBlock(), InfraRedstone.inRedGroup); diff --git a/src/main/java/com/elytradev/infraredstone/block/ModuleBase.java b/src/main/java/com/elytradev/infraredstone/block/ModuleBase.java index 114d1ae..e1e9083 100644 --- a/src/main/java/com/elytradev/infraredstone/block/ModuleBase.java +++ b/src/main/java/com/elytradev/infraredstone/block/ModuleBase.java @@ -7,6 +7,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import io.github.prospector.silk.block.SilkBlockWithEntity; +import net.minecraft.world.ViewableWorld; import net.minecraft.world.World; public class ModuleBase extends SilkBlockWithEntity implements NamedBlock { @@ -39,6 +40,15 @@ public Block getBlock() { } public boolean canBlockStay(World world, BlockPos pos) { - return world.getBlockState(pos.down()).hasSolidTopSurface(world, pos.down()); + return world.getBlockState(pos.down()).hasSolidTopSurface(world, pos.down()) + || world.getBlockState(pos.down()).getBlock() == ModBlocks.IN_RED_SCAFFOLD + || world.getBlockState(pos.down()).getBlock() == ModBlocks.IN_RED_BLOCK; + } + + @Override + public boolean canPlaceAt(BlockState state, ViewableWorld world, BlockPos pos) { + return world.getBlockState(pos.down()).hasSolidTopSurface(world, pos.down()) + || world.getBlockState(pos.down()).getBlock() == ModBlocks.IN_RED_SCAFFOLD + || world.getBlockState(pos.down()).getBlock() == ModBlocks.IN_RED_BLOCK; } } diff --git a/src/main/java/com/elytradev/infraredstone/block/NotGateBlock.java b/src/main/java/com/elytradev/infraredstone/block/NotGateBlock.java index bf86e38..aa7fce8 100644 --- a/src/main/java/com/elytradev/infraredstone/block/NotGateBlock.java +++ b/src/main/java/com/elytradev/infraredstone/block/NotGateBlock.java @@ -126,8 +126,4 @@ public void neighborUpdate(BlockState state, World world, BlockPos pos, Block bl } } - public boolean canBlockStay(World world, BlockPos pos) { - return world.getBlockState(pos.down()).hasSolidTopSurface(world, pos.down()); - } - } diff --git a/src/main/java/com/elytradev/infraredstone/block/XorGateBlock.java b/src/main/java/com/elytradev/infraredstone/block/XorGateBlock.java index dca76dc..210de0f 100644 --- a/src/main/java/com/elytradev/infraredstone/block/XorGateBlock.java +++ b/src/main/java/com/elytradev/infraredstone/block/XorGateBlock.java @@ -19,6 +19,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; +import net.minecraft.world.ViewableWorld; import net.minecraft.world.World; public class XorGateBlock extends ModuleBase { @@ -123,9 +124,4 @@ public void neighborUpdate(BlockState state, World world, BlockPos pos, Block bl .with(BOOLEAN_MODE, ((XorGateBlockEntity)be).booleanMode)); } } - - public boolean canBlockStay(World world, BlockPos pos) { - return world.getBlockState(pos.down()).hasSolidTopSurface(world, pos.down()); - } - } diff --git a/src/main/java/com/elytradev/infraredstone/block/entity/OscillatorBlockEntity.java b/src/main/java/com/elytradev/infraredstone/block/entity/OscillatorBlockEntity.java index e404634..3cdb39a 100644 --- a/src/main/java/com/elytradev/infraredstone/block/entity/OscillatorBlockEntity.java +++ b/src/main/java/com/elytradev/infraredstone/block/entity/OscillatorBlockEntity.java @@ -22,6 +22,7 @@ import net.minecraft.util.math.Direction; import net.minecraft.world.chunk.Chunk; + public class OscillatorBlockEntity extends IRComponentBlockEntity implements Tickable, MultimeterProbeProvider, InfraRedstoneCapable { private InfraRedstoneHandler signal = new InfraRedstoneHandler(); diff --git a/src/main/resources/assets/infraredstone/lang/en_us.json b/src/main/resources/assets/infraredstone/lang/en_us.json index b58a003..2b7d8dc 100644 --- a/src/main/resources/assets/infraredstone/lang/en_us.json +++ b/src/main/resources/assets/infraredstone/lang/en_us.json @@ -16,5 +16,6 @@ "msg.inred.multimeter.out": "Module signal output", "msg.inred.multimeter.cable": "Signal passing through cable", "msg.inred.multimeter.block": "Block emits value of 0b11_1111 (63)", - "container.infraredstone.oscillator": "Oscillator" + "container.infraredstone.oscillator": "Oscillator", + "itemGroup.infraredstone:infra_redstone_tab": "Infra-Redstone" } \ No newline at end of file diff --git a/src/main/resources/assets/infraredstone/render/block/diode.json b/src/main/resources/assets/infraredstone/render/block/diode.json index cb45dc5..f5ee9c7 100644 --- a/src/main/resources/assets/infraredstone/render/block/diode.json +++ b/src/main/resources/assets/infraredstone/render/block/diode.json @@ -9,6 +9,30 @@ { "type": "external", "part": "infraredstone:base" + }, + { + "type": "external", + "part": "infraredstone:diode/bit_0" + }, + { + "type": "external", + "part": "infraredstone:diode/bit_1" + }, + { + "type": "external", + "part": "infraredstone:diode/bit_2" + }, + { + "type": "external", + "part": "infraredstone:diode/bit_3" + }, + { + "type": "external", + "part": "infraredstone:diode/bit_4" + }, + { + "type": "external", + "part": "infraredstone:diode/bit_5" } ] } \ No newline at end of file diff --git a/src/main/resources/assets/infraredstone/render/part/diode/bit_0.json b/src/main/resources/assets/infraredstone/render/part/diode/bit_0.json index f082354..310b311 100644 --- a/src/main/resources/assets/infraredstone/render/part/diode/bit_0.json +++ b/src/main/resources/assets/infraredstone/render/part/diode/bit_0.json @@ -16,7 +16,7 @@ { "type": "translate", "offset: match": { - "bit_0=false": [0, -2, 0], + "bit_0=false": [0, -1, 0], "default": [0,0,0] } } diff --git a/src/main/resources/assets/infraredstone/render/part/diode/bit_1.json b/src/main/resources/assets/infraredstone/render/part/diode/bit_1.json index b8eb132..b961c42 100644 --- a/src/main/resources/assets/infraredstone/render/part/diode/bit_1.json +++ b/src/main/resources/assets/infraredstone/render/part/diode/bit_1.json @@ -16,7 +16,7 @@ { "type": "translate", "offset: match": { - "bit_1=false": [0, -2, 0], + "bit_1=false": [0, -1, 0], "default": [0,0,0] } } diff --git a/src/main/resources/assets/infraredstone/render/part/diode/bit_2.json b/src/main/resources/assets/infraredstone/render/part/diode/bit_2.json index 53c105d..a8d7cb2 100644 --- a/src/main/resources/assets/infraredstone/render/part/diode/bit_2.json +++ b/src/main/resources/assets/infraredstone/render/part/diode/bit_2.json @@ -16,7 +16,7 @@ { "type": "translate", "offset: match": { - "bit_2=false": [0, -2, 0], + "bit_2=false": [0, -1, 0], "default": [0,0,0] } } diff --git a/src/main/resources/assets/infraredstone/render/part/diode/bit_3.json b/src/main/resources/assets/infraredstone/render/part/diode/bit_3.json index e19a949..686d2fb 100644 --- a/src/main/resources/assets/infraredstone/render/part/diode/bit_3.json +++ b/src/main/resources/assets/infraredstone/render/part/diode/bit_3.json @@ -16,7 +16,7 @@ { "type": "translate", "offset: match": { - "bit_3=false": [0, -2, 0], + "bit_3=false": [0, -1, 0], "default": [0,0,0] } } diff --git a/src/main/resources/assets/infraredstone/render/part/diode/bit_4.json b/src/main/resources/assets/infraredstone/render/part/diode/bit_4.json index 17f62f4..5e91824 100644 --- a/src/main/resources/assets/infraredstone/render/part/diode/bit_4.json +++ b/src/main/resources/assets/infraredstone/render/part/diode/bit_4.json @@ -16,7 +16,7 @@ { "type": "translate", "offset: match": { - "bit_4=false": [0, -2, 0], + "bit_4=false": [0, -1, 0], "default": [0,0,0] } } diff --git a/src/main/resources/assets/infraredstone/render/part/diode/bit_5.json b/src/main/resources/assets/infraredstone/render/part/diode/bit_5.json index 8d790c2..2255646 100644 --- a/src/main/resources/assets/infraredstone/render/part/diode/bit_5.json +++ b/src/main/resources/assets/infraredstone/render/part/diode/bit_5.json @@ -16,7 +16,7 @@ { "type": "translate", "offset: match": { - "bit_5=false": [0, -2, 0], + "bit_5=false": [0, -1, 0], "default": [0,0,0] } }