diff --git a/src/generated/resources/assets/vampirism/blockstates/fog_diffuser.json b/src/generated/resources/assets/vampirism/blockstates/fog_diffuser.json new file mode 100644 index 0000000000..26150846d4 --- /dev/null +++ b/src/generated/resources/assets/vampirism/blockstates/fog_diffuser.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "vampirism:block/fog_diffuser_normal" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/vampirism/models/block/fog_diffuser_normal.json b/src/generated/resources/assets/vampirism/models/block/fog_diffuser_normal.json new file mode 100644 index 0000000000..31b155ba50 --- /dev/null +++ b/src/generated/resources/assets/vampirism/models/block/fog_diffuser_normal.json @@ -0,0 +1,4 @@ +{ + "parent": "vampirism:block/fog_diffuser", + "render_type": "minecraft:cutout" +} \ No newline at end of file diff --git a/src/generated/resources/assets/vampirism/models/item/fog_diffuser.json b/src/generated/resources/assets/vampirism/models/item/fog_diffuser.json new file mode 100644 index 0000000000..3a8ae059cc --- /dev/null +++ b/src/generated/resources/assets/vampirism/models/item/fog_diffuser.json @@ -0,0 +1,3 @@ +{ + "parent": "vampirism:block/fog_diffuser" +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json index 3afb8ab16b..4fdea35812 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -18,6 +18,7 @@ "vampirism:garlic_diffuser_weak", "vampirism:garlic_diffuser_normal", "vampirism:garlic_diffuser_improved", + "vampirism:fog_diffuser", "vampirism:chandelier", "vampirism:candelabra", "vampirism:candelabra_wall", diff --git a/src/generated/resources/data/minecraft/tags/blocks/needs_diamond_tool.json b/src/generated/resources/data/minecraft/tags/blocks/needs_diamond_tool.json index be53217caa..90db959a39 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/needs_diamond_tool.json +++ b/src/generated/resources/data/minecraft/tags/blocks/needs_diamond_tool.json @@ -5,6 +5,7 @@ "vampirism:garlic_diffuser_weak", "vampirism:garlic_diffuser_normal", "vampirism:garlic_diffuser_improved", + "vampirism:fog_diffuser", "#vampirism:totem_top_crafted" ] } \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/advancements/recipes/decorations/vampire/fog_diffuser.json b/src/generated/resources/data/vampirism/advancements/recipes/decorations/vampire/fog_diffuser.json new file mode 100644 index 0000000000..5a2a44bdfd --- /dev/null +++ b/src/generated/resources/data/vampirism/advancements/recipes/decorations/vampire/fog_diffuser.json @@ -0,0 +1,59 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_cursed_plank": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:cursed_spruce_planks" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_diamond": { + "conditions": { + "items": [ + { + "tag": "forge:gems/diamond" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_mother_core": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:mother_core" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "vampirism:vampire/fog_diffuser" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_diamond", + "has_cursed_plank", + "has_mother_core", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "vampirism:vampire/fog_diffuser" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/loot_tables/blocks/fog_diffuser.json b/src/generated/resources/data/vampirism/loot_tables/blocks/fog_diffuser.json new file mode 100644 index 0000000000..1685880c04 --- /dev/null +++ b/src/generated/resources/data/vampirism/loot_tables/blocks/fog_diffuser.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "vampirism:fog_diffuser" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "vampirism:blocks/fog_diffuser" +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/recipes/vampire/fog_diffuser.json b/src/generated/resources/data/vampirism/recipes/vampire/fog_diffuser.json new file mode 100644 index 0000000000..e5d095f714 --- /dev/null +++ b/src/generated/resources/data/vampirism/recipes/vampire/fog_diffuser.json @@ -0,0 +1,27 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "O": { + "tag": "forge:obsidian" + }, + "X": { + "item": "vampirism:cursed_spruce_planks" + }, + "Y": { + "tag": "forge:gems/diamond" + }, + "Z": { + "item": "vampirism:mother_core" + } + }, + "pattern": [ + "XYX", + "YZY", + "OOO" + ], + "result": { + "item": "vampirism:fog_diffuser" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/java/de/teamlapen/vampirism/blocks/FogDiffuserBlock.java b/src/main/java/de/teamlapen/vampirism/blocks/FogDiffuserBlock.java index 54c5c32ef4..d2273e3fbf 100644 --- a/src/main/java/de/teamlapen/vampirism/blocks/FogDiffuserBlock.java +++ b/src/main/java/de/teamlapen/vampirism/blocks/FogDiffuserBlock.java @@ -9,13 +9,18 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -23,6 +28,14 @@ public class FogDiffuserBlock extends VampirismBlockContainer { + private static final VoxelShape shape = makeShape(); + + private static @NotNull VoxelShape makeShape() { + VoxelShape a = Block.box(1, 0, 1, 15, 2, 15); + VoxelShape b = Block.box(3, 2, 3, 13, 12, 13); + return Shapes.or(a, b); + } + public FogDiffuserBlock(@NotNull Properties properties) { super(properties); } @@ -57,6 +70,12 @@ public BlockEntity newBlockEntity(@NotNull BlockPos pPos, @NotNull BlockState pS return RenderShape.MODEL; } + @NotNull + @Override + public VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) { + return shape; + } + @Override public void onRemove(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull BlockState newState, boolean isMoving) { super.onRemove(state, worldIn, pos, newState, isMoving); diff --git a/src/main/java/de/teamlapen/vampirism/blocks/GarlicDiffuserBlock.java b/src/main/java/de/teamlapen/vampirism/blocks/GarlicDiffuserBlock.java index 1523ee93a7..0f7ade622a 100644 --- a/src/main/java/de/teamlapen/vampirism/blocks/GarlicDiffuserBlock.java +++ b/src/main/java/de/teamlapen/vampirism/blocks/GarlicDiffuserBlock.java @@ -50,7 +50,7 @@ public class GarlicDiffuserBlock extends VampirismBlockContainer { private final Type type; public GarlicDiffuserBlock(Type type) { - super(Properties.of().mapColor(MapColor.STONE).strength(3f).sound(SoundType.STONE).noOcclusion()); + super(Properties.of().mapColor(MapColor.STONE).strength(40.0F, 1200.0F).sound(SoundType.STONE).noOcclusion()); this.type = type; this.registerDefaultState(this.getStateDefinition().any().setValue(FACING, Direction.NORTH)); } diff --git a/src/main/java/de/teamlapen/vampirism/client/core/ModBlocksRender.java b/src/main/java/de/teamlapen/vampirism/client/core/ModBlocksRender.java index a1bec9c850..e55adedd09 100755 --- a/src/main/java/de/teamlapen/vampirism/client/core/ModBlocksRender.java +++ b/src/main/java/de/teamlapen/vampirism/client/core/ModBlocksRender.java @@ -75,6 +75,7 @@ static void registerBlockEntityRenderers(EntityRenderersEvent.@NotNull RegisterR event.registerBlockEntityRenderer(ModTiles.BLOOD_PEDESTAL.get(), PedestalBESR::new); event.registerBlockEntityRenderer(ModTiles.TOTEM.get(), TotemBESR::new); event.registerBlockEntityRenderer(ModTiles.GARLIC_DIFFUSER.get(), GarlicDiffuserBESR::new); + event.registerBlockEntityRenderer(ModTiles.FOG_DIFFUSER.get(), FogDiffuserBESR::new); } private static void registerRenderType() { diff --git a/src/main/java/de/teamlapen/vampirism/client/renderer/blockentity/FogDiffuserBESR.java b/src/main/java/de/teamlapen/vampirism/client/renderer/blockentity/FogDiffuserBESR.java new file mode 100644 index 0000000000..28026328d9 --- /dev/null +++ b/src/main/java/de/teamlapen/vampirism/client/renderer/blockentity/FogDiffuserBESR.java @@ -0,0 +1,32 @@ +package de.teamlapen.vampirism.client.renderer.blockentity; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import de.teamlapen.vampirism.blockentity.FogDiffuserBlockEntity; +import de.teamlapen.vampirism.core.ModItems; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; + +public class FogDiffuserBESR extends VampirismBESR { + + private final ItemRenderer itemRenderer; + private final ItemStack motherCore; + + public FogDiffuserBESR(BlockEntityRendererProvider.Context context) { + this.itemRenderer = context.getItemRenderer(); + motherCore = ModItems.MOTHER_CORE.get().getDefaultInstance(); + } + + @Override + public void render(@NotNull FogDiffuserBlockEntity pBlockEntity, float pPartialTick, @NotNull PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight, int pPackedOverlay) { + pPoseStack.pushPose(); + pPoseStack.translate(0.5, 0.3, 0.5); + pPoseStack.mulPose(Axis.YP.rotationDegrees(pBlockEntity.getLevel().getGameTime() + pPartialTick)); + this.itemRenderer.renderStatic(motherCore, ItemDisplayContext.GROUND, pPackedLight, pPackedOverlay, pPoseStack, pBuffer, pBlockEntity.getLevel(), 0); + pPoseStack.popPose(); + } +} diff --git a/src/main/java/de/teamlapen/vampirism/core/ModBlocks.java b/src/main/java/de/teamlapen/vampirism/core/ModBlocks.java index e7ce854495..cd6f26608b 100755 --- a/src/main/java/de/teamlapen/vampirism/core/ModBlocks.java +++ b/src/main/java/de/teamlapen/vampirism/core/ModBlocks.java @@ -168,9 +168,8 @@ public class ModBlocks { ((FireBlock) Blocks.FIRE).setFlammable(block, 30, 60); return block; }); - public static final RegistryObject MOTHER = registerWithItem("mother", MotherBlock::new); //TODO remove item, add models/textures - - public static final RegistryObject FOG_DIFFUSER = registerWithItem("fog_diffuser", () -> new FogDiffuserBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).strength(3.5F).sound(SoundType.STONE))); + public static final RegistryObject MOTHER = registerWithItem("mother", MotherBlock::new); + public static final RegistryObject FOG_DIFFUSER = registerWithItem("fog_diffuser", () -> new FogDiffuserBlock(BlockBehaviour.Properties.of().noOcclusion().mapColor(MapColor.STONE).strength(40.0F, 1200.0F).sound(SoundType.STONE))); /** diff --git a/src/main/java/de/teamlapen/vampirism/data/BlockStateGenerator.java b/src/main/java/de/teamlapen/vampirism/data/BlockStateGenerator.java index d3be119839..a47a59d2a5 100644 --- a/src/main/java/de/teamlapen/vampirism/data/BlockStateGenerator.java +++ b/src/main/java/de/teamlapen/vampirism/data/BlockStateGenerator.java @@ -299,6 +299,8 @@ protected void registerStatesAndModels() { simpleBlock(ModBlocks.CURSED_HANGING_ROOTS.get(), models().cross("cursed_hanging_roots", modLoc("block/cursed_hanging_roots"))); simpleBlock(ModBlocks.MOTHER.get(), models().cubeAll("mother", modLoc("block/mother"))); + simpleBlock(ModBlocks.FOG_DIFFUSER.get(), models().withExistingParent("fog_diffuser_normal", modLoc("block/fog_diffuser")).renderType(cutout)); + } private void createWoodStates() { diff --git a/src/main/java/de/teamlapen/vampirism/data/ItemModelGenerator.java b/src/main/java/de/teamlapen/vampirism/data/ItemModelGenerator.java index a70a9f1206..f99fd40b3b 100644 --- a/src/main/java/de/teamlapen/vampirism/data/ItemModelGenerator.java +++ b/src/main/java/de/teamlapen/vampirism/data/ItemModelGenerator.java @@ -310,6 +310,7 @@ protected void registerModels() { withExistingParent(ModBlocks.ALCHEMY_TABLE.get(), modLoc("block/alchemy_table/alchemy_table")); withExistingParent(ModBlocks.CASTLE_BLOCK_PURPLE_BRICK_WALL.get(), mcLoc("block/wall_inventory")).texture("wall", modLoc("block/castle_block_purple_brick")); withExistingParent(ModBlocks.CASTLE_BLOCK_DARK_BRICK_WALL.get(), mcLoc("block/wall_inventory")).texture("wall", modLoc("block/castle_block_dark_brick")); + block(ModBlocks.FOG_DIFFUSER.get(), "fog_diffuser"); } } diff --git a/src/main/java/de/teamlapen/vampirism/data/LootTablesGenerator.java b/src/main/java/de/teamlapen/vampirism/data/LootTablesGenerator.java index 1c85720227..d4dcffb026 100644 --- a/src/main/java/de/teamlapen/vampirism/data/LootTablesGenerator.java +++ b/src/main/java/de/teamlapen/vampirism/data/LootTablesGenerator.java @@ -404,6 +404,7 @@ protected void generate() { .add(LootItem.lootTableItem(ModItems.HUMAN_HEART.get()).setQuality(10)) .add(LootItem.lootTableItem(Items.DIAMOND_BLOCK)) .add(LootItem.lootTableItem(ModItems.VAMPIRE_BLOOD_BOTTLE.get()).setQuality(10)))); + this.dropSelf(ModBlocks.FOG_DIFFUSER.get()); } @NotNull diff --git a/src/main/java/de/teamlapen/vampirism/data/RecipesGenerator.java b/src/main/java/de/teamlapen/vampirism/data/RecipesGenerator.java index 377f7711e5..201cc1f546 100644 --- a/src/main/java/de/teamlapen/vampirism/data/RecipesGenerator.java +++ b/src/main/java/de/teamlapen/vampirism/data/RecipesGenerator.java @@ -102,6 +102,8 @@ protected void buildRecipes(@NotNull Consumer consumer) { ItemLike obi_belt = ModItems.OBI_BELT.get(); ItemLike blood_container = ModBlocks.BLOOD_CONTAINER.get(); ItemLike basalt = Blocks.BASALT; + ItemLike mother_core = ModItems.MOTHER_CORE.get(); + ItemLike cursed_spruce_planks = ModBlocks.CURSED_SPRUCE_PLANKS.get(); TagKey planks = ItemTags.PLANKS; TagKey glass = Tags.Items.GLASS; TagKey glass_pane = Tags.Items.GLASS_PANES; @@ -417,6 +419,7 @@ protected void buildRecipes(@NotNull Consumer consumer) { hangingSign(consumer, ModItems.CURSED_SPRUCE_HANGING_SIGN.get(), ModBlocks.STRIPPED_CURSED_SPRUCE_LOG.get()); stonecutterResultFromBase(consumer, RecipeCategory.DECORATIONS, ModBlocks.CASTLE_BLOCK_DARK_BRICK_WALL.get(), ModBlocks.CASTLE_BLOCK_DARK_BRICK.get()); stonecutterResultFromBase(consumer, RecipeCategory.DECORATIONS, ModBlocks.CASTLE_BLOCK_PURPLE_BRICK_WALL.get(), ModBlocks.CASTLE_BLOCK_PURPLE_BRICK.get()); + ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, ModBlocks.FOG_DIFFUSER.get()).pattern("XYX").pattern("YZY").pattern("OOO").define('X', cursed_spruce_planks).define('Y', diamond).define('O', obsidian).define('Z', mother_core).unlockedBy("has_diamond", has(diamond)).unlockedBy("has_cursed_plank", has(cursed_spruce_planks)).unlockedBy("has_mother_core", has(mother_core)).save(consumer, vampire("fog_diffuser")); } private @NotNull JsonObject enchantment(int level, Enchantment enchantment) { diff --git a/src/main/java/de/teamlapen/vampirism/data/TagGenerator.java b/src/main/java/de/teamlapen/vampirism/data/TagGenerator.java index b3d3f48f33..9d7563226a 100644 --- a/src/main/java/de/teamlapen/vampirism/data/TagGenerator.java +++ b/src/main/java/de/teamlapen/vampirism/data/TagGenerator.java @@ -92,6 +92,7 @@ protected void addTags(HolderLookup.Provider holderLookup) { .add(ModBlocks.GARLIC_DIFFUSER_WEAK.get()) .add(ModBlocks.GARLIC_DIFFUSER_NORMAL.get()) .add(ModBlocks.GARLIC_DIFFUSER_IMPROVED.get()) + .add(ModBlocks.FOG_DIFFUSER.get()) .add(ModBlocks.CHANDELIER.get()) .add(ModBlocks.CANDELABRA.get()) .add(ModBlocks.CANDELABRA_WALL.get()) @@ -148,6 +149,7 @@ protected void addTags(HolderLookup.Provider holderLookup) { .add(ModBlocks.GARLIC_DIFFUSER_WEAK.get()) .add(ModBlocks.GARLIC_DIFFUSER_NORMAL.get()) .add(ModBlocks.GARLIC_DIFFUSER_IMPROVED.get()) + .add(ModBlocks.FOG_DIFFUSER.get()) .addTag(ModTags.Blocks.TOTEM_TOP_CRAFTED) ; diff --git a/src/main/resources/assets/vampirism/models/block/fog_diffuser.json b/src/main/resources/assets/vampirism/models/block/fog_diffuser.json new file mode 100644 index 0000000000..97866ca911 --- /dev/null +++ b/src/main/resources/assets/vampirism/models/block/fog_diffuser.json @@ -0,0 +1,106 @@ +{ + "parent": "block/block", + "textures": { + "particle": "block/obsidian", + "obsidian": "block/obsidian", + "side": "vampirism:block/fog_diffuser_side" + }, + "render_type": "minecraft:cutout", + "elements": [ + { + "name": "Obsidian base", + "from": [1, 0, 1], + "to": [15, 3, 15], + "faces": { + "north": {"uv": [2, 13, 14, 16], "texture": "#obsidian"}, + "east": {"uv": [2, 13, 14, 16], "texture": "#obsidian"}, + "south": {"uv": [2, 13, 14, 16], "texture": "#obsidian"}, + "west": {"uv": [2, 13, 14, 16], "texture": "#obsidian"}, + "up": {"uv": [2, 2, 14, 14], "texture": "#obsidian"}, + "down": {"uv": [2, 2, 14, 14], "texture": "#obsidian", "cullface": "down"} + } + }, + { + "name": "outer_wood", + "from": [3, 3, 3], + "to": [13, 12, 13], + "faces": { + "north": {"uv": [0, 0, 16, 13], "texture": "#side"}, + "east": {"uv": [0, 0, 16, 13], "texture": "#side"}, + "south": {"uv": [0, 0, 16, 13], "texture": "#side"}, + "west": {"uv": [0, 0, 16, 13], "texture": "#side"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#side"} + } + }, + { + "name": "PlaneX4", + "from": [12.5, 3, 3], + "to": [12.501, 12, 13], + "faces": { + "west": {"uv": [3, 4, 13, 13], "texture": "#side"} + } + }, + { + "name": "PlaneX4", + "from": [3.5, 3, 3], + "to": [3.501, 12, 13], + "faces": { + "east": {"uv": [3, 4, 13, 13], "texture": "#side"} + } + }, + { + "name": "PlaneZ6", + "from": [3, 3, 12.5], + "to": [13, 12, 12.501], + "faces": { + "north": {"uv": [3, 4, 13, 13], "texture": "#side"} + } + }, + { + "name": "PlaneZ6", + "from": [3, 3, 3.5], + "to": [13, 12, 3.501], + "faces": { + "south": {"uv": [3, 4, 13, 13], "texture": "#side"} + } + }, + { + "name": "PlaneY8", + "from": [3, 11.5, 3], + "to": [13, 11.501, 13], + "faces": { + "down": {"uv": [3, 3, 13, 13], "texture": "#side"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [28, 54, 0], + "translation": [0, 3.8913, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [28, 54, 0], + "translation": [0, 3.8913, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "translation": [0, 1.3913, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, 45, 0], + "translation": [0, 1.3913, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 225, 0], + "scale": [0.625, 0.625, 0.625] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/vampirism/textures/block/fog_diffuser_side.png b/src/main/resources/assets/vampirism/textures/block/fog_diffuser_side.png new file mode 100644 index 0000000000..ae3bf12e7e Binary files /dev/null and b/src/main/resources/assets/vampirism/textures/block/fog_diffuser_side.png differ