Fix top half of double flowers not sparkling with correct color. Also disable random offsetting because it's broken

This commit is contained in:
Vincent Lee committed 2016-04-09 21:25:41 -05:00
1 parent 533a287bd3
commit 5cdf48393a
1 file changed
+14 -5
@@ -35,6 +35,8 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -53,14 +55,12 @@ import java.util.Random;
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable {
private static final int COUNT = 8;
final int offset;
final boolean second;
private final boolean second;
public BlockModDoubleFlower(boolean second) {
this.second = second;
this.setHardness(0.0F);
this.setSoundType(SoundType.PLANT);
offset = second ? 8 : 0;
String name = LibBlockNames.DOUBLE_FLOWER + (second ? 2 : 1);
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
@@ -168,14 +168,23 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
}
@Override
public void randomDisplayTick(IBlockState state, World par1World, BlockPos pos, Random par5Random) {
@SideOnly(Side.CLIENT)
public Block.EnumOffsetType getOffsetType()
{
return Block.EnumOffsetType.NONE;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random par5Random) {
state = getActualState(state, world, pos);
int hex = state.getValue(second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1).getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = (hex & 0xFF);
if(par5Random.nextDouble() < ConfigHandler.flowerParticleFrequency)
Botania.proxy.sparkleFX(par1World, pos.getX() + 0.3 + par5Random.nextFloat() * 0.5, pos.getY() + 0.5 + par5Random.nextFloat() * 0.5, pos.getZ() + 0.3 + par5Random.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, par5Random.nextFloat(), 5);
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + par5Random.nextFloat() * 0.5, pos.getY() + 0.5 + par5Random.nextFloat() * 0.5, pos.getZ() + 0.3 + par5Random.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, par5Random.nextFloat(), 5);
}