- AuraPylon: fixxed interaction with arcane dropper

This commit is contained in:
HellFirePvP committed 2015-11-17 18:16:47 +01:00
1 parent 0f13aaddb4
commit cbcf92016d
4 files changed
+28 -8

No files matched your search

@@ -1,9 +1,12 @@
package makeo.gadomancy.common.blocks;
import cpw.mods.fml.common.network.NetworkRegistry;
import makeo.gadomancy.common.Gadomancy;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylonTop;
import makeo.gadomancy.common.blocks.tiles.TileNodeManipulator;
import makeo.gadomancy.common.network.PacketHandler;
import makeo.gadomancy.common.network.packets.PacketStartAnimation;
import makeo.gadomancy.common.registration.RegisteredBlocks;
import makeo.gadomancy.common.registration.RegisteredItems;
import makeo.gadomancy.common.registration.RegisteredMultiblocks;
@@ -104,6 +107,9 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent
//TODO check for research!
if(MultiblockHelper.isMultiblockPresent(world, x, y, z, RegisteredMultiblocks.auraPylonPattern) &&
ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsAuraPylonMultiblock, true)) {
PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y, z);
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32);
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
TileAuraPylon ta = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
ta.setTileInformation(true, false);
ta = (TileAuraPylon) world.getTileEntity(x, y - 3, z);
@@ -114,6 +120,8 @@ public class BlockAuraPylon extends BlockContainer implements IBlockTransparent
((TileAuraPylon) iter).setPartOfMultiblock(true);
world.markBlockForUpdate(x, y - count, z);
iter.markDirty();
pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y - count, z);
PacketHandler.INSTANCE.sendToAllAround(pkt, point);
count++;
iter = world.getTileEntity(x, y - count, z);
}
@@ -52,6 +52,8 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
private ItemStack crystalEssentiaStack = null;
private boolean isPartOfMultiblock = false;
public int timeSinceLastItemInfo = 0; //0-5, update interval = 2
private int ticksExisted = 0;
private Aspect holdingAspect;
private int amount = 0;
@@ -63,6 +65,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
@Override
public void updateEntity() {
ticksExisted++;
timeSinceLastItemInfo++;
if (!worldObj.isRemote) {
if ((ticksExisted & 7) == 0) {
@@ -81,6 +84,9 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
drainEssentia(io);
}
}
if(holdingAspect != null && timeSinceLastItemInfo > 8) {
informItemPickup();
}
}
} else {
@@ -189,10 +195,13 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
item.age = entity.age;
item.noClip = true;
timeSinceLastItemInfo = 0;
holdingAspect = ((ItemCrystalEssence) crystalEssentiaStack.getItem()).getAspects(crystalEssentiaStack).getAspects()[0];
distributeAspectInformation();
entity.setDead();
item.delayBeforeCanPickup = 60;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
markDirty();
} else {
@@ -70,6 +70,15 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
if (getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedXId).getObject() == null)
return;
if((ticksExisted & 1) == 0) {
ChunkCoordinates cc = (ChunkCoordinates) getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject();
if(cc == null) return;
TileEntity te = worldObj.getTileEntity(cc.posX, cc.posY, cc.posZ);
if(te != null && te instanceof TileAuraPylon) {
((TileAuraPylon) te).timeSinceLastItemInfo = 0;
}
}
float fX = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedXId);
float fY = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedYId);
float fZ = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedZId);
@@ -33,12 +33,12 @@ import thaumcraft.common.items.armor.Hover;
*/
public class EventHandlerEntity {
@SubscribeEvent(priority = EventPriority.LOWEST)
/*@SubscribeEvent(priority = EventPriority.LOWEST)
public void on(EntityEvent.EntityConstructing e) {
if (e.entity instanceof EntityPlayer) {
//e.entity.registerExtendedProperties(Gadomancy.MODID, new ExtendedPlayerProperties((EntityPlayer) e.entity));
}
}
}*/
@SubscribeEvent
public void on(EnderTeleportEvent e) {
@@ -49,11 +49,6 @@ public class EventHandlerEntity {
}
}
/*@SubscribeEvent
public void on( e) {
}*/
@SubscribeEvent
public void on(LivingSetAttackTargetEvent targetEvent) {
if(targetEvent.target instanceof EntityPlayer) {
@@ -72,7 +67,6 @@ public class EventHandlerEntity {
public void on(EntityItemPickupEvent event) {
if(!event.entityPlayer.worldObj.isRemote) {
if(event.item != null && event.item instanceof EntityPermNoClipItem) {
//TODO does not inform correctly?
EntityPermNoClipItem item = (EntityPermNoClipItem) event.item;
ChunkCoordinates master = (ChunkCoordinates) item.getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject();
TileEntity te = event.entityPlayer.worldObj.getTileEntity(master.posX, master.posY, master.posZ);