mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-22 05:02:30 +00:00
A bit of work on the power system, NBT and crash fixes.
This commit is contained in:
1 parent
e1d8683ff6
commit
013c32e274
4 files changed
+59
-60
No files matched your search
@@ -52,50 +52,6 @@ public class FXSparkle extends EntityFX
|
||||
{
|
||||
this(world, d, d1, d2, f, 0f, 0f, 0f, m);
|
||||
currentColor = type;
|
||||
switch (type) {
|
||||
case 0:
|
||||
particleRed=.75f + world.rand.nextFloat()*.25f;
|
||||
particleGreen=.25f + world.rand.nextFloat()*.25f;
|
||||
particleBlue=.75f + world.rand.nextFloat()*.25f;
|
||||
break;
|
||||
case 1:
|
||||
particleRed=.5f + world.rand.nextFloat()*.3f;
|
||||
particleGreen=.5f + world.rand.nextFloat()*.3f;
|
||||
particleBlue=.2f;
|
||||
break;
|
||||
case 2:
|
||||
particleRed=.2f;
|
||||
particleGreen=.2f;
|
||||
particleBlue=.7f + world.rand.nextFloat()*.3f;
|
||||
break;
|
||||
case 3:
|
||||
particleRed=.2f;
|
||||
particleGreen=.7f + world.rand.nextFloat()*.3f;
|
||||
particleBlue=.2f;
|
||||
break;
|
||||
case 4:
|
||||
particleRed=.7f + world.rand.nextFloat()*.3f;
|
||||
particleGreen=.2f;
|
||||
particleBlue=.2f;
|
||||
break;
|
||||
case 5:
|
||||
blendmode=771;
|
||||
particleRed= world.rand.nextFloat()*.1f;
|
||||
particleGreen= world.rand.nextFloat()*.1f;
|
||||
particleBlue= world.rand.nextFloat()*.1f;
|
||||
break;
|
||||
case 6:
|
||||
particleRed= .8f+world.rand.nextFloat()*.2f;
|
||||
particleGreen= .8f+world.rand.nextFloat()*.2f;
|
||||
particleBlue= .8f+world.rand.nextFloat()*.2f;
|
||||
break;
|
||||
case 7:
|
||||
particleRed=.2f;
|
||||
particleGreen=.5f + world.rand.nextFloat()*.3f;
|
||||
particleBlue=.6f + world.rand.nextFloat()*.3f;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public FXSparkle(World world, double d, double d1, double d2, double x, double y, double z,
|
||||
@@ -167,17 +123,8 @@ public class FXSparkle extends EntityFX
|
||||
prevPosY = posY;
|
||||
prevPosZ = posZ;
|
||||
|
||||
if (particleAge==0 && tinkle && worldObj.rand.nextInt(10)==0)
|
||||
worldObj.playSoundAtEntity(this, "random.orb", 0.02F, 0.7F * ((worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.6F + 2F));
|
||||
|
||||
if (particleAge++ >= particleMaxAge)
|
||||
{
|
||||
|
||||
setDead();
|
||||
}
|
||||
|
||||
|
||||
|
||||
motionY -= 0.040000000000000001D * particleGravity;
|
||||
if (noClip==false) pushOutOfBlocks(posX, (boundingBox.minY + boundingBox.maxY) / 2.0D, posZ);
|
||||
// moveEntity(motionX, motionY, motionZ);
|
||||
|
||||
@@ -21,9 +21,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
@@ -33,6 +30,11 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
private static final String TAG_COLLECTOR_X = "collectorX";
|
||||
private static final String TAG_COLLECTOR_Y = "collectorY";
|
||||
private static final String TAG_COLLECTOR_Z = "collectorZ";
|
||||
|
||||
int mana;
|
||||
|
||||
int sizeLastCheck = -1;
|
||||
@@ -124,12 +126,30 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_MANA, mana);
|
||||
mana = cmp.getInteger(TAG_MANA);
|
||||
|
||||
int x = cmp.getInteger(TAG_COLLECTOR_X);
|
||||
int y = cmp.getInteger(TAG_COLLECTOR_Y);
|
||||
int z = cmp.getInteger(TAG_COLLECTOR_Z);
|
||||
|
||||
if(supertile.worldObj != null) {
|
||||
TileEntity tileAt = supertile.worldObj.getBlockTileEntity(x, y, z);
|
||||
if(tileAt != null && tileAt instanceof IManaCollector)
|
||||
linkedCollector = tileAt;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
mana = cmp.getInteger(TAG_MANA);
|
||||
cmp.setInteger(TAG_MANA, mana);
|
||||
|
||||
int x = linkedCollector == null ? 0 : linkedCollector.xCoord;
|
||||
int y = linkedCollector == null ? -1 : linkedCollector.yCoord;
|
||||
int z = linkedCollector == null ? 0 : linkedCollector.zCoord;
|
||||
|
||||
cmp.setInteger(TAG_COLLECTOR_X, x);
|
||||
cmp.setInteger(TAG_COLLECTOR_Y, y);
|
||||
cmp.setInteger(TAG_COLLECTOR_Z, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,6 +44,7 @@ public class TileSpreader extends TileMod implements IManaCollector {
|
||||
|
||||
private static final int MAX_MANA = 1000;
|
||||
private static final String TAG_MANA = "mana";
|
||||
private static final String TAG_CAN_SHOOT = "canShoot";
|
||||
private static final String TAG_KNOWN_MANA = "knownMana";
|
||||
private static final String TAG_ROTATION_X = "rotationX";
|
||||
private static final String TAG_ROTATION_Y = "rotationY";
|
||||
@@ -113,6 +114,7 @@ public class TileSpreader extends TileMod implements IManaCollector {
|
||||
cmp.setInteger(TAG_MANA, mana);
|
||||
cmp.setFloat(TAG_ROTATION_X, rotationX);
|
||||
cmp.setFloat(TAG_ROTATION_Y, rotationY);
|
||||
cmp.setBoolean(TAG_CAN_SHOOT, canShootBurst);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,6 +122,7 @@ public class TileSpreader extends TileMod implements IManaCollector {
|
||||
mana = cmp.getInteger(TAG_MANA);
|
||||
rotationX = cmp.getFloat(TAG_ROTATION_X);
|
||||
rotationY = cmp.getFloat(TAG_ROTATION_Y);
|
||||
canShootBurst = cmp.getBoolean(TAG_CAN_SHOOT);
|
||||
|
||||
if(cmp.hasKey(TAG_KNOWN_MANA))
|
||||
knownMana = cmp.getInteger(TAG_KNOWN_MANA);
|
||||
@@ -225,7 +228,7 @@ public class TileSpreader extends TileMod implements IManaCollector {
|
||||
int ticksBeforeManaLoss = 100;
|
||||
// Apply ticks before mana loss changes here
|
||||
|
||||
float manaLossPerTick = 4F;
|
||||
float manaLossPerTick = 2F;
|
||||
// Apply mana loss per tick changes here
|
||||
|
||||
if(getCurrentMana() >= maxMana || fake) {
|
||||
@@ -270,7 +273,7 @@ public class TileSpreader extends TileMod implements IManaCollector {
|
||||
|
||||
@Override
|
||||
public void onClientDisplayTick() {
|
||||
if(worldObj != null) {
|
||||
if(worldObj != null && worldObj.getWorldVec3Pool() != null) {
|
||||
EntityManaBurst burst = getBurst(true);
|
||||
burst.getCollidedTile(false);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
import vazkii.botania.api.mana.IManaReceiver;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileSpreader;
|
||||
@@ -28,6 +29,13 @@ import vazkii.botania.common.block.tile.TileSpreader;
|
||||
public class EntityManaBurst extends EntityThrowable {
|
||||
|
||||
private static final String TAG_COLOR = "color";
|
||||
private static final String TAG_MANA = "mana";
|
||||
private static final String TAG_STARTING_MANA = "startingMana";
|
||||
private static final String TAG_MIN_MANA_LOSS = "minManaLoss";
|
||||
private static final String TAG_TICK_MANA_LOSS = "manaLossTick";
|
||||
private static final String TAG_SPREADER_X = "spreaderX";
|
||||
private static final String TAG_SPREADER_Y = "spreaderY";
|
||||
private static final String TAG_SPREADER_Z = "spreaderZ";
|
||||
|
||||
boolean fake = false;
|
||||
|
||||
@@ -97,12 +105,33 @@ public class EntityManaBurst extends EntityThrowable {
|
||||
public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeEntityToNBT(par1nbtTagCompound);
|
||||
par1nbtTagCompound.setInteger(TAG_COLOR, getColor());
|
||||
par1nbtTagCompound.setInteger(TAG_MANA, getMana());
|
||||
par1nbtTagCompound.setInteger(TAG_STARTING_MANA, getStartingMana());
|
||||
par1nbtTagCompound.setInteger(TAG_MIN_MANA_LOSS, getMinManaLoss());
|
||||
par1nbtTagCompound.setFloat(TAG_TICK_MANA_LOSS, getManaLossPerTick());
|
||||
|
||||
ChunkCoordinates coords = getBurstSourceChunkCoordinates();
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_X, coords.posX);
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_Y, coords.posY);
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_Z, coords.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readEntityFromNBT(par1nbtTagCompound);
|
||||
setColor(par1nbtTagCompound.getInteger(TAG_COLOR));
|
||||
setMana(par1nbtTagCompound.getInteger(TAG_MANA));
|
||||
setStartingMana(par1nbtTagCompound.getInteger(TAG_STARTING_MANA));
|
||||
setMinManaLoss(par1nbtTagCompound.getInteger(TAG_MIN_MANA_LOSS));
|
||||
setManaLossPerTick(par1nbtTagCompound.getFloat(TAG_TICK_MANA_LOSS));
|
||||
|
||||
int x = par1nbtTagCompound.getInteger(TAG_SPREADER_X);
|
||||
int y = par1nbtTagCompound.getInteger(TAG_SPREADER_Y);
|
||||
int z = par1nbtTagCompound.getInteger(TAG_SPREADER_Z);
|
||||
|
||||
TileEntity tile = worldObj.getBlockTileEntity(x, y, z);
|
||||
if(tile != null && tile instanceof IManaCollector)
|
||||
setBurstSourceCoords(x, y, z);
|
||||
}
|
||||
|
||||
public void particles() {
|
||||
|
||||
Reference in new issue
Block a user