Updated client/server check
This commit is contained in:
parent
eda77d2a41
commit
b0039e5229
21 changed files with 30 additions and 51 deletions
|
@ -33,7 +33,6 @@ import net.minecraftforge.common.ForgeChunkManager;
|
|||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.block.movement.TileEntityShipCore;
|
||||
import cr0s.warpdrive.config.Dictionary;
|
||||
|
@ -163,7 +162,7 @@ public class EntityJump extends Entity {
|
|||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.UpgradeType;
|
||||
|
@ -206,7 +205,7 @@ public abstract class TileEntityAbstractEnergy extends TileEntityAbstractInterfa
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
|
@ -41,7 +40,7 @@ public abstract class TileEntityAbstractLaser extends TileEntityAbstractInterfac
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package cr0s.warpdrive.block;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
|
||||
|
@ -21,7 +20,7 @@ public class TileEntityAirGenerator extends TileEntityAbstractEnergy {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package cr0s.warpdrive.block;
|
|||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
|
||||
public class TileEntityLaserMedium extends TileEntityAbstractEnergy {
|
||||
|
@ -16,7 +15,7 @@ public class TileEntityLaserMedium extends TileEntityAbstractEnergy {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraft.nbt.NBTTagString;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
|
@ -66,7 +65,7 @@ public class TileEntityShipScanner extends TileEntityAbstractEnergy {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||
if (worldObj.isRemote)
|
||||
return;
|
||||
|
||||
if (++searchTicks > 20) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.LinkedList;
|
|||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -96,7 +95,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.config.Dictionary;
|
||||
|
@ -68,7 +67,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
|
@ -64,7 +63,7 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import li.cil.oc.api.machine.Callback;
|
|||
import li.cil.oc.api.machine.Context;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.api.IVideoChannel;
|
||||
|
@ -35,7 +34,7 @@ public class TileEntityMonitor extends TileEntityAbstractInterfaced implements I
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
if (!worldObj.isRemote) {
|
||||
packetSendTicks--;
|
||||
if (packetSendTicks <= 0) {
|
||||
packetSendTicks = PACKET_SEND_INTERVAL_TICKS;
|
||||
|
|
|
@ -8,7 +8,6 @@ import li.cil.oc.api.machine.Callback;
|
|||
import li.cil.oc.api.machine.Context;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
|
@ -45,7 +44,7 @@ public class TileEntityRadar extends TileEntityAbstractEnergy {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
|
@ -120,7 +119,7 @@ public class TileEntityIC2reactorLaserMonitor extends TileEntityAbstractEnergy {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
|
@ -49,7 +48,7 @@ public class TileEntityLift extends TileEntityAbstractEnergy {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractInterfaced;
|
||||
|
@ -86,7 +85,7 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.util.Vec3;
|
|||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.EntityJump;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
|
||||
|
@ -106,7 +105,7 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1130,7 +1129,7 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
|
|||
public void validate() {
|
||||
super.validate();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1139,7 +1138,7 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
|
|||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
if (!FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (!worldObj.isRemote) {
|
||||
WarpDrive.starMap.removeFromRegistry(new StarMapEntry(this));
|
||||
}
|
||||
super.invalidate();
|
||||
|
|
|
@ -2,7 +2,6 @@ package cr0s.warpdrive.block.passive;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -127,22 +126,22 @@ public class BlockAir extends Block {
|
|||
* Ticks the block if it's been scheduled
|
||||
*/
|
||||
@Override
|
||||
public void updateTick(World par1World, int x, int y, int z, Random par5Random) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
public void updateTick(World world, int x, int y, int z, Random par5Random) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
int concentration = par1World.getBlockMetadata(x, y, z);
|
||||
boolean isInSpaceWorld = par1World.provider.dimensionId == WarpDriveConfig.G_SPACE_DIMENSION_ID || par1World.provider.dimensionId == WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID;
|
||||
int concentration = world.getBlockMetadata(x, y, z);
|
||||
boolean isInSpaceWorld = world.provider.dimensionId == WarpDriveConfig.G_SPACE_DIMENSION_ID || world.provider.dimensionId == WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID;
|
||||
|
||||
// Remove air block to vacuum block
|
||||
if (concentration <= 0 || !isInSpaceWorld) {
|
||||
par1World.setBlock(x, y, z, Blocks.air, 0, 3); // replace our air block to vacuum block
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 3); // replace our air block to vacuum block
|
||||
} else {
|
||||
// Try to spread the air
|
||||
spreadAirBlock(par1World, x, y, z, concentration);
|
||||
spreadAirBlock(world, x, y, z, concentration);
|
||||
}
|
||||
par1World.scheduleBlockUpdate(x, y, z, this, 30 + 2 * concentration);
|
||||
world.scheduleBlockUpdate(x, y, z, this, 30 + 2 * concentration);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,6 @@ import li.cil.oc.api.machine.Context;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.api.IVideoChannel;
|
||||
|
@ -41,7 +40,7 @@ public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChan
|
|||
super.updateEntity();
|
||||
|
||||
// Update video channel on clients (recovery mechanism, no need to go too fast)
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
if (!worldObj.isRemote) {
|
||||
packetSendTicks--;
|
||||
if (packetSendTicks <= 0) {
|
||||
packetSendTicks = PACKET_SEND_INTERVAL_TICKS;
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.api.IBreathingHelmet;
|
||||
|
@ -45,7 +44,7 @@ public class LivingHandler {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onLivingUpdate(LivingUpdateEvent event) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (event.entityLiving == null || event.entityLiving.worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
|
@ -49,7 +48,7 @@ public class PacketHandler {
|
|||
|
||||
// Beam effect sent to client side
|
||||
public static void sendBeamPacket(World worldObj, Vector3 source, Vector3 target, float red, float green, float blue, int age, int energy, int radius) {
|
||||
assert(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER);
|
||||
assert(!worldObj.isRemote);
|
||||
|
||||
MessageBeamEffect beamMessage = new MessageBeamEffect(source, target, red, green, blue, age, energy);
|
||||
|
||||
|
@ -82,7 +81,7 @@ public class PacketHandler {
|
|||
}
|
||||
|
||||
public static void sendBeamPacketToPlayersInArea(World worldObj, Vector3 source, Vector3 target, float red, float green, float blue, int age, int energy, AxisAlignedBB aabb) {
|
||||
assert(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER);
|
||||
assert(!worldObj.isRemote);
|
||||
|
||||
MessageBeamEffect beamMessage = new MessageBeamEffect(source, target, red, green, blue, age, energy);
|
||||
// Send packet to all players within cloaked area
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.world.World;
|
|||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.network.PacketHandler;
|
||||
|
||||
|
@ -65,7 +64,7 @@ public final class EntityCamera extends EntityLivingBase {
|
|||
|
||||
@Override
|
||||
public void onEntityUpdate() {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (worldObj.isRemote) {
|
||||
if (player == null || player.isDead) {
|
||||
WarpDrive.logger.error(this + " Player is null or dead, closing camera...");
|
||||
closeCamera();
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public final class EntityStarCore extends Entity
|
||||
|
@ -119,7 +118,7 @@ public final class EntityStarCore extends Entity
|
|||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue