diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java index 1708bb8f..3f50bca0 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java @@ -63,8 +63,11 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { for (BlockPos offsetToOrigin : TileEntityWoodStand.GOLD_POWDER_POSITIONS) { BlockPos origin = pos.subtract(offsetToOrigin); if (Helper.checkMultiblock(worldIn, origin, TileEntityWoodStand.GOLD_POWDER_POSITIONS, ModBlocks.GOLD_POWDER.getDefaultState(), true)) { + AxisAlignedBB box = this.getBoundingBox(stateIn, worldIn, pos); NaturesAura.proxy.spawnMagicParticle(worldIn, - pos.getX() + 0.375 + rand.nextFloat() * 0.25, pos.getY() + 0.1, pos.getZ() + 0.375 + rand.nextFloat() * 0.25, + pos.getX() + box.minX + (box.maxX - box.minX) * rand.nextFloat(), + pos.getY() + 0.05F, + pos.getZ() + box.minZ + (box.maxZ - box.minZ) * rand.nextFloat(), rand.nextGaussian() * 0.001, rand.nextFloat() * 0.001 + 0.005, rand.nextGaussian() * 0.001, 0xf4cb42, 1F, 50, 0F, false, true); break; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java index 0fee1bb0..d264f848 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java @@ -17,7 +17,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import java.util.HashMap; import java.util.Map; @@ -61,15 +60,17 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { public void update() { if (!this.world.isRemote) { if (this.ritualPos != null && this.involvedStands != null && this.output != null && this.totalTime > 0) { - if (this.isRitualOkay(this.world)) { + if (this.isRitualOkay()) { this.timer++; - if (this.timer % 3 == 0 && this.timer < this.totalTime / 2) { + if (this.timer % 5 == 0 && this.timer < this.totalTime / 2) { for (BlockPos pos : this.involvedStands.keySet()) { PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream( - (float) pos.getX() + 0.5F, (float) pos.getY() + 1.25F, (float) pos.getZ() + 0.5F, - this.ritualPos.getX() + 0.5F, this.ritualPos.getY() + 2.5F, this.ritualPos.getZ() + 0.5F, - this.world.rand.nextFloat() * 0.02F + 0.02F, 0xFF00FF, this.world.rand.nextFloat() * 1F + 1F + (float) pos.getX() + 0.4F + this.world.rand.nextFloat() * 0.2F, + (float) pos.getY() + 1.05F + this.world.rand.nextFloat() * 0.35F, + (float) pos.getZ() + 0.4F + this.world.rand.nextFloat() * 0.2F, + this.ritualPos.getX() + 0.5F, this.ritualPos.getY() + this.world.rand.nextFloat() * 2F + 1F, this.ritualPos.getZ() + 0.5F, + this.world.rand.nextFloat() * 0.02F + 0.02F, 0x89cc37, this.world.rand.nextFloat() * 1F + 1F )); } } @@ -136,14 +137,20 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { } } - private boolean isRitualOkay(World world) { + private boolean isRitualOkay() { + for (int i = 0; i < 3; i++) { + IBlockState state = this.world.getBlockState(this.ritualPos.up(i)); + if (!(state.getBlock() instanceof BlockLog)) { + return false; + } + } for (Map.Entry entry : this.involvedStands.entrySet()) { - TileEntity tile = world.getTileEntity(entry.getKey()); + TileEntity tile = this.world.getTileEntity(entry.getKey()); if (!(tile instanceof TileEntityWoodStand) || (this.timer < this.totalTime / 2 && !((TileEntityWoodStand) tile).stack.isItemEqual(entry.getValue()))) { return false; } } - return Helper.checkMultiblock(world, this.ritualPos, TileEntityWoodStand.GOLD_POWDER_POSITIONS, ModBlocks.GOLD_POWDER.getDefaultState(), true); + return Helper.checkMultiblock(this.world, this.ritualPos, TileEntityWoodStand.GOLD_POWDER_POSITIONS, ModBlocks.GOLD_POWDER.getDefaultState(), true); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index 6802923e..d4800424 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -3,7 +3,9 @@ package de.ellpeck.naturesaura.packet; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand; import io.netty.buffer.ByteBuf; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; @@ -59,10 +61,12 @@ public class PacketParticles implements IMessage { BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ); for (BlockPos offset : TileEntityWoodStand.GOLD_POWDER_POSITIONS) { BlockPos dustPos = pos.add(offset); + IBlockState state = world.getBlockState(dustPos); + AxisAlignedBB box = state.getBlock().getBoundingBox(state, world, dustPos); NaturesAura.proxy.spawnMagicParticle(world, - dustPos.getX() + 0.375F + world.rand.nextFloat() * 0.25F, + dustPos.getX() + box.minX + (box.maxX - box.minX) * world.rand.nextFloat(), dustPos.getY() + 0.1F, - dustPos.getZ() + 0.375F + world.rand.nextFloat() * 0.25F, + dustPos.getZ() + box.minZ + (box.maxZ - box.minZ) * world.rand.nextFloat(), (float) world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.005F + 0.01F, (float) world.rand.nextGaussian() * 0.01F, @@ -74,7 +78,7 @@ public class PacketParticles implements IMessage { 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, - 0xFF00FF, 1.5F, 50, 0F, false, true); + 0x89cc37, 1.5F, 50, 0F, false, true); } break; case 2: @@ -90,7 +94,7 @@ public class PacketParticles implements IMessage { NaturesAura.proxy.spawnMagicParticle(world, message.posX, message.posY, message.posZ, world.rand.nextGaussian() * 0.05F, world.rand.nextGaussian() * 0.05F, world.rand.nextGaussian() * 0.05F, - 0xFF00FF, 2F, 200, 0F, true, true); + 0x89cc37, 2F, 200, 0F, true, true); } break; }