Fix+tweak paint lens particles

This commit is contained in:
Vincent Lee committed 2016-05-01 22:43:33 -05:00
1 parent 96a1db97a9
commit 93656a9d43
3 files changed
+22 -10

No files matched your search

@@ -94,8 +94,6 @@ import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.world.SkyblockWorldEvents;
import vazkii.botania.common.world.WorldTypeSkyblock;
//import vazkii.botania.common.block.ModBanners;
public class CommonProxy {
public void preInit(FMLPreInitializationEvent event) {
@@ -23,6 +23,8 @@ import net.minecraft.util.math.RayTraceResult;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.common.Botania;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
import java.util.ArrayList;
import java.util.List;
@@ -74,13 +76,8 @@ public class LensPaint extends Lens {
if(stateThere.getValue(BotaniaAPI.paintableBlocks.get(block)) != placeColor
&& BotaniaAPI.paintableBlocks.get(block).getAllowedValues().contains(placeColor)) {
entity.worldObj.setBlockState(coords, stateThere.withProperty(BotaniaAPI.paintableBlocks.get(block), placeColor), 2);
int hex = placeColor.getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = (hex & 0xFF);
for(int i = 0; i < 4; i++)
Botania.proxy.sparkleFX(entity.worldObj, coords.getX() + (float) Math.random(), coords.getY() + (float) Math.random(), coords.getZ() + (float) Math.random(), r / 255F, g / 255F, b / 255F, 0.6F + (float) Math.random() * 0.3F, 5); // todo 1.8 noop right now due to serversiding
PacketHandler.sendToNearby(entity.worldObj, coords,
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.PAINT_LENS, coords.getX(), coords.getY(), coords.getZ(), placeColor.getMetadata()));
}
}
}
@@ -2,7 +2,9 @@ package vazkii.botania.common.network;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
@@ -83,6 +85,20 @@ public class PacketBotaniaEffect implements IMessage {
}
break;
}
case PAINT_LENS: {
EnumDyeColor placeColor = EnumDyeColor.byMetadata(message.args[0]);
int hex = placeColor.getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = (hex & 0xFF);
for(int i = 0; i < 10; i++) {
BlockPos pos = new BlockPos(message.x, message.y, message.z).offset(EnumFacing.VALUES[Minecraft.getMinecraft().theWorld.rand.nextInt(6)]);
Botania.proxy.sparkleFX(Minecraft.getMinecraft().theWorld,
pos.getX() + (float) Math.random(), pos.getY() + (float) Math.random(), pos.getZ() + (float) Math.random(),
r / 255F, g / 255F, b / 255F, 0.6F + (float) Math.random() * 0.5F, 5);
}
break;
}
}
});
@@ -93,7 +109,8 @@ public class PacketBotaniaEffect implements IMessage {
public enum EffectType {
POOL_CRAFT(0),
POOL_CHARGE(1);
POOL_CHARGE(1), // Arg: 1 if outputting, 0 if inputting
PAINT_LENS(1); // Arg: colour
private final int argCount;