From 7d48d1ffb96210e85211be55a6d695c8deacf135 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Wed, 18 Apr 2018 18:35:31 -0500 Subject: [PATCH] Fix some flower sparkle particles not accounting for vanilla flower random shifts --- .../vazkii/botania/api/subtile/SubTileGenerating.java | 10 ++++++++-- .../vazkii/botania/common/block/BlockModFlower.java | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/vazkii/botania/api/subtile/SubTileGenerating.java b/src/main/java/vazkii/botania/api/subtile/SubTileGenerating.java index b83cd58ef..b1f83bd15 100644 --- a/src/main/java/vazkii/botania/api/subtile/SubTileGenerating.java +++ b/src/main/java/vazkii/botania/api/subtile/SubTileGenerating.java @@ -24,6 +24,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.relauncher.Side; @@ -94,8 +95,13 @@ public class SubTileGenerating extends SubTileEntity { if(supertile.getWorld().isRemote) { double particleChance = 1F - (double) mana / (double) getMaxMana() / 3.5F; Color color = new Color(getColor()); - if(Math.random() > particleChance) - BotaniaAPI.internalHandler.sparkleFX(supertile.getWorld(), supertile.getPos().getX() + 0.3 + Math.random() * 0.5, supertile.getPos().getY() + 0.5 + Math.random() * 0.5, supertile.getPos().getZ() + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5); + if(Math.random() > particleChance) { + Vec3d offset = getWorld().getBlockState(getPos()).getOffset(getWorld(), getPos()); + double x = getPos().getX() + offset.x; + double y = getPos().getY() + offset.y; + double z = getPos().getZ() + offset.z; + BotaniaAPI.internalHandler.sparkleFX(supertile.getWorld(), x + 0.3 + Math.random() * 0.5, y + 0.5 + Math.random() * 0.5, z + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5); + } } boolean passive = isPassiveFlower(); diff --git a/src/main/java/vazkii/botania/common/block/BlockModFlower.java b/src/main/java/vazkii/botania/common/block/BlockModFlower.java index 860bc36c4..a34b551de 100644 --- a/src/main/java/vazkii/botania/common/block/BlockModFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockModFlower.java @@ -26,6 +26,7 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; @@ -124,9 +125,13 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IGrowab int r = (hex & 0xFF0000) >> 16; int g = (hex & 0xFF00) >> 8; int b = hex & 0xFF; + Vec3d offset = state.getOffset(world, pos); + double x = pos.getX() + offset.x; + double y = pos.getY() + offset.y; + double z = pos.getZ() + offset.z; if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency) - Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5); + Botania.proxy.sparkleFX(x + 0.3 + rand.nextFloat() * 0.5, y + 0.5 + rand.nextFloat() * 0.5, z + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5); } @Override