I messed that up >.>. Fix server crash on startup #272

This commit is contained in:
Vincent Lee committed 2016-05-10 23:21:38 -05:00
1 parent bf0712a75c
commit ae71a4756c
5 files changed
+54 -55

No files matched your search

@@ -55,10 +55,8 @@ import vazkii.botania.common.block.tile.TileMod;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.core.handler.MethodHandles;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ItemManaTablet;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.network.EffectType;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
@@ -194,7 +192,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
}
PacketHandler.sendToNearby(worldObj, getPos(),
new PacketBotaniaEffect(EffectType.POOL_CRAFT, pos.getX(), pos.getY(), pos.getZ()));
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.POOL_CRAFT, pos.getX(), pos.getY(), pos.getZ()));
}
@Override
@@ -267,7 +265,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
if(didSomething) {
if(ConfigHandler.chargingAnimationEnabled && worldObj.rand.nextInt(20) == 0) {
PacketHandler.sendToNearby(worldObj, getPos(),
new PacketBotaniaEffect(EffectType.POOL_CHARGE, getPos().getX(), getPos().getY(), getPos().getZ(), outputting ? 1 : 0));
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.POOL_CHARGE, getPos().getX(), getPos().getY(), getPos().getZ(), outputting ? 1 : 0));
}
isDoingTransfer = outputting;
}
@@ -78,7 +78,6 @@ import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.EffectType;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
@@ -190,7 +189,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBoss {
if(!hasProperArena(world, pos)) {
PacketHandler.sendTo((EntityPlayerMP) player,
new PacketBotaniaEffect(EffectType.ARENA_INDICATOR, pos.getX(), pos.getY(), pos.getZ()));
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ARENA_INDICATOR, pos.getX(), pos.getY(), pos.getZ()));
player.addChatMessage(new TextComponentTranslation("botaniamisc.badArena").setStyle(new Style().setColor(TextFormatting.RED)));
return false;
@@ -22,8 +22,6 @@ import net.minecraft.util.math.BlockPos;
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.EffectType;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
@@ -78,7 +76,7 @@ public class LensPaint extends Lens {
&& BotaniaAPI.paintableBlocks.get(block).getAllowedValues().contains(placeColor)) {
entity.worldObj.setBlockState(coords, stateThere.withProperty(BotaniaAPI.paintableBlocks.get(block), placeColor), 2);
PacketHandler.sendToNearby(entity.worldObj, coords,
new PacketBotaniaEffect(EffectType.PAINT_LENS, coords.getX(), coords.getY(), coords.getZ(), placeColor.getMetadata()));
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.PAINT_LENS, coords.getX(), coords.getY(), coords.getZ(), placeColor.getMetadata()));
}
}
}
@@ -62,54 +62,58 @@ public class PacketBotaniaEffect implements IMessage {
@Override
public IMessage onMessage(final PacketBotaniaEffect message, final MessageContext ctx) {
Minecraft.getMinecraft().addScheduledTask(() -> {
switch (message.type) {
case POOL_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(Minecraft.getMinecraft().theWorld, message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
Minecraft.getMinecraft().addScheduledTask(new Runnable() {
// Use anon - lambda causes classloading issues
@Override
public void run() {
switch (message.type) {
case POOL_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(Minecraft.getMinecraft().theWorld, message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
break;
}
break;
}
case POOL_CHARGE: {
if(ConfigHandler.chargingAnimationEnabled) {
boolean outputting = message.args[0] == 1;
BlockPos pos = new BlockPos(message.x, message.y, message.z);
Vector3 itemVec = Vector3.fromBlockPos(pos).add(0.5, 0.5 + Math.random() * 0.3, 0.5);
Vector3 tileVec = Vector3.fromBlockPos(pos).add(0.2 + Math.random() * 0.6, 0, 0.2 + Math.random() * 0.6);
LightningHandler.spawnLightningBolt(Minecraft.getMinecraft().theWorld, outputting ? tileVec : itemVec,
outputting ? itemVec : tileVec, 80, Minecraft.getMinecraft().theWorld.rand.nextLong(), 0x4400799c, 0x4400C6FF);
case POOL_CHARGE: {
if(ConfigHandler.chargingAnimationEnabled) {
boolean outputting = message.args[0] == 1;
BlockPos pos = new BlockPos(message.x, message.y, message.z);
Vector3 itemVec = Vector3.fromBlockPos(pos).add(0.5, 0.5 + Math.random() * 0.3, 0.5);
Vector3 tileVec = Vector3.fromBlockPos(pos).add(0.2 + Math.random() * 0.6, 0, 0.2 + Math.random() * 0.6);
LightningHandler.spawnLightningBolt(Minecraft.getMinecraft().theWorld, outputting ? tileVec : itemVec,
outputting ? itemVec : tileVec, 80, Minecraft.getMinecraft().theWorld.rand.nextLong(), 0x4400799c, 0x4400C6FF);
}
break;
}
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);
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;
}
break;
}
case ARENA_INDICATOR: {
for(int i = 0; i < 360; i += 8) {
float r = 1F;
float g = 0F;
float b = 1F;
float rad = i * (float) Math.PI / 180F;
double x = message.x + 0.5 - Math.cos(rad) * EntityDoppleganger.ARENA_RANGE;
double y = message.y + 0.5;
double z = message.z + 0.5 - Math.sin(rad) * EntityDoppleganger.ARENA_RANGE;
case ARENA_INDICATOR: {
for(int i = 0; i < 360; i += 8) {
float r = 1F;
float g = 0F;
float b = 1F;
float rad = i * (float) Math.PI / 180F;
double x = message.x + 0.5 - Math.cos(rad) * EntityDoppleganger.ARENA_RANGE;
double y = message.y + 0.5;
double z = message.z + 0.5 - Math.sin(rad) * EntityDoppleganger.ARENA_RANGE;
Botania.proxy.sparkleFX(Minecraft.getMinecraft().theWorld, x, y, z, r, g, b, 5F, 120);
Botania.proxy.sparkleFX(Minecraft.getMinecraft().theWorld, x, y, z, r, g, b, 5F, 120);
}
}
}
}
@@ -119,7 +123,7 @@ public class PacketBotaniaEffect implements IMessage {
}
}
private enum EffectType {
public enum EffectType {
POOL_CRAFT(0),
POOL_CHARGE(1), // Arg: 1 if outputting, 0 if inputting
PAINT_LENS(1), // Arg: colour
@@ -16,7 +16,7 @@ public final class PacketHandler {
private static final SimpleNetworkWrapper HANDLER = new SimpleNetworkWrapper(LibMisc.MOD_ID);
public static void init() {
HANDLER.registerMessage(HandlerBotaniaEffect.class, PacketBotaniaEffect.class, 0, Side.CLIENT);
HANDLER.registerMessage(PacketBotaniaEffect.Handler.class, PacketBotaniaEffect.class, 0, Side.CLIENT);
}
/**