From 2c3af715d79d670550725555ef2717fbd77bca9d Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sat, 23 Jan 2021 17:54:32 -0500 Subject: [PATCH] Fixed the Blood Altar not inputting Fluids properly. Also added the Vein Mining charge. --- changelog.txt | 1 + src/generated/resources/.cache/cache | 7 +- .../blockstates/veinmine_charge.json | 29 +++ .../assets/bloodmagic/lang/en_us.json | 3 +- .../models/block/veinmine_charge.json | 11 + .../models/item/veinmine_charge.json | 3 + .../loot_tables/blocks/veinmine_charge.json | 10 + .../recipes/soulforge/vein_charge.json | 21 ++ .../java/wayoftime/bloodmagic/BloodMagic.java | 3 + .../bloodmagic/altar/BloodAltar.java | 6 +- .../common/block/BlockVeinMineCharge.java | 20 ++ .../common/block/BloodMagicBlocks.java | 1 + .../common/data/GeneratorBlockStates.java | 1 + .../common/data/GeneratorItemModels.java | 1 + .../common/data/GeneratorLanguage.java | 3 +- .../common/data/GeneratorLootTable.java | 1 + .../common/item/BloodMagicItems.java | 1 + .../recipe/TartaricForgeRecipeProvider.java | 1 + .../bloodmagic/tile/TileDeforesterCharge.java | 2 - .../bloodmagic/tile/TileExplosiveCharge.java | 1 - .../bloodmagic/tile/TileShapedExplosive.java | 2 +- .../bloodmagic/tile/TileVeinMineCharge.java | 225 ++++++++++++++++++ .../models/block/sub/shaped_charge.json | 2 +- 23 files changed, 346 insertions(+), 9 deletions(-) create mode 100644 src/generated/resources/assets/bloodmagic/blockstates/veinmine_charge.json create mode 100644 src/generated/resources/assets/bloodmagic/models/block/veinmine_charge.json create mode 100644 src/generated/resources/assets/bloodmagic/models/item/veinmine_charge.json create mode 100644 src/generated/resources/data/bloodmagic/loot_tables/blocks/veinmine_charge.json create mode 100644 src/generated/resources/data/bloodmagic/recipes/soulforge/vein_charge.json create mode 100644 src/main/java/wayoftime/bloodmagic/common/block/BlockVeinMineCharge.java create mode 100644 src/main/java/wayoftime/bloodmagic/tile/TileVeinMineCharge.java diff --git a/changelog.txt b/changelog.txt index 99ee7985..893d102d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Version 3.1.0 ------------------------------------------------------ - Fixed Plunderer's Glint +- Fixed the Blood Altar not being able to input fluids. About time, Way! ------------------------------------------------------ diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 6135e236..0ea48c16 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -52,13 +52,14 @@ d2e2e78bd859c321a72f40fbb17ca79292d58031 assets/bloodmagic/blockstates/shaped_ch f1ca47098385a955155cab9c2a97219e02d390a0 assets/bloodmagic/blockstates/steadfastdemoncrystal.json 297bc2425f7b07b1a9dd3f7f6649c44f88dbac29 assets/bloodmagic/blockstates/stonebrickpath.json e3256db10fc8a8ab540f6ac8d27e0f47861e817a assets/bloodmagic/blockstates/stonetilepath.json +6989c4e23e5405772a8601ea88f071a479ed3fa9 assets/bloodmagic/blockstates/veinmine_charge.json 48ed6b25a5d8d8074c38d772fdc27c1753d42c36 assets/bloodmagic/blockstates/vengefuldemoncrystal.json e6d9cf699667aaa47efff37b2b033895dee29c15 assets/bloodmagic/blockstates/waterritualstone.json 74c889434f46e060e8f185e8ef674312eb2f1192 assets/bloodmagic/blockstates/woodbrickpath.json 42f26f715bddd16c069f9b51e3767b36477c8908 assets/bloodmagic/blockstates/woodtilepath.json 3c6ce233dae6c1307d9016406c324bbe844b4e1e assets/bloodmagic/blockstates/wornstonebrickpath.json d59655f12d1724b73b77c373fb6864fcff69db12 assets/bloodmagic/blockstates/wornstonetilepath.json -6018c5727249da4191f055bc7be11a67af18513b assets/bloodmagic/lang/en_us.json +ecf65a425fa9999726baa714503e7bd701c169ce assets/bloodmagic/lang/en_us.json 34445195b9f2459475cde53454bc8e37d32865d7 assets/bloodmagic/models/block/accelerationrune.json bcdbccc49d4509571be6988762ab87126275a4c8 assets/bloodmagic/models/block/airritualstone.json adf6c0b1e25451609486dc8c8cfbd9cf0f8c67f4 assets/bloodmagic/models/block/alchemicalreactionchamber.json @@ -181,6 +182,7 @@ d6238c0661560abd991d534ef6c8836f4655a7e7 assets/bloodmagic/models/block/sentient 65fe5e01ed2660e45a5c329ff2389a87e4d791ec assets/bloodmagic/models/block/speedrune.json c5d2b0e33500a5c51046cd606e0d1272ec0dddd6 assets/bloodmagic/models/block/stonebrickpath.json 359e28e79778961f57c6369b5d1b68218972fccb assets/bloodmagic/models/block/stonetilepath.json +d8c8cb24e0e8479ec620b4cd8d5a6f5abb1a2dcb assets/bloodmagic/models/block/veinmine_charge.json 6041f2e47f5437d90a58586e42d18dadc42df439 assets/bloodmagic/models/block/waterritualstone.json d77cdb168a084aeb962be6ad7b4f41b181837be6 assets/bloodmagic/models/block/woodbrickpath.json e54a4f2b3cd405c69782662b1b0d57e24f7c2524 assets/bloodmagic/models/block/woodtilepath.json @@ -406,6 +408,7 @@ ec6f6bf7f520182b2044f3cc5a10f1d4c7a8d7ab assets/bloodmagic/models/item/variants/ 7d22fdba9bb8593c247a0b33df11f3b26a16c254 assets/bloodmagic/models/item/variants/soulsword_steadfast_deactivated.json 2029220112f89a3f4d432ab4749dff6143846659 assets/bloodmagic/models/item/variants/soulsword_vengeful_activated.json 0f5a3e1e5993a03ccda156eed855b71fbd0be0a2 assets/bloodmagic/models/item/variants/soulsword_vengeful_deactivated.json +81776d7be5f2d13e44622a6d38929821bc78ae7d assets/bloodmagic/models/item/veinmine_charge.json 16bde91467016c6012fe2b618c898d0340043492 assets/bloodmagic/models/item/vengefulcrystal.json 11e3347147e079093c4fa12018412071db22a4f5 assets/bloodmagic/models/item/vengefuldemoncrystal.json 9019dcd2f21b03e703ceeee1ea3199de72110268 assets/bloodmagic/models/item/voidsigil.json @@ -521,6 +524,7 @@ f748a5ba8838b50de0502f132fe2a65f4726dae6 data/bloodmagic/loot_tables/blocks/soul 128ec3ee93e927d457beeb8161e80706e9239760 data/bloodmagic/loot_tables/blocks/steadfastdemoncrystal.json 8849e41b699c2eb7c3712a8e862bd9dd309a5c31 data/bloodmagic/loot_tables/blocks/stonebrickpath.json 6149fd464bafaabf35ca431202680c84cf5441b1 data/bloodmagic/loot_tables/blocks/stonetilepath.json +10b636d364f9ff72eb6db34f6f5e6aca704fc621 data/bloodmagic/loot_tables/blocks/veinmine_charge.json 33a22d9b198c93ed07ac69b7a594bb08db64b239 data/bloodmagic/loot_tables/blocks/vengefuldemoncrystal.json 26e3f34021426def32602e5ae7755e4672878320 data/bloodmagic/loot_tables/blocks/waterritualstone.json 04c5bc02383ddff04588af3a048ee3973e69666f data/bloodmagic/loot_tables/blocks/woodbrickpath.json @@ -691,6 +695,7 @@ d6e06747c75fc06e708a15358911f1c63eee86b1 data/bloodmagic/recipes/soulforge/petty 7e281841a2953c1284d332c2bbf75097f8128241 data/bloodmagic/recipes/soulforge/sentientsword.json dc977e9d98fcba66fbcce3f6c31a746db5ed60f5 data/bloodmagic/recipes/soulforge/shaped_charge.json c4102a1573e632d0b9f894353b0d522a51a7c65e data/bloodmagic/recipes/soulforge/steadfast_crystal_block.json +978033adf58e34fa317bcea448ac1ddf3f0cd69e data/bloodmagic/recipes/soulforge/vein_charge.json 3aa852edda803a2225ebe53d2daa55bd46b0a1b9 data/bloodmagic/recipes/soulforge/vengeful_crystal_block.json d7d993bb729284a5201c164ea81fbe1d8e4e4750 data/bloodmagic/recipes/weak_activation_crystal.json cf63fdccec992f2cb36c72843791623463cecc44 data/bloodmagic/tags/items/arc/cuttingfluid.json diff --git a/src/generated/resources/assets/bloodmagic/blockstates/veinmine_charge.json b/src/generated/resources/assets/bloodmagic/blockstates/veinmine_charge.json new file mode 100644 index 00000000..beb5ad11 --- /dev/null +++ b/src/generated/resources/assets/bloodmagic/blockstates/veinmine_charge.json @@ -0,0 +1,29 @@ +{ + "variants": { + "attached=down": { + "model": "bloodmagic:block/veinmine_charge", + "x": 180 + }, + "attached=up": { + "model": "bloodmagic:block/veinmine_charge" + }, + "attached=north": { + "model": "bloodmagic:block/veinmine_charge", + "x": 90 + }, + "attached=south": { + "model": "bloodmagic:block/veinmine_charge", + "x": 270 + }, + "attached=west": { + "model": "bloodmagic:block/veinmine_charge", + "x": 90, + "y": 270 + }, + "attached=east": { + "model": "bloodmagic:block/veinmine_charge", + "x": 90, + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/bloodmagic/lang/en_us.json b/src/generated/resources/assets/bloodmagic/lang/en_us.json index 2834fa5d..484be079 100644 --- a/src/generated/resources/assets/bloodmagic/lang/en_us.json +++ b/src/generated/resources/assets/bloodmagic/lang/en_us.json @@ -64,6 +64,7 @@ "block.bloodmagic.steadfastdemoncrystal": "Steadfast Crystal Cluster", "block.bloodmagic.stonebrickpath": "Stone Path", "block.bloodmagic.stonetilepath": "Tiled Stone Path", + "block.bloodmagic.veinmine_charge": "Vein Charge", "block.bloodmagic.vengefuldemoncrystal": "Vengeful Crystal Cluster", "block.bloodmagic.waterritualstone": "Water Ritual Stone", "block.bloodmagic.woodbrickpath": "Wooden Path", @@ -279,10 +280,10 @@ "ritual.bloodmagic.crystalHarvestRitual.info": "Breaks Demon Will crystal clusters within its range, dropping the results on top of the crystals.", "ritual.bloodmagic.crystalSplitRitual": "Resonance of the Faceted Crystal", "ritual.bloodmagic.crystalSplitRitual.info": "Splits apart a well-grown Raw crystal cluster into seperal aspected crystal clusters.", + "ritual.bloodmagic.ellipseRitual": "Focus of the Ellipsoid", "ritual.bloodmagic.ellipseRitual.chest.info": "(Chest) The location of the inventory that the ritual will grab blocks from to place in the world.", "ritual.bloodmagic.ellipseRitual.info": "Creates a hollow spheroid around the ritual using the blocks in the attached chest.", "ritual.bloodmagic.ellipseRitual.spheroidRange.info": "(Placement) The range that the ritual will place its blocks in. Spheroid is centered on the ritual - if one side is shorter than the side opposite the spheroid is truncated.", - "ritual.bloodmagic.ellipsoidRitual": "Focus of the Ellipsoid", "ritual.bloodmagic.eternalSoulRitual.info": "Capable of transferring Life Essence from a Network back into an Altar at a cost.", "ritual.bloodmagic.expulsionRitual": "Aura of Expulsion", "ritual.bloodmagic.expulsionRitual.expulsionRange.info": "(Expulsion) The area from which players that are not owner or have an orb in the chest will be teleported away from.", diff --git a/src/generated/resources/assets/bloodmagic/models/block/veinmine_charge.json b/src/generated/resources/assets/bloodmagic/models/block/veinmine_charge.json new file mode 100644 index 00000000..1c50bf82 --- /dev/null +++ b/src/generated/resources/assets/bloodmagic/models/block/veinmine_charge.json @@ -0,0 +1,11 @@ +{ + "parent": "bloodmagic:block/sub/shaped_charge", + "textures": { + "1": "minecraft:block/sandstone_bottom", + "3": "minecraft:block/sandstone_bottom", + "4": "bloodmagic:block/blankrune", + "5": "minecraft:block/sand", + "6": "bloodmagic:models/defaultcrystal", + "particle": "bloodmagic:models/defaultcrystal" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/bloodmagic/models/item/veinmine_charge.json b/src/generated/resources/assets/bloodmagic/models/item/veinmine_charge.json new file mode 100644 index 00000000..d4e412ca --- /dev/null +++ b/src/generated/resources/assets/bloodmagic/models/item/veinmine_charge.json @@ -0,0 +1,3 @@ +{ + "parent": "bloodmagic:block/veinmine_charge" +} \ No newline at end of file diff --git a/src/generated/resources/data/bloodmagic/loot_tables/blocks/veinmine_charge.json b/src/generated/resources/data/bloodmagic/loot_tables/blocks/veinmine_charge.json new file mode 100644 index 00000000..e7f06266 --- /dev/null +++ b/src/generated/resources/data/bloodmagic/loot_tables/blocks/veinmine_charge.json @@ -0,0 +1,10 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "bloodmagic:veinmine_charge", + "rolls": 1.0, + "entries": [] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/bloodmagic/recipes/soulforge/vein_charge.json b/src/generated/resources/data/bloodmagic/recipes/soulforge/vein_charge.json new file mode 100644 index 00000000..eadea857 --- /dev/null +++ b/src/generated/resources/data/bloodmagic/recipes/soulforge/vein_charge.json @@ -0,0 +1,21 @@ +{ + "type": "bloodmagic:soulforge", + "input0": { + "tag": "forge:cobblestone" + }, + "input1": { + "item": "minecraft:charcoal" + }, + "input2": { + "tag": "forge:sandstone" + }, + "input3": { + "tag": "forge:sand" + }, + "output": { + "item": "bloodmagic:veinmine_charge", + "count": 8 + }, + "minimumDrain": 10.0, + "drain": 0.5 +} \ No newline at end of file diff --git a/src/main/java/wayoftime/bloodmagic/BloodMagic.java b/src/main/java/wayoftime/bloodmagic/BloodMagic.java index 9bced871..e4a7493e 100644 --- a/src/main/java/wayoftime/bloodmagic/BloodMagic.java +++ b/src/main/java/wayoftime/bloodmagic/BloodMagic.java @@ -78,6 +78,7 @@ import wayoftime.bloodmagic.tile.TileMasterRitualStone; import wayoftime.bloodmagic.tile.TileMimic; import wayoftime.bloodmagic.tile.TileShapedExplosive; import wayoftime.bloodmagic.tile.TileSoulForge; +import wayoftime.bloodmagic.tile.TileVeinMineCharge; import wayoftime.bloodmagic.util.handler.event.GenericHandler; import wayoftime.bloodmagic.util.handler.event.WillHandler; @@ -201,6 +202,8 @@ public class BloodMagic event.getRegistry().register(TileEntityType.Builder.create(TileMimic::new, BloodMagicBlocks.MIMIC.get(), BloodMagicBlocks.ETHEREAL_MIMIC.get()).build(null).setRegistryName("mimic")); event.getRegistry().register(TileEntityType.Builder.create(TileShapedExplosive::new, BloodMagicBlocks.SHAPED_CHARGE.get()).build(null).setRegistryName("shaped_explosive")); event.getRegistry().register(TileEntityType.Builder.create(TileDeforesterCharge::new, BloodMagicBlocks.DEFORESTER_CHARGE.get()).build(null).setRegistryName("deforester_charge")); + event.getRegistry().register(TileEntityType.Builder.create(TileVeinMineCharge::new, BloodMagicBlocks.VEINMINE_CHARGE.get()).build(null).setRegistryName("veinmine_charge")); + } @SubscribeEvent diff --git a/src/main/java/wayoftime/bloodmagic/altar/BloodAltar.java b/src/main/java/wayoftime/bloodmagic/altar/BloodAltar.java index c978293b..45d0f645 100644 --- a/src/main/java/wayoftime/bloodmagic/altar/BloodAltar.java +++ b/src/main/java/wayoftime/bloodmagic/altar/BloodAltar.java @@ -237,6 +237,10 @@ public class BloodAltar// implements IFluidHandler // // System.out.println("There are currently " + altarRecipes.size() + " Altar Recipes loaded."); // +// this.fluidInput = new FluidStack(BloodMagicBlocks.LIFE_ESSENCE_FLUID.get(), 1000); + +// System.out.println(this.fluidOutput.getAmount()); + World world = tileAltar.getWorld(); BlockPos pos = tileAltar.getPos(); @@ -671,7 +675,7 @@ public class BloodAltar// implements IFluidHandler if (!doFill) { - if (fluidInput == null) + if (fluidInput == null || fluidInput.isEmpty()) { return Math.min(bufferCapacity, resource.getAmount()); } diff --git a/src/main/java/wayoftime/bloodmagic/common/block/BlockVeinMineCharge.java b/src/main/java/wayoftime/bloodmagic/common/block/BlockVeinMineCharge.java new file mode 100644 index 00000000..dc3e8f04 --- /dev/null +++ b/src/main/java/wayoftime/bloodmagic/common/block/BlockVeinMineCharge.java @@ -0,0 +1,20 @@ +package wayoftime.bloodmagic.common.block; + +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockReader; +import wayoftime.bloodmagic.tile.TileVeinMineCharge; + +public class BlockVeinMineCharge extends BlockShapedExplosive +{ + public BlockVeinMineCharge(int explosionSize, Properties properties) + { + super(explosionSize, properties); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) + { + return new TileVeinMineCharge(); + } +} diff --git a/src/main/java/wayoftime/bloodmagic/common/block/BloodMagicBlocks.java b/src/main/java/wayoftime/bloodmagic/common/block/BloodMagicBlocks.java index 5c9101e0..17351a69 100644 --- a/src/main/java/wayoftime/bloodmagic/common/block/BloodMagicBlocks.java +++ b/src/main/java/wayoftime/bloodmagic/common/block/BloodMagicBlocks.java @@ -176,6 +176,7 @@ public class BloodMagicBlocks public static final RegistryObject SHAPED_CHARGE = BLOCKS.register("shaped_charge", () -> new BlockShapedExplosive(3, Properties.create(Material.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE).harvestLevel(1).setRequiresTool())); public static final RegistryObject DEFORESTER_CHARGE = BLOCKS.register("deforester_charge", () -> new BlockDeforesterCharge(3, Properties.create(Material.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE).harvestLevel(1).setRequiresTool())); + public static final RegistryObject VEINMINE_CHARGE = BLOCKS.register("veinmine_charge", () -> new BlockVeinMineCharge(3, Properties.create(Material.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE).harvestLevel(1).setRequiresTool())); // //// private static RegistryObject register(String name, Supplier sup, Function, Supplier> itemCreator) diff --git a/src/main/java/wayoftime/bloodmagic/common/data/GeneratorBlockStates.java b/src/main/java/wayoftime/bloodmagic/common/data/GeneratorBlockStates.java index 6384393e..e40fb934 100644 --- a/src/main/java/wayoftime/bloodmagic/common/data/GeneratorBlockStates.java +++ b/src/main/java/wayoftime/bloodmagic/common/data/GeneratorBlockStates.java @@ -94,6 +94,7 @@ public class GeneratorBlockStates extends BlockStateProvider buildOrientable(BloodMagicBlocks.SHAPED_CHARGE.get(), "shaped_charge", modLoc("block/sub/shaped_charge"), modLoc("block/dungeon/dungeon_stone"), modLoc("block/dungeon/dungeon_tile"), modLoc("block/blankrune"), modLoc("block/largebloodstonebrick"), modLoc("models/defaultcrystal")); buildOrientable(BloodMagicBlocks.DEFORESTER_CHARGE.get(), "deforester_charge", modLoc("block/sub/shaped_charge"), new ResourceLocation("block/oak_log_top"), new ResourceLocation("block/oak_log_top"), modLoc("block/blankrune"), new ResourceLocation("block/oak_planks"), modLoc("models/defaultcrystal")); + buildOrientable(BloodMagicBlocks.VEINMINE_CHARGE.get(), "veinmine_charge", modLoc("block/sub/shaped_charge"), new ResourceLocation("block/sandstone_bottom"), new ResourceLocation("block/sandstone_bottom"), modLoc("block/blankrune"), new ResourceLocation("block/sand"), modLoc("models/defaultcrystal")); } private void buildOrientable(Block block, String name, ResourceLocation modelPath, ResourceLocation base, ResourceLocation edges, ResourceLocation centerCap, ResourceLocation binding, ResourceLocation core) diff --git a/src/main/java/wayoftime/bloodmagic/common/data/GeneratorItemModels.java b/src/main/java/wayoftime/bloodmagic/common/data/GeneratorItemModels.java index f5ca132e..090e2925 100644 --- a/src/main/java/wayoftime/bloodmagic/common/data/GeneratorItemModels.java +++ b/src/main/java/wayoftime/bloodmagic/common/data/GeneratorItemModels.java @@ -91,6 +91,7 @@ public class GeneratorItemModels extends ItemModelProvider registerBlockModel(BloodMagicBlocks.SHAPED_CHARGE.get()); registerBlockModel(BloodMagicBlocks.DEFORESTER_CHARGE.get()); + registerBlockModel(BloodMagicBlocks.VEINMINE_CHARGE.get()); registerMultiLayerItem(BloodMagicItems.SLATE_VIAL.get(), modLoc("item/alchemic_vial"), modLoc("item/alchemic_ribbon")); registerMultiLayerItem(BloodMagicItems.MELEE_DAMAGE_ANOINTMENT.get(), modLoc("item/alchemic_vial"), modLoc("item/alchemic_liquid"), modLoc("item/alchemic_ribbon")); diff --git a/src/main/java/wayoftime/bloodmagic/common/data/GeneratorLanguage.java b/src/main/java/wayoftime/bloodmagic/common/data/GeneratorLanguage.java index b2cddc18..0a95d49b 100644 --- a/src/main/java/wayoftime/bloodmagic/common/data/GeneratorLanguage.java +++ b/src/main/java/wayoftime/bloodmagic/common/data/GeneratorLanguage.java @@ -171,7 +171,7 @@ public class GeneratorLanguage extends LanguageProvider add("ritual.bloodmagic.crystalHarvestRitual", "Crack of the Fractured Crystal"); add("ritual.bloodmagic.forsakenSoulRitual", "Gathering of the Forsaken Souls"); add("ritual.bloodmagic.crystalSplitRitual", "Resonance of the Faceted Crystal"); - add("ritual.bloodmagic.ellipsoidRitual", "Focus of the Ellipsoid"); + add("ritual.bloodmagic.ellipseRitual", "Focus of the Ellipsoid"); add("ritual.bloodmagic.cobblestoneRitual", "Le Vulcanos Frigius"); add("ritual.bloodmagic.placerRitual", "The Filler"); @@ -451,6 +451,7 @@ public class GeneratorLanguage extends LanguageProvider addBlock(BloodMagicBlocks.SHAPED_CHARGE, "Shaped Charge"); addBlock(BloodMagicBlocks.DEFORESTER_CHARGE, "Deforester Charge"); + addBlock(BloodMagicBlocks.VEINMINE_CHARGE, "Vein Charge"); // Item names addItem(BloodMagicItems.WEAK_BLOOD_ORB, "Weak Blood Orb"); diff --git a/src/main/java/wayoftime/bloodmagic/common/data/GeneratorLootTable.java b/src/main/java/wayoftime/bloodmagic/common/data/GeneratorLootTable.java index 1c9e20b0..537b08b5 100644 --- a/src/main/java/wayoftime/bloodmagic/common/data/GeneratorLootTable.java +++ b/src/main/java/wayoftime/bloodmagic/common/data/GeneratorLootTable.java @@ -134,6 +134,7 @@ public class GeneratorLootTable extends LootTableProvider registerNoDropLootTable(BloodMagicBlocks.SHAPED_CHARGE.get()); registerNoDropLootTable(BloodMagicBlocks.DEFORESTER_CHARGE.get()); + registerNoDropLootTable(BloodMagicBlocks.VEINMINE_CHARGE.get()); } private void registerNoDropLootTable(Block block) diff --git a/src/main/java/wayoftime/bloodmagic/common/item/BloodMagicItems.java b/src/main/java/wayoftime/bloodmagic/common/item/BloodMagicItems.java index f736ee7c..e727b490 100644 --- a/src/main/java/wayoftime/bloodmagic/common/item/BloodMagicItems.java +++ b/src/main/java/wayoftime/bloodmagic/common/item/BloodMagicItems.java @@ -101,6 +101,7 @@ public class BloodMagicItems public static final RegistryObject SHAPED_CHARGE_ITEM = ITEMS.register("shaped_charge", () -> new ItemBlockShapedCharge(BloodMagicBlocks.SHAPED_CHARGE.get(), new Item.Properties().group(BloodMagic.TAB))); public static final RegistryObject DEFORESTER_CHARGE_ITEM = ITEMS.register("deforester_charge", () -> new ItemBlockShapedCharge(BloodMagicBlocks.DEFORESTER_CHARGE.get(), new Item.Properties().group(BloodMagic.TAB))); + public static final RegistryObject VEINMINE_CHARGE_ITEM = ITEMS.register("veinmine_charge", () -> new ItemBlockShapedCharge(BloodMagicBlocks.VEINMINE_CHARGE.get(), new Item.Properties().group(BloodMagic.TAB))); // TODO: Need to rework the above instantiations for the ItemBlocks so that it's // done with the Blocks. diff --git a/src/main/java/wayoftime/bloodmagic/common/recipe/TartaricForgeRecipeProvider.java b/src/main/java/wayoftime/bloodmagic/common/recipe/TartaricForgeRecipeProvider.java index 0db37b35..d35442be 100644 --- a/src/main/java/wayoftime/bloodmagic/common/recipe/TartaricForgeRecipeProvider.java +++ b/src/main/java/wayoftime/bloodmagic/common/recipe/TartaricForgeRecipeProvider.java @@ -49,6 +49,7 @@ public class TartaricForgeRecipeProvider implements ISubRecipeProvider TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicBlocks.SHAPED_CHARGE.get(), 8), 10, 0.5, Ingredient.fromTag(Tags.Items.COBBLESTONE), Ingredient.fromItems(Items.CHARCOAL), Ingredient.fromTag(Tags.Items.SAND), Ingredient.fromTag(Tags.Items.STONE)).build(consumer, BloodMagic.rl(basePath + "shaped_charge")); TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicBlocks.DEFORESTER_CHARGE.get(), 8), 10, 0.5, Ingredient.fromTag(Tags.Items.COBBLESTONE), Ingredient.fromItems(Items.CHARCOAL), Ingredient.fromTag(ItemTags.LOGS), Ingredient.fromTag(ItemTags.PLANKS)).build(consumer, BloodMagic.rl(basePath + "deforester_charge")); + TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicBlocks.VEINMINE_CHARGE.get(), 8), 10, 0.5, Ingredient.fromTag(Tags.Items.COBBLESTONE), Ingredient.fromItems(Items.CHARCOAL), Ingredient.fromTag(Tags.Items.SANDSTONE), Ingredient.fromTag(Tags.Items.SAND)).build(consumer, BloodMagic.rl(basePath + "vein_charge")); ItemStack stack = new ItemStack(BloodMagicBlocks.DEFORESTER_CHARGE.get()); AnointmentHolder smeltingHolder = new AnointmentHolder(); diff --git a/src/main/java/wayoftime/bloodmagic/tile/TileDeforesterCharge.java b/src/main/java/wayoftime/bloodmagic/tile/TileDeforesterCharge.java index 7fb18391..110f1d6c 100644 --- a/src/main/java/wayoftime/bloodmagic/tile/TileDeforesterCharge.java +++ b/src/main/java/wayoftime/bloodmagic/tile/TileDeforesterCharge.java @@ -42,8 +42,6 @@ public class TileDeforesterCharge extends TileExplosiveCharge // private boolean cached = false; public double internalCounter = 0; -// public int explosionRadius; -// public int explosionDepth; public int currentLogs = 0; diff --git a/src/main/java/wayoftime/bloodmagic/tile/TileExplosiveCharge.java b/src/main/java/wayoftime/bloodmagic/tile/TileExplosiveCharge.java index 19136d3c..d334ef65 100644 --- a/src/main/java/wayoftime/bloodmagic/tile/TileExplosiveCharge.java +++ b/src/main/java/wayoftime/bloodmagic/tile/TileExplosiveCharge.java @@ -15,7 +15,6 @@ import wayoftime.bloodmagic.tile.base.TileTicking; public class TileExplosiveCharge extends TileTicking { - public AnointmentHolder anointmentHolder = new AnointmentHolder(); public TileExplosiveCharge(TileEntityType type) diff --git a/src/main/java/wayoftime/bloodmagic/tile/TileShapedExplosive.java b/src/main/java/wayoftime/bloodmagic/tile/TileShapedExplosive.java index cefdf33f..5fe75fcd 100644 --- a/src/main/java/wayoftime/bloodmagic/tile/TileShapedExplosive.java +++ b/src/main/java/wayoftime/bloodmagic/tile/TileShapedExplosive.java @@ -26,7 +26,7 @@ import wayoftime.bloodmagic.common.block.BlockShapedExplosive; public class TileShapedExplosive extends TileExplosiveCharge { @ObjectHolder("bloodmagic:shaped_explosive") - public static TileEntityType TYPE; + public static TileEntityType TYPE; public double internalCounter = 0; public int explosionRadius; diff --git a/src/main/java/wayoftime/bloodmagic/tile/TileVeinMineCharge.java b/src/main/java/wayoftime/bloodmagic/tile/TileVeinMineCharge.java new file mode 100644 index 00000000..78b77615 --- /dev/null +++ b/src/main/java/wayoftime/bloodmagic/tile/TileVeinMineCharge.java @@ -0,0 +1,225 @@ +package wayoftime.bloodmagic.tile; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import com.mojang.datafixers.util.Pair; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameters; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.particles.ParticleTypes; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvents; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.registries.ObjectHolder; +import wayoftime.bloodmagic.common.block.BlockShapedExplosive; + +public class TileVeinMineCharge extends TileExplosiveCharge +{ + @ObjectHolder("bloodmagic:veinmine_charge") + public static TileEntityType TYPE; + + private Map veinPartsMap; + private List veinPartsCache; + private boolean finishedAnalysis; + + public double internalCounter = 0; + + public int currentBlocks = 0; + + public int maxBlocks = 128; + + public TileVeinMineCharge(TileEntityType type, int maxBlocks) + { + super(type); + + this.maxBlocks = maxBlocks; + } + + public TileVeinMineCharge() + { + this(TYPE, 64 * 3); + } + + @Override + public void onUpdate() + { + if (world.isRemote) + { + return; + } +// System.out.println("Counter: " + internalCounter); + + Direction explosiveDirection = this.getBlockState().get(BlockShapedExplosive.ATTACHED).getOpposite(); + BlockState attachedState = world.getBlockState(pos.offset(explosiveDirection)); + Block attachedBlock = attachedState.getBlock(); +// if (!BlockTags.LOGS.contains(attachedState.getBlock()) && !BlockTags.LEAVES.contains(attachedState.getBlock())) +// { +// return; +// } + + if (veinPartsMap == null) + { + veinPartsMap = new HashMap(); + veinPartsMap.put(pos.offset(explosiveDirection), false); + veinPartsCache = new LinkedList(); + veinPartsCache.add(pos.offset(explosiveDirection)); + internalCounter = 0; +// veinPartsMap.add(pos.offset(explosiveDirection)); + } + + boolean foundNew = false; + List newPositions = new LinkedList(); + for (BlockPos currentPos : veinPartsCache) + { + if (!veinPartsMap.getOrDefault(currentPos, false)) // If the BlockPos wasn't checked yet + { +// BlockPos currentPos = entry.getKey(); + for (Direction dir : Direction.values()) + { + BlockPos checkPos = currentPos.offset(dir); + if (veinPartsMap.containsKey(checkPos)) + { + continue; + } + + BlockState checkState = world.getBlockState(checkPos); + + boolean isTree = false; + if (currentBlocks >= maxBlocks) + { + continue; + } + if (attachedBlock.equals(checkState.getBlock())) + { + currentBlocks++; + isTree = true; + + } + + if (isTree) + { + veinPartsMap.put(checkPos, false); + newPositions.add(checkPos); + foundNew = true; + } + } + + veinPartsMap.put(currentPos, true); + if (currentBlocks >= maxBlocks) + { + finishedAnalysis = true; + break; + } + } + } + + veinPartsCache.addAll(newPositions); + +// System.out.println("Found blocks: " + veinPartsMap.size()); + + if (foundNew) + { + return; + } + + internalCounter++; + if (internalCounter == 20) + { +// worldIn.playSound((PlayerEntity)null, tntentity.getPosX(), tntentity.getPosY(), tntentity.getPosZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound((PlayerEntity) null, this.getPos().getX() + 0.5, this.getPos().getY() + 0.5, this.getPos().getZ() + 0.5, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F); + ((ServerWorld) this.world).spawnParticle(ParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 5, 0.02, 0.03, 0.02, 0); + } + + if (internalCounter == 30) + { + world.playSound((PlayerEntity) null, this.getPos().getX() + 0.5, this.getPos().getY() + 0.5, this.getPos().getZ() + 0.5, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); + } + + if (internalCounter < 30) + { + return; + } + + if (world.rand.nextDouble() < 0.3) + { + ((ServerWorld) this.world).spawnParticle(ParticleTypes.SMOKE, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 1, 0.0D, 0.0D, 0.0D, 0); + } + + if (internalCounter == 100) + { + ItemStack toolStack = this.getHarvestingTool(); + world.playSound((PlayerEntity) null, this.getPos().getX() + 0.5, this.getPos().getY() + 0.5, this.getPos().getZ() + 0.5, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, (1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F); + + int numParticles = 10; + + ((ServerWorld) this.world).spawnParticle(ParticleTypes.EXPLOSION, pos.getX() + 0.5 + explosiveDirection.getXOffset(), pos.getY() + 0.5 + explosiveDirection.getYOffset(), pos.getZ() + 0.5 + explosiveDirection.getZOffset(), numParticles, 1.0D, 1.0D, 1.0D, 0); + + ObjectArrayList> objectarraylist = new ObjectArrayList<>(); + + for (BlockPos blockPos : veinPartsCache) + { +// BlockPos blockpos = initialPos.offset(explosiveDirection, i).offset(sweepDir1, j).offset(sweepDir2, k); + + BlockState blockstate = this.world.getBlockState(blockPos); + Block block = blockstate.getBlock(); + if (!blockstate.isAir(this.world, blockPos)) + { + BlockPos blockpos1 = blockPos.toImmutable(); +// this.world.getProfiler().startSection("explosion_blocks"); + if (this.world instanceof ServerWorld) + { + TileEntity tileentity = blockstate.hasTileEntity() ? this.world.getTileEntity(blockPos) : null; + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld) this.world)).withRandom(this.world.rand).withParameter(LootParameters.field_237457_g_, Vector3d.copyCentered(blockPos)).withParameter(LootParameters.TOOL, toolStack).withNullableParameter(LootParameters.BLOCK_ENTITY, tileentity); +// if (this.mode == Explosion.Mode.DESTROY) { +// lootcontext$builder.withParameter(LootParameters.EXPLOSION_RADIUS, this.size); +// } + + blockstate.getDrops(lootcontext$builder).forEach((stack) -> { + handleExplosionDrops(objectarraylist, stack, blockpos1); + }); + + world.setBlockState(blockPos, Blocks.AIR.getDefaultState(), 3); + +// blockstate.onBlockExploded(this.world, blockpos, null); +// this.world.getProfiler().endSection(); + } + } + } + + for (Pair pair : objectarraylist) + { + Block.spawnAsEntity(this.world, pair.getSecond(), pair.getFirst()); + } + + world.setBlockState(getPos(), Blocks.AIR.getDefaultState()); + } + } + + @Override + public void deserialize(CompoundNBT tag) + { + internalCounter = tag.getDouble("internalCounter"); + } + + @Override + public CompoundNBT serialize(CompoundNBT tag) + { + tag.putDouble("internalCounter", internalCounter); + return tag; + } +} diff --git a/src/main/resources/assets/bloodmagic/models/block/sub/shaped_charge.json b/src/main/resources/assets/bloodmagic/models/block/sub/shaped_charge.json index f19e2f75..28ae6a06 100644 --- a/src/main/resources/assets/bloodmagic/models/block/sub/shaped_charge.json +++ b/src/main/resources/assets/bloodmagic/models/block/sub/shaped_charge.json @@ -18,7 +18,7 @@ "north": {"uv": [0, 6, 10, 8], "texture": "#3"}, "east": {"uv": [0, 6, 10, 8], "texture": "#3"}, "south": {"uv": [0, 6, 10, 8], "texture": "#3"}, - "west": {"uv": [8, 14, 18, 16], "texture": "#3"}, + "west": {"uv": [6, 14, 16, 16], "texture": "#3"}, "up": {"uv": [10, 10, 0, 0], "texture": "#3"}, "down": {"uv": [10, 0, 0, 10], "texture": "#3"} }