From f163261f56519ffe7c18155ffb4a181806b158eb Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Sat, 14 Jun 2014 22:17:53 +0100 Subject: [PATCH] Fixed spreaders. Build 56. --- .../core/handler/ClientTickHandler.java | 2 +- .../client/core/proxy/ClientProxy.java | 7 ++++++ .../common/block/tile/mana/TileSpreader.java | 11 +++++--- .../core/handler/ManaNetworkHandler.java | 25 +++++++++++++++++++ .../common/core/proxy/CommonProxy.java | 5 ++++ build.properties | 4 +-- version/1.7.2.txt | 2 +- web/changelog.txt | 2 ++ web/versions.ini | 3 ++- 9 files changed, 52 insertions(+), 9 deletions(-) diff --git a/MODSRC/vazkii/botania/client/core/handler/ClientTickHandler.java b/MODSRC/vazkii/botania/client/core/handler/ClientTickHandler.java index 1d67d426d..07198ecde 100644 --- a/MODSRC/vazkii/botania/client/core/handler/ClientTickHandler.java +++ b/MODSRC/vazkii/botania/client/core/handler/ClientTickHandler.java @@ -51,7 +51,7 @@ public class ClientTickHandler { if(player != null) { ItemStack stack = player.getCurrentEquippedItem(); if(stack != null && stack.getItem() instanceof ItemTwigWand) { - List list = new ArrayList(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().theWorld)); + List list = new ArrayList(ManaNetworkHandler.instance.getAllClientCollectorsInWorld(Minecraft.getMinecraft().theWorld)); for(TileEntity tile : list) { if(tile instanceof IManaCollector) ((IManaCollector) tile).onClientDisplayTick(); diff --git a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java index 2734889e6..71315092f 100644 --- a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java @@ -12,6 +12,7 @@ package vazkii.botania.client.core.proxy; import net.minecraft.client.Minecraft; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; @@ -50,6 +51,7 @@ import vazkii.botania.common.block.tile.TileRuneAltar; import vazkii.botania.common.block.tile.mana.TilePool; import vazkii.botania.common.block.tile.mana.TileSpreader; import vazkii.botania.common.core.handler.ConfigHandler; +import vazkii.botania.common.core.handler.ManaNetworkHandler; import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.core.proxy.CommonProxy; import vazkii.botania.common.core.version.VersionChecker; @@ -109,6 +111,11 @@ public class ClientProxy extends CommonProxy { public void setEntryToOpen(LexiconEntry entry) { GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(entry, new GuiLexiconIndex(entry.category)); } + + @Override + public void addClientCollector(TileEntity tile) { + ManaNetworkHandler.addClientCollector(tile); + } @Override public long getWorldElapsedTicks() { diff --git a/MODSRC/vazkii/botania/common/block/tile/mana/TileSpreader.java b/MODSRC/vazkii/botania/common/block/tile/mana/TileSpreader.java index 75c619eba..6ce08ffc4 100644 --- a/MODSRC/vazkii/botania/common/block/tile/mana/TileSpreader.java +++ b/MODSRC/vazkii/botania/common/block/tile/mana/TileSpreader.java @@ -44,6 +44,7 @@ import vazkii.botania.api.mana.ManaNetworkEvent; import vazkii.botania.api.wand.ITileBound; import vazkii.botania.client.core.handler.HUDHandler; import vazkii.botania.client.lib.LibResources; +import vazkii.botania.common.Botania; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.block.tile.TileSimpleInventory; import vazkii.botania.common.core.helper.Vector3; @@ -108,11 +109,13 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector, @Override public void updateEntity() { - if(!worldObj.isRemote && !added) { + boolean added = this.added; + if(!worldObj.isRemote && !this.added) { ManaNetworkEvent.addCollector(this); - added = true; - } - + this.added = true; + } else if(worldObj.isRemote && !added) + Botania.proxy.addClientCollector(this); + boolean redstone = false; for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { diff --git a/MODSRC/vazkii/botania/common/core/handler/ManaNetworkHandler.java b/MODSRC/vazkii/botania/common/core/handler/ManaNetworkHandler.java index e22e1f6c7..f9481181d 100644 --- a/MODSRC/vazkii/botania/common/core/handler/ManaNetworkHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/ManaNetworkHandler.java @@ -25,11 +25,16 @@ import vazkii.botania.api.mana.ManaNetworkEvent.Action; import vazkii.botania.api.mana.ManaNetworkEvent.ManaBlockType; import vazkii.botania.common.core.helper.MathHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public final class ManaNetworkHandler implements IManaNetwork { public static final ManaNetworkHandler instance = new ManaNetworkHandler(); + @SideOnly(Side.CLIENT) + public static WeakHashMap> clientCollectors = new WeakHashMap(); + public WeakHashMap> manaPools = new WeakHashMap(); public WeakHashMap> manaCollectors = new WeakHashMap(); @@ -101,11 +106,31 @@ public final class ManaNetworkHandler implements IManaNetwork { if(!tiles.contains(tile)) tiles.add(tile); } + + @SideOnly(Side.CLIENT) + public static void addClientCollector(TileEntity tile) { + World world = tile.getWorldObj(); + Map> map = clientCollectors; + + List tiles; + if(!map.containsKey(world)) + map.put(world, new ArrayList()); + + tiles = map.get(world); + + if(!tiles.contains(tile)) + tiles.add(tile); + } @Override public List getAllCollectorsInWorld(World world) { return getAllInWorld(manaCollectors, world); } + + @SideOnly(Side.CLIENT) + public List getAllClientCollectorsInWorld(World world) { + return getAllInWorld(clientCollectors, world); + } @Override public List getAllPoolsInWorld(World world) { diff --git a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java index 7fcea5c3a..d1cd867db 100644 --- a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java @@ -16,6 +16,7 @@ import java.util.List; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import vazkii.botania.api.BotaniaAPI; @@ -93,6 +94,10 @@ public class CommonProxy { public void setEntryToOpen(LexiconEntry entry) { // NO-OP } + + public void addClientCollector(TileEntity tile) { + // NO-OP + } public long getWorldElapsedTicks() { return MinecraftServer.getServer().worldServers[0].getTotalWorldTime(); diff --git a/build.properties b/build.properties index 84a8c23f3..bbd18de06 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ -#Sat, 14 Jun 2014 21:56:08 +0100 +#Sat, 14 Jun 2014 22:17:14 +0100 version=r1.0 -build_number=56 +build_number=57 mc_version=1.7.2 mod_name=Botania dir.repo=./ diff --git a/version/1.7.2.txt b/version/1.7.2.txt index 752af7923..b47604f88 100644 --- a/version/1.7.2.txt +++ b/version/1.7.2.txt @@ -1 +1 @@ -r1.0-55 \ No newline at end of file +r1.0-56 \ No newline at end of file diff --git a/web/changelog.txt b/web/changelog.txt index 8238fb522..94f1776b9 100644 --- a/web/changelog.txt +++ b/web/changelog.txt @@ -1,3 +1,5 @@ +r1.0 56 +*Fixed Mana Spreaders not showing the prediction beam, another thing broken by 54... r1.0 55 *Added some sanity checking to the flowers' connection code to reflect the changes in 54, be it for Spreaders or Pools. In theory, this ought to fix the bug where flowers lose their binding upon relog. I can't exactly tell you if that is the case though, because this issue is completely sporadic and nigh-on impossible to reproduce with consistency. Warning: This change modifies API files SubTileGenerating.java and SubTileFunctional.java. Third time's the charm, right? Please be so. *Mana Mirrors no longer show their binding in the tooltip, but rather in world. diff --git a/web/versions.ini b/web/versions.ini index d2d0ad381..68cdffedc 100644 --- a/web/versions.ini +++ b/web/versions.ini @@ -52,4 +52,5 @@ r1.0-51=1.7.2 r1.0-52=1.7.2 r1.0-53=1.7.2 r1.0-54=1.7.2 -r1.0-55=1.7.2 \ No newline at end of file +r1.0-55=1.7.2 +r1.0-56=1.7.2 \ No newline at end of file