Only spawn effects on client side (#89)

This commit is contained in:
DarkShadow44 authored and GitHub committed 2026-03-25 13:13:22 +01:00
1 parent 96ffb23eae
commit 0d3d390e22
13 files changed
+226 -152

No files matched your search

@@ -65,11 +65,13 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
if (partnerX - xCoord != 0) {
xInc = ((float) Math.copySign(.05, partnerX - xCoord)) * (worldObj.getTotalWorldTime() % 20);
}
ThaumicTinkerer.tcProxy.sparkle(
(float) (0.5 + i + xInc),
(float) (yCoord + 0.5),
(float) (j + 0.5 + zInc),
xCoord < partnerX || zCoord > partnerX ? 2 : 14);
if (worldObj.isRemote) {
ThaumicTinkerer.tcProxy.sparkle(
(float) (0.5 + i + xInc),
(float) (yCoord + 0.5),
(float) (j + 0.5 + zInc),
xCoord < partnerX || zCoord > partnerX ? 2 : 14);
}
j += Math.copySign(1, partnerZ - zCoord);
} while (j < partnerZ);
i += Math.copySign(1, partnerX - xCoord);
@@ -17,7 +17,8 @@ public class TileForcefield extends TileEntity {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
ticks--;
ThaumicTinkerer.tcProxy.blockSparkle(worldObj, xCoord, yCoord, zCoord, 255, 1);
if (worldObj.isRemote) {
ThaumicTinkerer.tcProxy.blockSparkle(worldObj, xCoord, yCoord, zCoord, 255, 1);
}
}
}
@@ -73,7 +73,9 @@ public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,
if (distanceSqrd > 1) {
MiscHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), speedMod * 0.25F);
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
if (worldObj.isRemote) {
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
}
}
}
}
@@ -43,6 +43,7 @@ import thaumic.tinkerer.common.lib.LibBlockNames;
public class TileRepairer extends TileEntity
implements ISidedInventory, IAspectContainer, IEssentiaTransport, IMovableTile {
private static final String TAG_TOOK_LAST_TICK = "tookLastTick";
private static final Map<Aspect, Integer> repairValues = new HashMap<>();
static {
@@ -53,12 +54,25 @@ public class TileRepairer extends TileEntity
public int ticksExisted = 0;
public boolean tookLastTick = true;
int dmgLastTick = 0;
ItemStack[] inventorySlots = new ItemStack[1];
@Override
public void updateEntity() {
if (++ticksExisted % 10 == 0) {
if (worldObj.isRemote) {
if (tookLastTick) {
ThaumicTinkerer.tcProxy.sparkle(
(float) (xCoord + 0.25 + Math.random() / 2F),
(float) (yCoord + 1 + Math.random() / 2F),
(float) (zCoord + 0.25 + Math.random() / 2F),
0);
}
return;
}
boolean oldTookLastTick = tookLastTick;
tookLastTick = false;
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
if (inventorySlots[0] != null) {
if (TinkersConstructCompat.isTConstructTool(inventorySlots[0])) {
@@ -66,18 +80,11 @@ public class TileRepairer extends TileEntity
if (dmg > 0) {
int essentia = drawEssentia();
TinkersConstructCompat.fixDamage(inventorySlots[0], essentia);
int newDmg = TinkersConstructCompat.getDamage(inventorySlots[0]);
tookLastTick = newDmg != dmg;
markDirty();
if (dmgLastTick != 0 && dmgLastTick != dmg) {
ThaumicTinkerer.tcProxy.sparkle(
(float) (xCoord + 0.25 + Math.random() / 2F),
(float) (yCoord + 1 + Math.random() / 2F),
(float) (zCoord + 0.25 + Math.random() / 2F),
0);
tookLastTick = true;
} else tookLastTick = false;
} else tookLastTick = false;
dmgLastTick = inventorySlots[0] == null ? 0
: TinkersConstructCompat.getDamage(inventorySlots[0]);
}
if (tookLastTick != oldTookLastTick) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
return;
}
}
@@ -85,20 +92,12 @@ public class TileRepairer extends TileEntity
if (inventorySlots[0] != null && inventorySlots[0].getItemDamage() > 0) {
int essentia = drawEssentia();
int dmg = inventorySlots[0].getItemDamage();
inventorySlots[0].setItemDamage(Math.max(0, dmg - essentia));
int newDmg = Math.max(0, dmg - essentia);
inventorySlots[0].setItemDamage(newDmg);
tookLastTick = newDmg != dmg;
markDirty();
if (dmgLastTick != 0 && dmgLastTick != dmg) {
ThaumicTinkerer.tcProxy.sparkle(
(float) (xCoord + 0.25 + Math.random() / 2F),
(float) (yCoord + 1 + Math.random() / 2F),
(float) (zCoord + 0.25 + Math.random() / 2F),
0);
tookLastTick = true;
} else tookLastTick = false;
} else tookLastTick = false;
dmgLastTick = inventorySlots[0] == null ? 0 : inventorySlots[0].getItemDamage();
}
if (tookLastTick != oldTookLastTick) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
@@ -117,6 +116,7 @@ public class TileRepairer extends TileEntity
}
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
tookLastTick = par1NBTTagCompound.getBoolean(TAG_TOOK_LAST_TICK);
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
inventorySlots = new ItemStack[1];
@@ -127,6 +127,7 @@ public class TileRepairer extends TileEntity
}
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
par1NBTTagCompound.setBoolean(TAG_TOOK_LAST_TICK, tookLastTick);
NBTTagList nbttaglist = new NBTTagList();
if (inventorySlots[0] != null) {
NBTTagCompound tagList = new NBTTagCompound();
@@ -51,22 +51,23 @@ public class TileWarpGate extends TileEntity implements IInventory {
if (!destGate.locked) {
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 1F);
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
(float) player.posY + player.worldObj.rand.nextFloat(),
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
6);
if (player.worldObj.isRemote) {
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
(float) player.posY + player.worldObj.rand.nextFloat(),
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
6);
}
player.mountEntity(null);
if (player instanceof EntityPlayerMP) ((EntityPlayerMP) player).playerNetServerHandler
.setPlayerLocation(x + 0.5, y + 1.6, z + 0.5, player.rotationYaw, player.rotationPitch);
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
(float) player.posY + player.worldObj.rand.nextFloat(),
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
6);
if (player.worldObj.isRemote) {
for (int i = 0; i < 20; i++) ThaumicTinkerer.tcProxy.sparkle(
(float) player.posX + player.worldObj.rand.nextFloat() - 0.5F,
(float) player.posY + player.worldObj.rand.nextFloat(),
(float) player.posZ + player.worldObj.rand.nextFloat() - 0.5F,
6);
}
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 0.1F);
return true;
} else
@@ -85,11 +85,13 @@ public class ItemXPTalisman extends ItemBase implements IBauble {
int xp = getXP(par1ItemStack);
setXP(par1ItemStack, xp - LibFeatures.XP_TALISMAN_ENCHANTING_BOTTLE_COST);
par2World.playSoundAtEntity(par3EntityPlayer, "random.orb", 0.1F, (float) (0.1F + Math.random() / 2F));
for (int i = 0; par2World.isRemote && i < 6; i++) ThaumicTinkerer.tcProxy.sparkle(
(float) (par3EntityPlayer.posX + (Math.random() - 0.5)),
(float) (par3EntityPlayer.posY + Math.random() - 0.5),
(float) (par3EntityPlayer.posZ + (Math.random() - 0.5)),
3);
if (par2World.isRemote) {
for (int i = 0; par2World.isRemote && i < 6; i++) ThaumicTinkerer.tcProxy.sparkle(
(float) (par3EntityPlayer.posX + (Math.random() - 0.5)),
(float) (par3EntityPlayer.posY + Math.random() - 0.5),
(float) (par3EntityPlayer.posZ + (Math.random() - 0.5)),
3);
}
}
}
@@ -97,10 +99,13 @@ public class ItemXPTalisman extends ItemBase implements IBauble {
}
private void consumeXPOrb(EntityXPOrb orb) {
orb.setDead();
orb.worldObj.playSoundAtEntity(orb, "thaumcraft:zap", orb.getXpValue() / 10F, 1F);
ThaumicTinkerer.tcProxy
.wispFX(orb.worldObj, orb.posX, orb.posY, orb.posZ, orb.getXpValue() / 5F, 0.1F, 0.9F, 0.1F);
if (!orb.worldObj.isRemote) {
orb.setDead();
orb.worldObj.playSoundAtEntity(orb, "thaumcraft:zap", orb.getXpValue() / 10F, 1F);
} else {
ThaumicTinkerer.tcProxy
.wispFX(orb.worldObj, orb.posX, orb.posY, orb.posZ, orb.getXpValue() / 5F, 0.1F, 0.9F, 0.1F);
}
}
@Override
@@ -179,13 +184,15 @@ public class ItemXPTalisman extends ItemBase implements IBauble {
@Override
public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) {
World par2World = player.worldObj;
if (par1ItemStack.getItemDamage() == 1 && !par2World.isRemote) {
if (par1ItemStack.getItemDamage() == 1) {
int r = LibFeatures.XP_TALISMAN_RANGE;
int currentXP = getXP(par1ItemStack);
int xpToAdd = 0;
int maxXP = LibFeatures.XP_TALISMAN_MAX_XP - currentXP; // Max, to prevent overflow.
if (maxXP <= 0) {
par1ItemStack.setItemDamage(0);
if (!par2World.isRemote) {
par1ItemStack.setItemDamage(0);
}
return; // Can't take any XP.
}
@@ -211,8 +218,9 @@ public class ItemXPTalisman extends ItemBase implements IBauble {
if (maxXP <= 0) break;
}
}
setXP(par1ItemStack, Math.min(LibFeatures.XP_TALISMAN_MAX_XP, currentXP + xpToAdd));
if (!par2World.isRemote) {
setXP(par1ItemStack, Math.min(LibFeatures.XP_TALISMAN_MAX_XP, currentXP + xpToAdd));
}
}
}
@@ -83,10 +83,10 @@ public class ItemFocusDeflect extends ItemModFocus {
(e.posX - p.posX) * (e.posX - p.posX) + (e.posY - p.posY) * (e.posY - p.posY)
+ (e.posZ - p.posZ) * (e.posZ - p.posZ))
* 2);
for (int i = 0; i < 6; i++)
ThaumicTinkerer.tcProxy.sparkle((float) e.posX, (float) e.posY, (float) e.posZ, 6);
if (p.worldObj.isRemote) {
for (int i = 0; i < 6; i++)
ThaumicTinkerer.tcProxy.sparkle((float) e.posX, (float) e.posY, (float) e.posZ, 6);
}
e.posX += motionVec.x;
e.posY += motionVec.y;
e.posZ += motionVec.z;
@@ -126,15 +126,17 @@ public class ItemFocusDislocation extends ItemModFocus {
tile1.zCoord = mop.blockZ;
world.setTileEntity(mop.blockX, mop.blockY, mop.blockZ, tile1);
}
} else player.swingItem();
} else {
player.swingItem();
for (int i = 0; i < 8; i++) {
float x = (float) (mop.blockX + Math.random());
float y = (float) (mop.blockY + Math.random()) + 0.65F;
float z = (float) (mop.blockZ + Math.random());
ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
}
}
clearPickedBlock(itemstack);
for (int i = 0; i < 8; i++) {
float x = (float) (mop.blockX + Math.random());
float y = (float) (mop.blockY + Math.random()) + 0.65F;
float z = (float) (mop.blockZ + Math.random());
ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
}
world.playSoundAtEntity(player, "thaumcraft:wand", 0.5F, 1F);
}
} else if (!blacklist.contains(block) && isBlockAllowed(block)
@@ -146,13 +148,13 @@ public class ItemFocusDislocation extends ItemModFocus {
world.removeTileEntity(mop.blockX, mop.blockY, mop.blockZ);
world.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.air, 0, 1 | 2);
storePickedBlock(itemstack, block, (short) meta, tile);
}
for (int i = 0; i < 8; i++) {
float x = (float) (mop.blockX + Math.random());
float y = (float) (mop.blockY + Math.random());
float z = (float) (mop.blockZ + Math.random());
ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
} else {
for (int i = 0; i < 8; i++) {
float x = (float) (mop.blockX + Math.random());
float y = (float) (mop.blockY + Math.random());
float z = (float) (mop.blockZ + Math.random());
ThaumicTinkerer.tcProxy.burst(world, x, y, z, 0.2F);
}
}
world.playSoundAtEntity(player, block.stepSound.getBreakSound(), 1F, 1F);
world.playSoundAtEntity(player, "thaumcraft:wand", 0.5F, 1F);
@@ -56,15 +56,17 @@ public class ItemFocusFlight extends ItemModFocus {
if (p instanceof EntityPlayerMP) {
((EntityPlayerMP) p).playerNetServerHandler.floatingTickCount = 0;
}
for (int i = 0; i < 5; i++) ThaumicTinkerer.tcProxy.smokeSpiral(
world,
p.posX,
p.posY - p.motionY,
p.posZ,
2F,
(int) (Math.random() * 360),
(int) p.posY,
0x9E2FF);
if (world.isRemote) {
for (int i = 0; i < 5; i++) ThaumicTinkerer.tcProxy.smokeSpiral(
world,
p.posX,
p.posY - p.motionY,
p.posZ,
2F,
(int) (Math.random() * 360),
(int) p.posY,
0x9E2FF);
}
world.playSoundAtEntity(p, "thaumcraft:wind", 0.4F, 1F);
}
@@ -58,11 +58,13 @@ public class ItemFocusHeal extends ItemModFocus {
int progress = playerHealData.get(p.getGameProfile().getName()) + 1;
playerHealData.put(p.getGameProfile().getName(), progress);
ThaumicTinkerer.tcProxy.sparkle(
(float) p.posX + p.worldObj.rand.nextFloat() - 0.5F,
(float) p.posY + p.worldObj.rand.nextFloat(),
(float) p.posZ + p.worldObj.rand.nextFloat() - 0.5F,
0);
if (p.worldObj.isRemote) {
ThaumicTinkerer.tcProxy.sparkle(
(float) p.posX + p.worldObj.rand.nextFloat() - 0.5F,
(float) p.posY + p.worldObj.rand.nextFloat(),
(float) p.posZ + p.worldObj.rand.nextFloat() - 0.5F,
0);
}
if (progress >= 30 - potency * 10 / 3) {
playerHealData.put(p.getGameProfile().getName(), 0);
@@ -117,21 +117,23 @@ public class ItemFocusSmelt extends ItemModFocus {
p.worldObj.playSoundAtEntity(p, "fire.fire", 1F, 1F);
// Particle
////////////////////
for (int i = 0; i < 25; i++) {
double x = pos.blockX + Math.random();
double y = pos.blockY + Math.random();
double z = pos.blockZ + Math.random();
if (p.worldObj.isRemote) {
for (int i = 0; i < 25; i++) {
double x = pos.blockX + Math.random();
double y = pos.blockY + Math.random();
double z = pos.blockZ + Math.random();
ThaumicTinkerer.tcProxy.wispFX2(
p.worldObj,
x,
y,
z,
(float) Math.random() / 2F,
4,
true,
true,
(float) -Math.random() / 10F);
ThaumicTinkerer.tcProxy.wispFX2(
p.worldObj,
x,
y,
z,
(float) Math.random() / 2F,
4,
true,
true,
(float) -Math.random() / 10F);
}
}
}
}
@@ -146,21 +148,23 @@ public class ItemFocusSmelt extends ItemModFocus {
if (time % soundCooldown == 0) p.worldObj.playSoundAtEntity(p, "fire.fire", 0.2F, 1F);
// Particle
////////////////////
for (int i = 0; i < 2; i++) {
double x = pos.blockX + Math.random();
double y = pos.blockY + Math.random();
double z = pos.blockZ + Math.random();
if (p.worldObj.isRemote) {
for (int i = 0; i < 2; i++) {
double x = pos.blockX + Math.random();
double y = pos.blockY + Math.random();
double z = pos.blockZ + Math.random();
ThaumicTinkerer.tcProxy.wispFX2(
p.worldObj,
x,
y,
z,
(float) Math.random() / 2F,
4,
true,
true,
(float) -Math.random() / 10F);
ThaumicTinkerer.tcProxy.wispFX2(
p.worldObj,
x,
y,
z,
(float) Math.random() / 2F,
4,
true,
true,
(float) -Math.random() / 10F);
}
}
}
@@ -65,7 +65,9 @@ public class ItemFocusTelekinesis extends ItemModFocus {
if (!entities.isEmpty() && wand.consumeAllVis(stack, player, getVisCost(stack), true, false)) {
for (EntityItem item : entities) {
MiscHelper.setEntityMotionFromVector(item, target, 0.3333F);
ThaumicTinkerer.tcProxy.sparkle((float) item.posX, (float) item.posY, (float) item.posZ, 0);
if (player.worldObj.isRemote) {
ThaumicTinkerer.tcProxy.sparkle((float) item.posX, (float) item.posY, (float) item.posZ, 0);
}
}
}
}
@@ -19,20 +19,30 @@ import thaumic.tinkerer.common.block.BlockForcefield;
*/
public class PotionEffectHandler {
public static HashMap<Entity, Long> airPotionHit = new HashMap<>();
public static HashMap<Entity, Long> firePotionHit = new HashMap<>();
public static HashMap<Entity, Long> airPotionHitClient = new HashMap<>();
public static HashMap<Entity, Long> airPotionHitServer = new HashMap<>();
public static HashMap<Entity, Long> firePotionHitClient = new HashMap<>();
public static HashMap<Entity, Long> firePotionHitServer = new HashMap<>();
@SubscribeEvent
public void onLivingHurt(LivingAttackEvent e) {
if (e.source.getSourceOfDamage() instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) e.source.getSourceOfDamage();
if (p.isPotionActive(ModPotions.potionAir) && !p.worldObj.isRemote) {
airPotionHit.put(e.entity, e.entity.worldObj.getTotalWorldTime());
if (p.isPotionActive(ModPotions.potionAir)) {
if (p.worldObj.isRemote) {
airPotionHitClient.put(e.entity, e.entity.worldObj.getTotalWorldTime());
} else {
airPotionHitServer.put(e.entity, e.entity.worldObj.getTotalWorldTime());
}
}
if (p.isPotionActive(ModPotions.potionFire) && !p.worldObj.isRemote) {
firePotionHit.put(e.entity, e.entity.worldObj.getTotalWorldTime());
if (p.isPotionActive(ModPotions.potionFire)) {
if (p.worldObj.isRemote) {
firePotionHitClient.put(e.entity, e.entity.worldObj.getTotalWorldTime());
} else {
firePotionHitServer.put(e.entity, e.entity.worldObj.getTotalWorldTime());
}
}
if (p.isPotionActive(ModPotions.potionEarth) && !p.worldObj.isRemote) {
if (p.isPotionActive(ModPotions.potionEarth)) {
boolean xAxis = Math.abs(e.entity.posZ - p.posZ) < Math.abs(e.entity.posX - p.posX);
int centerX = (int) ((e.entity.posX + p.posX) / 2);
@@ -42,26 +52,33 @@ public class PotionEffectHandler {
for (int i = -2; i < 3; i++) {
for (int j = -2; j < 3; j++) {
if (xAxis) {
if (p.worldObj.isAirBlock(centerX, centerY + i, centerZ + j)) {
p.worldObj.setBlock(
centerX,
centerY + i,
centerZ + j,
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockForcefield.class));
if (!p.worldObj.isRemote) {
if (p.worldObj.isAirBlock(centerX, centerY + i, centerZ + j)) {
p.worldObj.setBlock(
centerX,
centerY + i,
centerZ + j,
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockForcefield.class));
}
} else {
ThaumicTinkerer.tcProxy
.blockSparkle(p.worldObj, centerX, centerY + i, centerZ + j, 100, 100);
}
} else {
if (p.worldObj.isAirBlock(centerX + j, centerY + i, centerZ)) {
p.worldObj.setBlock(
centerX + j,
centerY + i,
centerZ,
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockForcefield.class));
} else {
if (!p.worldObj.isRemote) {
if (p.worldObj.isAirBlock(centerX + j, centerY + i, centerZ)) {
p.worldObj.setBlock(
centerX + j,
centerY + i,
centerZ,
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockForcefield.class));
}
} else {
ThaumicTinkerer.tcProxy
.blockSparkle(p.worldObj, centerX + j, centerY + i, centerZ, 100, 100);
}
}
}
}
@@ -78,7 +95,9 @@ public class PotionEffectHandler {
if (e.player.worldObj.getBlock(x, y, z) == Blocks.lava
|| e.player.worldObj.getBlock(x, y, z) == Blocks.flowing_lava) {
e.player.worldObj.setBlock(x, y, z, Blocks.obsidian);
ThaumicTinkerer.tcProxy.burst(e.player.worldObj, x + .5, y + .5, z + .5, 1.2F);
if (e.player.worldObj.isRemote) {
ThaumicTinkerer.tcProxy.burst(e.player.worldObj, x + .5, y + .5, z + .5, 1.2F);
}
}
}
}
@@ -87,31 +106,27 @@ public class PotionEffectHandler {
}
@SubscribeEvent
public void onTick(TickEvent.ServerTickEvent e) {
public void onTickClient(TickEvent.ClientTickEvent e) {
Iterator<Entity> iter = airPotionHit.keySet().iterator();
Iterator<Entity> iter = airPotionHitClient.keySet().iterator();
while (iter.hasNext()) {
Entity target = (Entity) iter.next();
Entity target = iter.next();
if (target.isEntityAlive()) {
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
Random rand = new Random();
target.setVelocity(rand.nextFloat() - .5, rand.nextFloat(), rand.nextFloat() - .5);
ThaumicTinkerer.tcProxy.burst(target.worldObj, target.posX, target.posY, target.posZ, .5F);
}
}
if (target.worldObj.getTotalWorldTime() > airPotionHit.get(target) + 20) {
if (target.worldObj.getTotalWorldTime() > airPotionHitClient.get(target) + 20) {
iter.remove();
}
}
// Fire Potion
iter = firePotionHit.keySet().iterator();
iter = firePotionHitClient.keySet().iterator();
while (iter.hasNext()) {
Entity target = (Entity) iter.next();
Entity target = iter.next();
if (target.isEntityAlive()) {
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
Random rand = new Random();
target.setFire(6);
for (int i = 0; i < 30; i++) {
double theta = rand.nextFloat() * 2 * Math.PI;
@@ -138,7 +153,39 @@ public class PotionEffectHandler {
}
}
}
if (target.worldObj.getTotalWorldTime() > firePotionHit.get(target) + 6000) {
if (target.worldObj.getTotalWorldTime() > firePotionHitClient.get(target) + 6000) {
iter.remove();
}
}
}
@SubscribeEvent
public void onTickServer(TickEvent.ServerTickEvent e) {
Iterator<Entity> iter = airPotionHitServer.keySet().iterator();
while (iter.hasNext()) {
Entity target = iter.next();
if (target.isEntityAlive()) {
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
Random rand = new Random();
target.setVelocity(rand.nextFloat() - .5, rand.nextFloat(), rand.nextFloat() - .5);
}
}
if (target.worldObj.getTotalWorldTime() > airPotionHitServer.get(target) + 20) {
iter.remove();
}
}
// Fire Potion
iter = firePotionHitServer.keySet().iterator();
while (iter.hasNext()) {
Entity target = iter.next();
if (target.isEntityAlive()) {
if (target.worldObj.getTotalWorldTime() % 5 == 0) {
target.setFire(6);
}
}
if (target.worldObj.getTotalWorldTime() > firePotionHitServer.get(target) + 6000) {
iter.remove();
}
}