Finished adding the "Creeping Doubt" plant block.
Still need to do some more work, such as adding the seeds and the material you get from the plant.
This commit is contained in:
parent
032e163795
commit
295488f144
36 changed files with 451 additions and 15 deletions
|
@ -18,6 +18,7 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
|||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.api.item.IMultiWillTool;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAlchemyArray;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderAltar;
|
||||
import wayoftime.bloodmagic.client.render.block.RenderDemonCrucible;
|
||||
|
@ -32,7 +33,6 @@ import wayoftime.bloodmagic.common.item.ItemSacrificialDagger;
|
|||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilToggleable;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSentientSword;
|
||||
import wayoftime.bloodmagic.common.registries.BloodMagicEntityTypes;
|
||||
import wayoftime.bloodmagic.api.item.IMultiWillTool;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
import wayoftime.bloodmagic.tile.TileAltar;
|
||||
import wayoftime.bloodmagic.tile.TileDemonCrucible;
|
||||
|
@ -65,6 +65,7 @@ public class ClientEvents
|
|||
DeferredWorkQueue.runLater(() -> {
|
||||
RenderType rendertype = RenderType.getCutoutMipped();
|
||||
RenderTypeLookup.setRenderLayer(BloodMagicBlocks.ALCHEMY_TABLE.get(), rendertype);
|
||||
RenderTypeLookup.setRenderLayer(BloodMagicBlocks.GROWING_DOUBT.get(), rendertype);
|
||||
|
||||
ClientEvents.registerContainerScreens();
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.CropsBlock;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
public class BlockGrowingDoubt extends CropsBlock
|
||||
{
|
||||
private static final VoxelShape[] SHAPES = new VoxelShape[] {
|
||||
Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 4.0D, 16.0D),
|
||||
Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D),
|
||||
Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D),
|
||||
Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D),
|
||||
Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 10.0D, 16.0D),
|
||||
Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 11.0D, 16.0D),
|
||||
Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D),
|
||||
Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D) };
|
||||
|
||||
public BlockGrowingDoubt(AbstractBlock.Properties properties)
|
||||
{
|
||||
super(properties);
|
||||
}
|
||||
|
||||
protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos)
|
||||
{
|
||||
return state.isIn(BloodMagicBlocks.NETHER_SOIL.get());
|
||||
}
|
||||
|
||||
protected IItemProvider getSeedsItem()
|
||||
{
|
||||
return Items.POTATO;
|
||||
}
|
||||
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{
|
||||
return SHAPES[state.get(this.getAgeProperty())];
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ import net.minecraft.block.AbstractBlock;
|
|||
import net.minecraft.block.AbstractBlock.Properties;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FarmlandBlock;
|
||||
import net.minecraft.block.FenceGateBlock;
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
import net.minecraft.block.RotatedPillarBlock;
|
||||
|
@ -19,6 +18,7 @@ import net.minecraft.item.BucketItem;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
@ -105,16 +105,28 @@ public class BloodMagicBlocks
|
|||
public static final RegistryObject<Block> MIMIC = BLOCKS.register("mimic", () -> new BlockMimic(Properties.create(Material.IRON).sound(SoundType.METAL).hardnessAndResistance(2.0f).setOpaque(BloodMagicBlocks::isntSolid).setSuffocates(BloodMagicBlocks::isntSolid).setBlocksVision(BloodMagicBlocks::isntSolid).notSolid()));
|
||||
public static final RegistryObject<Block> ETHEREAL_MIMIC = BLOCKS.register("ethereal_mimic", () -> new BlockMimic(Properties.create(Material.IRON).sound(SoundType.METAL).hardnessAndResistance(2.0f).setOpaque(BloodMagicBlocks::isntSolid).setSuffocates(BloodMagicBlocks::isntSolid).setBlocksVision(BloodMagicBlocks::isntSolid).notSolid().doesNotBlockMovement()));
|
||||
|
||||
private static ForgeFlowingFluid.Properties makeProperties()
|
||||
private static ForgeFlowingFluid.Properties makeLifeEssenceProperties()
|
||||
{
|
||||
return new ForgeFlowingFluid.Properties(LIFE_ESSENCE_FLUID, LIFE_ESSENCE_FLUID_FLOWING, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING)).bucket(LIFE_ESSENCE_BUCKET).block(LIFE_ESSENCE_BLOCK);
|
||||
return new ForgeFlowingFluid.Properties(LIFE_ESSENCE_FLUID, LIFE_ESSENCE_FLUID_FLOWING, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING).overlay(new ResourceLocation("block/water_overlay")).viscosity(1).sound(SoundEvents.ITEM_BUCKET_FILL, SoundEvents.ITEM_BUCKET_EMPTY)).bucket(LIFE_ESSENCE_BUCKET).block(LIFE_ESSENCE_BLOCK);
|
||||
}
|
||||
|
||||
public static RegistryObject<FlowingFluid> LIFE_ESSENCE_FLUID = FLUIDS.register("life_essence_fluid", () -> new ForgeFlowingFluid.Source(makeProperties()));
|
||||
public static RegistryObject<FlowingFluid> LIFE_ESSENCE_FLUID_FLOWING = FLUIDS.register("life_essence_fluid_flowing", () -> new ForgeFlowingFluid.Flowing(makeProperties()));
|
||||
public static final ResourceLocation DOUBT_STILL_RESOURCE = new ResourceLocation("bloodmagic:block/liquid_doubt_still");
|
||||
public static final ResourceLocation DOUBT_FLOWING_RESOURCE = new ResourceLocation("bloodmagic:block/liquid_doubt_flowing");
|
||||
|
||||
private static ForgeFlowingFluid.Properties makeDoubtProperties()
|
||||
{
|
||||
return new ForgeFlowingFluid.Properties(DOUBT_FLUID, DOUBT_FLUID_FLOWING, FluidAttributes.builder(DOUBT_STILL_RESOURCE, DOUBT_FLOWING_RESOURCE).overlay(new ResourceLocation("block/water_overlay")).viscosity(1).sound(SoundEvents.ITEM_BUCKET_FILL, SoundEvents.ITEM_BUCKET_EMPTY)).bucket(DOUBT_BUCKET).block(DOUBT_BLOCK);
|
||||
}
|
||||
|
||||
public static RegistryObject<FlowingFluid> LIFE_ESSENCE_FLUID = FLUIDS.register("life_essence_fluid", () -> new ForgeFlowingFluid.Source(makeLifeEssenceProperties()));
|
||||
public static RegistryObject<FlowingFluid> LIFE_ESSENCE_FLUID_FLOWING = FLUIDS.register("life_essence_fluid_flowing", () -> new ForgeFlowingFluid.Flowing(makeLifeEssenceProperties()));
|
||||
public static RegistryObject<FlowingFluid> DOUBT_FLUID = FLUIDS.register("doubt_fluid", () -> new ForgeFlowingFluid.Source(makeDoubtProperties()));
|
||||
public static RegistryObject<FlowingFluid> DOUBT_FLUID_FLOWING = FLUIDS.register("doubt_fluid_flowing", () -> new ForgeFlowingFluid.Flowing(makeDoubtProperties()));
|
||||
|
||||
public static RegistryObject<FlowingFluidBlock> LIFE_ESSENCE_BLOCK = BLOCKS.register("life_essence_block", () -> new FlowingFluidBlock(LIFE_ESSENCE_FLUID, Block.Properties.create(net.minecraft.block.material.Material.WATER).doesNotBlockMovement().hardnessAndResistance(100.0F).noDrops()));
|
||||
public static RegistryObject<FlowingFluidBlock> DOUBT_BLOCK = BLOCKS.register("doubt_block", () -> new FlowingFluidBlock(DOUBT_FLUID, Block.Properties.create(net.minecraft.block.material.Material.WATER).doesNotBlockMovement().hardnessAndResistance(100.0F).noDrops()));
|
||||
public static RegistryObject<Item> LIFE_ESSENCE_BUCKET = ITEMS.register("life_essence_bucket", () -> new BucketItem(LIFE_ESSENCE_FLUID, new Item.Properties().containerItem(Items.BUCKET).maxStackSize(1).group(BloodMagic.TAB)));
|
||||
public static RegistryObject<Item> DOUBT_BUCKET = ITEMS.register("doubt_bucket", () -> new BucketItem(DOUBT_FLUID, new Item.Properties().containerItem(Items.BUCKET).maxStackSize(1).group(BloodMagic.TAB)));
|
||||
|
||||
public static final RegistryObject<ContainerType<ContainerSoulForge>> SOUL_FORGE_CONTAINER = CONTAINERS.register("soul_forge_container", () -> IForgeContainerType.create(ContainerSoulForge::new));
|
||||
public static final RegistryObject<ContainerType<ContainerAlchemicalReactionChamber>> ARC_CONTAINER = CONTAINERS.register("arc_container", () -> IForgeContainerType.create(ContainerAlchemicalReactionChamber::new));
|
||||
|
@ -151,7 +163,9 @@ public class BloodMagicBlocks
|
|||
|
||||
public static final RegistryObject<Block> HELLFORGED_BLOCK = DUNGEONBLOCKS.register("dungeon_metal", () -> new Block(Properties.create(Material.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE).harvestLevel(2).setRequiresTool()));
|
||||
|
||||
public static final RegistryObject<Block> NETHER_SOIL = BLOCKS.register("nether_soil", () -> new FarmlandBlock(Properties.create(Material.EARTH).hardnessAndResistance(0.4F, 0.4F).sound(SoundType.NETHERRACK).harvestTool(ToolType.PICKAXE)));
|
||||
public static final RegistryObject<Block> NETHER_SOIL = BLOCKS.register("nether_soil", () -> new BlockNetherrackSoil(Properties.create(Material.EARTH).hardnessAndResistance(0.4F, 0.4F).sound(SoundType.NETHERRACK).harvestTool(ToolType.PICKAXE).tickRandomly()));
|
||||
|
||||
public static final RegistryObject<Block> GROWING_DOUBT = BLOCKS.register("creeping_doubt", () -> new BlockGrowingDoubt(Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().zeroHardnessAndResistance().sound(SoundType.CROP)));
|
||||
|
||||
private static boolean isntSolid(BlockState state, IBlockReader reader, BlockPos pos)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package wayoftime.bloodmagic.common.data;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.CropsBlock;
|
||||
import net.minecraft.block.FenceGateBlock;
|
||||
import net.minecraft.block.RotatedPillarBlock;
|
||||
import net.minecraft.block.StairsBlock;
|
||||
import net.minecraft.block.WallBlock;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.state.IntegerProperty;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.generators.BlockModelBuilder;
|
||||
|
@ -86,12 +88,21 @@ public class GeneratorBlockStates extends BlockStateProvider
|
|||
buildCubeAllWithTextureName("solidclearmimic");
|
||||
buildCubeAllWithTextureName("solidlightmimic");
|
||||
buildCubeAllWithTextureName("solidopaquemimic");
|
||||
|
||||
buildCrop(BloodMagicBlocks.GROWING_DOUBT.get(), CropsBlock.AGE, 7, BloodMagic.rl("block/creeping_doubt_1"), BloodMagic.rl("block/creeping_doubt_2"), BloodMagic.rl("block/creeping_doubt_3"), BloodMagic.rl("block/creeping_doubt_4"), BloodMagic.rl("block/creeping_doubt_5"), BloodMagic.rl("block/creeping_doubt_6"), BloodMagic.rl("block/creeping_doubt_7"), BloodMagic.rl("block/creeping_doubt_8"));
|
||||
}
|
||||
|
||||
// private void buildCustomLoader(Block block)
|
||||
// {
|
||||
// ModelFile modelFile = models().crop("", null);
|
||||
// }
|
||||
private void buildCrop(Block block, IntegerProperty prop, int maxAge, ResourceLocation... textures)
|
||||
{
|
||||
String basePath = block.getRegistryName().getPath();
|
||||
VariantBlockStateBuilder builder = getVariantBuilder(block);
|
||||
|
||||
for (int i = 0; i <= maxAge; i++)
|
||||
{
|
||||
ModelFile modelFile = models().crop(basePath + "_" + (i + 1), textures[i]);
|
||||
builder.partialState().with(prop, i).modelForState().modelFile(modelFile).addModel();
|
||||
}
|
||||
}
|
||||
|
||||
private void buildFarmland(Block block, ResourceLocation top, ResourceLocation side)
|
||||
{
|
||||
|
|
|
@ -85,6 +85,7 @@ public class GeneratorItemModels extends ItemModelProvider
|
|||
|
||||
registerCustomFullTexture(BloodMagicBlocks.MIMIC.get(), "solidopaquemimic");
|
||||
registerCustomFullTexture(BloodMagicBlocks.ETHEREAL_MIMIC.get(), "etherealopaquemimic");
|
||||
this.crop(BloodMagicBlocks.GROWING_DOUBT.get().getRegistryName().getPath(), modLoc("block/creeping_doubt_8"));
|
||||
}
|
||||
|
||||
private void registerCustomFullTexture(Block block, String texturePath)
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.mojang.datafixers.util.Pair;
|
|||
import net.minecraft.advancements.criterion.StatePropertiesPredicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.CropsBlock;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.LootTableProvider;
|
||||
import net.minecraft.data.loot.BlockLootTables;
|
||||
|
@ -129,6 +130,7 @@ public class GeneratorLootTable extends LootTableProvider
|
|||
registerDropSelfLootTable(BloodMagicBlocks.MIMIC.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.ETHEREAL_MIMIC.get());
|
||||
|
||||
registerCropDropLootTable(BloodMagicBlocks.GROWING_DOUBT.get(), BloodMagicItems.WEAK_BLOOD_SHARD.get());
|
||||
}
|
||||
|
||||
private void registerNoDropLootTable(Block block)
|
||||
|
@ -137,6 +139,19 @@ public class GeneratorLootTable extends LootTableProvider
|
|||
this.registerLootTable(block, LootTable.builder().addLootPool(builder));
|
||||
}
|
||||
|
||||
private void registerCropDropLootTable(Block block, Item item)
|
||||
{
|
||||
LootTable.Builder builder = LootTable.builder();
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
ILootCondition.IBuilder harvestAge = BlockStateProperty.builder(block).fromProperties(StatePropertiesPredicate.Builder.newBuilder().withIntProp(CropsBlock.AGE, i));
|
||||
builder = builder.addLootPool(LootPool.builder().addEntry(ItemLootEntry.builder(item).acceptFunction(SetCount.builder(ConstantRange.of(1))).acceptCondition(harvestAge)));
|
||||
}
|
||||
|
||||
this.registerLootTable(block, builder);
|
||||
}
|
||||
|
||||
private void registerDropCrystalsLootTable(Block block, Item item)
|
||||
{
|
||||
LootTable.Builder builder = LootTable.builder();
|
||||
|
|
|
@ -95,6 +95,7 @@ public class BloodMagicItems
|
|||
public static final RegistryObject<Item> MIMIC_ETHEREAL_ITEM = ITEMS.register("ethereal_mimic", () -> new ItemBlockMimic(BloodMagicBlocks.ETHEREAL_MIMIC.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
|
||||
public static final RegistryObject<Item> NETHE_SOIL_ITEM = ITEMS.register("nether_soil", () -> new BlockItem(BloodMagicBlocks.NETHER_SOIL.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> GROWING_DOUBT_ITEM = ITEMS.register("growing_doubt", () -> new BlockItem(BloodMagicBlocks.GROWING_DOUBT.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.
|
||||
|
||||
|
|
|
@ -5,15 +5,19 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.BlockToolInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.api.item.IBindable;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.core.data.SoulNetwork;
|
||||
import wayoftime.bloodmagic.demonaura.WorldDemonWillHandler;
|
||||
import wayoftime.bloodmagic.event.ItemBindEvent;
|
||||
import wayoftime.bloodmagic.api.item.IBindable;
|
||||
import wayoftime.bloodmagic.network.DemonAuraClientPacket;
|
||||
import wayoftime.bloodmagic.orb.BloodOrb;
|
||||
import wayoftime.bloodmagic.orb.IBloodOrb;
|
||||
|
@ -75,6 +79,15 @@ public class GenericHandler
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onHoe(BlockToolInteractEvent event)
|
||||
{
|
||||
if (event.getToolType() == ToolType.HOE && Tags.Blocks.NETHERRACK.contains(event.getState().getBlock()))
|
||||
{
|
||||
event.setFinalState(BloodMagicBlocks.NETHER_SOIL.get().getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPlayerDemonWillAura(PlayerEntity player)
|
||||
{
|
||||
if (player instanceof ServerPlayerEntity)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue