diff --git a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java index f2b5b4847..096946828 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java @@ -6,7 +6,48 @@ import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; -import WayofTime.alchemicalWizardry.common.items.*; +import WayofTime.alchemicalWizardry.common.items.AWBaseItems; +import WayofTime.alchemicalWizardry.common.items.ActivationCrystal; +import WayofTime.alchemicalWizardry.common.items.AirScribeTool; +import WayofTime.alchemicalWizardry.common.items.ApprenticeBloodOrb; +import WayofTime.alchemicalWizardry.common.items.ArchmageBloodOrb; +import WayofTime.alchemicalWizardry.common.items.ArmourInhibitor; +import WayofTime.alchemicalWizardry.common.items.BlankSpell; +import WayofTime.alchemicalWizardry.common.items.BloodShard; +import WayofTime.alchemicalWizardry.common.items.BoundAxe; +import WayofTime.alchemicalWizardry.common.items.BoundPickaxe; +import WayofTime.alchemicalWizardry.common.items.BoundShovel; +import WayofTime.alchemicalWizardry.common.items.CheatyItem; +import WayofTime.alchemicalWizardry.common.items.CreativeDagger; +import WayofTime.alchemicalWizardry.common.items.DaggerOfSacrifice; +import WayofTime.alchemicalWizardry.common.items.DawnScribeTool; +import WayofTime.alchemicalWizardry.common.items.DemonPlacer; +import WayofTime.alchemicalWizardry.common.items.DemonicTelepositionFocus; +import WayofTime.alchemicalWizardry.common.items.DuskScribeTool; +import WayofTime.alchemicalWizardry.common.items.EarthScribeTool; +import WayofTime.alchemicalWizardry.common.items.EnergyBattery; +import WayofTime.alchemicalWizardry.common.items.EnergyBazooka; +import WayofTime.alchemicalWizardry.common.items.EnergyBlast; +import WayofTime.alchemicalWizardry.common.items.EnergySword; +import WayofTime.alchemicalWizardry.common.items.EnhancedTelepositionFocus; +import WayofTime.alchemicalWizardry.common.items.FireScribeTool; +import WayofTime.alchemicalWizardry.common.items.ItemAlchemyBase; +import WayofTime.alchemicalWizardry.common.items.ItemBloodLetterPack; +import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal; +import WayofTime.alchemicalWizardry.common.items.ItemComponents; +import WayofTime.alchemicalWizardry.common.items.ItemDiabloKey; +import WayofTime.alchemicalWizardry.common.items.ItemIncense; +import WayofTime.alchemicalWizardry.common.items.ItemRitualDismantler; +import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner; +import WayofTime.alchemicalWizardry.common.items.LavaCrystal; +import WayofTime.alchemicalWizardry.common.items.LifeBucket; +import WayofTime.alchemicalWizardry.common.items.MagicianBloodOrb; +import WayofTime.alchemicalWizardry.common.items.MasterBloodOrb; +import WayofTime.alchemicalWizardry.common.items.ReinforcedTelepositionFocus; +import WayofTime.alchemicalWizardry.common.items.SacrificialDagger; +import WayofTime.alchemicalWizardry.common.items.TelepositionFocus; +import WayofTime.alchemicalWizardry.common.items.TranscendentBloodOrb; +import WayofTime.alchemicalWizardry.common.items.WaterScribeTool; import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourEarth; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourFire; diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIMeteorRecipeHandler.java b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIMeteorRecipeHandler.java index bc9f0062b..875b54b11 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIMeteorRecipeHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/nei/NEIMeteorRecipeHandler.java @@ -1,6 +1,7 @@ package WayofTime.alchemicalWizardry.client.nei; -import java.awt.*; +import java.awt.Point; +import java.awt.Rectangle; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java b/src/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java index 77b6dfbdb..cdf4cd005 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java @@ -1,5 +1,7 @@ package WayofTime.alchemicalWizardry.common; +import java.util.Arrays; +import java.util.BitSet; import java.util.EnumMap; import java.util.LinkedList; import java.util.List; @@ -10,6 +12,7 @@ import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.AlchemicalWizardry; @@ -77,6 +80,8 @@ private void addClientHandler() { .addAfter(tileAltarCodec, "CurrentReagentBarMessageHandler", new CurrentReagentBarMessageHandler()); clientChannel.pipeline() .addAfter(tileAltarCodec, "CurrentAddedHPMessageHandler", new CurrentAddedHPMessageHandler()); + clientChannel.pipeline() + .addAfter(tileAltarCodec, "GaiaBiomeChangeHandler", new GaiaBiomeChangeMessageHandler()); } @SideOnly(Side.SERVER) @@ -283,6 +288,23 @@ protected void channelRead0(ChannelHandlerContext ctx, KeyboardMessage msg) thro } } + private static class GaiaBiomeChangeMessageHandler extends SimpleChannelInboundHandler { + + @Override + protected void channelRead0(ChannelHandlerContext ctx, GaiaBiomeChangeMessage msg) throws Exception { + Chunk chunk = AlchemicalWizardry.proxy.getClientWorld().getChunkFromChunkCoords(msg.chunkX, msg.chunkZ); + if (chunk != null) { + byte[] biomeArray = chunk.getBiomeArray(); + for (int i = 0; i < 16 * 16; ++i) { + if (msg.mask.get(i)) { + biomeArray[i] = msg.biome; + } + } + chunk.setBiomeArray(biomeArray); + } + } + } + public static class BMMessage { int index; @@ -417,6 +439,16 @@ public static class KeyboardMessage extends BMMessage { byte keyPressed; } + public static class GaiaBiomeChangeMessage extends BMMessage { + + int chunkX; + int chunkZ; + byte biome; + BitSet mask; + // One bit per coordinate in a chunk, 16*16 bits = 32 bytes + public static final int maskByteCount = 32; + } + private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec { public ClientToServerCodec() {} @@ -458,6 +490,7 @@ public TEAltarCodec() { addDiscriminator(12, CurrentReagentBarMessage.class); addDiscriminator(13, CurrentAddedHPMessage.class); addDiscriminator(14, KeyboardMessage.class); + addDiscriminator(15, GaiaBiomeChangeMessage.class); } @Override @@ -669,6 +702,17 @@ public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) target.writeByte(((KeyboardMessage) msg).keyPressed); break; + + case 15: + target.writeInt(((GaiaBiomeChangeMessage) msg).chunkX); + target.writeInt(((GaiaBiomeChangeMessage) msg).chunkZ); + target.writeByte(((GaiaBiomeChangeMessage) msg).biome); + byte[] arr = Arrays.copyOf( + ((GaiaBiomeChangeMessage) msg).mask.toByteArray(), + GaiaBiomeChangeMessage.maskByteCount); + target.writeBytes(arr); + break; + } } @@ -894,6 +938,16 @@ public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BMMessage msg) { System.out.println("Packet recieved: being decoded"); ((KeyboardMessage) msg).keyPressed = dat.readByte(); break; + + case 15: + ((GaiaBiomeChangeMessage) msg).chunkX = dat.readInt(); + ((GaiaBiomeChangeMessage) msg).chunkZ = dat.readInt(); + ((GaiaBiomeChangeMessage) msg).biome = dat.readByte(); + + byte[] buffer = new byte[GaiaBiomeChangeMessage.maskByteCount]; + dat.readBytes(buffer); + ((GaiaBiomeChangeMessage) msg).mask = BitSet.valueOf(buffer); + break; } } } @@ -1067,6 +1121,17 @@ public static Packet getKeyboardPressPacket(byte bt) { return INSTANCE.channels.get(Side.CLIENT).generatePacketFrom(msg); } + public static Packet getGaiaBiomeChangePacket(int x, int z, byte biome, BitSet mask) { + GaiaBiomeChangeMessage msg = new GaiaBiomeChangeMessage(); + msg.index = 15; + msg.chunkX = x; + msg.chunkZ = z; + msg.biome = biome; + msg.mask = mask; + + return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); + } + public void sendTo(Packet message, EntityPlayerMP player) { this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.PLAYER); @@ -1087,6 +1152,13 @@ public void sendToAllAround(Packet message, NetworkRegistry.TargetPoint point) { this.channels.get(Side.SERVER).writeAndFlush(message); } + public void sendToDimension(Packet message, Integer dimensionId) { + this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET) + .set(FMLOutboundHandler.OutboundTarget.DIMENSION); + this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId); + this.channels.get(Side.SERVER).writeAndFlush(message); + } + public void sendToServer(Packet message) { this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET) .set(FMLOutboundHandler.OutboundTarget.TOSERVER); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBloodMagic.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBloodMagic.java index 8f69c5614..356b1de52 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBloodMagic.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandBloodMagic.java @@ -1,6 +1,10 @@ package WayofTime.alchemicalWizardry.common.commands; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBileDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBileDemon.java index 06347b51b..310b81c3a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBileDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBileDemon.java @@ -3,7 +3,15 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.*; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityHorse; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBoulderFist.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBoulderFist.java index eaaa88045..58de9760c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBoulderFist.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityBoulderFist.java @@ -3,7 +3,16 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.*; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILeapAtTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityHorse; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFallenAngel.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFallenAngel.java index eac7d5fea..f057f3481 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFallenAngel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityFallenAngel.java @@ -1,7 +1,19 @@ package WayofTime.alchemicalWizardry.common.entity.mob; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIArrowAttack; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityHorse; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityLowerGuardian.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityLowerGuardian.java index f2cbe6e32..e09d300af 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityLowerGuardian.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityLowerGuardian.java @@ -3,7 +3,15 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.*; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityHorse; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShade.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShade.java index 5042392d3..79f056965 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShade.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityShade.java @@ -3,7 +3,15 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.*; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityHorse; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntitySmallEarthGolem.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntitySmallEarthGolem.java index 5c3abfbd6..ff055c247 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntitySmallEarthGolem.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntitySmallEarthGolem.java @@ -1,7 +1,19 @@ package WayofTime.alchemicalWizardry.common.entity.mob; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIArrowAttack; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityHorse; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWingedFireDemon.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWingedFireDemon.java index 494a131ef..ceb703a98 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWingedFireDemon.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityWingedFireDemon.java @@ -1,7 +1,19 @@ package WayofTime.alchemicalWizardry.common.entity.mob; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIArrowAttack; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityHorse; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemAttunedCrystal.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemAttunedCrystal.java index 0d7864b6f..5890a466d 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemAttunedCrystal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemAttunedCrystal.java @@ -19,7 +19,11 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.Int3; -import WayofTime.alchemicalWizardry.api.alchemy.energy.*; +import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; import cpw.mods.fml.relauncher.Side; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java index db31ef3a5..47b58cc69 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java @@ -17,7 +17,11 @@ import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.alchemy.energy.*; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilFluid.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilFluid.java index 52c297fae..448c7a67e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilFluid.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilFluid.java @@ -17,7 +17,11 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.*; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; +import net.minecraftforge.fluids.IFluidHandler; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.Int3; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderElemental.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderElemental.java index ac850577f..0eff7b786 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderElemental.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/mob/RenderElemental.java @@ -5,7 +5,13 @@ import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -import WayofTime.alchemicalWizardry.common.entity.mob.*; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityAirElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityFireElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityHolyElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental; public class RenderElemental extends RenderLiving { diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBlastProjectile.java b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBlastProjectile.java index ad387ed45..95bd3a2dd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBlastProjectile.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/renderer/projectile/RenderEnergyBlastProjectile.java @@ -9,7 +9,14 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import WayofTime.alchemicalWizardry.common.entity.projectile.*; +import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.LightningBoltProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.WaterProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java index cf4bd8a76..e47248474 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java @@ -1,7 +1,11 @@ package WayofTime.alchemicalWizardry.common.rituals; +import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.BitSet; import java.util.List; +import java.util.Queue; +import java.util.function.BiConsumer; import net.minecraft.block.Block; import net.minecraft.entity.effect.EntityLightningBolt; @@ -24,6 +28,7 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; @@ -75,61 +80,38 @@ public void performEffect(IMasterRitualStone ritualStone) { } boolList[range][range] = true; - boolean isReady = false; - while (!isReady) { - isReady = true; + Queue BFSqueue = new ArrayDeque<>(); + BFSqueue.add(x); + BFSqueue.add(z); - for (int i = 0; i < 2 * range + 1; i++) { - for (int j = 0; j < 2 * range + 1; j++) { - if (boolList[i][j]) { - if (i - 1 >= 0 && !boolList[i - 1][j]) { - Block block = world.getBlock(x - range + i - 1, y + 1, z - range + j); + BiConsumer tryEnqueue = (nextX, nextZ) -> { + if (Math.abs(nextX - x) > range || Math.abs(nextZ - z) > range) return; + if (boolList[nextX - (x - range)][nextZ - (z - range)]) return; - if (!ModBlocks.largeBloodStoneBrick.equals(block) - && !ModBlocks.bloodStoneBrick.equals(block)) { - boolList[i - 1][j] = true; - isReady = false; - } - } + Block block = world.getBlock(nextX, y + 1, nextZ); + if (block == null || block.equals(ModBlocks.bloodStoneBrick) + || block.equals(ModBlocks.largeBloodStoneBrick)) + return; - if (j - 1 >= 0 && !boolList[i][j - 1]) { - Block block = world.getBlock(x - range + i, y + 1, z - range + j - 1); + boolList[nextX - (x - range)][nextZ - (z - range)] = true; + BFSqueue.add(nextX); + BFSqueue.add(nextZ); + }; - if (!ModBlocks.largeBloodStoneBrick.equals(block) - && !ModBlocks.bloodStoneBrick.equals(block)) { - boolList[i][j - 1] = true; - isReady = false; - } - } + while (!BFSqueue.isEmpty()) { + Integer curX = BFSqueue.remove(); + Integer curZ = BFSqueue.remove(); - if (i + 1 <= 2 * range && !boolList[i + 1][j]) { - Block block = world.getBlock(x - range + i + 1, y + 1, z - range + j); - - if (!ModBlocks.largeBloodStoneBrick.equals(block) - && !ModBlocks.bloodStoneBrick.equals(block)) { - boolList[i + 1][j] = true; - isReady = false; - } - } - - if (j + 1 <= 2 * range && !boolList[i][j + 1]) { - Block block = world.getBlock(x - range + i, y + 1, z - range + j + 1); - - if (!ModBlocks.largeBloodStoneBrick.equals(block) - && !ModBlocks.bloodStoneBrick.equals(block)) { - boolList[i][j + 1] = true; - isReady = false; - } - } - } - } - } + tryEnqueue.accept(curX + 1, curZ); + tryEnqueue.accept(curX, curZ + 1); + tryEnqueue.accept(curX - 1, curZ); + tryEnqueue.accept(curX, curZ - 1); } float temperature = 0.5f; float humidity = 0.5f; - float acceptableRange = 0.1f; + float acceptableRange = 0.0999f; int biomeSkip = 0; for (int i = -1; i <= 1; i++) { @@ -240,26 +222,42 @@ public void performEffect(IMasterRitualStone ritualStone) { biomeID = 1; } - for (int i = 0; i < 2 * range + 1; i++) { - for (int j = 0; j < 2 * range + 1; j++) { - if (boolList[i][j]) { - Chunk chunk = world.getChunkFromBlockCoords(x - range + i, z - range + j); - byte[] byteArray = chunk.getBiomeArray(); - int moduX = (x - range + i) % 16; - int moduZ = (z - range + j) % 16; - - if (moduX < 0) { - moduX = moduX + 16; - } + List chunkList = new ArrayList<>(); - if (moduZ < 0) { - moduZ = moduZ + 16; - } + for (int chunkX = (x - range) >> 4; chunkX <= (x + range) >> 4; ++chunkX) { + for (int chunkZ = (z - range) >> 4; chunkZ <= (z + range) >> 4; ++chunkZ) { + chunkList.add(world.getChunkFromChunkCoords(chunkX, chunkZ)); + } + } - byteArray[moduZ * 16 + moduX] = (byte) biomeID; - chunk.setBiomeArray(byteArray); + for (Chunk chunk : chunkList) { + byte[] byteArray = chunk.getBiomeArray(); + BitSet mask = new BitSet(); + boolean changed = false; + + for (int cZ = 0; cZ < 16; ++cZ) { + int offsetZ = (chunk.zPosition << 4 | cZ) - (z - range); + if (0 <= offsetZ && offsetZ < 2 * range + 1) { + for (int cX = 0; cX < 16; ++cX) { + int offsetX = (chunk.xPosition << 4 | cX) - (x - range); + if (0 <= offsetX && offsetX < 2 * range + 1) { + if (boolList[offsetX][offsetZ]) { + mask.set(cZ << 4 | cX, true); + byteArray[cZ << 4 | cX] = (byte) biomeID; + changed = true; + } + } + } } } + + if (changed) { + chunk.setBiomeArray(byteArray); + NewPacketHandler.INSTANCE.sendToDimension( + NewPacketHandler + .getGaiaBiomeChangePacket(chunk.xPosition, chunk.zPosition, (byte) biomeID, mask), + world.provider.dimensionId); + } } SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java index 0daf8ebcb..66e0c2e0e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java @@ -20,7 +20,12 @@ import WayofTime.alchemicalWizardry.api.ColourAndCoords; import WayofTime.alchemicalWizardry.api.Int3; -import WayofTime.alchemicalWizardry.api.alchemy.energy.*; +import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; +import WayofTime.alchemicalWizardry.api.alchemy.energy.TileSegmentedReagentHandler; import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import cpw.mods.fml.relauncher.Side;