Skip to content

Commit

Permalink
Tweak enchanting particles
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jun 13, 2024
1 parent 19e0195 commit f48afe2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
23 changes: 13 additions & 10 deletions src/main/java/mod/emt/harkenscythe/blocks/HSBloodAltar.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
if (te instanceof HSTileEntityBloodAltar)
{
HSTileEntityBloodAltar altar = (HSTileEntityBloodAltar) te;
int altarX = altar.getPos().getX();
int altarY = altar.getPos().getY();
int altarZ = altar.getPos().getZ();
ItemStack altarItem = altar.getInputStack();
ItemStack heldItem = player.getHeldItem(hand);

Expand All @@ -65,15 +68,15 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
if (!altarItem.isEmpty() && altar.isValidRecipe())
{
Item item = altar.getInputStack().getItem();
int requiredBloods = HSAltarRecipes.getRequiredBlood(altar.getInputStack().getItem());
altar.decreaseCrucibleLevel(requiredBloods / 10);
int requiredBlood = HSAltarRecipes.getRequiredBlood(altar.getInputStack().getItem());
altar.decreaseCrucibleLevel(requiredBlood / 10);
altar.getInputStack().shrink(1);
if (!player.world.isRemote) player.world.spawnEntity(new EntityItem(player.world, altar.getPos().getX() + 0.5D, altar.getPos().getY() + 1.5D, altar.getPos().getZ() + 0.5D, new ItemStack(HSAltarRecipes.getOutputBlood(item))));
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), HSSoundEvents.BLOCK_BLOOD_ALTAR_ENCHANT, SoundCategory.BLOCKS, 0.8F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), SoundEvents.ENTITY_ENDEREYE_DEATH, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
for (int i = 0; i < requiredBloods; i++)
if (!player.world.isRemote) player.world.spawnEntity(new EntityItem(player.world, altarX + 0.5D, altarY + 1.5D, altarZ + 0.5D, new ItemStack(HSAltarRecipes.getOutputBlood(item))));
player.world.playSound(altarX, altarY, altarZ, HSSoundEvents.BLOCK_BLOOD_ALTAR_ENCHANT, SoundCategory.BLOCKS, 0.8F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altarX, altarY, altarZ, SoundEvents.ENTITY_ENDEREYE_DEATH, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
for (int i = 0; i < requiredBlood; i++)
{
player.world.spawnParticle(EnumParticleTypes.SPELL_WITCH, altar.getPos().getX() + 0.5D, altar.getPos().getY() + 2.0D, altar.getPos().getZ() + 0.5D, 0.0D, 0.0D, 0.0D);
player.world.spawnParticle(EnumParticleTypes.SPELL_WITCH, altarX + world.rand.nextFloat(), altarY + 1.0D + world.rand.nextFloat(), altarZ + world.rand.nextFloat(), 0.0D, 0.5D, 0.0D);
}
altar.updateBloodCount();
altar.updateRecipe();
Expand All @@ -85,13 +88,13 @@ else if (!heldItem.isEmpty())
if (altarItem.isEmpty())
{
altar.setInputStack(heldItem.splitStack(1));
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altarX, altarY, altarZ, SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
return true;
}
else if (altarItem.getMaxStackSize() > altarItem.getCount() && ItemStack.areItemsEqual(altarItem, heldItem) && ItemStack.areItemStackTagsEqual(altarItem, heldItem))
{
heldItem.shrink(1);
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altarX, altarY, altarZ, SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
altarItem.grow(1);
return true;
}
Expand All @@ -102,7 +105,7 @@ else if (altarItem.getMaxStackSize() > altarItem.getCount() && ItemStack.areItem
if (!itemStack.isEmpty())
{
player.addItemStackToInventory(itemStack);
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), SoundEvents.ENTITY_ENDEREYE_DEATH, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altarX, altarY, altarZ, SoundEvents.ENTITY_ENDEREYE_DEATH, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
altar.setInputStack(ItemStack.EMPTY);
return true;
}
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/mod/emt/harkenscythe/blocks/HSSoulAltar.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
if (te instanceof HSTileEntitySoulAltar)
{
HSTileEntitySoulAltar altar = (HSTileEntitySoulAltar) te;
int altarX = altar.getPos().getX();
int altarY = altar.getPos().getY();
int altarZ = altar.getPos().getZ();
ItemStack altarItem = altar.getInputStack();
ItemStack heldItem = player.getHeldItem(hand);

Expand All @@ -68,12 +71,12 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
int requiredSouls = HSAltarRecipes.getRequiredSouls(altar.getInputStack().getItem());
altar.decreaseCrucibleLevel(requiredSouls / 10);
altar.getInputStack().shrink(1);
if (!player.world.isRemote) player.world.spawnEntity(new EntityItem(player.world, altar.getPos().getX() + 0.5D, altar.getPos().getY() + 1.5D, altar.getPos().getZ() + 0.5D, new ItemStack(HSAltarRecipes.getOutputSoul(item))));
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), HSSoundEvents.BLOCK_SOUL_ALTAR_ENCHANT, SoundCategory.BLOCKS, 0.8F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), SoundEvents.ENTITY_ENDEREYE_DEATH, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
if (!player.world.isRemote) player.world.spawnEntity(new EntityItem(player.world, altarX + 0.5D, altarY + 1.5D, altarZ + 0.5D, new ItemStack(HSAltarRecipes.getOutputSoul(item))));
player.world.playSound(altarX, altarY, altarZ, HSSoundEvents.BLOCK_SOUL_ALTAR_ENCHANT, SoundCategory.BLOCKS, 0.8F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altarX, altarY, altarZ, SoundEvents.ENTITY_ENDEREYE_DEATH, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
for (int i = 0; i < requiredSouls; i++)
{
player.world.spawnParticle(EnumParticleTypes.SPELL_WITCH, altar.getPos().getX() + 0.5D, altar.getPos().getY() + 2.0D, altar.getPos().getZ() + 0.5D, 0.0D, 0.0D, 0.0D);
player.world.spawnParticle(EnumParticleTypes.SPELL_WITCH, altarX + world.rand.nextFloat(), altarY + 1.0D + world.rand.nextFloat(), altarZ + world.rand.nextFloat(), 0.0D, 0.5D, 0.0D);
}
altar.updateSoulCount();
altar.updateRecipe();
Expand All @@ -85,13 +88,13 @@ else if (!heldItem.isEmpty())
if (altarItem.isEmpty())
{
altar.setInputStack(heldItem.splitStack(1));
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altarX, altarY, altarZ, SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
return true;
}
else if (altarItem.getMaxStackSize() > altarItem.getCount() && ItemStack.areItemsEqual(altarItem, heldItem) && ItemStack.areItemStackTagsEqual(altarItem, heldItem))
{
heldItem.shrink(1);
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altarX, altarY, altarZ, SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
altarItem.grow(1);
return true;
}
Expand All @@ -102,7 +105,7 @@ else if (altarItem.getMaxStackSize() > altarItem.getCount() && ItemStack.areItem
if (!itemStack.isEmpty())
{
player.addItemStackToInventory(itemStack);
player.world.playSound(altar.getPos().getX(), altar.getPos().getY(), altar.getPos().getZ(), SoundEvents.ENTITY_ENDEREYE_DEATH, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
player.world.playSound(altarX, altarY, altarZ, SoundEvents.ENTITY_ENDEREYE_DEATH, SoundCategory.BLOCKS, 1.0F, 1.5F / (altar.getWorld().rand.nextFloat() * 0.4F + 1.2F), false);
altar.setInputStack(ItemStack.EMPTY);
return true;
}
Expand Down

0 comments on commit f48afe2

Please sign in to comment.