Replace !Proxies.common.isSimulating(world) with standard world.isRemote

This commit is contained in:
mezz committed 2015-09-25 15:18:24 -07:00
1 parent 1e89bab556
commit 4234c38d69
44 files changed
+66 -102

No files matched your search

@@ -41,7 +41,7 @@ public class ContainerImprinter extends ContainerItemInventory<ImprinterInventor
@Override
public void onContainerClosed(EntityPlayer entityplayer) {
if (!Proxies.common.isSimulating(entityplayer.worldObj)) {
if (entityplayer.worldObj.isRemote) {
return;
}
@@ -66,7 +66,7 @@ public class ContainerImprinter extends ContainerItemInventory<ImprinterInventor
}
public void updateContainer(World world) {
if (!isNetSynced && !Proxies.common.isSimulating(world)) {
if (!isNetSynced && world.isRemote) {
isNetSynced = true;
Proxies.net.sendToServer(new ForestryPacket(PacketId.IMPRINT_SELECTION_GET));
}
@@ -23,7 +23,6 @@ import forestry.core.config.Config;
import forestry.core.gui.IHintSource;
import forestry.core.items.ItemAlyzer;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
public class ItemBeealyzer extends ItemAlyzer {
@@ -35,7 +34,7 @@ public class ItemBeealyzer extends ItemAlyzer {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
entityplayer.openGui(ForestryAPI.instance, GuiId.BeealyzerGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ);
}
@@ -74,7 +74,7 @@ public class ItemHabitatLocator extends ItemInventoried {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
entityplayer.openGui(ForestryAPI.instance, GuiId.HabitatLocatorGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ);
}
@@ -124,7 +124,7 @@ public class ItemHabitatLocator extends ItemInventoried {
@Override
public void onUpdate(ItemStack p_77663_1_, World world, Entity player, int p_77663_4_, boolean p_77663_5_) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return;
}
@@ -24,7 +24,6 @@ import forestry.apiculture.genetics.Bee;
import forestry.core.inventory.ItemInventory;
import forestry.core.items.ItemForestry;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
public class ItemImprinter extends ItemForestry {
@@ -152,7 +151,7 @@ public class ItemImprinter extends ItemForestry {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
entityplayer.openGui(ForestryAPI.instance, GuiId.ImprinterGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY,
(int) entityplayer.posZ);
}
@@ -115,7 +115,7 @@ public class BlockForestryLeaves extends BlockNewLeaf implements ITileEntityProv
int fortune = EnchantmentHelper.getFortuneModifier(player);
float saplingModifier = 1.0f;
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
ItemStack held = player.inventory.getCurrentItem();
if (held != null && held.getItem() instanceof IToolGrafter) {
saplingModifier = ((IToolGrafter) held.getItem()).getSaplingModifier(held, world, player, x, y, z);
@@ -27,7 +27,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.arboriculture.tiles.TileFruitPod;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.ItemStackUtil;
@@ -67,7 +66,7 @@ public class BlockFruitPod extends BlockCocoa {
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
TileFruitPod tile = getPodTile(world, x, y, z);
if (tile != null) {
for (ItemStack drop : tile.getDrop()) {
@@ -36,7 +36,6 @@ import forestry.api.arboriculture.TreeManager;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.arboriculture.tiles.TileSapling;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.ItemStackUtil;
@@ -141,7 +140,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable {
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) {
super.onNeighborBlockChange(world, x, y, z, neighbour);
if (Proxies.common.isSimulating(world) && !this.canBlockStay(world, x, y, z)) {
if (!world.isRemote && !this.canBlockStay(world, x, y, z)) {
dropAsSapling(world, x, y, z);
world.setBlockToAir(x, y, z);
}
@@ -165,7 +164,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable {
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
if (Proxies.common.isSimulating(world) && canHarvestBlock(player, world.getBlockMetadata(x, y, z))) {
if (!world.isRemote && canHarvestBlock(player, world.getBlockMetadata(x, y, z))) {
if (!player.capabilities.isCreativeMode) {
dropAsSapling(world, x, y, z);
}
@@ -175,7 +174,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable {
}
private static void dropAsSapling(World world, int x, int y, int z) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return;
}
@@ -23,7 +23,6 @@ import forestry.core.config.Config;
import forestry.core.gui.IHintSource;
import forestry.core.items.ItemAlyzer;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.core.utils.GeneticsUtil;
public class ItemTreealyzer extends ItemAlyzer {
@@ -36,7 +35,7 @@ public class ItemTreealyzer extends ItemAlyzer {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
entityplayer.openGui(ForestryAPI.instance, GuiId.TreealyzerGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY,
(int) entityplayer.posZ);
}
@@ -26,7 +26,6 @@ import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.IStreamable;
import forestry.core.network.PacketTileStream;
import forestry.core.proxy.Proxies;
import forestry.core.utils.ItemStackUtil;
public class TileWood extends TileEntity implements IStreamable {
@@ -87,7 +86,7 @@ public class TileWood extends TileEntity implements IStreamable {
public static <T extends Block & IWoodTyped> boolean blockRemovedByPlayer(T block, World world, EntityPlayer player, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if (Proxies.common.isSimulating(world) && block.canHarvestBlock(player, meta) && !player.capabilities.isCreativeMode) {
if (!world.isRemote && block.canHarvestBlock(player, meta) && !player.capabilities.isCreativeMode) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileWood) {
@@ -204,7 +204,7 @@ public class BlockBase extends BlockForestry {
}
}
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return true;
}
@@ -224,7 +224,7 @@ public class BlockBase extends BlockForestry {
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return;
}
@@ -25,7 +25,6 @@ import com.mojang.authlib.GameProfile;
import forestry.core.CreativeTabForestry;
import forestry.core.access.IOwnable;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IRestrictedAccessTile;
import forestry.core.tiles.TileForestry;
import forestry.core.utils.Log;
@@ -55,7 +54,7 @@ public abstract class BlockForestry extends BlockContainer {
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack itemstack) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return;
}
@@ -36,7 +36,6 @@ import forestry.core.CreativeTabForestry;
import forestry.core.config.Constants;
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
/**
@@ -88,7 +87,7 @@ public class BlockSoil extends Block implements IItemTyped {
@Override
public void updateTick(World world, int i, int j, int k, Random random) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return;
}
@@ -21,7 +21,6 @@ import net.minecraft.world.World;
import forestry.core.circuits.ISocketable;
import forestry.core.multiblock.MultiblockControllerBase;
import forestry.core.multiblock.MultiblockTileEntityBase;
import forestry.core.proxy.Proxies;
import forestry.core.utils.InventoryUtil;
public abstract class BlockStructure extends BlockForestry {
@@ -88,7 +87,7 @@ public abstract class BlockStructure extends BlockForestry {
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return;
}
@@ -31,7 +31,6 @@ import forestry.core.errors.EnumErrorCode;
import forestry.core.inventory.ItemInventory;
import forestry.core.items.ItemForestry;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.core.utils.datastructures.RevolvingList;
public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
@@ -283,7 +282,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
entityplayer.openGui(ForestryAPI.instance, GuiId.SolderingIronGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY,
(int) entityplayer.posZ);
}
@@ -282,7 +282,7 @@ public class ItemResearchNote extends ItemForestry {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return itemstack;
}
@@ -31,7 +31,7 @@ public class ContainerAlyzer extends ContainerItemInventory<ItemAlyzer.AlyzerInv
@Override
public void onContainerClosed(EntityPlayer entityplayer) {
if (!Proxies.common.isSimulating(entityplayer.worldObj)) {
if (entityplayer.worldObj.isRemote) {
return;
}
@@ -16,8 +16,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import forestry.core.proxy.Proxies;
public class ItemAssemblyKit extends ItemForestry {
private final ItemStack assembled;
private final boolean motionOnOpen;
@@ -35,7 +33,7 @@ public class ItemAssemblyKit extends ItemForestry {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
itemstack.stackSize--;
EntityItem entity = new EntityItem(world, entityplayer.posX, entityplayer.posY, entityplayer.posZ, assembled.copy());
@@ -47,7 +47,7 @@ public class ItemCrated extends Item {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
if (contained == null || itemstack.stackSize == 0) {
return itemstack;
}
@@ -21,7 +21,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.core.CreativeTabForestry;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.utils.StringUtil;
@@ -42,7 +41,7 @@ public class ItemForestry extends Item {
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) {
if (isBonemeal) {
if (ItemDye.applyBonemeal(itemstack, world, x, y, z, player)) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
world.playAuxSFX(2005, x, y, z, 0);
}
@@ -24,8 +24,6 @@ import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import forestry.core.proxy.Proxies;
public abstract class ItemForestryTool extends ItemForestry {
private final ItemStack remnants;
@@ -63,7 +61,7 @@ public abstract class ItemForestryTool extends ItemForestry {
return;
}
if (Proxies.common.isSimulating(event.entityPlayer.worldObj) && remnants != null) {
if (!event.entityPlayer.worldObj.isRemote && remnants != null) {
EntityItem entity = new EntityItem(event.entityPlayer.worldObj, event.entityPlayer.posX, event.entityPlayer.posY, event.entityPlayer.posZ,
remnants.copy());
event.entityPlayer.worldObj.spawnEntityInWorld(entity);
@@ -138,7 +138,7 @@ public class ItemLiquidContainer extends Item {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return itemstack;
}
@@ -201,10 +201,6 @@ public class ProxyCommon {
return 4f;
}
public boolean isSimulating(World world) {
return true;
}
public boolean isShiftDown() {
return false;
}
@@ -259,7 +255,7 @@ public class ProxyCommon {
public void sendFXSignal(PacketFXSignal.VisualFXType visualFX, PacketFXSignal.SoundFXType soundFX, World world, int xCoord, int yCoord, int zCoord,
Block block, int i) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
Proxies.net.sendNetworkPacket(new PacketFXSignal(visualFX, soundFX, xCoord, yCoord, zCoord, block, i), world);
}
}
@@ -102,11 +102,6 @@ public class ProxyCommonClient extends ProxyCommon {
}
}
@Override
public boolean isSimulating(World world) {
return !world.isRemote;
}
@Override
public boolean isShiftDown() {
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
@@ -134,7 +129,7 @@ public class ProxyCommonClient extends ProxyCommon {
@Override
public void playSoundFX(World world, int x, int y, int z, Block block) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
super.playSoundFX(world, x, y, z, block);
} else {
playSoundFX(world, x, y, z, block.stepSound.getStepResourcePath(), block.stepSound.getVolume(), block.stepSound.getPitch());
@@ -143,7 +138,7 @@ public class ProxyCommonClient extends ProxyCommon {
@Override
public void playBlockBreakSoundFX(World world, int x, int y, int z, Block block) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
super.playSoundFX(world, x, y, z, block);
} else {
playSoundFX(world, x, y, z, block.stepSound.getBreakSound(), block.stepSound.getVolume() / 4, block.stepSound.getPitch());
@@ -152,7 +147,7 @@ public class ProxyCommonClient extends ProxyCommon {
@Override
public void playBlockPlaceSoundFX(World world, int x, int y, int z, Block block) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
super.playSoundFX(world, x, y, z, block);
} else {
playSoundFX(world, x, y, z, block.stepSound.getStepResourcePath(), block.stepSound.getVolume() / 4, block.stepSound.getPitch());
@@ -218,7 +213,7 @@ public class ProxyCommonClient extends ProxyCommon {
@Override
public void addBlockDestroyEffects(World world, int xCoord, int yCoord, int zCoord, Block block, int i) {
if (!isSimulating(world)) {
if (world.isRemote) {
getClientInstance().effectRenderer.addBlockDestroyEffects(xCoord, yCoord, zCoord, block, i);
} else {
super.addBlockDestroyEffects(world, xCoord, yCoord, zCoord, block, i);
@@ -227,7 +222,7 @@ public class ProxyCommonClient extends ProxyCommon {
@Override
public void addBlockPlaceEffects(World world, int xCoord, int yCoord, int zCoord, Block block, int i) {
if (!isSimulating(world)) {
if (world.isRemote) {
playBlockPlaceSoundFX(world, xCoord, yCoord, zCoord, block);
} else {
super.addBlockPlaceEffects(world, xCoord, yCoord, zCoord, block, i);
@@ -203,7 +203,7 @@ public class TileEscritoire extends TileBase implements ISidedInventory, IRender
@Override
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
super.setInventorySlotContents(slotIndex, itemstack);
if (slotIndex == SLOT_ANALYZE && Proxies.common.isSimulating(tile.worldObj)) {
if (slotIndex == SLOT_ANALYZE && !tile.worldObj.isRemote) {
if (!AlleleManager.alleleRegistry.isIndividual(getStackInSlot(SLOT_ANALYZE)) && getStackInSlot(SLOT_ANALYZE) != null) {
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(getStackInSlot(SLOT_ANALYZE));
if (ersatz != null) {
@@ -105,7 +105,7 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
public final void updateEntity() {
tickCount++;
if (Proxies.common.isSimulating(worldObj)) {
if (!worldObj.isRemote) {
updateServerSide();
} else {
updateClientSide();
@@ -32,7 +32,7 @@ public class TileMillRainmaker extends TileMill {
@Override
public void openGui(EntityPlayer player) {
if (!Proxies.common.isSimulating(player.worldObj)) {
if (player.worldObj.isRemote) {
return;
}
@@ -98,7 +98,7 @@ public class TileMillRainmaker extends TileMill {
Proxies.common.addEntityExplodeFX(worldObj, (f + f4), f1, (f2 + f3));
}
if (Proxies.common.isSimulating(worldObj)) {
if (!worldObj.isRemote) {
if (reverse) {
worldObj.getWorldInfo().setRaining(false);
} else {
@@ -28,7 +28,6 @@ import forestry.core.inventory.wrappers.InventoryMapper;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.tiles.TileBase;
import forestry.core.utils.InventoryUtil;
@@ -208,7 +207,7 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
}
}
if (Proxies.common.isSimulating(worldObj)) {
if (!worldObj.isRemote) {
memorized.memorizeRecipe(worldObj, currentRecipe, currentCrafting);
}
@@ -18,7 +18,6 @@ import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import forestry.core.config.ForestryBlock;
import forestry.core.proxy.Proxies;
import forestry.farming.blocks.BlockMushroom;
public class EventHandlerFarming {
@@ -26,7 +25,7 @@ public class EventHandlerFarming {
@SubscribeEvent
public void handleBonemeal(BonemealEvent event) {
if (!Proxies.common.isSimulating(event.world)) {
if (event.world.isRemote) {
return;
}
@@ -34,7 +34,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.core.blocks.BlockStructure;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleHelper;
import forestry.core.utils.ItemStackUtil;
import forestry.farming.render.EnumFarmBlockTexture;
@@ -98,7 +97,7 @@ public class BlockFarm extends BlockStructure {
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if (Proxies.common.isSimulating(world) && canHarvestBlock(player, meta)) {
if (!world.isRemote && canHarvestBlock(player, meta)) {
List<ItemStack> drops = getDrops(world, x, y, z, 0, 0);
for (ItemStack drop : drops) {
ItemStackUtil.dropItemStackAsEntity(drop, world, x, y, z);
@@ -30,7 +30,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import forestry.core.blocks.IItemTyped;
import forestry.core.config.Constants;
import forestry.core.proxy.Proxies;
import forestry.farming.worldgen.WorldGenBigMushroom;
public class BlockMushroom extends BlockSapling implements IItemTyped {
@@ -76,7 +75,7 @@ public class BlockMushroom extends BlockSapling implements IItemTyped {
@Override
public void updateTick(World world, int i, int j, int k, Random random) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return;
}
@@ -41,7 +41,7 @@ public class ContainerInfuser extends ContainerItemInventory<InfuserInventory> {
@Override
public void onContainerClosed(EntityPlayer entityplayer) {
if (!Proxies.common.isSimulating(entityplayer.worldObj)) {
if (entityplayer.worldObj.isRemote) {
return;
}
@@ -32,7 +32,6 @@ import forestry.api.food.BeverageManager;
import forestry.api.food.IBeverageEffect;
import forestry.core.config.Config;
import forestry.core.items.ItemForestryFood;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
public class ItemBeverage extends ItemForestryFood {
@@ -142,7 +141,7 @@ public class ItemBeverage extends ItemForestryFood {
entityplayer.getFoodStats().func_151686_a(this, itemstack);
world.playSoundAtEntity(entityplayer, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return itemstack;
}
@@ -28,7 +28,6 @@ import forestry.core.config.ForestryItem;
import forestry.core.inventory.ItemInventory;
import forestry.core.items.ItemForestry;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.food.BeverageEffect;
import forestry.plugins.PluginManager;
@@ -334,7 +333,7 @@ public class ItemInfuser extends ItemForestry {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
entityplayer.openGui(ForestryAPI.instance, GuiId.InfuserGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY,
(int) entityplayer.posZ);
}
@@ -44,7 +44,6 @@ import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IButterfly;
import forestry.api.lepidopterology.IEntityButterfly;
import forestry.core.proxy.Proxies;
import forestry.core.utils.ItemStackUtil;
import forestry.lepidopterology.genetics.Butterfly;
import forestry.lepidopterology.render.RenderButterflyItem;
@@ -333,7 +332,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
@Override
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
if (Proxies.common.isSimulating(worldObj)) {
if (!worldObj.isRemote) {
setIndividual(contained);
}
return data;
@@ -407,7 +406,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
return false;
}
if (Proxies.common.isSimulating(worldObj)) {
if (!worldObj.isRemote) {
contained.getGenome().getPrimary().getRoot().getBreedingTracker(worldObj, player.getGameProfile()).registerCatch(contained);
ItemStackUtil.dropItemStackAsEntity(PluginLepidopterology.butterflyInterface.getMemberStack(contained.copy(), EnumFlutterType.BUTTERFLY.ordinal()), worldObj, posX, posY, posZ);
setDead();
@@ -436,7 +435,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
super.onUpdate();
// Update stuff client side
if (!Proxies.common.isSimulating(worldObj)) {
if (worldObj.isRemote) {
if (species == null || dataWatcher.hasChanges()) {
scale = (float) dataWatcher.getWatchableObjectInt(DATAWATCHER_ID_SCALE) / 100;
String uid = dataWatcher.getWatchableObjectString(DATAWATCHER_ID_SPECIES);
@@ -113,7 +113,7 @@ public class ItemButterflyGE extends ItemGE {
if (type != EnumFlutterType.BUTTERFLY) {
return false;
}
if (!Proxies.common.isSimulating(entityItem.worldObj) || entityItem.ticksExisted < 80) {
if (entityItem.worldObj.isRemote || entityItem.ticksExisted < 80) {
return false;
}
if (rand.nextInt(24) != 0) {
@@ -207,7 +207,7 @@ public class ItemButterflyGE extends ItemGE {
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float facingX, float facingY, float facingZ) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return false;
}
@@ -22,7 +22,6 @@ import forestry.core.config.Config;
import forestry.core.gui.IHintSource;
import forestry.core.items.ItemAlyzer;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.plugins.PluginLepidopterology;
public class ItemFlutterlyzer extends ItemAlyzer {
@@ -96,7 +95,7 @@ public class ItemFlutterlyzer extends ItemAlyzer {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
entityplayer.openGui(ForestryAPI.instance, GuiId.FlutterlyzerGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY,
(int) entityplayer.posZ);
}
@@ -67,7 +67,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable {
public ContainerCatalogue(EntityPlayer player) {
this.player = player;
if (Proxies.common.isSimulating(player.worldObj)) {
if (!player.worldObj.isRemote) {
rebuildStationsList();
}
}
@@ -104,7 +104,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable {
}
public void nextPage() {
if (!Proxies.common.isSimulating(player.worldObj)) {
if (player.worldObj.isRemote) {
sendSelection(true);
return;
}
@@ -117,7 +117,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable {
}
public void previousPage() {
if (!Proxies.common.isSimulating(player.worldObj)) {
if (player.worldObj.isRemote) {
sendSelection(false);
return;
}
@@ -130,7 +130,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable {
}
public void cycleFilter() {
if (!Proxies.common.isSimulating(player.worldObj)) {
if (player.worldObj.isRemote) {
PacketGuiSelect packet = new PacketGuiSelect(PacketId.GUI_SELECTION_CHANGE, 2, 0);
Proxies.net.sendToServer(packet);
return;
@@ -150,7 +150,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable {
/* Managing Trade info */
private void updateTradeInfo() {
// Updating is done by the server.
if (!Proxies.common.isSimulating(player.worldObj)) {
if (player.worldObj.isRemote) {
return;
}
@@ -59,7 +59,7 @@ public class ContainerLetter extends ContainerItemInventory<LetterInventory> {
}
// Rip open delivered mails
if (Proxies.common.isSimulating(player.worldObj)) {
if (!player.worldObj.isRemote) {
if (inventory.getLetter().isProcessed()) {
inventory.onLetterOpened();
}
@@ -78,7 +78,7 @@ public class ContainerLetter extends ContainerItemInventory<LetterInventory> {
@Override
public void onContainerClosed(EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(entityplayer.worldObj)) {
if (!entityplayer.worldObj.isRemote) {
ILetter letter = inventory.getLetter();
if (!letter.isProcessed()) {
IMailAddress sender = PostManager.postRegistry.getMailAddress(entityplayer.getGameProfile());
@@ -183,7 +183,7 @@ public class ContainerLetter extends ContainerItemInventory<LetterInventory> {
/* Managing Trade info */
private void updateTradeInfo(World world, IMailAddress address) {
// Updating is done by the server.
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return;
}
@@ -53,7 +53,7 @@ public class ContainerMailbox extends ContainerTile<TileMailbox> {
ItemStack stack = super.slotClick(slotIndex, button, par3, player);
if (SlotUtil.isSlotInRange(slotIndex, SLOT_LETTERS, SLOT_LETTERS_COUNT)) {
if (Proxies.common.isSimulating(player.worldObj) && mailInventory != null) {
if (!player.worldObj.isRemote && mailInventory != null) {
POBoxInfo info = mailInventory.getPOBoxInfo();
Proxies.net.sendToPlayer(new PacketPOBoxInfo(info), player);
}
@@ -17,7 +17,6 @@ import net.minecraft.world.World;
import forestry.api.core.ForestryAPI;
import forestry.core.items.ItemForestry;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
public class ItemCatalogue extends ItemForestry {
@@ -28,7 +27,7 @@ public class ItemCatalogue extends ItemForestry {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
entityplayer.openGui(ForestryAPI.instance, GuiId.CatalogueGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY,
(int) entityplayer.posZ);
}
@@ -37,7 +37,6 @@ import forestry.core.gui.IHintSource;
import forestry.core.inventory.ItemInventory;
import forestry.core.items.ItemInventoried;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.utils.SlotUtil;
import forestry.core.utils.StringUtil;
@@ -61,7 +60,7 @@ public class ItemLetter extends ItemInventoried {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (Proxies.common.isSimulating(world)) {
if (!world.isRemote) {
if (itemstack.stackSize == 1) {
entityplayer.openGui(ForestryAPI.instance, GuiId.LetterGUI.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ);
} else {
@@ -34,7 +34,6 @@ import forestry.api.mail.PostManager;
import forestry.core.config.Config;
import forestry.core.inventory.InventoryAdapter;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileBase;
import forestry.mail.EnumDeliveryState;
import forestry.mail.POBox;
@@ -56,7 +55,7 @@ public class TileMailbox extends TileBase implements IMailContainer {
@Override
public void openGui(EntityPlayer player) {
if (!Proxies.common.isSimulating(worldObj)) {
if (worldObj.isRemote) {
return;
}
@@ -86,7 +85,7 @@ public class TileMailbox extends TileBase implements IMailContainer {
/* MAIL HANDLING */
public IInventory getOrCreateMailInventory(World world, GameProfile playerProfile) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return getInternalInventory();
}
@@ -280,7 +280,7 @@ public class TileTrader extends TileBase {
return;
}
if (Proxies.common.isSimulating(worldObj)) {
if (!worldObj.isRemote) {
IErrorLogic errorLogic = getErrorLogic();
boolean hasValidTradeAddress = PostManager.postRegistry.isValidTradeAddress(worldObj, address);
@@ -301,7 +301,7 @@ public class TileTrader extends TileBase {
@Override
public IInventoryAdapter getInternalInventory() {
// Handle client side
if (!Proxies.common.isSimulating(worldObj) || !address.isValid()) {
if (worldObj.isRemote || !address.isValid()) {
return super.getInternalInventory();
}
@@ -40,7 +40,6 @@ import forestry.core.inventory.wrappers.IInvSlot;
import forestry.core.inventory.wrappers.InventoryIterator;
import forestry.core.items.ItemInventoried;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.InventoryUtil;
@@ -75,7 +74,7 @@ public class ItemBackpack extends ItemInventoried {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return itemstack;
}
@@ -96,7 +95,7 @@ public class ItemBackpack extends ItemInventoried {
@Override
public boolean onItemUseFirst(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (!Proxies.common.isSimulating(world)) {
if (world.isRemote) {
return false;
}