diff --git a/Changelog.txt b/Changelog.txt index a5b8a31..7a364c6 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -10,6 +10,7 @@ Abandonned trying to make my own book system. I'll just try and fix Waslie's. Fixed a bug with the free chunk assignment. -- Removed the automatic chunk assignment. It's not useful anymore. Added 7 different types of Ethereal Blocks. Fuun! Updated to Blood Magic 1.3.0b-3. I didn't test the fix, but it shouldn't be crashing with it anymore. +Fixed the Ritual Representations. Now they work perfectly! Version 1.1.9-Alpha3: Finalized the Soul Network Manifestation system. I need now to give it a bit of fluff and couple of kicks in the butts, but it's close. diff --git a/src/main/java/tombenpotter/sanguimancy/api/tile/TileBaseSNPart.java b/src/main/java/tombenpotter/sanguimancy/api/tile/TileBaseSNPart.java index 2ba0264..c3a536a 100644 --- a/src/main/java/tombenpotter/sanguimancy/api/tile/TileBaseSNPart.java +++ b/src/main/java/tombenpotter/sanguimancy/api/tile/TileBaseSNPart.java @@ -2,9 +2,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import tombenpotter.sanguimancy.api.ICustomNBTTag; import tombenpotter.sanguimancy.api.objects.BlockPostition; import tombenpotter.sanguimancy.api.objects.BoolAndBlockPosList; -import tombenpotter.sanguimancy.api.ICustomNBTTag; import tombenpotter.sanguimancy.api.objects.SNKNotBoolean; import tombenpotter.sanguimancy.api.snManifestation.ISNComponent; import tombenpotter.sanguimancy.api.snManifestation.ISNKnot; @@ -28,8 +28,8 @@ public ArrayList getSNKnots() { @Override public BoolAndBlockPosList getComponentsInNetwork() { BoolAndBlockPosList blockPosList = new BoolAndBlockPosList(); - for (BlockPostition postition : getAdjacentISNComponents()) { - if (postition != null) { + if (getAdjacentISNComponents() != null) { + for (BlockPostition postition : getAdjacentISNComponents()) { if (postition != null) { if (!blockPosList.hashMap.containsKey(postition) && postition.getTile(worldObj) != null && postition.getTile(worldObj) instanceof ISNKnot) { ISNKnot knot = (ISNKnot) postition.getTile(worldObj); diff --git a/src/main/java/tombenpotter/sanguimancy/blocks/BlockItemSNPart.java b/src/main/java/tombenpotter/sanguimancy/blocks/BlockItemSNPart.java index 8003e34..9efbc2c 100644 --- a/src/main/java/tombenpotter/sanguimancy/blocks/BlockItemSNPart.java +++ b/src/main/java/tombenpotter/sanguimancy/blocks/BlockItemSNPart.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import tombenpotter.sanguimancy.Sanguimancy; import tombenpotter.sanguimancy.api.objects.BlockPostition; @@ -93,4 +94,10 @@ public void onNeighborBlockChange(World world, int x, int y, int z, Block neighb } } } + + @Override + public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { + return true; + } + } diff --git a/src/main/java/tombenpotter/sanguimancy/blocks/BlockRitualSNPart.java b/src/main/java/tombenpotter/sanguimancy/blocks/BlockRitualSNPart.java index f6cb188..77beef9 100644 --- a/src/main/java/tombenpotter/sanguimancy/blocks/BlockRitualSNPart.java +++ b/src/main/java/tombenpotter/sanguimancy/blocks/BlockRitualSNPart.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import tombenpotter.sanguimancy.Sanguimancy; import tombenpotter.sanguimancy.api.objects.BlockPostition; @@ -83,4 +84,9 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p } return super.onBlockActivated(world, x, y, z, player, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_); } + + @Override + public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { + return true; + } } diff --git a/src/main/java/tombenpotter/sanguimancy/client/render/RenderRitualRepresentation.java b/src/main/java/tombenpotter/sanguimancy/client/render/RenderRitualRepresentation.java index 89ecab5..de573c2 100644 --- a/src/main/java/tombenpotter/sanguimancy/client/render/RenderRitualRepresentation.java +++ b/src/main/java/tombenpotter/sanguimancy/client/render/RenderRitualRepresentation.java @@ -30,7 +30,7 @@ public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double if (tileEntity instanceof TileRitualSNPart) { TileRitualSNPart tile = (TileRitualSNPart) tileEntity; EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (tile.ritualPosition != null && player.getHeldItem() != null && player.getHeldItem().isItemEqual(new ItemStack(ModItems.itemSeerSigil))) { + if (player.getHeldItem() != null && player.getHeldItem().isItemEqual(new ItemStack(ModItems.itemSeerSigil))) { renderNameTag(tile, x, y, z); } } @@ -98,7 +98,7 @@ public void renderModel(TileRitualSNPart tile, double x, double y, double z) { public void renderNameTag(TileRitualSNPart tile, double x, double y, double z) { float f = 1.6F; float f1 = 0.016666668F * f; - String s = tile.ritualPosition.toString(); + String s = "x: " + String.valueOf(tile.xRitual) + " y: " + String.valueOf(tile.yRitual) + " z: " + String.valueOf(tile.zRitual); RenderManager manager = RenderManager.instance; FontRenderer fontrenderer = manager.getFontRenderer(); GL11.glPushMatrix(); diff --git a/src/main/java/tombenpotter/sanguimancy/tile/TileItemSNPart.java b/src/main/java/tombenpotter/sanguimancy/tile/TileItemSNPart.java index d39ad63..eaadb6f 100644 --- a/src/main/java/tombenpotter/sanguimancy/tile/TileItemSNPart.java +++ b/src/main/java/tombenpotter/sanguimancy/tile/TileItemSNPart.java @@ -11,8 +11,8 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; -import tombenpotter.sanguimancy.api.objects.BlockPostition; import tombenpotter.sanguimancy.api.EnumSNType; +import tombenpotter.sanguimancy.api.objects.BlockPostition; import tombenpotter.sanguimancy.api.objects.SNKNotBoolean; import tombenpotter.sanguimancy.api.snManifestation.ISNKnot; import tombenpotter.sanguimancy.api.tile.TileBaseSNPart; @@ -223,7 +223,7 @@ public void updateEntity() { if (worldObj.getWorldTime() % 200 == 0) { HashMap map = getComponentsInNetwork().hashMap; for (BlockPostition postition : map.keySet()) { - if (map.get(postition).isSNKnot && map.get(postition).isSNKnotActive && worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0) { + if (map.get(postition).isSNKnot && map.get(postition).isSNKnotActive && (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0 || worldObj.getStrongestIndirectPower(xCoord, yCoord, zCoord) > 0)) { disablePart(false); } else if (map.get(postition).isSNKnot && !map.get(postition).isSNKnotActive) { disablePart(false); diff --git a/src/main/java/tombenpotter/sanguimancy/tile/TileRitualSNPart.java b/src/main/java/tombenpotter/sanguimancy/tile/TileRitualSNPart.java index d1ea027..bf2975c 100644 --- a/src/main/java/tombenpotter/sanguimancy/tile/TileRitualSNPart.java +++ b/src/main/java/tombenpotter/sanguimancy/tile/TileRitualSNPart.java @@ -3,7 +3,6 @@ import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.api.event.RitualRunEvent; import WayofTime.alchemicalWizardry.api.event.RitualStopEvent; -import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -24,7 +23,9 @@ public class TileRitualSNPart extends TileBaseSNPart implements ICustomNBTTag { public NBTTagCompound custoomNBTTag; - public BlockPostition ritualPosition; + public int xRitual; + public int yRitual; + public int zRitual; public TileRitualSNPart() { MinecraftForge.EVENT_BUS.register(this); @@ -49,14 +50,18 @@ public void onNetworkUpdate(BlockPostition originalPosition) { public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); custoomNBTTag = tagCompound.getCompoundTag("customNBTTag"); - ritualPosition = BlockPostition.readFromNBT(tagCompound); + this.xRitual = tagCompound.getInteger("xRitual"); + this.yRitual = tagCompound.getInteger("yRitual"); + this.zRitual = tagCompound.getInteger("zRitual"); } @Override public void writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); tagCompound.setTag("customNBTTag", custoomNBTTag); - ritualPosition.writeToNBT(tagCompound); + tagCompound.setInteger("xRitual", xRitual); + tagCompound.setInteger("yRitual", yRitual); + tagCompound.setInteger("zRitual", zRitual); } @Override @@ -95,19 +100,22 @@ public void markDirty() { @SubscribeEvent public void disableLinkedRitual(RitualRunEvent event) { - if (ritualPosition != null) { - HashMap map = getComponentsInNetwork().hashMap; - for (BlockPostition postition : map.keySet()) { - if (map.get(postition).isSNKnot && map.get(postition).isSNKnotActive && worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0) { - if (event.mrs.getXCoord() == ritualPosition.x && event.mrs.getYCoord() == ritualPosition.y && event.mrs.getZCoord() == ritualPosition.z) { - ritualPosition = new BlockPostition(event.mrs.getXCoord(), event.mrs.getYCoord(), event.mrs.getZCoord()); - event.setResult(Event.Result.DENY); - } - } else if (map.get(postition).isSNKnot && !map.get(postition).isSNKnotActive) { - if (event.mrs.getXCoord() == ritualPosition.x && event.mrs.getYCoord() == ritualPosition.y && event.mrs.getZCoord() == ritualPosition.z) { - ritualPosition = new BlockPostition(event.mrs.getXCoord(), event.mrs.getYCoord(), event.mrs.getZCoord()); - event.setResult(Event.Result.DENY); - } + HashMap map = getComponentsInNetwork().hashMap; + for (BlockPostition postition : map.keySet()) { + if (map.get(postition).isSNKnot && map.get(postition).isSNKnotActive && (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0 || worldObj.getStrongestIndirectPower(xCoord, yCoord, zCoord) > 0)) { + if (event.mrs.getXCoord() == xRitual && event.mrs.getYCoord() == yRitual && event.mrs.getZCoord() == zRitual) { + this.xRitual = event.mrs.getXCoord(); + this.yRitual = event.mrs.getYCoord(); + this.zRitual = event.mrs.getZCoord(); + event.setCanceled(true); + } + } + if (map.get(postition).isSNKnot && !map.get(postition).isSNKnotActive) { + if (event.mrs.getXCoord() == xRitual && event.mrs.getYCoord() == yRitual && event.mrs.getZCoord() == zRitual) { + this.xRitual = event.mrs.getXCoord(); + this.yRitual = event.mrs.getYCoord(); + this.zRitual = event.mrs.getZCoord(); + event.setCanceled(true); } } } @@ -115,18 +123,16 @@ public void disableLinkedRitual(RitualRunEvent event) { @SubscribeEvent public void removeMasterStone(RitualStopEvent event) { - if (ritualPosition != null) { - if (event.mrs.getXCoord() == ritualPosition.x && event.mrs.getYCoord() == ritualPosition.y && event.mrs.getZCoord() == ritualPosition.z) { - worldObj.setBlockToAir(xCoord, yCoord, zCoord); - } + if (event.mrs.getXCoord() == xRitual && event.mrs.getYCoord() == yRitual && event.mrs.getZCoord() == zRitual) { + worldObj.setBlockToAir(xCoord, yCoord, zCoord); } } public boolean onBlockRightClicked(EntityPlayer player, ItemStack stack) { - if (stack != null && ritualPosition != null) { + if (stack != null) { if (stack.isItemEqual(new ItemStack(ModItems.divinationSigil)) || stack.isItemEqual(new ItemStack(ModItems.itemSeerSigil))) { if (!worldObj.isRemote) { - player.addChatComponentMessage(new ChatComponentText(ritualPosition.toString())); + player.addChatComponentMessage(new ChatComponentText("x: " + String.valueOf(xRitual) + " y: " + String.valueOf(yRitual) + " z: " + String.valueOf(zRitual))); } return true; } diff --git a/src/main/java/tombenpotter/sanguimancy/util/EventHandler.java b/src/main/java/tombenpotter/sanguimancy/util/EventHandler.java index c346898..5715dd0 100644 --- a/src/main/java/tombenpotter/sanguimancy/util/EventHandler.java +++ b/src/main/java/tombenpotter/sanguimancy/util/EventHandler.java @@ -36,7 +36,6 @@ import net.minecraftforge.event.world.BlockEvent; import org.lwjgl.opengl.GL11; import tombenpotter.sanguimancy.Sanguimancy; -import tombenpotter.sanguimancy.api.objects.BlockPostition; import tombenpotter.sanguimancy.api.soulCorruption.SoulCorruptionHelper; import tombenpotter.sanguimancy.network.PacketHandler; import tombenpotter.sanguimancy.network.events.EventCorruptedInfusion; @@ -262,7 +261,9 @@ public void onRitualStart(RitualActivatedEvent event) { dimWorld.setBlock(baseX, baseY, baseZ, BlocksRegistry.ritualRepresentation); if (dimWorld.getTileEntity(baseX, baseY, baseZ) != null && dimWorld.getTileEntity(baseX, baseY, baseZ) instanceof TileRitualSNPart) { TileRitualSNPart part = (TileRitualSNPart) dimWorld.getTileEntity(baseX, baseY, baseZ); - part.ritualPosition = new BlockPostition(event.mrs.getXCoord(), event.mrs.getYCoord(), event.mrs.getZCoord()); + part.xRitual = event.mrs.getXCoord(); + part.yRitual = event.mrs.getYCoord(); + part.zRitual = event.mrs.getZCoord(); dimWorld.markBlockForUpdate(baseX, baseY, baseZ); } }