From 37e3a8c2db4ecb7a865257158efbac6f488eaf75 Mon Sep 17 00:00:00 2001 From: Andrew-71 Date: Sun, 3 Sep 2023 16:20:07 +0300 Subject: [PATCH] Add vintage lamp and improve backend --- TODO.md | 1 + .../su/a71/new_soviet/NewSovietClient.java | 3 +- .../{light_bulb.json => light_bulb_lamp.json} | 4 +- .../{lamp.json => table_lamp.json} | 12 +-- .../recipes/decorations/vintage_lamp.json | 61 ++++++++++++ .../blocks/{lamp.json => table_lamp.json} | 2 +- .../loot_tables/blocks/vintage_lamp.json | 20 ++++ .../{light_bulb.json => light_bulb_lamp.json} | 2 +- .../recipes/{lamp.json => table_lamp.json} | 4 +- .../data/new_soviet/recipes/vintage_lamp.json | 25 +++++ .../su/a71/new_soviet/DataGeneration.java | 49 +++++----- .../su/a71/new_soviet/blocks/LampBlock.java | 4 +- ...BulbBlock.java => LightBulbLampBlock.java} | 16 +--- .../a71/new_soviet/blocks/TableLampBlock.java | 10 +- .../new_soviet/blocks/VintageLampBlock.java | 23 +++++ .../new_soviet/registration/NSE_Custom.java | 17 ++-- .../new_soviet/registration/NSE_Sounds.java | 3 + .../{light_bulb.json => light_bulb_lamp.json} | 0 .../{lamp.json => table_lamp.json} | 0 .../new_soviet/blockstates/vintage_lamp.json | 10 ++ .../assets/new_soviet/lang/en_us.json | 7 +- .../models/block/handrail/handrail.json | 2 +- .../models/block/handrail/handrail_left.json | 2 +- .../models/block/handrail/handrail_right.json | 2 +- .../new_soviet/models/block/vintage_lamp.json | 89 ++++++++++++++++++ .../{light_bulb.json => light_bulb_lamp.json} | 0 .../item/{lamp.json => table_lamp.json} | 0 .../new_soviet/models/item/vintage_lamp.json | 4 + .../block/custom/furniture/vintage_lamp.png | Bin 0 -> 884 bytes .../textures/block/{ => custom}/handrail.png | Bin 30 files changed, 300 insertions(+), 72 deletions(-) rename src/main/generated/data/new_soviet/advancements/recipes/decorations/{light_bulb.json => light_bulb_lamp.json} (87%) rename src/main/generated/data/new_soviet/advancements/recipes/decorations/{lamp.json => table_lamp.json} (83%) create mode 100644 src/main/generated/data/new_soviet/advancements/recipes/decorations/vintage_lamp.json rename src/main/generated/data/new_soviet/loot_tables/blocks/{lamp.json => table_lamp.json} (87%) create mode 100644 src/main/generated/data/new_soviet/loot_tables/blocks/vintage_lamp.json rename src/main/generated/data/new_soviet/recipes/{light_bulb.json => light_bulb_lamp.json} (89%) rename src/main/generated/data/new_soviet/recipes/{lamp.json => table_lamp.json} (82%) create mode 100644 src/main/generated/data/new_soviet/recipes/vintage_lamp.json rename src/main/java/su/a71/new_soviet/blocks/{LightBulbBlock.java => LightBulbLampBlock.java} (90%) create mode 100644 src/main/java/su/a71/new_soviet/blocks/VintageLampBlock.java rename src/main/resources/assets/new_soviet/blockstates/{light_bulb.json => light_bulb_lamp.json} (100%) rename src/main/resources/assets/new_soviet/blockstates/{lamp.json => table_lamp.json} (100%) create mode 100644 src/main/resources/assets/new_soviet/blockstates/vintage_lamp.json create mode 100644 src/main/resources/assets/new_soviet/models/block/vintage_lamp.json rename src/main/resources/assets/new_soviet/models/item/{light_bulb.json => light_bulb_lamp.json} (100%) rename src/main/resources/assets/new_soviet/models/item/{lamp.json => table_lamp.json} (100%) create mode 100644 src/main/resources/assets/new_soviet/models/item/vintage_lamp.json create mode 100644 src/main/resources/assets/new_soviet/textures/block/custom/furniture/vintage_lamp.png rename src/main/resources/assets/new_soviet/textures/block/{ => custom}/handrail.png (100%) diff --git a/TODO.md b/TODO.md index 3ef5f90..4d247c1 100644 --- a/TODO.md +++ b/TODO.md @@ -11,6 +11,7 @@ * Add (with functionality) present appliance/furniture/electronics textures * Add achievement criterion for dice and advancements * PO2 wall (fix) +* What's switch type 2? === ACHIEVEMENTS === Kolkhoz warrior - kill a zombie, skeleton, creeper and spider with a sickle \ No newline at end of file diff --git a/src/client/java/su/a71/new_soviet/NewSovietClient.java b/src/client/java/su/a71/new_soviet/NewSovietClient.java index 2509989..1524f32 100644 --- a/src/client/java/su/a71/new_soviet/NewSovietClient.java +++ b/src/client/java/su/a71/new_soviet/NewSovietClient.java @@ -17,7 +17,8 @@ public class NewSovietClient implements ClientModInitializer { public void onInitializeClient() { BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.CRATE, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.HANDRAIL, RenderLayer.getCutout()); - BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.LAMP, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.TABLE_LAMP, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.VINTAGE_LAMP, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.CEILING_FAN, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.SIREN, RenderLayer.getCutout()); diff --git a/src/main/generated/data/new_soviet/advancements/recipes/decorations/light_bulb.json b/src/main/generated/data/new_soviet/advancements/recipes/decorations/light_bulb_lamp.json similarity index 87% rename from src/main/generated/data/new_soviet/advancements/recipes/decorations/light_bulb.json rename to src/main/generated/data/new_soviet/advancements/recipes/decorations/light_bulb_lamp.json index 676446a..6776827 100644 --- a/src/main/generated/data/new_soviet/advancements/recipes/decorations/light_bulb.json +++ b/src/main/generated/data/new_soviet/advancements/recipes/decorations/light_bulb_lamp.json @@ -15,7 +15,7 @@ }, "has_the_recipe": { "conditions": { - "recipe": "new_soviet:light_bulb" + "recipe": "new_soviet:light_bulb_lamp" }, "trigger": "minecraft:recipe_unlocked" } @@ -28,7 +28,7 @@ ], "rewards": { "recipes": [ - "new_soviet:light_bulb" + "new_soviet:light_bulb_lamp" ] }, "sends_telemetry_event": false diff --git a/src/main/generated/data/new_soviet/advancements/recipes/decorations/lamp.json b/src/main/generated/data/new_soviet/advancements/recipes/decorations/table_lamp.json similarity index 83% rename from src/main/generated/data/new_soviet/advancements/recipes/decorations/lamp.json rename to src/main/generated/data/new_soviet/advancements/recipes/decorations/table_lamp.json index 8e90837..3b37286 100644 --- a/src/main/generated/data/new_soviet/advancements/recipes/decorations/lamp.json +++ b/src/main/generated/data/new_soviet/advancements/recipes/decorations/table_lamp.json @@ -15,7 +15,7 @@ }, "has_the_recipe": { "conditions": { - "recipe": "new_soviet:lamp" + "recipe": "new_soviet:table_lamp" }, "trigger": "minecraft:recipe_unlocked" }, @@ -31,13 +31,11 @@ }, "trigger": "minecraft:inventory_changed" }, - "has_white_wool": { + "has_wool": { "conditions": { "items": [ { - "items": [ - "minecraft:white_wool" - ] + "tag": "minecraft:wool" } ] }, @@ -48,13 +46,13 @@ [ "has_torch", "has_stick", - "has_white_wool", + "has_wool", "has_the_recipe" ] ], "rewards": { "recipes": [ - "new_soviet:lamp" + "new_soviet:table_lamp" ] }, "sends_telemetry_event": false diff --git a/src/main/generated/data/new_soviet/advancements/recipes/decorations/vintage_lamp.json b/src/main/generated/data/new_soviet/advancements/recipes/decorations/vintage_lamp.json new file mode 100644 index 0000000..9d645c6 --- /dev/null +++ b/src/main/generated/data/new_soviet/advancements/recipes/decorations/vintage_lamp.json @@ -0,0 +1,61 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_green_stained_glass": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:green_stained_glass" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_iron_nugget": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:iron_nugget" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "new_soviet:vintage_lamp" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_torch": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:torch" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_torch", + "has_iron_nugget", + "has_green_stained_glass", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "new_soviet:vintage_lamp" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/lamp.json b/src/main/generated/data/new_soviet/loot_tables/blocks/table_lamp.json similarity index 87% rename from src/main/generated/data/new_soviet/loot_tables/blocks/lamp.json rename to src/main/generated/data/new_soviet/loot_tables/blocks/table_lamp.json index 09ab428..d4e10b9 100644 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/lamp.json +++ b/src/main/generated/data/new_soviet/loot_tables/blocks/table_lamp.json @@ -11,7 +11,7 @@ "entries": [ { "type": "minecraft:item", - "name": "new_soviet:lamp" + "name": "new_soviet:table_lamp" } ], "rolls": 1.0 diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/vintage_lamp.json b/src/main/generated/data/new_soviet/loot_tables/blocks/vintage_lamp.json new file mode 100644 index 0000000..ffa9eca --- /dev/null +++ b/src/main/generated/data/new_soviet/loot_tables/blocks/vintage_lamp.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "new_soviet:vintage_lamp" + } + ], + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/recipes/light_bulb.json b/src/main/generated/data/new_soviet/recipes/light_bulb_lamp.json similarity index 89% rename from src/main/generated/data/new_soviet/recipes/light_bulb.json rename to src/main/generated/data/new_soviet/recipes/light_bulb_lamp.json index c3a87c7..f87bf46 100644 --- a/src/main/generated/data/new_soviet/recipes/light_bulb.json +++ b/src/main/generated/data/new_soviet/recipes/light_bulb_lamp.json @@ -18,7 +18,7 @@ " Z " ], "result": { - "item": "new_soviet:light_bulb" + "item": "new_soviet:light_bulb_lamp" }, "show_notification": true } \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/recipes/lamp.json b/src/main/generated/data/new_soviet/recipes/table_lamp.json similarity index 82% rename from src/main/generated/data/new_soviet/recipes/lamp.json rename to src/main/generated/data/new_soviet/recipes/table_lamp.json index 21e1c1d..b53b31a 100644 --- a/src/main/generated/data/new_soviet/recipes/lamp.json +++ b/src/main/generated/data/new_soviet/recipes/table_lamp.json @@ -9,7 +9,7 @@ "item": "minecraft:torch" }, "W": { - "item": "minecraft:white_wool" + "tag": "minecraft:wool" } }, "pattern": [ @@ -19,7 +19,7 @@ ], "result": { "count": 3, - "item": "new_soviet:lamp" + "item": "new_soviet:table_lamp" }, "show_notification": true } \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/recipes/vintage_lamp.json b/src/main/generated/data/new_soviet/recipes/vintage_lamp.json new file mode 100644 index 0000000..ba72137 --- /dev/null +++ b/src/main/generated/data/new_soviet/recipes/vintage_lamp.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "item": "minecraft:green_stained_glass" + }, + "N": { + "item": "minecraft:iron_nugget" + }, + "T": { + "item": "minecraft:torch" + } + }, + "pattern": [ + "NNN", + "GTG", + " N " + ], + "result": { + "count": 3, + "item": "new_soviet:vintage_lamp" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/DataGeneration.java b/src/main/java/su/a71/new_soviet/DataGeneration.java index 411cc25..2131c86 100644 --- a/src/main/java/su/a71/new_soviet/DataGeneration.java +++ b/src/main/java/su/a71/new_soviet/DataGeneration.java @@ -9,34 +9,21 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; -import net.minecraft.block.Block; import net.minecraft.block.Blocks; -import net.minecraft.block.CandleBlock; import net.minecraft.data.client.BlockStateModelGenerator; import net.minecraft.data.client.ItemModelGenerator; import net.minecraft.data.server.recipe.RecipeJsonProvider; import net.minecraft.data.server.recipe.RecipeProvider; import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; -import net.minecraft.item.Item; import net.minecraft.item.ItemConvertible; import net.minecraft.item.Items; -import net.minecraft.loot.LootPool; -import net.minecraft.loot.LootTable; -import net.minecraft.loot.condition.BlockStatePropertyLootCondition; -import net.minecraft.loot.entry.ItemEntry; -import net.minecraft.loot.entry.LootPoolEntry; -import net.minecraft.loot.function.ExplosionDecayLootFunction; -import net.minecraft.loot.function.LootFunctionConsumingBuilder; -import net.minecraft.loot.function.SetCountLootFunction; -import net.minecraft.loot.provider.number.ConstantLootNumberProvider; -import net.minecraft.predicate.StatePredicate; import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; import net.minecraft.util.Util; -import su.a71.new_soviet.blocks.CheckerBlock; import su.a71.new_soviet.registration.NSE_Blocks; import su.a71.new_soviet.registration.NSE_Custom; import su.a71.new_soviet.registration.NSE_Items; @@ -239,7 +226,8 @@ public class DataGeneration implements DataGeneratorEntrypoint { addDrop(NSE_Custom.BROWN_TV); addDrop(NSE_Custom.RADIO_RECEIVER); addDrop(NSE_Custom.SIREN); - addDrop(NSE_Custom.LAMP); + addDrop(NSE_Custom.TABLE_LAMP); + addDrop(NSE_Custom.VINTAGE_LAMP); addDrop(NSE_Custom.CEILING_FAN); addDrop(NSE_Custom.SWITCH); @@ -971,7 +959,7 @@ public class DataGeneration implements DataGeneratorEntrypoint { .offerTo(exporter); } - private void lampRecipe(Consumer exporter, ItemConvertible output) { + private void tableLampRecipe(Consumer exporter, ItemConvertible output) { ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, output, 3) .pattern("WWW") .pattern("WTW") @@ -979,13 +967,30 @@ public class DataGeneration implements DataGeneratorEntrypoint { .input('S', Items.STICK) .input('T', Items.TORCH) - .input('W', Items.WHITE_WOOL) + .input('W', ItemTags.WOOL) .criterion(RecipeProvider.hasItem(Items.TORCH), RecipeProvider.conditionsFromItem(Items.TORCH)) .criterion(RecipeProvider.hasItem(Items.STICK), RecipeProvider.conditionsFromItem(Items.STICK)) - .criterion(RecipeProvider.hasItem(Items.WHITE_WOOL), - RecipeProvider.conditionsFromItem(Items.WHITE_WOOL)) + .criterion("has_wool", RecipeProvider.conditionsFromTag(ItemTags.WOOL)) + .offerTo(exporter); + } + + private void vintageLampRecipe(Consumer exporter, ItemConvertible output) { + ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, output, 3) + .pattern("NNN") + .pattern("GTG") + .pattern(" N ") + + .input('N', Items.IRON_NUGGET) + .input('T', Items.TORCH) + .input('G', Items.GREEN_STAINED_GLASS) + .criterion(RecipeProvider.hasItem(Items.TORCH), + RecipeProvider.conditionsFromItem(Items.TORCH)) + .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), + RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) + .criterion(RecipeProvider.hasItem(Items.GREEN_STAINED_GLASS), + RecipeProvider.conditionsFromItem(Items.GREEN_STAINED_GLASS)) .offerTo(exporter); } @@ -1042,7 +1047,8 @@ public class DataGeneration implements DataGeneratorEntrypoint { tvRecipe(exporter, NSE_Custom.RED_TV, Items.RED_DYE); radioRecipe(exporter, NSE_Custom.RADIO_RECEIVER); ceilingFanRecipe(exporter, NSE_Custom.CEILING_FAN); - lampRecipe(exporter, NSE_Custom.LAMP); + tableLampRecipe(exporter, NSE_Custom.TABLE_LAMP); + vintageLampRecipe(exporter, NSE_Custom.VINTAGE_LAMP); sickleRecipe(exporter, NSE_Items.SICKLE); rakeRecipe(exporter, NSE_Items.RAKE); @@ -1315,7 +1321,7 @@ public class DataGeneration implements DataGeneratorEntrypoint { offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, NSE_Blocks.CHISELED_SPRUCE_DOOR, Blocks.SPRUCE_DOOR); offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, NSE_Blocks.CHISELED_BIRCH_DOOR, Blocks.BIRCH_DOOR); - ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, NSE_Custom.LIGHT_BULB, 1) + ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, NSE_Custom.LIGHT_BULB_LAMP, 1) .input('X', Items.IRON_INGOT).input('Y', Items.IRON_NUGGET).input('Z', NSE_Items.LIGHT_BULB) .pattern(" X ").pattern(" Y ").pattern(" Z ") .criterion(hasItem(NSE_Items.LIGHT_BULB), conditionsFromItem(NSE_Items.LIGHT_BULB)).offerTo(exporter); @@ -1493,7 +1499,6 @@ public class DataGeneration implements DataGeneratorEntrypoint { @Override public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { - // BlockStateModelGenerator.createStairsBlockState(NSE_Blocks.SAND_TILES_STAIRS, new Identifier(NewSoviet.MOD_ID, "sand_tiles_stairs")); } diff --git a/src/main/java/su/a71/new_soviet/blocks/LampBlock.java b/src/main/java/su/a71/new_soviet/blocks/LampBlock.java index c55e664..0e4ed38 100644 --- a/src/main/java/su/a71/new_soviet/blocks/LampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/LampBlock.java @@ -33,9 +33,9 @@ public abstract class LampBlock extends Block implements Waterloggable { public LampBlock(AbstractBlock.Settings settings, boolean defaultLightState, java.util.function.ToIntFunction luminance) { super(settings.luminance(luminance == null ? (BlockState state) -> { if (state.get(INVERTED)) { - return state.get(ON) ? 0 : 12; + return state.get(ON) ? 0 : 14; } else { - return state.get(ON) ? 12 : 0; + return state.get(ON) ? 14 : 0; } } : luminance)); this.defaultLightState = defaultLightState; diff --git a/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java b/src/main/java/su/a71/new_soviet/blocks/LightBulbLampBlock.java similarity index 90% rename from src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java rename to src/main/java/su/a71/new_soviet/blocks/LightBulbLampBlock.java index 171989d..d51ef5a 100644 --- a/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/LightBulbLampBlock.java @@ -4,10 +4,7 @@ import net.minecraft.block.*; import net.minecraft.text.Text; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; @@ -18,34 +15,31 @@ 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.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; -import su.a71.new_soviet.Config; import su.a71.new_soviet.NewSoviet; import su.a71.new_soviet.registration.NSE_Custom; import su.a71.new_soviet.registration.NSE_Items; import su.a71.new_soviet.registration.NSE_Sounds; -public class LightBulbBlock extends LampBlock { +public class LightBulbLampBlock extends LampBlock { protected static final VoxelShape SHAPE; public static final BooleanProperty BROKEN; - public LightBulbBlock(Block.Settings settings) { + public LightBulbLampBlock(Block.Settings settings) { super(settings, false, (BlockState state) -> { if (state.get(BROKEN)) { return 0; } if (state.get(INVERTED)) { - return state.get(ON) ? 0 : 12; + return state.get(ON) ? 0 : 14; } else { - return state.get(ON) ? 12 : 0; + return state.get(ON) ? 14 : 0; } }); } @@ -67,7 +61,7 @@ public class LightBulbBlock extends LampBlock { } else { player.getItemCooldownManager().set(NSE_Items.LIGHT_BULB, 10); player.sendMessage(Text.translatable("block.new_soviet.light_bulb_block.energized")); - world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Custom.ELECTRIC_HIT, SoundCategory.AMBIENT, 0.8f, 1f); + world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.ELECTRIC_HIT, SoundCategory.AMBIENT, 0.8f, 1f); if (!player.isCreative()) { player.damage(world.getDamageSources().lightningBolt(), NewSoviet.RANDOM.nextBetween(1, 4)); } diff --git a/src/main/java/su/a71/new_soviet/blocks/TableLampBlock.java b/src/main/java/su/a71/new_soviet/blocks/TableLampBlock.java index 7f59e3f..2068aee 100644 --- a/src/main/java/su/a71/new_soviet/blocks/TableLampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/TableLampBlock.java @@ -9,7 +9,7 @@ import net.minecraft.world.BlockView; import net.minecraft.world.WorldView; public class TableLampBlock extends LampBlock { - protected static final VoxelShape SHAPE; + protected final VoxelShape SHAPE = getStandingShape();; public TableLampBlock(AbstractBlock.Settings settings) { super(settings, true, null); @@ -24,9 +24,7 @@ public class TableLampBlock extends LampBlock { return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); } - - - public static VoxelShape getStandingShape(){ + public VoxelShape getStandingShape(){ VoxelShape shape = VoxelShapes.empty(); shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.4375, 0.25, 0.4375, 0.5625, 0.875, 0.5625)); shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.375, 0, 0.375, 0.625, 0.25, 0.625)); @@ -35,8 +33,4 @@ public class TableLampBlock extends LampBlock { shape.simplify(); return shape; } - - static { - SHAPE = getStandingShape(); - } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/VintageLampBlock.java b/src/main/java/su/a71/new_soviet/blocks/VintageLampBlock.java new file mode 100644 index 0000000..3ff4ea7 --- /dev/null +++ b/src/main/java/su/a71/new_soviet/blocks/VintageLampBlock.java @@ -0,0 +1,23 @@ +package su.a71.new_soviet.blocks; + +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; + +public class VintageLampBlock extends TableLampBlock { + public VintageLampBlock(Settings settings) { + super(settings); + } + + @Override + public VoxelShape getStandingShape(){ + VoxelShape shape = VoxelShapes.empty(); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.28125, 0, 0.28125, 0.71875, 0.125, 0.71875)); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.40625, 0.125, 0.40625, 0.59375, 0.625, 0.59375)); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.4375, 0.625, 0.4375, 0.5625, 0.875, 0.5625)); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.1875, 0.875, 0.1875, 0.8125, 1.125, 0.8125)); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.25, 1.125, 0.25, 0.75, 1.1875, 0.75)); + + shape.simplify(); + return shape; + } +} diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java b/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java index 1e5b590..34f9ffb 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java @@ -31,21 +31,19 @@ public class NSE_Custom extends NSE_BaseRegistration { public static final RadioReceiverBlock RADIO_RECEIVER = new RadioReceiverBlock(); public static final SwitchBlock SWITCH = new SwitchBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).notSolid().pistonBehavior(PistonBehavior.DESTROY).strength(1f, 2f).mapColor(MapColor.TERRACOTTA_WHITE)); - public static final TableLampBlock LAMP = new TableLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.LANTERN).strength(1f, 1.5f).mapColor(MapColor.WHITE)); - public static final LightBulbBlock LIGHT_BULB = new LightBulbBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.GLASS).strength(1f, 1.5f).mapColor(MapColor.WHITE)); + public static final TableLampBlock TABLE_LAMP = new TableLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.LANTERN).strength(1f, 1.5f).mapColor(MapColor.WHITE)); + public static final TableLampBlock VINTAGE_LAMP = new VintageLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.LANTERN).strength(1f, 1.5f).mapColor(MapColor.WHITE)); + public static final LightBulbLampBlock LIGHT_BULB_LAMP = new LightBulbLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.GLASS).strength(1f, 1.5f).mapColor(MapColor.WHITE)); public static final CeilingFanBlock CEILING_FAN = new CeilingFanBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.WHITE)); public static final SirenBlock SIREN = new SirenBlock(); - public static final SoundEvent ELECTRIC_HIT = SoundEvent.of(new Identifier(NewSoviet.MOD_ID, "electric_hit")); - public static final LandMineBlock LANDMINE = new LandMineBlock(FabricBlockSettings.create().mapColor(MapColor.LIGHT_GRAY).offset(AbstractBlock.OffsetType.XZ).dynamicBounds()); - //games - //checkers + public static final CheckerBlock WHITE_CHECKER = new CheckerBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).hardness(0.1f).nonOpaque().mapColor(MapColor.WHITE)); public static final CheckerBlock BLACK_CHECKER = new CheckerBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).hardness(0.1f).nonOpaque().mapColor(MapColor.BLACK)); - //chess + public static final ChessBlock WHITE_BISHOP = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,8,5,11,9,11), Block.createCuboidShape(5,10,5,11,16,11), Block.createCuboidShape(7,16,7,9,19,9))); public static final ChessBlock WHITE_KING = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,13,5,11,16,11), Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5.5,7,5.5,10.5,8,10.5))); public static final ChessBlockKnight WHITE_KNIGHT = new ChessBlockKnight(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque()); @@ -71,8 +69,9 @@ public class NSE_Custom extends NSE_BaseRegistration { registerBlock("red_tv", () -> RED_TV, NSE_CUSTOM_TAB); registerBlock("brown_tv", () -> BROWN_TV, NSE_CUSTOM_TAB); registerBlock("radio_receiver", () -> RADIO_RECEIVER, NSE_CUSTOM_TAB); - registerBlock("lamp", () -> LAMP, NSE_CUSTOM_TAB); - registerBlock("light_bulb", () -> LIGHT_BULB, NSE_CUSTOM_TAB); + registerBlock("table_lamp", () -> TABLE_LAMP, NSE_CUSTOM_TAB); + registerBlock("vintage_lamp", () -> VINTAGE_LAMP, NSE_CUSTOM_TAB); + registerBlock("light_bulb_lamp", () -> LIGHT_BULB_LAMP, NSE_CUSTOM_TAB); registerBlock("ceiling_fan", () -> CEILING_FAN, NSE_CUSTOM_TAB); registerBlock("siren", () -> SIREN, NSE_CUSTOM_TAB); registerBlock("landmine", () -> LANDMINE, NSE_CUSTOM_TAB); diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java b/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java index 35a3713..ab18137 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java @@ -2,6 +2,8 @@ package su.a71.new_soviet.registration; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundEvent; +import net.minecraft.util.Identifier; +import su.a71.new_soviet.NewSoviet; public class NSE_Sounds extends NSE_BaseRegistration { public static SoundEvent DICE_SOUND = registerSoundEvent("dice_sound"); @@ -35,6 +37,7 @@ public class NSE_Sounds extends NSE_BaseRegistration { public static SoundEvent CIGARETTE_PAUSE = registerSoundEvent("cigarette_pause"); public static final SoundEvent SIREN_SOUND = registerSoundEvent("siren_sound"); + public static final SoundEvent ELECTRIC_HIT = SoundEvent.of(new Identifier(NewSoviet.MOD_ID, "electric_hit")); public static final SoundEvent LIGHT_BULB_BROKEN_SOUND = registerSoundEvent("light_bulb_broken_sound"); diff --git a/src/main/resources/assets/new_soviet/blockstates/light_bulb.json b/src/main/resources/assets/new_soviet/blockstates/light_bulb_lamp.json similarity index 100% rename from src/main/resources/assets/new_soviet/blockstates/light_bulb.json rename to src/main/resources/assets/new_soviet/blockstates/light_bulb_lamp.json diff --git a/src/main/resources/assets/new_soviet/blockstates/lamp.json b/src/main/resources/assets/new_soviet/blockstates/table_lamp.json similarity index 100% rename from src/main/resources/assets/new_soviet/blockstates/lamp.json rename to src/main/resources/assets/new_soviet/blockstates/table_lamp.json diff --git a/src/main/resources/assets/new_soviet/blockstates/vintage_lamp.json b/src/main/resources/assets/new_soviet/blockstates/vintage_lamp.json new file mode 100644 index 0000000..52cb73e --- /dev/null +++ b/src/main/resources/assets/new_soviet/blockstates/vintage_lamp.json @@ -0,0 +1,10 @@ +{ + "variants": { + "inverted=true": { + "model": "new_soviet:block/vintage_lamp" + }, + "inverted=false": { + "model": "new_soviet:block/vintage_lamp" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/lang/en_us.json b/src/main/resources/assets/new_soviet/lang/en_us.json index 10ab373..b7eb4aa 100644 --- a/src/main/resources/assets/new_soviet/lang/en_us.json +++ b/src/main/resources/assets/new_soviet/lang/en_us.json @@ -147,7 +147,7 @@ "block.new_soviet.red_tv": "Red TV", "block.new_soviet.brown_tv": "Brown TV", "block.new_soviet.radio_receiver": "Radio", - "block.new_soviet.lamp": "Lamp", + "block.new_soviet.table_lamp": "Table Lamp", "block.new_soviet.ceiling_fan": "Ceiling Fan", "block.new_soviet.siren": "Siren", "item.new_soviet.dice_d6": "Dice", @@ -184,7 +184,7 @@ "block.new_soviet.blue_concrete_with_bars": "Blue Concrete With Bars", "block.new_soviet.red_concrete_with_bars": "Red Concrete With Bars", "subtitles.new_soviet.light_bulb_broken": "Light bulb breaks", - "block.new_soviet.light_bulb": "Light Bulb Lamp", + "block.new_soviet.light_bulb_lamp": "Light Bulb Lamp", "item.new_soviet.light_bulb_item": "Light Bulb", "block.new_soviet.light_bulb_block.energized": "Turn off the power!", "block.new_soviet.crate": "Crate", @@ -432,5 +432,6 @@ "block.new_soviet.cyan_linoleum_stairs": "Cyan Linoleum Stairs", "block.new_soviet.metal_plating_slab": "Metal Plating Slab", "block.new_soviet.metal_plating_stairs": "Metal Plating Stairs", - "subtitles.new_soviet.electric_hit": "Electric shock" + "subtitles.new_soviet.electric_hit": "Electric shock", + "block.new_soviet.vintage_lamp": "Vintage Lamp" } \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/models/block/handrail/handrail.json b/src/main/resources/assets/new_soviet/models/block/handrail/handrail.json index 99f941e..cf839ad 100644 --- a/src/main/resources/assets/new_soviet/models/block/handrail/handrail.json +++ b/src/main/resources/assets/new_soviet/models/block/handrail/handrail.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "texture_size": [64, 64], "textures": { - "0": "new_soviet:block/handrail", + "0": "new_soviet:block/custom/handrail", "particle": "new_soviet:block/industrial/metal_plating" }, "elements": [ diff --git a/src/main/resources/assets/new_soviet/models/block/handrail/handrail_left.json b/src/main/resources/assets/new_soviet/models/block/handrail/handrail_left.json index 56f9743..bb17a8a 100644 --- a/src/main/resources/assets/new_soviet/models/block/handrail/handrail_left.json +++ b/src/main/resources/assets/new_soviet/models/block/handrail/handrail_left.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "texture_size": [64, 64], "textures": { - "0": "new_soviet:block/handrail", + "0": "new_soviet:block/custom/handrail", "particle": "new_soviet:block/industrial/metal_plating" }, "elements": [ diff --git a/src/main/resources/assets/new_soviet/models/block/handrail/handrail_right.json b/src/main/resources/assets/new_soviet/models/block/handrail/handrail_right.json index c952c58..c89000c 100644 --- a/src/main/resources/assets/new_soviet/models/block/handrail/handrail_right.json +++ b/src/main/resources/assets/new_soviet/models/block/handrail/handrail_right.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "texture_size": [64, 64], "textures": { - "0": "new_soviet:block/handrail", + "0": "new_soviet:block/custom/handrail", "particle": "new_soviet:block/industrial/metal_plating" }, "elements": [ diff --git a/src/main/resources/assets/new_soviet/models/block/vintage_lamp.json b/src/main/resources/assets/new_soviet/models/block/vintage_lamp.json new file mode 100644 index 0000000..fce1e05 --- /dev/null +++ b/src/main/resources/assets/new_soviet/models/block/vintage_lamp.json @@ -0,0 +1,89 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [64, 64], + "textures": { + "1": "new_soviet:block/custom/furniture/vintage_lamp", + "particle": "new_soviet:block/custom/furniture/vintage_lamp" + }, + "elements": [ + { + "name": "head", + "from": [4.5, 0, 4.5], + "to": [11.5, 2, 11.5], + "rotation": {"angle": 0, "axis": "y", "origin": [8, -8, 8]}, + "faces": { + "north": {"uv": [1.75, 7.5, 3.5, 8], "texture": "#1"}, + "east": {"uv": [0, 7.5, 1.75, 8], "texture": "#1"}, + "south": {"uv": [5.25, 7.5, 7, 8], "texture": "#1"}, + "west": {"uv": [3.5, 7.5, 5.25, 8], "texture": "#1"}, + "up": {"uv": [3.5, 7.5, 1.75, 5.75], "texture": "#1"}, + "down": {"uv": [5.25, 5.75, 3.5, 7.5], "texture": "#1"} + } + }, + { + "name": "head", + "from": [6.5, 2, 6.5], + "to": [9.5, 10, 9.5], + "rotation": {"angle": 0, "axis": "y", "origin": [8, -8, 8]}, + "faces": { + "north": {"uv": [7.75, 6.5, 8.5, 8.5], "texture": "#1"}, + "east": {"uv": [7, 6.5, 7.75, 8.5], "texture": "#1"}, + "south": {"uv": [9.25, 6.5, 10, 8.5], "texture": "#1"}, + "west": {"uv": [8.5, 6.5, 9.25, 8.5], "texture": "#1"}, + "up": {"uv": [8.5, 6.5, 7.75, 5.75], "texture": "#1"}, + "down": {"uv": [9.25, 5.75, 8.5, 6.5], "texture": "#1"} + } + }, + { + "name": "head", + "from": [7, 10, 7], + "to": [9, 14, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, -8, 8]}, + "faces": { + "north": {"uv": [0.5, 0.5, 1, 1.5], "texture": "#1"}, + "east": {"uv": [0, 0.5, 0.5, 1.5], "texture": "#1"}, + "south": {"uv": [1.5, 0.5, 2, 1.5], "texture": "#1"}, + "west": {"uv": [1, 0.5, 1.5, 1.5], "texture": "#1"}, + "up": {"uv": [1, 0.5, 0.5, 0], "texture": "#1"}, + "down": {"uv": [1.5, 0, 1, 0.5], "texture": "#1"} + } + }, + { + "name": "head", + "from": [3, 14, 3], + "to": [13, 18, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, -8, 8]}, + "faces": { + "north": {"uv": [2.5, 2.5, 5, 3.5], "texture": "#1"}, + "east": {"uv": [0, 2.5, 2.5, 3.5], "texture": "#1"}, + "south": {"uv": [7.5, 2.5, 10, 3.5], "texture": "#1"}, + "west": {"uv": [5, 2.5, 7.5, 3.5], "texture": "#1"}, + "up": {"uv": [5, 2.5, 2.5, 0], "texture": "#1"}, + "down": {"uv": [7.5, 0, 5, 2.5], "texture": "#1"} + } + }, + { + "name": "head", + "from": [4, 18, 4], + "to": [12, 19, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [8, -8, 8]}, + "faces": { + "north": {"uv": [2, 5.5, 4, 5.75], "texture": "#1"}, + "east": {"uv": [0, 5.5, 2, 5.75], "texture": "#1"}, + "south": {"uv": [6, 5.5, 8, 5.75], "texture": "#1"}, + "west": {"uv": [4, 5.5, 6, 5.75], "texture": "#1"}, + "up": {"uv": [4, 5.5, 2, 3.5], "texture": "#1"}, + "down": {"uv": [6, 3.5, 4, 5.5], "texture": "#1"} + } + } + ], + "groups": [ + { + "name": "head", + "origin": [8, 16, 8], + "color": 0, + "nbt": "{}", + "children": [0, 1, 2, 3, 4] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/models/item/light_bulb.json b/src/main/resources/assets/new_soviet/models/item/light_bulb_lamp.json similarity index 100% rename from src/main/resources/assets/new_soviet/models/item/light_bulb.json rename to src/main/resources/assets/new_soviet/models/item/light_bulb_lamp.json diff --git a/src/main/resources/assets/new_soviet/models/item/lamp.json b/src/main/resources/assets/new_soviet/models/item/table_lamp.json similarity index 100% rename from src/main/resources/assets/new_soviet/models/item/lamp.json rename to src/main/resources/assets/new_soviet/models/item/table_lamp.json diff --git a/src/main/resources/assets/new_soviet/models/item/vintage_lamp.json b/src/main/resources/assets/new_soviet/models/item/vintage_lamp.json new file mode 100644 index 0000000..032aa6c --- /dev/null +++ b/src/main/resources/assets/new_soviet/models/item/vintage_lamp.json @@ -0,0 +1,4 @@ +{ + "parent": "new_soviet:block/vintage_lamp" +} + diff --git a/src/main/resources/assets/new_soviet/textures/block/custom/furniture/vintage_lamp.png b/src/main/resources/assets/new_soviet/textures/block/custom/furniture/vintage_lamp.png new file mode 100644 index 0000000000000000000000000000000000000000..8e74692587fa0c7dbae7bce6a2f2cbf674ee8ea8 GIT binary patch literal 884 zcmV-)1B?8LP)dSPLRF-u39%g< zg4{z`YwZ|&9pc19^Ig2&S+6sb*_qjO0g~+3);$0ys|<$9{C?}f1pwI3SF7v#GDBnH z6aiWN_O2lN?krK#48Ew}#Qtb*B#zZ}eItm<=LyC8apLtF4a}{rA?nIb>jhx&&nHn< znXjnh_5xRq&gRCg!>cIv8V&#E`ep&)dyXMt0ASedM;$XMia@mD;=L@~NO210NqGQJ zE-w@S4z95PtLfmf8N8o$l#gG2N=0KH?WM-X1UxY?=7HikC$k=0sc4_4j3Au`Z3zz$ z$M9&M`!twl@P2LGY#lD*=xhaCetN!%gA)_&k_~O6gw;J2yT?m-GW%$kY+v3l_p!XKW9x9y zmp2}pI67Ow*5RTrKR7XQdcFy5ql9+J#_sWw|9)+w0u{#4x*KhCrPP^lxHP6tp zA2Drt))Z=0)34v-HZLNR9GCT`DRJ^oJMTSUxD@7V`rFm7T+=ihxUi<#FT?Ew{CLv8h)-<}l` z4PXf_FDlNL#9K$o1ELh21?2&tAm({7+J_a)N=X|< zdEf89Eh(iwf7tP?2N#CQ@b&xER16Wj1jH@uU8@6Nps=B_z^Sj!=7vsxW#C>g&E=FB z101&(_(yA1(<`eCI&&kBzSA6g8!7|$fN2qHfPve00)1g+(<(2zeO&*fmPTSB6r~ie z2E%SY$}*TXu^zw`tyN7g9Q0oD1Q{dnc@32%wzDSI0Q?AB%mBQf!wn)E2*rRW)6N