Added the Fungal charge.

Fungal Charges work on all nether and giant mushrooms.
This commit is contained in:
WayofTime 2021-01-23 19:06:35 -05:00
parent 2c3af715d7
commit df286a73f1
26 changed files with 281 additions and 3 deletions

View file

@ -73,6 +73,7 @@ import wayoftime.bloodmagic.tile.TileDeforesterCharge;
import wayoftime.bloodmagic.tile.TileDemonCrucible;
import wayoftime.bloodmagic.tile.TileDemonCrystal;
import wayoftime.bloodmagic.tile.TileDemonCrystallizer;
import wayoftime.bloodmagic.tile.TileFungalCharge;
import wayoftime.bloodmagic.tile.TileIncenseAltar;
import wayoftime.bloodmagic.tile.TileMasterRitualStone;
import wayoftime.bloodmagic.tile.TileMimic;
@ -203,6 +204,7 @@ public class BloodMagic
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"));
event.getRegistry().register(TileEntityType.Builder.create(TileFungalCharge::new, BloodMagicBlocks.FUNGAL_CHARGE.get()).build(null).setRegistryName("fungal_charge"));
}

View file

@ -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.TileFungalCharge;
public class BlockFungalCharge extends BlockShapedExplosive
{
public BlockFungalCharge(int explosionSize, Properties properties)
{
super(explosionSize, properties);
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{
return new TileFungalCharge();
}
}

View file

@ -177,6 +177,7 @@ public class BloodMagicBlocks
public static final RegistryObject<Block> 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<Block> 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<Block> 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()));
public static final RegistryObject<Block> FUNGAL_CHARGE = BLOCKS.register("fungal_charge", () -> new BlockFungalCharge(3, Properties.create(Material.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE).harvestLevel(1).setRequiresTool()));
//
//// private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator)

View file

@ -95,6 +95,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"));
buildOrientable(BloodMagicBlocks.FUNGAL_CHARGE.get(), "fungal_charge", modLoc("block/sub/shaped_charge"), new ResourceLocation("block/nether_wart_block"), new ResourceLocation("block/crimson_planks"), modLoc("block/blankrune"), new ResourceLocation("block/crimson_stem"), modLoc("models/defaultcrystal"));
}
private void buildOrientable(Block block, String name, ResourceLocation modelPath, ResourceLocation base, ResourceLocation edges, ResourceLocation centerCap, ResourceLocation binding, ResourceLocation core)

View file

@ -2,6 +2,7 @@ package wayoftime.bloodmagic.common.data;
import java.nio.file.Path;
import net.minecraft.block.Blocks;
import net.minecraft.data.BlockTagsProvider;
import net.minecraft.data.DataGenerator;
import net.minecraft.tags.BlockTags;
@ -9,6 +10,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.data.ExistingFileHelper;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
public class GeneratorBlockTags extends BlockTagsProvider
{
@ -22,6 +24,8 @@ public class GeneratorBlockTags extends BlockTagsProvider
{
this.getOrCreateBuilder(BlockTags.WALLS).add(BloodMagicBlocks.DUNGEON_BRICK_WALL.get());
this.getOrCreateBuilder(BlockTags.WALLS).add(BloodMagicBlocks.DUNGEON_POLISHED_WALL.get());
this.getOrCreateBuilder(BloodMagicTags.Blocks.MUSHROOM_STEM).add(Blocks.MUSHROOM_STEM).add(Blocks.CRIMSON_STEM).add(Blocks.WARPED_STEM);
this.getOrCreateBuilder(BloodMagicTags.Blocks.MUSHROOM_HYPHAE).add(Blocks.BROWN_MUSHROOM_BLOCK).add(Blocks.RED_MUSHROOM_BLOCK).add(Blocks.CRIMSON_HYPHAE).add(Blocks.WARPED_HYPHAE).add(Blocks.STRIPPED_CRIMSON_HYPHAE).add(Blocks.STRIPPED_WARPED_HYPHAE).add(Blocks.NETHER_WART_BLOCK).add(Blocks.WARPED_WART_BLOCK).add(Blocks.SHROOMLIGHT);
}
/**

View file

@ -92,6 +92,7 @@ public class GeneratorItemModels extends ItemModelProvider
registerBlockModel(BloodMagicBlocks.SHAPED_CHARGE.get());
registerBlockModel(BloodMagicBlocks.DEFORESTER_CHARGE.get());
registerBlockModel(BloodMagicBlocks.VEINMINE_CHARGE.get());
registerBlockModel(BloodMagicBlocks.FUNGAL_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"));

View file

@ -53,6 +53,9 @@ public class GeneratorItemTags extends ItemTagsProvider
this.getOrCreateBuilder(BloodMagicTags.CRYSTAL_DEMON).add(BloodMagicItems.VENGEFUL_CRYSTAL.get());
this.getOrCreateBuilder(BloodMagicTags.CRYSTAL_DEMON).add(BloodMagicItems.STEADFAST_CRYSTAL.get());
this.copy(BloodMagicTags.Blocks.MUSHROOM_STEM, BloodMagicTags.MUSHROOM_STEM);
this.copy(BloodMagicTags.Blocks.MUSHROOM_HYPHAE, BloodMagicTags.MUSHROOM_HYPHAE);
// this.getOrCreateBuilder(GOORESISTANT).addTag(BlockTags.DOORS);
// this.getOrCreateBuilder(GOORESISTANT).addTag(BlockTags.BEDS);
// this.getOrCreateBuilder(GOORESISTANT).add(Blocks.PISTON, Blocks.PISTON_HEAD, Blocks.STICKY_PISTON, Blocks.MOVING_PISTON);

View file

@ -451,7 +451,8 @@ public class GeneratorLanguage extends LanguageProvider
addBlock(BloodMagicBlocks.SHAPED_CHARGE, "Shaped Charge");
addBlock(BloodMagicBlocks.DEFORESTER_CHARGE, "Deforester Charge");
addBlock(BloodMagicBlocks.VEINMINE_CHARGE, "Vein Charge");
addBlock(BloodMagicBlocks.VEINMINE_CHARGE, "Controlled Charge");
addBlock(BloodMagicBlocks.FUNGAL_CHARGE, "Fungal Charge");
// Item names
addItem(BloodMagicItems.WEAK_BLOOD_ORB, "Weak Blood Orb");

View file

@ -135,6 +135,7 @@ public class GeneratorLootTable extends LootTableProvider
registerNoDropLootTable(BloodMagicBlocks.SHAPED_CHARGE.get());
registerNoDropLootTable(BloodMagicBlocks.DEFORESTER_CHARGE.get());
registerNoDropLootTable(BloodMagicBlocks.VEINMINE_CHARGE.get());
registerNoDropLootTable(BloodMagicBlocks.FUNGAL_CHARGE.get());
}
private void registerNoDropLootTable(Block block)

View file

@ -102,6 +102,7 @@ public class BloodMagicItems
public static final RegistryObject<Item> SHAPED_CHARGE_ITEM = ITEMS.register("shaped_charge", () -> new ItemBlockShapedCharge(BloodMagicBlocks.SHAPED_CHARGE.get(), new Item.Properties().group(BloodMagic.TAB)));
public static final RegistryObject<Item> DEFORESTER_CHARGE_ITEM = ITEMS.register("deforester_charge", () -> new ItemBlockShapedCharge(BloodMagicBlocks.DEFORESTER_CHARGE.get(), new Item.Properties().group(BloodMagic.TAB)));
public static final RegistryObject<Item> VEINMINE_CHARGE_ITEM = ITEMS.register("veinmine_charge", () -> new ItemBlockShapedCharge(BloodMagicBlocks.VEINMINE_CHARGE.get(), new Item.Properties().group(BloodMagic.TAB)));
public static final RegistryObject<Item> FUNGAL_CHARGE_ITEM = ITEMS.register("fungal_charge", () -> new ItemBlockShapedCharge(BloodMagicBlocks.FUNGAL_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.

View file

@ -50,6 +50,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"));
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicBlocks.FUNGAL_CHARGE.get(), 8), 10, 0.5, Ingredient.fromTag(Tags.Items.COBBLESTONE), Ingredient.fromItems(Items.CHARCOAL), Ingredient.fromTag(BloodMagicTags.MUSHROOM_HYPHAE), Ingredient.fromTag(Tags.Items.MUSHROOMS)).build(consumer, BloodMagic.rl(basePath + "fungal_charge"));
ItemStack stack = new ItemStack(BloodMagicBlocks.DEFORESTER_CHARGE.get());
AnointmentHolder smeltingHolder = new AnointmentHolder();

View file

@ -1,7 +1,9 @@
package wayoftime.bloodmagic.common.tags;
import net.minecraft.block.Block;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
@ -21,6 +23,9 @@ public class BloodMagicTags
public static final ITag.INamedTag<Fluid> LIFE_ESSENCE = FluidTags.makeWrapperTag("forge:life");
public static final ITag.INamedTag<Item> MUSHROOM_STEM = ItemTags.makeWrapperTag("minecraft:mushroom_stem");
public static final ITag.INamedTag<Item> MUSHROOM_HYPHAE = ItemTags.makeWrapperTag("minecraft:mushroom_hyphae");
// Ores
public static final ITag.INamedTag<Item> ORE_COPPER = getForgeOreTag("copper");
public static final ITag.INamedTag<Item> ORE_TIN = getForgeOreTag("tin");
@ -52,6 +57,12 @@ public class BloodMagicTags
public static final ITag.INamedTag<Item> GRAVEL_GOLD = getGravelTag("gold");
public static final ITag.INamedTag<Item> GRAVEL_NETHERITE_SCRAP = getGravelTag("netherite_scrap");
public static class Blocks
{
public static final ITag.INamedTag<Block> MUSHROOM_STEM = BlockTags.makeWrapperTag("minecraft:mushroom_stem");
public static final ITag.INamedTag<Block> MUSHROOM_HYPHAE = BlockTags.makeWrapperTag("minecraft:mushroom_hyphae");
}
public static ITag.INamedTag<Item> getForgeOreTag(String name)
{
return ItemTags.makeWrapperTag("forge:ores/" + name);

View file

@ -0,0 +1,40 @@
package wayoftime.bloodmagic.tile;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.registries.ObjectHolder;
import wayoftime.bloodmagic.common.tags.BloodMagicTags;
public class TileFungalCharge extends TileVeinMineCharge
{
@ObjectHolder("bloodmagic:fungal_charge")
public static TileEntityType<TileFungalCharge> TYPE;
public TileFungalCharge(TileEntityType<?> type, int maxBlocks)
{
super(type, maxBlocks);
}
public TileFungalCharge()
{
this(TYPE, 64 * 3);
}
@Override
public boolean isValidBlock(BlockState originalBlockState, BlockState testState)
{
return isValidStartingBlock(testState);
}
@Override
public boolean isValidStartingBlock(BlockState originalBlockState)
{
return BloodMagicTags.Blocks.MUSHROOM_HYPHAE.contains(originalBlockState.getBlock()) || BloodMagicTags.Blocks.MUSHROOM_STEM.contains(originalBlockState.getBlock());
}
@Override
public boolean checkDiagonals()
{
return true;
}
}

View file

@ -24,6 +24,7 @@ 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.util.math.vector.Vector3i;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.registries.ObjectHolder;
import wayoftime.bloodmagic.common.block.BlockShapedExplosive;
@ -37,6 +38,11 @@ public class TileVeinMineCharge extends TileExplosiveCharge
private List<BlockPos> veinPartsCache;
private boolean finishedAnalysis;
private Vector3i[] diagonals = new Vector3i[] { new Vector3i(0, 1, 1), new Vector3i(0, 1, -1),
new Vector3i(0, -1, 1), new Vector3i(0, -1, -1), new Vector3i(1, 0, 1), new Vector3i(-1, 0, 1),
new Vector3i(1, 0, -1), new Vector3i(-1, 0, -1), new Vector3i(1, 1, 0), new Vector3i(-1, 1, 0),
new Vector3i(1, -1, 0), new Vector3i(-1, -1, 0) };
public double internalCounter = 0;
public int currentBlocks = 0;
@ -67,6 +73,10 @@ public class TileVeinMineCharge extends TileExplosiveCharge
Direction explosiveDirection = this.getBlockState().get(BlockShapedExplosive.ATTACHED).getOpposite();
BlockState attachedState = world.getBlockState(pos.offset(explosiveDirection));
Block attachedBlock = attachedState.getBlock();
if (!isValidStartingBlock(attachedState))
{
return;
}
// if (!BlockTags.LOGS.contains(attachedState.getBlock()) && !BlockTags.LEAVES.contains(attachedState.getBlock()))
// {
// return;
@ -104,7 +114,7 @@ public class TileVeinMineCharge extends TileExplosiveCharge
{
continue;
}
if (attachedBlock.equals(checkState.getBlock()))
if (isValidBlock(attachedState, checkState))
{
currentBlocks++;
isTree = true;
@ -119,6 +129,39 @@ public class TileVeinMineCharge extends TileExplosiveCharge
}
}
if (this.checkDiagonals())
{
for (Vector3i vec : this.diagonals)
{
BlockPos checkPos = currentPos.add(vec);
if (veinPartsMap.containsKey(checkPos))
{
continue;
}
BlockState checkState = world.getBlockState(checkPos);
boolean isTree = false;
if (currentBlocks >= maxBlocks)
{
continue;
}
if (isValidBlock(attachedState, checkState))
{
currentBlocks++;
isTree = true;
}
if (isTree)
{
veinPartsMap.put(checkPos, false);
newPositions.add(checkPos);
foundNew = true;
}
}
}
veinPartsMap.put(currentPos, true);
if (currentBlocks >= maxBlocks)
{
@ -214,12 +257,29 @@ public class TileVeinMineCharge extends TileExplosiveCharge
public void deserialize(CompoundNBT tag)
{
internalCounter = tag.getDouble("internalCounter");
maxBlocks = tag.getInt("maxBlocks");
}
@Override
public CompoundNBT serialize(CompoundNBT tag)
{
tag.putDouble("internalCounter", internalCounter);
tag.putInt("maxBlocks", maxBlocks);
return tag;
}
public boolean isValidBlock(BlockState originalBlockState, BlockState testState)
{
return originalBlockState.getBlock() == testState.getBlock();
}
public boolean isValidStartingBlock(BlockState originalBlockState)
{
return true;
}
public boolean checkDiagonals()
{
return true;
}
}