Insulated Server from Client Entities.

This commit is contained in:
AlgorithmX2 2014-01-28 13:27:22 -06:00
parent 9a64980443
commit 373f062deb
7 changed files with 36 additions and 19 deletions

2
api

@ -1 +1 @@
Subproject commit 573265e8d674511b455a24862a6da6710e945e58
Subproject commit d9b2b1442347a580e89c86f1108aeaac2b2b4a82

View file

@ -94,8 +94,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
try
{
ResourceLocation resLoc = new ResourceLocation( Name );
resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", new Object[] { "textures/blocks",
resLoc.getResourcePath(), ".png" } ) );
resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", new Object[] { "textures/blocks", resLoc.getResourcePath(), ".png" } ) );
Resource res = Minecraft.getMinecraft().getResourceManager().getResource( resLoc );
if ( res != null )
@ -464,6 +463,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
}
@Override
@SideOnly(Side.CLIENT)
final public AxisAlignedBB getSelectedBoundingBoxFromPool(World w, int x, int y, int z)
{
ICustomCollision collisionHandler = null;

View file

@ -33,6 +33,7 @@ import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.util.Platform;
public class BlockCableBus extends AEBaseBlock
{
@ -215,7 +216,8 @@ public class BlockCableBus extends AEBaseBlock
public void setupTile()
{
setTileEntiy( Api.instance.partHelper.getCombinedInstance( TileCableBus.class.getName() ) );
CommonHelper.proxy.bindTileEntitySpecialRenderer( getTileEntityClass(), this );
if ( Platform.isClient() )
CommonHelper.proxy.bindTileEntitySpecialRenderer( getTileEntityClass(), this );
}
private ICableBusContainer cb(IBlockAccess w, int x, int y, int z)

View file

@ -4,20 +4,19 @@ import java.util.EnumSet;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderQNB;
import appeng.client.render.effects.EnergyFx;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuantumLinkChamber extends AEBaseBlock
{
@ -33,6 +32,7 @@ public class BlockQuantumLinkChamber extends AEBaseBlock
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World w, int bx, int by, int bz, Random r)
{
TileQuantumBridge bridge = getTileEntity( w, bx, by, bz );
@ -40,17 +40,7 @@ public class BlockQuantumLinkChamber extends AEBaseBlock
{
if ( bridge.hasQES() )
{
float x = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
float y = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
float z = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
EnergyFx fx = new EnergyFx( w, bx + x + 0.5, by + y + 0.5, bz + z + 0.5, Item.diamond );
fx.motionX = -x * 0.1;
fx.motionY = -y * 0.1;
fx.motionZ = -z * 0.1;
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
CommonHelper.proxy.spawnEnergy( w, bx + 0.5, by + 0.5, bz + 0.5 );
}
}
}

View file

@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
@ -15,6 +16,7 @@ import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.TESRWrapper;
import appeng.client.render.WorldRender;
import appeng.client.render.effects.EnergyFx;
import appeng.client.render.effects.LightningEffect;
import appeng.client.render.entity.RenderTinyTNTPrimed;
import appeng.client.texture.CableBusTextures;
@ -87,4 +89,19 @@ public class ClientHelper extends ServerHelper
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
}
@Override
public void spawnEnergy(World w, double posX, double posY, double posZ)
{
float x = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
float y = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
float z = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
EnergyFx fx = new EnergyFx( w, posX + x, posY + y, posZ + z, Item.diamond );
fx.motionX = -x * 0.1;
fx.motionY = -y * 0.1;
fx.motionZ = -z * 0.1;
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
}
}

View file

@ -26,4 +26,6 @@ public abstract class CommonHelper
public abstract void spawnLightning(World worldObj, double posX, double posY, double posZ);
public abstract void spawnEnergy(World w, double posX, double posY, double posZ);
}

View file

@ -78,4 +78,10 @@ public class ServerHelper extends CommonHelper
// :P
}
@Override
public void spawnEnergy(World w, double posX, double posY, double posZ)
{
// :P
}
}