mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-25 22:44:44 +00:00
Fix terra plate not playing particles. Closes #2124
This commit is contained in:
2 files changed
+47
-36
No files matched your search
@@ -35,6 +35,8 @@ import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.network.PacketBotaniaEffect;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
|
||||
public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
|
||||
@@ -71,6 +73,9 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if(world.isRemote)
|
||||
return;
|
||||
|
||||
boolean removeMana = true;
|
||||
|
||||
if(hasValidPlatform()) {
|
||||
@@ -88,10 +93,13 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
otherSpark.registerTransfer(spark);
|
||||
}
|
||||
}
|
||||
if(mana > 0)
|
||||
doParticles();
|
||||
if(mana > 0) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
PacketHandler.sendToNearby(world, getPos(),
|
||||
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.TERRA_PLATE, getPos().getX(), getPos().getY(), getPos().getZ()));
|
||||
}
|
||||
|
||||
if(mana >= MAX_MANA && !worldObj.isRemote) {
|
||||
if(mana >= MAX_MANA) {
|
||||
EntityItem item = items.get(0);
|
||||
for(EntityItem otherItem : items)
|
||||
if(otherItem != item)
|
||||
@@ -109,38 +117,6 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
recieveMana(-1000);
|
||||
}
|
||||
|
||||
void doParticles() {
|
||||
if(worldObj.isRemote) {
|
||||
int ticks = (int) (100.0 * ((double) getCurrentMana() / (double) MAX_MANA));
|
||||
|
||||
int totalSpiritCount = 3;
|
||||
double tickIncrement = 360D / totalSpiritCount;
|
||||
|
||||
int speed = 5;
|
||||
double wticks = ticks * speed - tickIncrement;
|
||||
|
||||
double r = Math.sin((ticks - 100) / 10D) * 2;
|
||||
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
|
||||
|
||||
for(int i = 0; i < totalSpiritCount; i++) {
|
||||
double x = pos.getX() + Math.sin(wticks * Math.PI / 180) * r + 0.5;
|
||||
double y = pos.getY() + 0.25 + Math.abs(r) * 0.7;
|
||||
double z = pos.getZ() + Math.cos(wticks * Math.PI / 180) * r + 0.5;
|
||||
|
||||
wticks += tickIncrement;
|
||||
float[] colorsfx = new float[] {
|
||||
0F, (float) ticks / (float) 100, 1F - (float) ticks / (float) 100
|
||||
};
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F);
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F);
|
||||
|
||||
if(ticks == 100)
|
||||
for(int j = 0; j < 15; j++)
|
||||
Botania.proxy.wispFX(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityItem> getItems() {
|
||||
return worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -15,6 +16,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileTerraPlate;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
@@ -240,6 +242,38 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
|
||||
break;
|
||||
}
|
||||
case TERRA_PLATE: {
|
||||
TileEntity te = world.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||
if(te instanceof TileTerraPlate) {
|
||||
int ticks = (int) (100.0 * ((double) ((TileTerraPlate) te).getCurrentMana() / (double) TileTerraPlate.MAX_MANA));
|
||||
|
||||
int totalSpiritCount = 3;
|
||||
double tickIncrement = 360D / totalSpiritCount;
|
||||
|
||||
int speed = 5;
|
||||
double wticks = ticks * speed - tickIncrement;
|
||||
|
||||
double r = Math.sin((ticks - 100) / 10D) * 2;
|
||||
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
|
||||
|
||||
for(int i = 0; i < totalSpiritCount; i++) {
|
||||
double x = message.x + Math.sin(wticks * Math.PI / 180) * r + 0.5;
|
||||
double y = message.y + 0.25 + Math.abs(r) * 0.7;
|
||||
double z = message.z + Math.cos(wticks * Math.PI / 180) * r + 0.5;
|
||||
|
||||
wticks += tickIncrement;
|
||||
float[] colorsfx = new float[] {
|
||||
0F, (float) ticks / (float) 100, 1F - (float) ticks / (float) 100
|
||||
};
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F);
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F);
|
||||
|
||||
if(ticks == 100)
|
||||
for(int j = 0; j < 15; j++)
|
||||
Botania.proxy.wispFX(message.x + 0.5, message.y + 0.5, message.z + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -259,7 +293,8 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
ENCHANTER_CRAFT(0),
|
||||
ENCHANTER_DESTROY(0),
|
||||
ENTROPINNYUM(0),
|
||||
BLACK_LOTUS_DISSOLVE(0);
|
||||
BLACK_LOTUS_DISSOLVE(0),
|
||||
TERRA_PLATE(0);
|
||||
|
||||
private final int argCount;
|
||||
|
||||
|
||||
Reference in new issue
Block a user