mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-25 20:22:19 +00:00
prevent dedicated server crash (#100)
This commit is contained in:
1 parent
8dc27474ec
commit
9009b1372a
11 files changed
+95
-61
No files matched your search
@@ -393,6 +393,7 @@ public final class ClientProxy extends CommonProxy {
|
||||
return this.clientHandler.getEnergyCrystalAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tryRepositionPlayerOnMount(int entityId) {
|
||||
this.clientHandler.tryRepositionPlayerOnMount(entityId);
|
||||
}
|
||||
|
||||
+3
@@ -16,6 +16,8 @@ import com.brandon3055.draconicevolution.common.utils.DataUtils;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public final class ShieldRenderHandler {
|
||||
|
||||
@@ -31,6 +33,7 @@ public final class ShieldRenderHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void tickEnd(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.END && !shieldStatus.isEmpty()) {
|
||||
|
||||
@@ -335,6 +335,8 @@ public class CommonProxy {
|
||||
return dragonChunkLoader;
|
||||
}
|
||||
|
||||
public void tryRepositionPlayerOnMount(int entityId) {}
|
||||
|
||||
public void registerInhibitor(TileDislocatorInhibitor tile) {
|
||||
if (tile.hasWorldObj()) {
|
||||
registerInhibitor(this.serverInhibitorsMap, tile);
|
||||
|
||||
@@ -8,6 +8,9 @@ import net.minecraft.world.World;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.Particles;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 30/9/2015.
|
||||
*/
|
||||
@@ -62,18 +65,14 @@ public class EntityChaosBolt extends Entity {
|
||||
|
||||
if (ticks == 10 && !burst) {
|
||||
if (worldObj.isRemote) {
|
||||
DraconicEvolution.clientProxy().spawnParticle(
|
||||
new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 10),
|
||||
32);
|
||||
spawnParticles(10);
|
||||
}
|
||||
setDead();
|
||||
} else if (ticks > 10) {
|
||||
if (ticks < 25) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
if (worldObj.isRemote) {
|
||||
DraconicEvolution.clientProxy().spawnParticle(
|
||||
new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 0),
|
||||
32);
|
||||
spawnParticles(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +85,13 @@ public class EntityChaosBolt extends Entity {
|
||||
ticks++;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnParticles(int mode) {
|
||||
DraconicEvolution.clientProxy().spawnParticle(
|
||||
new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, mode),
|
||||
32);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound compound) {
|
||||
// if (compound.hasKey("ShardPos")){
|
||||
|
||||
+18
-7
@@ -13,6 +13,8 @@ import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
|
||||
import com.brandon3055.draconicevolution.common.utils.handlers.ProcessHandler;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 3/10/2015.
|
||||
@@ -41,12 +43,10 @@ public class EntityChaosVortex extends Entity {
|
||||
else ticksExisted = dataWatcher.getWatchableObjectInt(20);
|
||||
|
||||
if (ticksExisted < 30 && ticksExisted % 5 == 0 && worldObj.isRemote) {
|
||||
DraconicEvolution.clientProxy()
|
||||
.spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, false), 512);
|
||||
spawnChaosParticles(false);
|
||||
}
|
||||
if (ticksExisted >= 100 && ticksExisted < 130 && ticksExisted % 5 == 0 && worldObj.isRemote) {
|
||||
DraconicEvolution.clientProxy()
|
||||
.spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, true), 512);
|
||||
spawnChaosParticles(true);
|
||||
}
|
||||
if (ticksExisted < 100) return;
|
||||
|
||||
@@ -55,9 +55,7 @@ public class EntityChaosVortex extends Entity {
|
||||
double y = posY - 8 + rand.nextDouble() * 16;
|
||||
double z = posZ - 18 + rand.nextDouble() * 36;
|
||||
if (worldObj.isRemote) {
|
||||
DraconicEvolution.clientProxy().spawnParticle(
|
||||
new Particles.AdvancedSeekerParticle(worldObj, x, y, z, posX, posY, posZ, 2, 1f, 1f, 1f, 100),
|
||||
128);
|
||||
spawnSeekerParticles(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +71,19 @@ public class EntityChaosVortex extends Entity {
|
||||
if (ticksExisted > 620) setDead();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnChaosParticles(boolean shrink) {
|
||||
DraconicEvolution.clientProxy()
|
||||
.spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, shrink), 512);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnSeekerParticles(double x, double y, double z) {
|
||||
DraconicEvolution.clientProxy().spawnParticle(
|
||||
new Particles.AdvancedSeekerParticle(worldObj, x, y, z, posX, posY, posZ, 2, 1f, 1f, 1f, 100),
|
||||
128);
|
||||
}
|
||||
|
||||
private void shakeScreen() {
|
||||
double intensity = (ticksExisted - 130) / 100D;
|
||||
if (intensity > 1D) intensity = 1D;
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class MountUpdatePacket implements IMessage {
|
||||
return null;
|
||||
}
|
||||
|
||||
DraconicEvolution.clientProxy().tryRepositionPlayerOnMount(message.entityID);
|
||||
DraconicEvolution.proxy.tryRepositionPlayerOnMount(message.entityID);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -55,9 +55,9 @@ public class TileChaosShard extends TileEntity {
|
||||
|
||||
public void detonate() {
|
||||
if (!worldObj.isRemote
|
||||
&& locationHash != getLocationHash(xCoord, yCoord, zCoord, worldObj.provider.dimensionId))
|
||||
&& locationHash != getLocationHash(xCoord, yCoord, zCoord, worldObj.provider.dimensionId)) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
else {
|
||||
} else {
|
||||
EntityChaosVortex vortex = new EntityChaosVortex(worldObj);
|
||||
vortex.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
|
||||
worldObj.spawnEntityInWorld(vortex);
|
||||
|
||||
+7
-10
@@ -47,19 +47,16 @@ public class TileEnergyRelay extends TileRemoteEnergyBase {
|
||||
super.updateEntity();
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
ring = DraconicEvolution.clientProxy().energyField(
|
||||
worldObj,
|
||||
xCoord + 0.5,
|
||||
yCoord + 0.5,
|
||||
zCoord + 0.5,
|
||||
0,
|
||||
powerTier == 1,
|
||||
ring,
|
||||
inView > 0);
|
||||
return;
|
||||
spawnEnergyField();
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnEnergyField() {
|
||||
ring = DraconicEvolution.clientProxy()
|
||||
.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0, powerTier == 1, ring, inView > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
|
||||
+8
-1
@@ -78,7 +78,14 @@ public class TileEnergyTransceiver extends TileRemoteEnergyBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (worldObj.isRemote) particle = DraconicEvolution.clientProxy()
|
||||
if (worldObj.isRemote) {
|
||||
spawnParticle();
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnParticle() {
|
||||
particle = DraconicEvolution.clientProxy()
|
||||
.energyField(worldObj, getBeamX(), getBeamY(), getBeamZ(), 1, powerTier == 1, particle, inView > 0);
|
||||
}
|
||||
|
||||
|
||||
+18
-13
@@ -100,19 +100,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe
|
||||
rType = 1;
|
||||
else rType = 0;
|
||||
}
|
||||
device.beam = DraconicEvolution.clientProxy().energyBeam(
|
||||
worldObj,
|
||||
getBeamX(),
|
||||
getBeamY(),
|
||||
getBeamZ(),
|
||||
remoteTile.getBeamX(),
|
||||
remoteTile.getBeamY(),
|
||||
remoteTile.getBeamZ(),
|
||||
(int) device.energyFlow,
|
||||
getPowerTier() == 1,
|
||||
device.beam,
|
||||
true,
|
||||
rType);
|
||||
updateBeam(device, remoteTile, rType);
|
||||
} else {
|
||||
double difference = getCapacity() - remoteTile.getCapacity();
|
||||
double energyToEqual = Math
|
||||
@@ -137,6 +125,23 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void updateBeam(LinkedEnergyDevice device, IRemoteEnergyHandler remoteTile, int rType) {
|
||||
device.beam = DraconicEvolution.clientProxy().energyBeam(
|
||||
worldObj,
|
||||
getBeamX(),
|
||||
getBeamY(),
|
||||
getBeamZ(),
|
||||
remoteTile.getBeamX(),
|
||||
remoteTile.getBeamY(),
|
||||
remoteTile.getBeamZ(),
|
||||
(int) device.energyFlow,
|
||||
getPowerTier() == 1,
|
||||
device.beam,
|
||||
true,
|
||||
rType);
|
||||
}
|
||||
|
||||
protected void detectAndSendChanges(int index) {
|
||||
if (worldObj.isRemote) return;
|
||||
|
||||
|
||||
+23
-21
@@ -62,32 +62,13 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase {
|
||||
super.updateEntity();
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
ring = DraconicEvolution.clientProxy().energyField(
|
||||
worldObj,
|
||||
xCoord + 0.5,
|
||||
yCoord + 0.5,
|
||||
zCoord + 0.5,
|
||||
2,
|
||||
powerTier == 1,
|
||||
ring,
|
||||
inView > 0);
|
||||
spawnEnergyField();
|
||||
|
||||
for (LinkedReceiver receiver : receiverList) {
|
||||
int particleValue = 200;
|
||||
if (receiver.particleEnergyCounter > particleValue) {
|
||||
receiver.particleEnergyCounter -= particleValue;
|
||||
|
||||
// todo detect box size
|
||||
DraconicEvolution.clientProxy().spawnParticle(
|
||||
new Particles.TransceiverParticle(
|
||||
worldObj,
|
||||
xCoord + 0.5,
|
||||
yCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4),
|
||||
zCoord + 0.5,
|
||||
receiver.xCoord + worldObj.rand.nextDouble(),
|
||||
receiver.yCoord + worldObj.rand.nextDouble(),
|
||||
receiver.zCoord + worldObj.rand.nextDouble()),
|
||||
64);
|
||||
spawnParticles(receiver);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -120,6 +101,27 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase {
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnEnergyField() {
|
||||
ring = DraconicEvolution.clientProxy()
|
||||
.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 2, powerTier == 1, ring, inView > 0);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void spawnParticles(LinkedReceiver receiver) {
|
||||
// todo detect box size
|
||||
DraconicEvolution.clientProxy().spawnParticle(
|
||||
new Particles.TransceiverParticle(
|
||||
worldObj,
|
||||
xCoord + 0.5,
|
||||
yCoord + 0.3 + (worldObj.rand.nextDouble() * 0.4),
|
||||
zCoord + 0.5,
|
||||
receiver.xCoord + worldObj.rand.nextDouble(),
|
||||
receiver.yCoord + worldObj.rand.nextDouble(),
|
||||
receiver.zCoord + worldObj.rand.nextDouble()),
|
||||
64);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void receiveObjectFromServer(int index, Object object) {
|
||||
|
||||
Reference in new issue
Block a user