mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
some sounds to polish existing features up
This commit is contained in:
parent
3ea9129d15
commit
b1f4d3ebf9
9 changed files with 31 additions and 12 deletions
|
@ -11,10 +11,12 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
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;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
@ -103,7 +105,7 @@ public final class Helper {
|
|||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public static boolean putStackOnTile(EntityPlayer player, EnumHand hand, BlockPos pos, int slot) {
|
||||
public static boolean putStackOnTile(EntityPlayer player, EnumHand hand, BlockPos pos, int slot, boolean sound) {
|
||||
TileEntity tile = player.world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityImpl) {
|
||||
IItemHandlerModifiable handler = ((TileEntityImpl) tile).getItemHandler(null);
|
||||
|
@ -112,14 +114,19 @@ public final class Helper {
|
|||
if (!handStack.isEmpty()) {
|
||||
ItemStack remain = handler.insertItem(slot, handStack, player.world.isRemote);
|
||||
if (!ItemStack.areItemStacksEqual(remain, handStack)) {
|
||||
if (!player.world.isRemote) {
|
||||
if (sound)
|
||||
player.world.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
SoundEvents.ENTITY_ITEMFRAME_ADD_ITEM, SoundCategory.PLAYERS, 0.75F, 1F);
|
||||
if (!player.world.isRemote)
|
||||
player.setHeldItem(hand, remain);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!handler.getStackInSlot(slot).isEmpty()) {
|
||||
if (sound)
|
||||
player.world.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
SoundEvents.ENTITY_ITEMFRAME_REMOVE_ITEM, SoundCategory.PLAYERS, 0.75F, 1F);
|
||||
if (!player.world.isRemote) {
|
||||
player.addItemStackToInventory(handler.getStackInSlot(slot));
|
||||
handler.setStackInSlot(slot, ItemStack.EMPTY);
|
||||
|
|
|
@ -24,7 +24,7 @@ public class BlockNatureAltar extends BlockContainerImpl {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return Helper.putStackOnTile(playerIn, hand, pos, 0);
|
||||
return Helper.putStackOnTile(playerIn, hand, pos, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,9 +5,7 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -28,7 +26,7 @@ public class BlockWoodStand extends BlockContainerImpl {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return Helper.putStackOnTile(playerIn, hand, pos, 0);
|
||||
return Helper.putStackOnTile(playerIn, hand, pos, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,11 +14,13 @@ import net.minecraft.block.BlockStoneBrick;
|
|||
import net.minecraft.block.BlockStoneBrick.EnumType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
@ -192,6 +194,9 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
|
|||
this.items.setStackInSlot(0, this.currentRecipe.output.copy());
|
||||
this.currentRecipe = null;
|
||||
this.timer = 0;
|
||||
|
||||
this.world.playSound(null, this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5,
|
||||
SoundEvents.ENTITY_ARROW_HIT_PLAYER, SoundCategory.BLOCKS, 0.65F, 1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.block.BlockLeaves;
|
|||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -16,6 +17,7 @@ import net.minecraft.nbt.NBTTagList;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
@ -100,6 +102,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 3));
|
||||
this.world.playSound(null, this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5,
|
||||
SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.BLOCKS, 0.65F, 1F);
|
||||
|
||||
this.ritualPos = null;
|
||||
this.involvedStands = null;
|
||||
|
@ -109,10 +113,15 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
} else if (this.timer == this.totalTime / 2) {
|
||||
for (BlockPos pos : this.involvedStands.keySet()) {
|
||||
TileEntityWoodStand stand = (TileEntityWoodStand) this.world.getTileEntity(pos);
|
||||
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(stand.pos.getX(), stand.pos.getY(), stand.pos.getZ(), 1));
|
||||
this.world.playSound(null, stand.pos.getX() + 0.5, stand.pos.getY() + 0.5, stand.pos.getZ() + 0.5,
|
||||
SoundEvents.BLOCK_WOOD_STEP, SoundCategory.BLOCKS, 0.5F, 1F);
|
||||
|
||||
stand.items.setStackInSlot(0, ItemStack.EMPTY);
|
||||
stand.sendToClients();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
@ -76,8 +76,8 @@ public class PacketParticles implements IMessage {
|
|||
case 1: // Tree ritual: Consuming item
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) {
|
||||
NaturesAura.proxy.spawnMagicParticle(world,
|
||||
message.posX + 0.5F, message.posY + 1.25F, message.posZ + 0.5F,
|
||||
(float) world.rand.nextGaussian() * 0.05F, world.rand.nextFloat() * 0.05F, (float) world.rand.nextGaussian() * 0.05F,
|
||||
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
|
||||
(float) world.rand.nextGaussian() * 0.02F, world.rand.nextFloat() * 0.02F, (float) world.rand.nextGaussian() * 0.02F,
|
||||
0x89cc37, 1.5F, 50, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "naturesaura:items/color_changer"
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "naturesaura:items/color_changer_fill_mode",
|
||||
"layer1": "naturesaura:items/color_changer_fill_mode_overlay"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "naturesaura:items/color_changer",
|
||||
"layer1": "naturesaura:items/color_changer_overlay"
|
||||
|
|
Loading…
Reference in a new issue