Skip to content

Commit

Permalink
Add basic crucibles
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jun 4, 2024
1 parent e75c97d commit 6d83223
Show file tree
Hide file tree
Showing 32 changed files with 371 additions and 17 deletions.
12 changes: 0 additions & 12 deletions src/main/java/mod/emt/harkenscythe/blocks/HSBlock.java

This file was deleted.

51 changes: 51 additions & 0 deletions src/main/java/mod/emt/harkenscythe/blocks/HSBloodCrucible.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package mod.emt.harkenscythe.blocks;

import java.util.Random;
import net.minecraft.block.BlockCauldron;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class HSBloodCrucible extends BlockCauldron
{
public HSBloodCrucible()
{
super();
}

@Override
public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{

}

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
return false;
}

@Override
public void fillWithRain(World world, BlockPos pos)
{

}

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Item.getItemFromBlock(this);
}

@Override
public ItemStack getItem(World world, BlockPos pos, IBlockState state)
{
return new ItemStack(Item.getItemFromBlock(this));
}
}
142 changes: 142 additions & 0 deletions src/main/java/mod/emt/harkenscythe/blocks/HSSoulCrucible.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package mod.emt.harkenscythe.blocks;

import java.util.Random;
import mod.emt.harkenscythe.init.HSItems;
import net.minecraft.block.BlockCauldron;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class HSSoulCrucible extends BlockCauldron
{
public HSSoulCrucible()
{
super();
}

@Override
public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{

}

// TODO: Works, but needs refactoring
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (world.isRemote)
{
return false;
}
ItemStack stack = player.getHeldItem(hand);
if (!stack.isEmpty())
{
int level = state.getValue(LEVEL);
Item item = stack.getItem();

if (item == HSItems.essence_keeper || item == HSItems.essence_vessel || item == HSItems.essence_keeper_soul || item == HSItems.essence_vessel_soul)
{
// Filling the crucible
if (level < 3 && !player.isSneaking())
{
if (item == HSItems.essence_keeper_soul || item == HSItems.essence_vessel_soul)
{
if (!player.capabilities.isCreativeMode)
{
if (stack.getItemDamage() + 20 < stack.getMaxDamage())
{
stack.setItemDamage(stack.getItemDamage() + 20);
}
else if (item == HSItems.essence_keeper_soul)
{
stack.shrink(1);
player.setHeldItem(hand, new ItemStack(HSItems.essence_keeper));
}
else if (item == HSItems.essence_vessel_soul)
{
stack.shrink(1);
player.setHeldItem(hand, new ItemStack(HSItems.essence_vessel));
}
}

world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
this.setWaterLevel(world, pos, state, level + 1);
}
}
// Emptying the crucible
else if (level > 0 && player.isSneaking())
{
if (!player.capabilities.isCreativeMode)
{
if (item == HSItems.essence_keeper || item == HSItems.essence_vessel)
{
stack.shrink(1);
if (item == HSItems.essence_keeper)
{
ItemStack newEssenceKeeperSoul = new ItemStack(HSItems.essence_keeper_soul);
player.setHeldItem(hand, newEssenceKeeperSoul);
}
else if (item == HSItems.essence_vessel)
{
ItemStack newEssenceVesselSoul = new ItemStack(HSItems.essence_vessel_soul);
newEssenceVesselSoul.setItemDamage(newEssenceVesselSoul.getItemDamage() + 20);
player.setHeldItem(hand, newEssenceVesselSoul);
}
}
else if (item == HSItems.essence_keeper_soul || item == HSItems.essence_vessel_soul)
{
if (stack.getItemDamage() <= 0)
{
return false;
}
else if (stack.getItemDamage() - 20 < 0)
{
stack.setItemDamage(stack.getItemDamage() - 20);
}
else if (item == HSItems.essence_keeper_soul)
{
stack.shrink(1);
player.setHeldItem(hand, new ItemStack(HSItems.essence_keeper_soul));
}
else if (item == HSItems.essence_vessel_soul)
{
stack.shrink(1);
player.setHeldItem(hand, new ItemStack(HSItems.essence_vessel_soul));
}
}
}
world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
this.setWaterLevel(world, pos, state, level - 1);
}
return true;
}
}
return false;
}

@Override
public void fillWithRain(World world, BlockPos pos)
{

}

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Item.getItemFromBlock(this);
}

@Override
public ItemStack getItem(World world, BlockPos pos, IBlockState state)
{
return new ItemStack(Item.getItemFromBlock(this));
}
}
12 changes: 8 additions & 4 deletions src/main/java/mod/emt/harkenscythe/init/HSBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import javax.annotation.Nonnull;
import mod.emt.harkenscythe.HarkenScythe;
import mod.emt.harkenscythe.blocks.HSBlock;
import mod.emt.harkenscythe.blocks.HSBloodCrucible;
import mod.emt.harkenscythe.blocks.HSSoulCrucible;
import net.minecraft.block.Block;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
Expand All @@ -14,8 +15,10 @@
@GameRegistry.ObjectHolder(HarkenScythe.MOD_ID)
public class HSBlocks
{
@GameRegistry.ObjectHolder("block")
public static HSBlock block;
@GameRegistry.ObjectHolder("blood_crucible")
public static HSBloodCrucible blood_crucible;
@GameRegistry.ObjectHolder("soul_crucible")
public static HSSoulCrucible soul_crucible;

@SubscribeEvent
public static void onRegisterBlocksEvent(@Nonnull final RegistryEvent.Register<Block> event)
Expand All @@ -25,7 +28,8 @@ public static void onRegisterBlocksEvent(@Nonnull final RegistryEvent.Register<B
// BLOCKS
registry.registerAll
(
HSRegistry.setup(new HSBlock(), "block")
HSRegistry.setup(new HSBloodCrucible(), "blood_crucible"),
HSRegistry.setup(new HSSoulCrucible(), "soul_crucible")
);
}
}
9 changes: 9 additions & 0 deletions src/main/java/mod/emt/harkenscythe/items/HSEssenceKeeper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import mod.emt.harkenscythe.HarkenScythe;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class HSEssenceKeeper extends Item
Expand All @@ -20,4 +23,10 @@ public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSl
{
super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected);
}

@Override
public boolean doesSneakBypassUse(ItemStack stack, IBlockAccess world, BlockPos pos, EntityPlayer player)
{
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"variants": {
"level=0": {"model": "harkenscythe:blood_crucible_empty"},
"level=1": {"model": "harkenscythe:blood_crucible_level1"},
"level=2": {"model": "harkenscythe:blood_crucible_level2"},
"level=3": {"model": "harkenscythe:blood_crucible_level3"}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"variants": {
"level=0": {"model": "harkenscythe:soul_crucible_empty"},
"level=1": {"model": "harkenscythe:soul_crucible_level1"},
"level=2": {"model": "harkenscythe:soul_crucible_level2"},
"level=3": {"model": "harkenscythe:soul_crucible_level3"}
}
}
6 changes: 5 additions & 1 deletion src/main/resources/assets/harkenscythe/lang/en_us.lang
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# CREATIVE TAB
itemGroup.harkenscythe.tab=Harken Scythe

# BLOCKS
tile.harkenscythe.blood_crucible.name=Blood Crucible
tile.harkenscythe.soul_crucible.name=Soul Crucible

# ITEMS
item.harkenscythe.diamond_scythe.name=Diamond Scythe
item.harkenscythe.essence_keeper.name=Essence Keeper
item.harkenscythe.essence_keeper_blood.name=Blood Keeper
item.harkenscythe.essence_keeper_soul.name=Soul Keeper
item.harkenscythe.essence_vessel.name=Essence Keeper
item.harkenscythe.essence_vessel.name=Essence Vessel
item.harkenscythe.essence_vessel_blood.name=Blood Vessel
item.harkenscythe.essence_vessel_soul.name=Soul Vessel
item.harkenscythe.golden_scythe.name=Golden Scythe
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "block/cauldron_empty",
"textures": {
"particle": "harkenscythe:blocks/blood_crucible_side",
"top": "harkenscythe:blocks/blood_crucible_top",
"bottom": "harkenscythe:blocks/blood_crucible_bottom",
"side": "harkenscythe:blocks/blood_crucible_side",
"inside": "harkenscythe:blocks/blood_crucible_inner"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parent": "block/cauldron_level1",
"textures": {
"particle": "harkenscythe:blocks/blood_crucible_side",
"top": "harkenscythe:blocks/blood_crucible_top",
"bottom": "harkenscythe:blocks/blood_crucible_bottom",
"side": "harkenscythe:blocks/blood_crucible_side",
"inside": "harkenscythe:blocks/blood_crucible_inner",
"water": "harkenscythe:blocks/blood_crucible_liquid"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parent": "block/cauldron_level2",
"textures": {
"particle": "harkenscythe:blocks/blood_crucible_side",
"top": "harkenscythe:blocks/blood_crucible_top",
"bottom": "harkenscythe:blocks/blood_crucible_bottom",
"side": "harkenscythe:blocks/blood_crucible_side",
"inside": "harkenscythe:blocks/blood_crucible_inner",
"water": "harkenscythe:blocks/blood_crucible_liquid"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parent": "block/cauldron_level3",
"textures": {
"particle": "harkenscythe:blocks/blood_crucible_side",
"top": "harkenscythe:blocks/blood_crucible_top",
"bottom": "harkenscythe:blocks/blood_crucible_bottom",
"side": "harkenscythe:blocks/blood_crucible_side",
"inside": "harkenscythe:blocks/blood_crucible_inner",
"water": "harkenscythe:blocks/blood_crucible_liquid"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "block/cauldron_empty",
"textures": {
"particle": "harkenscythe:blocks/soul_crucible_side",
"top": "harkenscythe:blocks/soul_crucible_top",
"bottom": "harkenscythe:blocks/soul_crucible_bottom",
"side": "harkenscythe:blocks/soul_crucible_side",
"inside": "harkenscythe:blocks/soul_crucible_inner"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parent": "block/cauldron_level1",
"textures": {
"particle": "harkenscythe:blocks/soul_crucible_side",
"top": "harkenscythe:blocks/soul_crucible_top",
"bottom": "harkenscythe:blocks/soul_crucible_bottom",
"side": "harkenscythe:blocks/soul_crucible_side",
"inside": "harkenscythe:blocks/soul_crucible_inner",
"water": "harkenscythe:blocks/soul_crucible_liquid"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parent": "block/cauldron_level2",
"textures": {
"particle": "harkenscythe:blocks/soul_crucible_side",
"top": "harkenscythe:blocks/soul_crucible_top",
"bottom": "harkenscythe:blocks/soul_crucible_bottom",
"side": "harkenscythe:blocks/soul_crucible_side",
"inside": "harkenscythe:blocks/soul_crucible_inner",
"water": "harkenscythe:blocks/soul_crucible_liquid"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parent": "block/cauldron_level3",
"textures": {
"particle": "harkenscythe:blocks/soul_crucible_side",
"top": "harkenscythe:blocks/soul_crucible_top",
"bottom": "harkenscythe:blocks/soul_crucible_bottom",
"side": "harkenscythe:blocks/soul_crucible_side",
"inside": "harkenscythe:blocks/soul_crucible_inner",
"water": "harkenscythe:blocks/soul_crucible_liquid"
}
}
Loading

0 comments on commit 6d83223

Please sign in to comment.