LOTS of alchemy changes...
This commit is contained in:
parent
64ccc50698
commit
2b749000b6
99 changed files with 7488 additions and 659 deletions
|
@ -6,34 +6,151 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerCapabilities;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
|
||||
public class AlchemicalWizardryEventHooks
|
||||
{
|
||||
public static Map<String,Boolean> playerFlightBuff = new HashMap();
|
||||
public static Map<String,Boolean> playerBoostStepHeight = new HashMap();
|
||||
public static List<String> playersWith1Step = new ArrayList();
|
||||
|
||||
|
||||
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
|
||||
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerSoundEvent(SoundEvent event)
|
||||
{
|
||||
if(event.isCancelable() && Minecraft.getMinecraft() != null)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if(player != null && player.isPotionActive(AlchemicalWizardry.customPotionBoost))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingSpawnEvent(CheckSpawn event)
|
||||
{
|
||||
if(!(event.entityLiving instanceof EntityMob))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String respawnRitual = "AW028SpawnWard";
|
||||
|
||||
Integer dimension = new Integer(event.world.provider.dimensionId);
|
||||
if(respawnMap.containsKey(dimension))
|
||||
{
|
||||
List<CoordAndRange> list = respawnMap.get(dimension);
|
||||
|
||||
if(list != null)
|
||||
{
|
||||
for(CoordAndRange coords : list)
|
||||
{
|
||||
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
|
||||
if(tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual))
|
||||
{
|
||||
if(event.x > coords.xCoord-coords.horizRadius && event.x < coords.xCoord+coords.horizRadius && event.z > coords.zCoord-coords.horizRadius && event.z < coords.zCoord+coords.horizRadius && event.y > coords.yCoord-coords.vertRadius && event.y < coords.yCoord+coords.vertRadius)
|
||||
{
|
||||
switch(event.getResult())
|
||||
{
|
||||
case ALLOW:
|
||||
event.setResult(Result.DEFAULT);
|
||||
break;
|
||||
case DEFAULT:
|
||||
event.setResult(Result.DENY);
|
||||
break;
|
||||
case DENY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else
|
||||
{
|
||||
list.remove(coords);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String forceSpawnRitual = "AW028SpawnWard";
|
||||
|
||||
if(forceSpawnMap.containsKey(dimension))
|
||||
{
|
||||
List<CoordAndRange> list = forceSpawnMap.get(dimension);
|
||||
|
||||
if(list != null)
|
||||
{
|
||||
for(CoordAndRange coords : list)
|
||||
{
|
||||
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
|
||||
if(tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual))
|
||||
{
|
||||
if(event.x > coords.xCoord-coords.horizRadius && event.x < coords.xCoord+coords.horizRadius && event.z > coords.zCoord-coords.horizRadius && event.z < coords.zCoord+coords.horizRadius && event.y > coords.yCoord-coords.vertRadius && event.y < coords.yCoord+coords.vertRadius)
|
||||
{
|
||||
switch(event.getResult())
|
||||
{
|
||||
case ALLOW:
|
||||
break;
|
||||
case DEFAULT:
|
||||
event.setResult(Result.ALLOW);
|
||||
break;
|
||||
case DENY:
|
||||
event.setResult(Result.DEFAULT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else
|
||||
{
|
||||
list.remove(coords);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerRespawnEvent(PlayerRespawnEvent event)
|
||||
{
|
||||
|
@ -149,6 +266,11 @@ public class AlchemicalWizardryEventHooks
|
|||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
|
||||
{
|
||||
event.entityLiving.fallDistance = 0;
|
||||
}
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning))
|
||||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionDrowning).getAmplifier();
|
||||
|
|
|
@ -7,6 +7,7 @@ import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightPro
|
|||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaSecondaryProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
|
||||
|
@ -48,6 +49,7 @@ public class CommonProxy
|
|||
|
||||
public void registerEvents()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void registerSoundHandler()
|
||||
|
@ -78,6 +80,7 @@ public class CommonProxy
|
|||
EntityRegistry.registerModEntity(EntityBloodLightProjectile.class, "bloodLightProjectile", 12, AlchemicalWizardry.instance, 128, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityMeteor.class, "meteor", 13, AlchemicalWizardry.instance, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntitySpellProjectile.class, "spellProjectile", 14, AlchemicalWizardry.instance, 128, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityParticleBeam.class, "particleBeam", 15, AlchemicalWizardry.instance, 120, 3, true);
|
||||
}
|
||||
|
||||
public void registerTickHandlers()
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public class CoordAndRange
|
||||
{
|
||||
public int xCoord;
|
||||
public int yCoord;
|
||||
public int zCoord;
|
||||
public int horizRadius;
|
||||
public int vertRadius;
|
||||
|
||||
public CoordAndRange(int x, int y, int z, int horiz, int vert)
|
||||
{
|
||||
this.xCoord = x;
|
||||
this.yCoord = y;
|
||||
this.zCoord = z;
|
||||
this.horizRadius = horiz;
|
||||
this.vertRadius = vert;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return o instanceof CoordAndRange ? ((CoordAndRange)o).xCoord == this.xCoord && ((CoordAndRange)o).yCoord == this.yCoord && ((CoordAndRange)o).zCoord == this.zCoord && ((CoordAndRange)o).horizRadius == this.horizRadius && ((CoordAndRange)o).vertRadius == this.vertRadius: false;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
public class Int3
|
||||
{
|
||||
|
@ -14,6 +16,20 @@ public class Int3
|
|||
this.zCoord = zCoord;
|
||||
}
|
||||
|
||||
public static Int3 readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger("xCoord", xCoord);
|
||||
tag.setInteger("yCoord", yCoord);
|
||||
tag.setInteger("zCoord", zCoord);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,8 @@ import io.netty.channel.ChannelHandlerContext;
|
|||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -14,11 +16,13 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
|
@ -75,6 +79,7 @@ public enum NewPacketHandler
|
|||
clientChannel.pipeline().addAfter(tileAltarCodec, "ParticleHandler", new ParticleMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "VelocityHandler", new VelocityMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEMasterStoneHandler", new TEMasterStoneMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEReagentConduitHandler", new TEReagentConduitMessageHandler());
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,6 +247,22 @@ public enum NewPacketHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TEReagentConduitMessageHandler extends SimpleChannelInboundHandler<TEReagentConduitMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TEReagentConduitMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEReagentConduit)
|
||||
{
|
||||
TEReagentConduit reagentConduit = (TEReagentConduit) te;
|
||||
|
||||
reagentConduit.destinationList = msg.destinationList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class BMMessage
|
||||
{
|
||||
|
@ -343,6 +364,15 @@ public enum NewPacketHandler
|
|||
String ritual;
|
||||
boolean isRunning;
|
||||
}
|
||||
|
||||
public static class TEReagentConduitMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
List<ColourAndCoords> destinationList;
|
||||
}
|
||||
|
||||
private class TEAltarCodec extends FMLIndexedMessageToMessageCodec<BMMessage>
|
||||
{
|
||||
|
@ -358,6 +388,7 @@ public enum NewPacketHandler
|
|||
addDiscriminator(7, ParticleMessage.class);
|
||||
addDiscriminator(8, VelocityMessage.class);
|
||||
addDiscriminator(9, TEMasterStoneMessage.class);
|
||||
addDiscriminator(10, TEReagentConduitMessage.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -537,6 +568,27 @@ public enum NewPacketHandler
|
|||
|
||||
target.writeBoolean(((TEMasterStoneMessage)msg).isRunning);
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
target.writeInt(((TEReagentConduitMessage)msg).x);
|
||||
target.writeInt(((TEReagentConduitMessage)msg).y);
|
||||
target.writeInt(((TEReagentConduitMessage)msg).z);
|
||||
|
||||
List<ColourAndCoords> list = ((TEReagentConduitMessage)msg).destinationList;
|
||||
target.writeInt(list.size());
|
||||
|
||||
for(ColourAndCoords colourSet : list)
|
||||
{
|
||||
target.writeInt(colourSet.colourRed);
|
||||
target.writeInt(colourSet.colourGreen);
|
||||
target.writeInt(colourSet.colourBlue);
|
||||
target.writeInt(colourSet.colourIntensity);
|
||||
target.writeInt(colourSet.xCoord);
|
||||
target.writeInt(colourSet.yCoord);
|
||||
target.writeInt(colourSet.zCoord);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -725,6 +777,26 @@ public enum NewPacketHandler
|
|||
|
||||
((TEMasterStoneMessage)msg).ritual = ritual;
|
||||
((TEMasterStoneMessage)msg).isRunning = dat.readBoolean();
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
((TEReagentConduitMessage)msg).x = dat.readInt();
|
||||
((TEReagentConduitMessage)msg).y = dat.readInt();
|
||||
((TEReagentConduitMessage)msg).z = dat.readInt();
|
||||
|
||||
int listSize = dat.readInt();
|
||||
|
||||
List<ColourAndCoords> list = new LinkedList();
|
||||
|
||||
for(int i=0; i < listSize; i++)
|
||||
{
|
||||
list.add(new ColourAndCoords(dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt()));
|
||||
}
|
||||
|
||||
((TEReagentConduitMessage)msg).destinationList = list;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -857,6 +929,19 @@ public enum NewPacketHandler
|
|||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TEReagentConduit tile)
|
||||
{
|
||||
TEReagentConduitMessage msg = new TEReagentConduitMessage();
|
||||
msg.index = 10;
|
||||
msg.x = tile.xCoord;
|
||||
msg.y = tile.yCoord;
|
||||
msg.z = tile.zCoord;
|
||||
|
||||
msg.destinationList = tile.destinationList;
|
||||
|
||||
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);
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
|
||||
|
||||
public class BlockAlchemicCalcinator extends BlockContainer
|
||||
{
|
||||
public BlockAlchemicCalcinator()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("alchemicCalcinator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEAlchemicCalcinator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if(playerItem.getItem() instanceof IReagentManipulator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(playerItem.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
if(tileEntity.getStackInSlot(0) == null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
}
|
||||
}
|
||||
else if(tileEntity.getStackInSlot(1) == null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(1, newItem);
|
||||
}
|
||||
|
||||
} else if (playerItem == null)
|
||||
{
|
||||
if(tileEntity.getStackInSlot(1) != null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1));
|
||||
tileEntity.setInventorySlotContents(1, null);
|
||||
}else if(tileEntity.getStackInSlot(0) != null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
|
||||
tileEntity.getWorldObj().markBlockForUpdate(x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||
|
||||
public class BlockBelljar extends BlockContainer
|
||||
{
|
||||
public BlockBelljar()
|
||||
{
|
||||
super(Material.glass);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("crystalBelljar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEBellJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TEBellJar)
|
||||
{
|
||||
return ((TEBellJar) tile).getRSPowerOutput();
|
||||
}
|
||||
return 15;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,9 @@ public class BlockReagentConduit extends BlockContainer
|
|||
{
|
||||
public BlockReagentConduit()
|
||||
{
|
||||
super(Material.rock);
|
||||
super(Material.cloth);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockReagentConduit");
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
@ -24,7 +26,7 @@ public class BlockReagentConduit extends BlockContainer
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
super.registerBlockIcons(iconRegister);
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleTransCircle");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,6 +35,12 @@ public class BlockReagentConduit extends BlockContainer
|
|||
return new TEReagentConduit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.projectile;
|
||||
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBeamParticle extends EntityFX
|
||||
{
|
||||
|
||||
protected EntityBeamParticle(World p_i1218_1_, double p_i1218_2_,
|
||||
double p_i1218_4_, double p_i1218_6_)
|
||||
{
|
||||
super(p_i1218_1_, p_i1218_2_, p_i1218_4_, p_i1218_6_);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
|
@ -50,14 +50,7 @@ public class EntityMeteor extends EnergyBlastProjectile
|
|||
@Override
|
||||
public void onImpact(Entity mop)
|
||||
{
|
||||
if (mop == shootingEntity && ticksInAir > 3)
|
||||
{
|
||||
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
|
||||
this.setDead();
|
||||
} else
|
||||
{
|
||||
MeteorRegistry.createMeteorImpact(worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID);
|
||||
}
|
||||
MeteorRegistry.createMeteorImpact(worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID);
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,350 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.projectile;
|
||||
|
||||
import net.minecraft.client.particle.EntityCloudFX;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.registry.IThrowableEntity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
//Shamelessly ripped off from x3n0ph0b3
|
||||
public class EntityParticleBeam extends Entity implements IProjectile, IThrowableEntity
|
||||
{
|
||||
protected int xTile = -1;
|
||||
protected int yTile = -1;
|
||||
protected int zTile = -1;
|
||||
protected int inTile = 0;
|
||||
protected int inData = 0;
|
||||
protected float colourRed = 0f;
|
||||
protected float colourGreen = 0f;
|
||||
protected float colourBlue = 0f;
|
||||
protected int xDest = 0;
|
||||
protected int yDest = 0;
|
||||
protected int zDest = 0;
|
||||
protected boolean inGround = false;
|
||||
/**
|
||||
* The owner of this arrow.
|
||||
*/
|
||||
public EntityLivingBase shootingEntity;
|
||||
protected int ticksInAir = 0;
|
||||
protected int maxTicksInAir = 600;
|
||||
private int ricochetCounter = 0;
|
||||
private boolean scheduledForDeath = false;
|
||||
protected int projectileDamage;
|
||||
|
||||
public EntityParticleBeam(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.maxTicksInAir = 600;
|
||||
}
|
||||
|
||||
public EntityParticleBeam(World par1World, double par2, double par4, double par6)
|
||||
{
|
||||
super(par1World);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(par2, par4, par6);
|
||||
yOffset = 0.0F;
|
||||
this.maxTicksInAir = 600;
|
||||
}
|
||||
|
||||
public EntityParticleBeam(World par1World, EntityLivingBase par2EntityPlayer, int damage)
|
||||
{
|
||||
super(par1World);
|
||||
shootingEntity = par2EntityPlayer;
|
||||
float par3 = 0.8F;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
|
||||
posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
|
||||
posY -= 0.2D;
|
||||
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
|
||||
this.setPosition(posX, posY, posZ);
|
||||
yOffset = 0.0F;
|
||||
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
|
||||
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
|
||||
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
|
||||
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
|
||||
this.projectileDamage = damage;
|
||||
this.maxTicksInAir = 600;
|
||||
}
|
||||
|
||||
public EntityParticleBeam(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
|
||||
{
|
||||
super(par1World);
|
||||
shootingEntity = par2EntityPlayer;
|
||||
float par3 = 0.8F;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
|
||||
posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
|
||||
posY -= 0.2D;
|
||||
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
|
||||
this.setPosition(posX, posY, posZ);
|
||||
yOffset = 0.0F;
|
||||
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
|
||||
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
|
||||
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
|
||||
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
|
||||
this.projectileDamage = damage;
|
||||
this.maxTicksInAir = maxTicksInAir;
|
||||
}
|
||||
|
||||
public EntityParticleBeam(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
|
||||
{
|
||||
super(par1World);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = par2EntityLivingBase;
|
||||
this.posY = par2EntityLivingBase.posY + (double) par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D;
|
||||
double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX;
|
||||
double d1 = par3EntityLivingBase.boundingBox.minY + (double) (par3EntityLivingBase.height / 1.5F) - this.posY;
|
||||
double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ;
|
||||
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
|
||||
|
||||
if (d3 >= 1.0E-7D)
|
||||
{
|
||||
float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
|
||||
float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI));
|
||||
double d4 = d0 / d3;
|
||||
double d5 = d2 / d3;
|
||||
this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3);
|
||||
this.yOffset = 0.0F;
|
||||
float f4 = (float) d3 * 0.2F;
|
||||
this.setThrowableHeading(d0, d1, d2, par4, par5);
|
||||
}
|
||||
|
||||
this.projectileDamage = damage;
|
||||
this.maxTicksInAir = maxTicksInAir;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
dataWatcher.addObject(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z
|
||||
* direction.
|
||||
*/
|
||||
@Override
|
||||
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8)
|
||||
{
|
||||
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5);
|
||||
var1 /= var9;
|
||||
var3 /= var9;
|
||||
var5 /= var9;
|
||||
var1 += rand.nextGaussian() * 0.007499999832361937D * var8;
|
||||
var3 += rand.nextGaussian() * 0.007499999832361937D * var8;
|
||||
var5 += rand.nextGaussian() * 0.007499999832361937D * var8;
|
||||
var1 *= var7;
|
||||
var3 *= var7;
|
||||
var5 *= var7;
|
||||
motionX = var1;
|
||||
motionY = var3;
|
||||
motionZ = var5;
|
||||
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
|
||||
prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
|
||||
* posY, posZ, yaw, pitch
|
||||
*/
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
|
||||
{
|
||||
this.setPosition(par1, par3, par5);
|
||||
this.setRotation(par7, par8);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Sets the velocity to the args. Args: x, y, z
|
||||
*/
|
||||
public void setVelocity(double par1, double par3, double par5)
|
||||
{
|
||||
motionX = par1;
|
||||
motionY = par3;
|
||||
motionZ = par5;
|
||||
|
||||
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
|
||||
{
|
||||
float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
|
||||
prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch;
|
||||
prevRotationYaw = rotationYaw;
|
||||
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (ticksInAir > maxTicksInAir)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
posX += motionX;
|
||||
posY += motionY;
|
||||
posZ += motionZ;
|
||||
MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
|
||||
this.setPosition(posX, posY, posZ);
|
||||
|
||||
this.doFiringParticles();
|
||||
|
||||
if(Math.pow(posX - xDest, 2) + Math.pow(posY - yDest, 2) + Math.pow(posZ - zDest, 2) <= 1)
|
||||
{
|
||||
this.scheduledForDeath = true;
|
||||
}
|
||||
|
||||
if(this.scheduledForDeath)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
public void doFiringParticles()
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
|
||||
EntityFX particle = new EntityCloudFX(worldObj, posX, posY, posZ, 0, 0, 0);
|
||||
particle.setRBGColorF(colourRed + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()), colourGreen + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()), colourBlue + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()));
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle);
|
||||
//worldObj.spawnParticle("happyVillager", posX, posY, posZ, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
par1NBTTagCompound.setShort("xTile", (short) xTile);
|
||||
par1NBTTagCompound.setShort("yTile", (short) yTile);
|
||||
par1NBTTagCompound.setShort("zTile", (short) zTile);
|
||||
par1NBTTagCompound.setByte("inTile", (byte) inTile);
|
||||
par1NBTTagCompound.setByte("inData", (byte) inData);
|
||||
par1NBTTagCompound.setByte("inGround", (byte) (inGround ? 1 : 0));
|
||||
par1NBTTagCompound.setInteger("ticksInAir", ticksInAir);
|
||||
par1NBTTagCompound.setInteger("maxTicksInAir", maxTicksInAir);
|
||||
par1NBTTagCompound.setInteger("projectileDamage", this.projectileDamage);
|
||||
par1NBTTagCompound.setFloat("colourRed", colourRed);
|
||||
par1NBTTagCompound.setFloat("colourGreen", colourGreen);
|
||||
par1NBTTagCompound.setFloat("colourBlue", colourBlue);
|
||||
par1NBTTagCompound.setInteger("xDest", xDest);
|
||||
par1NBTTagCompound.setInteger("yDest", yDest);
|
||||
par1NBTTagCompound.setInteger("zDest", zDest);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
xTile = par1NBTTagCompound.getShort("xTile");
|
||||
yTile = par1NBTTagCompound.getShort("yTile");
|
||||
zTile = par1NBTTagCompound.getShort("zTile");
|
||||
inTile = par1NBTTagCompound.getByte("inTile") & 255;
|
||||
inData = par1NBTTagCompound.getByte("inData") & 255;
|
||||
inGround = par1NBTTagCompound.getByte("inGround") == 1;
|
||||
ticksInAir = par1NBTTagCompound.getInteger("ticksInAir");
|
||||
maxTicksInAir = par1NBTTagCompound.getInteger("maxTicksInAir");
|
||||
projectileDamage = par1NBTTagCompound.getInteger("projectileDamage");
|
||||
colourRed = par1NBTTagCompound.getFloat("colourRed");
|
||||
colourGreen = par1NBTTagCompound.getFloat("colourGreen");
|
||||
colourBlue = par1NBTTagCompound.getFloat("colourBlue");
|
||||
xDest = par1NBTTagCompound.getInteger("xDest");
|
||||
yDest = par1NBTTagCompound.getInteger("yDest");
|
||||
zDest = par1NBTTagCompound.getInteger("zDest");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
protected void spawnHitParticles(String string, int i)
|
||||
{
|
||||
for (int particles = 0; particles < i; particles++)
|
||||
{
|
||||
worldObj.spawnParticle(string, posX, posY - (string == "portal" ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
|
||||
}
|
||||
}
|
||||
|
||||
public DamageSource getDamageSource()
|
||||
{
|
||||
return DamageSource.causeMobDamage(shootingEntity);
|
||||
}
|
||||
|
||||
public double smallGauss(double d)
|
||||
{
|
||||
return (worldObj.rand.nextFloat() - 0.5D) * d;
|
||||
}
|
||||
|
||||
public double gaussian(double d)
|
||||
{
|
||||
return d + d * ((rand.nextFloat() - 0.5D) / 4);
|
||||
}
|
||||
|
||||
private int getRicochetMax()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getThrower()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return this.shootingEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThrower(Entity entity)
|
||||
{
|
||||
if(entity instanceof EntityLivingBase)
|
||||
this.shootingEntity = (EntityLivingBase)entity;
|
||||
|
||||
}
|
||||
|
||||
public void setColour(float red, float green, float blue)
|
||||
{
|
||||
this.colourRed = red;
|
||||
this.colourGreen = green;
|
||||
this.colourBlue = blue;
|
||||
}
|
||||
|
||||
public void setDestination(int xDest, int yDest, int zDest)
|
||||
{
|
||||
this.xDest = xDest;
|
||||
this.yDest = yDest;
|
||||
this.zDest = zDest;
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@ import thaumcraft.api.IRunicArmor;
|
|||
import thaumcraft.api.nodes.IRevealer;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
@ -30,7 +31,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@Optional.InterfaceList(value = {@Interface(iface="thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), @Interface(iface="thaumcraft.api.IGoggles", modid = "Thaumcraft"), @Interface(iface="thaumcraft.api.IRunicArmor", modid = "Thaumcraft")})
|
||||
public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,IRevealer, IGoggles, IRunicArmor
|
||||
public class BoundArmour extends ItemArmor implements IAlchemyGoggles,ISpecialArmor,IBindable ,IRevealer, IGoggles, IRunicArmor
|
||||
{
|
||||
private static int invSize = 9;
|
||||
private static IIcon helmetIcon;
|
||||
|
@ -694,4 +695,30 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I
|
|||
|
||||
return harden;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player)
|
||||
{
|
||||
ItemStack[] inv = getInternalInventory(stack);
|
||||
|
||||
if (inv == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ItemStack item : inv)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.getItem().equals(ModItems.itemSeerSigil))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class ItemComponents extends Item
|
||||
{
|
||||
private static final String[] ITEM_NAMES = new String[]{"QuartzRod", "EmptyCore", "MagicalesCable", "WoodBrace", "StoneBrace", "ProjectileCore", "SelfCore","MeleeCore","ParadigmBackPlate","OutputCable","FlameCore","IcyCore","GustCore","EarthenCore","InputCable","CrackedRunicPlate","RunicPlate","ScribedRunicPlate","DefaultCore","OffensiveCore","DefensiveCore","EnvironmentalCore","PowerCore","CostCore","PotencyCore","ObsidianBrace"};
|
||||
private static final String[] ITEM_NAMES = new String[]{"QuartzRod", "EmptyCore", "MagicalesCable", "WoodBrace", "StoneBrace", "ProjectileCore", "SelfCore","MeleeCore","ParadigmBackPlate","OutputCable","FlameCore","IcyCore","GustCore","EarthenCore","InputCable","CrackedRunicPlate","RunicPlate","ScribedRunicPlate","DefaultCore","OffensiveCore","DefensiveCore","EnvironmentalCore","PowerCore","CostCore","PotencyCore","ObsidianBrace","ToolCore"};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
|
|
@ -0,0 +1,391 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.energy;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
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.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemAttunedCrystal extends Item implements IReagentManipulator
|
||||
{
|
||||
public static final int maxDistance = 5;
|
||||
|
||||
public IIcon crystalBody;
|
||||
public IIcon crystalLabel;
|
||||
|
||||
public ItemAttunedCrystal()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.hasSubtypes = true;
|
||||
this.maxStackSize = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
Reagent reagent = this.getReagent(stack);
|
||||
|
||||
String name = super.getItemStackDisplayName(stack);
|
||||
|
||||
if(reagent != null)
|
||||
{
|
||||
name = name + " (" + reagent.name + ")";
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("A tool to tune alchemy");
|
||||
par3List.add("reagent transmission");
|
||||
|
||||
if (!(par1ItemStack.stackTagCompound == null))
|
||||
{
|
||||
Reagent reagent = this.getReagent(par1ItemStack);
|
||||
if(reagent != null)
|
||||
{
|
||||
par3List.add("Currently selected reagent: " + reagent.name);
|
||||
}
|
||||
|
||||
if(this.getHasSavedCoordinates(par1ItemStack))
|
||||
{
|
||||
par3List.add("");
|
||||
Int3 coords = this.getCoordinates(par1ItemStack);
|
||||
par3List.add("Coords: " + coords.xCoord + ", " + coords.yCoord + ", " + coords.zCoord);
|
||||
par3List.add("Bound Dimension: " + getDimension(par1ItemStack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.crystalBody = iconRegister.registerIcon("AlchemicalWizardry:AttunedCrystal1");
|
||||
this.crystalLabel = iconRegister.registerIcon("AlchemicalWizardry:AttunedCrystal2");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
switch(pass)
|
||||
{
|
||||
case 0:
|
||||
return 256*(256*255 + 255) + 255;
|
||||
case 1:
|
||||
Reagent reagent = this.getReagent(stack);
|
||||
if(reagent != null)
|
||||
{
|
||||
return (reagent.getColourRed()*256*256 + reagent.getColourGreen()*256 + reagent.getColourBlue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 256*(256*255 + 255) + 255;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderPasses(int meta)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
switch(pass)
|
||||
{
|
||||
case 0:
|
||||
return this.crystalBody;
|
||||
case 1:
|
||||
return this.crystalLabel;
|
||||
}
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false);
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
if(player.isSneaking())
|
||||
{
|
||||
this.setHasSavedCoordinates(itemStack, false);
|
||||
player.addChatComponentMessage(new ChatComponentText("Clearing saved container..."));
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
} else
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(tile instanceof IReagentHandler))
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
IReagentHandler relay = (IReagentHandler)tile;
|
||||
|
||||
if(player.isSneaking())
|
||||
{
|
||||
ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.UNKNOWN);
|
||||
if(infos != null)
|
||||
{
|
||||
List<Reagent> reagentList = new LinkedList();
|
||||
for(ReagentContainerInfo info : infos)
|
||||
{
|
||||
if(info != null)
|
||||
{
|
||||
ReagentStack reagentStack = info.reagent;
|
||||
if(reagentStack != null)
|
||||
{
|
||||
Reagent reagent = reagentStack.reagent;
|
||||
if(reagent != null)
|
||||
{
|
||||
reagentList.add(reagent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reagent pastReagent = this.getReagent(itemStack);
|
||||
|
||||
boolean goForNext = false;
|
||||
boolean hasFound = false;
|
||||
for(Reagent reagent : reagentList)
|
||||
{
|
||||
if(goForNext)
|
||||
{
|
||||
goForNext = false;
|
||||
this.setReagentWithNotification(itemStack, reagent, player);
|
||||
}
|
||||
|
||||
if(reagent == pastReagent)
|
||||
{
|
||||
goForNext = true;
|
||||
hasFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(hasFound)
|
||||
{
|
||||
if(goForNext)
|
||||
{
|
||||
this.setReagentWithNotification(itemStack, reagentList.get(0), player);
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(reagentList.size() >= 1)
|
||||
{
|
||||
this.setReagentWithNotification(itemStack, reagentList.get(0), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(this.getHasSavedCoordinates(itemStack))
|
||||
{
|
||||
Int3 coords = this.getCoordinates(itemStack);
|
||||
int dimension = this.getDimension(itemStack);
|
||||
|
||||
if(dimension != world.provider.dimensionId || Math.abs(coords.xCoord - x) > maxDistance || Math.abs(coords.yCoord - y) > maxDistance || Math.abs(coords.zCoord - z) > maxDistance)
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText("Linked container is either too far or is in a different dimension."));
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
TileEntity pastTile = world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
if(!(pastTile instanceof TEReagentConduit))
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText("Can no longer find linked container."));
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
Reagent reagent = this.getReagent(itemStack);
|
||||
|
||||
TEReagentConduit pastRelay = (TEReagentConduit)pastTile;
|
||||
|
||||
if(player.isSneaking())
|
||||
{
|
||||
pastRelay.removeReagentDestinationViaActual(reagent, x, y, z);
|
||||
}else
|
||||
{
|
||||
if(pastRelay.addReagentDestinationViaActual(reagent, x, y, z))
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText("Container is now linked. Transmitting: " + reagent.name));
|
||||
}else
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText("Linked container has no connections remaining!"));
|
||||
}
|
||||
}
|
||||
world.markBlockForUpdate(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
}else
|
||||
{
|
||||
int dimension = world.provider.dimensionId;
|
||||
|
||||
this.setDimension(itemStack, dimension);
|
||||
this.setCoordinates(itemStack, new Int3(x, y, z));
|
||||
|
||||
player.addChatComponentMessage(new ChatComponentText("Linking to selected container."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public void setCoordinates(ItemStack stack, Int3 coords)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
coords.writeToNBT(tag);
|
||||
|
||||
this.setHasSavedCoordinates(stack, true);
|
||||
}
|
||||
|
||||
public void setDimension(ItemStack stack, int dimension)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
tag.setInteger("dimension", dimension);
|
||||
}
|
||||
|
||||
public Int3 getCoordinates(ItemStack stack)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
return Int3.readFromNBT(tag);
|
||||
}
|
||||
|
||||
public int getDimension(ItemStack stack)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
return tag.getInteger("dimension");
|
||||
}
|
||||
|
||||
public void setHasSavedCoordinates(ItemStack stack, boolean flag)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
tag.setBoolean("hasSavedCoordinates", flag);
|
||||
}
|
||||
|
||||
public boolean getHasSavedCoordinates(ItemStack stack)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
return tag.getBoolean("hasSavedCoordinates");
|
||||
}
|
||||
|
||||
public Reagent getReagent(ItemStack stack)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
return ReagentRegistry.getReagentForKey(tag.getString("reagent"));
|
||||
}
|
||||
|
||||
public void setReagent(ItemStack stack, Reagent reagent)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
tag.setString("reagent", ReagentRegistry.getKeyForReagent(reagent));
|
||||
}
|
||||
|
||||
public void setReagentWithNotification(ItemStack stack, Reagent reagent, EntityPlayer player)
|
||||
{
|
||||
this.setReagent(stack, reagent);
|
||||
|
||||
if(reagent != null)
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText("Attuned Crystal now set to: " + reagent.name));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.energy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemDestinationClearer extends Item implements IReagentManipulator
|
||||
{
|
||||
public ItemDestinationClearer()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.maxStackSize = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:TankClearer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Used to clear the destination");
|
||||
par3List.add("list for an alchemy container");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false);
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
return itemStack;
|
||||
} else
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(tile instanceof TEReagentConduit))
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
TEReagentConduit relay = (TEReagentConduit)tile;
|
||||
|
||||
relay.reagentTargetList.clear();
|
||||
|
||||
player.addChatComponentMessage(new ChatComponentText("Destination list now cleared."));
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,278 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.energy;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
|
||||
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 WayofTime.alchemicalWizardry.common.Int3;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemTankSegmenter extends Item implements IReagentManipulator
|
||||
{
|
||||
public IIcon crystalBody;
|
||||
public IIcon crystalLabel;
|
||||
|
||||
public ItemTankSegmenter()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.hasSubtypes = true;
|
||||
this.maxStackSize = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
Reagent reagent = this.getReagent(stack);
|
||||
|
||||
String name = super.getItemStackDisplayName(stack);
|
||||
|
||||
if(reagent != null)
|
||||
{
|
||||
name = name + " (" + reagent.name + ")";
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add("Used to designate which");
|
||||
par3List.add("reagents can go into a container");
|
||||
|
||||
if (!(par1ItemStack.stackTagCompound == null))
|
||||
{
|
||||
Reagent reagent = this.getReagent(par1ItemStack);
|
||||
if(reagent != null)
|
||||
{
|
||||
par3List.add("Currently selected reagent: " + reagent.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.crystalBody = iconRegister.registerIcon("AlchemicalWizardry:TankSegmenter1");
|
||||
this.crystalLabel = iconRegister.registerIcon("AlchemicalWizardry:TankSegmenter2");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
switch(pass)
|
||||
{
|
||||
case 0:
|
||||
return 256*(256*255 + 255) + 255;
|
||||
case 1:
|
||||
Reagent reagent = this.getReagent(stack);
|
||||
if(reagent != null)
|
||||
{
|
||||
return (reagent.getColourRed()*256*256 + reagent.getColourGreen()*256 + reagent.getColourBlue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 256*(256*255 + 255) + 255;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderPasses(int meta)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
switch(pass)
|
||||
{
|
||||
case 0:
|
||||
return this.crystalBody;
|
||||
case 1:
|
||||
return this.crystalLabel;
|
||||
}
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false);
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
return itemStack;
|
||||
} else
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(tile instanceof ISegmentedReagentHandler))
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
ISegmentedReagentHandler reagentHandler = (ISegmentedReagentHandler)tile;
|
||||
|
||||
if(player.isSneaking())
|
||||
{
|
||||
ReagentContainerInfo[] infos = reagentHandler.getContainerInfo(ForgeDirection.UNKNOWN);
|
||||
if(infos != null)
|
||||
{
|
||||
List<Reagent> reagentList = new LinkedList();
|
||||
for(ReagentContainerInfo info : infos)
|
||||
{
|
||||
if(info != null)
|
||||
{
|
||||
ReagentStack reagentStack = info.reagent;
|
||||
if(reagentStack != null)
|
||||
{
|
||||
Reagent reagent = reagentStack.reagent;
|
||||
if(reagent != null)
|
||||
{
|
||||
reagentList.add(reagent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reagent pastReagent = this.getReagent(itemStack);
|
||||
|
||||
boolean goForNext = false;
|
||||
boolean hasFound = false;
|
||||
for(Reagent reagent : reagentList)
|
||||
{
|
||||
if(goForNext)
|
||||
{
|
||||
goForNext = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(reagent == pastReagent)
|
||||
{
|
||||
goForNext = true;
|
||||
hasFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(hasFound)
|
||||
{
|
||||
if(goForNext)
|
||||
{
|
||||
this.setReagentWithNotification(itemStack, reagentList.get(0), player);
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(reagentList.size() >= 1)
|
||||
{
|
||||
this.setReagentWithNotification(itemStack, reagentList.get(0), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
Reagent reagent = this.getReagent(itemStack);
|
||||
if(reagent == null)
|
||||
{
|
||||
//TODO: Send message that "All are wiped"
|
||||
reagentHandler.getAttunedTankMap().clear();
|
||||
return itemStack;
|
||||
}
|
||||
int totalTankSize = reagentHandler.getNumberOfTanks();
|
||||
int numberAssigned = reagentHandler.getTanksTunedToReagent(reagent) + 1;
|
||||
|
||||
if(numberAssigned > totalTankSize)
|
||||
{
|
||||
numberAssigned = 0;
|
||||
}
|
||||
|
||||
player.addChatComponentMessage(new ChatComponentText("Tank now has " + numberAssigned + " tank(s) set to: " + reagent.name));
|
||||
|
||||
reagentHandler.setTanksTunedToReagent(reagent, numberAssigned);
|
||||
}
|
||||
}else if(movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS)
|
||||
{
|
||||
this.setReagent(itemStack, null);
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public Reagent getReagent(ItemStack stack)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
return ReagentRegistry.getReagentForKey(tag.getString("reagent"));
|
||||
}
|
||||
|
||||
public void setReagent(ItemStack stack, Reagent reagent)
|
||||
{
|
||||
if(!stack.hasTagCompound())
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
tag.setString("reagent", ReagentRegistry.getKeyForReagent(reagent));
|
||||
}
|
||||
|
||||
public void setReagentWithNotification(ItemStack stack, Reagent reagent, EntityPlayer player)
|
||||
{
|
||||
this.setReagent(stack, reagent);
|
||||
|
||||
if(reagent != null)
|
||||
{
|
||||
player.addChatComponentMessage(new ChatComponentText("Tank Segmenter now set to: " + reagent.name));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,16 +9,23 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.common.PacketHandler;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class DivinationSigil extends Item implements ArmourUpgrade
|
||||
public class DivinationSigil extends Item implements ArmourUpgrade, IReagentManipulator, IBindable
|
||||
{
|
||||
public DivinationSigil()
|
||||
{
|
||||
|
@ -67,8 +74,44 @@ public class DivinationSigil extends Item implements ArmourUpgrade
|
|||
String ownerName = itemTag.getString("ownerName");
|
||||
//PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(ownerName));
|
||||
int currentEssence = EnergyItems.getCurrentEssence(ownerName);
|
||||
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentText("Current Essence: " + EnergyItems.getCurrentEssence(ownerName) + "LP"));
|
||||
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false);
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentText("Current Essence: " + EnergyItems.getCurrentEssence(ownerName) + "LP"));
|
||||
|
||||
return par1ItemStack;
|
||||
} else
|
||||
{
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
TileEntity tile = par2World.getTileEntity(x, y, z);
|
||||
|
||||
if(!(tile instanceof IReagentHandler))
|
||||
{
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
IReagentHandler relay = (IReagentHandler)tile;
|
||||
|
||||
ReagentContainerInfo[] infoList = relay.getContainerInfo(ForgeDirection.UNKNOWN);
|
||||
if(infoList != null)
|
||||
{
|
||||
for(ReagentContainerInfo info : infoList)
|
||||
{
|
||||
if(info != null && info.reagent != null && info.reagent.reagent != null)
|
||||
{
|
||||
par3EntityPlayer.addChatComponentMessage(new ChatComponentText("Reagent: " + ReagentRegistry.getKeyForReagent(info.reagent.reagent) + ", Amount: " + info.reagent.amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
@ -77,7 +120,7 @@ public class DivinationSigil extends Item implements ArmourUpgrade
|
|||
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 400, 9,true));
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 400, 9, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,21 +2,20 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSeerSigil extends Item implements IHolding
|
||||
public class ItemSeerSigil extends Item implements IHolding, ArmourUpgrade
|
||||
{
|
||||
public ItemSeerSigil()
|
||||
{
|
||||
|
@ -64,4 +63,26 @@ public class ItemSeerSigil extends Item implements IHolding
|
|||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmourUpdate(World world, EntityPlayer player,
|
||||
ItemStack thisItemStack)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgrade()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyForTenSeconds()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,10 +164,10 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog
|
|||
{
|
||||
switch(this.armorType)
|
||||
{
|
||||
case 0: return 8;
|
||||
case 1: return 4;
|
||||
case 2: return 3;
|
||||
case 3: return 3;
|
||||
case 0: return 7;
|
||||
case 1: return 3;
|
||||
case 2: return 2;
|
||||
case 3: return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package WayofTime.alchemicalWizardry.common.potion;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
public class PotionDeaf extends Potion
|
||||
{
|
||||
public PotionDeaf(int par1, boolean par2, int par3)
|
||||
{
|
||||
super(par1, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Potion setIconIndex(int par1, int par2)
|
||||
{
|
||||
super.setIconIndex(par1, par2);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package WayofTime.alchemicalWizardry.common.potion;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
public class PotionFeatherFall extends Potion
|
||||
{
|
||||
public PotionFeatherFall(int par1, boolean par2, int par3)
|
||||
{
|
||||
super(par1, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Potion setIconIndex(int par1, int par2)
|
||||
{
|
||||
super.setIconIndex(par1, par2);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -8,16 +8,54 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
|
||||
|
||||
public class BeamRenderer
|
||||
{
|
||||
private static final ResourceLocation field_110629_a = new ResourceLocation("textures/entity/beacon_beam.png");
|
||||
protected static TileEntityRendererDispatcher field_147501_a;
|
||||
|
||||
|
||||
public int xInit;
|
||||
public int yInit;
|
||||
public int zInit;
|
||||
|
||||
public int xFinal;
|
||||
public int yFinal;
|
||||
public int zFinal;
|
||||
|
||||
public int colourRed;
|
||||
public int colourGreen;
|
||||
public int colourBlue;
|
||||
public int colourIntensity;
|
||||
|
||||
public double size;
|
||||
|
||||
public void setInitialPosition(int x, int y, int z)
|
||||
{
|
||||
this.xInit = x;
|
||||
this.yInit = y;
|
||||
this.zInit = z;
|
||||
}
|
||||
|
||||
public void setColourAndFinalPosition(ColourAndCoords col)
|
||||
{
|
||||
this.colourRed = col.colourRed;
|
||||
this.colourGreen = col.colourGreen;
|
||||
this.colourBlue = col.colourBlue;
|
||||
this.colourIntensity = col.colourIntensity;
|
||||
|
||||
this.xFinal = col.xCoord;
|
||||
this.yFinal = col.yCoord;
|
||||
this.zFinal = col.zCoord;
|
||||
}
|
||||
|
||||
public void setSize(double size)
|
||||
{
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
protected static void bindTexture(ResourceLocation p_147499_1_)
|
||||
{
|
||||
TextureManager texturemanager = BeamRenderer.field_147501_a.field_147553_e;
|
||||
TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e;
|
||||
|
||||
if (texturemanager != null)
|
||||
{
|
||||
|
@ -25,14 +63,16 @@ public class BeamRenderer
|
|||
}
|
||||
}
|
||||
|
||||
public static void render()
|
||||
public void render(double d0, double d1, double d2)
|
||||
{
|
||||
double d0 = 0;
|
||||
double d1 = 0;
|
||||
double d2 = 0;
|
||||
|
||||
|
||||
float distance = 5; //Total distance
|
||||
int xDiff = this.xFinal - this.xInit;
|
||||
int yDiff = this.yFinal - this.yInit;
|
||||
int zDiff = this.zFinal - this.zInit;
|
||||
|
||||
float planarAngle = (float)(Math.atan2(-zDiff, xDiff) * 180d / Math.PI); //Radians
|
||||
float verticalAngle = (float)(Math.atan2(yDiff, Math.sqrt(xDiff*xDiff + zDiff+zDiff)) * 180d / Math.PI);
|
||||
|
||||
float distance = (float) Math.sqrt(xDiff*xDiff + yDiff*yDiff + zDiff*zDiff); //Total distance
|
||||
|
||||
GL11.glPushMatrix();
|
||||
float f1 = 1.0f;
|
||||
|
@ -51,11 +91,11 @@ public class BeamRenderer
|
|||
GL11.glDepthMask(false);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(255, 0, 0, 50);
|
||||
tessellator.setColorRGBA(colourRed, colourGreen, colourBlue, colourIntensity);
|
||||
//tessellator.setColorOpaque(255, 255, 255);
|
||||
|
||||
double inside = 0.45d-0.5d;
|
||||
double outside = 1.0d-0.45d-0.5d;
|
||||
double inside = -(this.size/2d);
|
||||
double outside = 1.0d-(0.50d - this.size/2d)-0.5d;
|
||||
|
||||
double d18 = inside;
|
||||
double d19 = inside;
|
||||
|
@ -73,8 +113,8 @@ public class BeamRenderer
|
|||
|
||||
GL11.glTranslated(d0+0.5, d1+0.5, d2+0.5);
|
||||
|
||||
GL11.glRotatef(45F, 0F, 1F, 0F); //Rotate on planar axis
|
||||
GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis
|
||||
GL11.glRotatef(planarAngle, 0F, 1F, 0F); //Rotate on planar axis
|
||||
GL11.glRotatef(verticalAngle, 0F, 0F, 1F); //Rotate vertical axis
|
||||
//GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically
|
||||
|
||||
double offset = 0;
|
||||
|
|
|
@ -0,0 +1,485 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.block;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelAlchemicalCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RenderAlchemicCalcinator extends TileEntitySpecialRenderer
|
||||
{
|
||||
private final RenderItem customRenderItem;
|
||||
private ModelAlchemicalCalcinator modelConduit = new ModelAlchemicalCalcinator();
|
||||
|
||||
private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png");
|
||||
|
||||
public RenderAlchemicCalcinator()
|
||||
{
|
||||
customRenderItem = new RenderItem()
|
||||
{
|
||||
@Override
|
||||
public boolean shouldBob()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
customRenderItem.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f)
|
||||
{
|
||||
if (tileEntity instanceof TEAlchemicCalcinator)
|
||||
{
|
||||
TEAlchemicCalcinator tileAltar = (TEAlchemicCalcinator) tileEntity;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/AlchemicalCalcinator.png");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
|
||||
//A reference to your Model file. Again, very important.
|
||||
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
//Tell it to stop rendering for both the PushMatrix's
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
// GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (tileAltar.getStackInSlot(1) != null)
|
||||
{
|
||||
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(1));
|
||||
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
|
||||
ghostEntityItem.hoverStart = 0.0F;
|
||||
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(1));
|
||||
//translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), d0, d1, d2, ForgeDirection.DOWN);
|
||||
float displacement = 0.2F;
|
||||
|
||||
if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
|
||||
{
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F);
|
||||
} else
|
||||
{
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f*2f);
|
||||
}
|
||||
|
||||
//GL11.glTranslatef((float) tileAltar.xCoord + 0.5F, (float) tileAltar.yCoord + 2.7F, (float) tileAltar.zCoord + 0.5F);
|
||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
|
||||
if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock))
|
||||
{
|
||||
GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F);
|
||||
}
|
||||
|
||||
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (tileAltar.getStackInSlot(0) != null)
|
||||
{
|
||||
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0));
|
||||
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
|
||||
ghostEntityItem.hoverStart = 0.0F;
|
||||
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0));
|
||||
//translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), d0, d1, d2, ForgeDirection.DOWN);
|
||||
float displacement = -0.5F;
|
||||
|
||||
if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
|
||||
{
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F);
|
||||
} else
|
||||
{
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f*2f);
|
||||
}
|
||||
|
||||
//GL11.glTranslatef((float) tileAltar.xCoord + 0.5F, (float) tileAltar.yCoord + 2.7F, (float) tileAltar.zCoord + 0.5F);
|
||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
|
||||
if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock))
|
||||
{
|
||||
GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F);
|
||||
}
|
||||
|
||||
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
ReagentContainerInfo[] info = tileAltar.getContainerInfo(ForgeDirection.UNKNOWN);
|
||||
if(info.length >= 1 && info[0] != null)
|
||||
{
|
||||
ReagentStack reagentStack = info[0].reagent;
|
||||
int capacity = info[0].capacity;
|
||||
if(reagentStack != null && reagentStack.reagent != null)
|
||||
{
|
||||
Reagent reagent = reagentStack.reagent;
|
||||
this.renderTankContents(d0, d1, d2, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for (int i = 0; i <= 1; i++)
|
||||
// {
|
||||
// GL11.glPushMatrix();
|
||||
//
|
||||
// if (tileAltar.getStackInSlot(i) != null)
|
||||
// {
|
||||
// float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(i));
|
||||
// float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||
// EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
|
||||
// ghostEntityItem.hoverStart = 0.0F;
|
||||
// ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(i));
|
||||
// //translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), d0, d1, d2, ForgeDirection.DOWN);
|
||||
// float displacementX = getXDisplacementForSlot(i);
|
||||
// float displacementY = getYDisplacementForSlot(i);
|
||||
// float displacementZ = getZDisplacementForSlot(i);
|
||||
//
|
||||
// if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
|
||||
// {
|
||||
// GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.7F, (float) d2 + 0.5F + displacementZ);
|
||||
// } else
|
||||
// {
|
||||
// GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.6F, (float) d2 + 0.5F + displacementZ);
|
||||
// }
|
||||
//
|
||||
// //GL11.glTranslatef((float) tileAltar.xCoord + 0.5F, (float) tileAltar.yCoord + 2.7F, (float) tileAltar.zCoord + 0.5F);
|
||||
// GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
// GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||
// customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
// }
|
||||
//
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTankContents(double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float f1 = 1.0f;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
this.bindTexture(resourceLocation);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
float f2 = 0;
|
||||
float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(colourRed, colourGreen, colourBlue, colourIntensity);
|
||||
|
||||
GL11.glTranslated(x+0.5, y+0.5, z+0.5);
|
||||
//GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis
|
||||
//GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically
|
||||
|
||||
tessellator.setBrightness(240);
|
||||
|
||||
double x1 = -7d/16d;
|
||||
double x2 = 7d/16d;
|
||||
double y1 = 1d/16d;
|
||||
double y2 = 5d/16d;
|
||||
double z1 = -7d/16d;
|
||||
double z2 = 7d/16d;
|
||||
|
||||
double resx1 = 0.0d;
|
||||
double resx2 = 0.0d;
|
||||
double resy1 = 1.0d;
|
||||
double resy2 = 1.0d;
|
||||
|
||||
tessellator.addVertexWithUV(x1, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z1, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x1, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y1, z2, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x2, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx1, resy2);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private float getGhostItemScaleFactor(ItemStack itemStack)
|
||||
{
|
||||
float scaleFactor = 1.5F;
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
switch (customRenderItem.getMiniBlockCount(itemStack,(byte)1))
|
||||
{
|
||||
case 1:
|
||||
return 0.90F * scaleFactor;
|
||||
|
||||
case 2:
|
||||
return 0.90F * scaleFactor;
|
||||
|
||||
case 3:
|
||||
return 0.90F * scaleFactor;
|
||||
|
||||
case 4:
|
||||
return 0.90F * scaleFactor;
|
||||
|
||||
case 5:
|
||||
return 0.80F * scaleFactor;
|
||||
|
||||
default:
|
||||
return 0.90F * scaleFactor;
|
||||
}
|
||||
} else
|
||||
{
|
||||
switch (customRenderItem.getMiniItemCount(itemStack,(byte)1))
|
||||
{
|
||||
case 1:
|
||||
return 0.65F * scaleFactor;
|
||||
|
||||
case 2:
|
||||
return 0.65F * scaleFactor;
|
||||
|
||||
case 3:
|
||||
return 0.65F * scaleFactor;
|
||||
|
||||
case 4:
|
||||
return 0.65F * scaleFactor;
|
||||
|
||||
default:
|
||||
return 0.65F * scaleFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return scaleFactor;
|
||||
}
|
||||
|
||||
private float getXDisplacementForSlot(int slot)
|
||||
{
|
||||
switch (slot)
|
||||
{
|
||||
case 0:
|
||||
return 0.0f;
|
||||
|
||||
case 1:
|
||||
return -0.375f;
|
||||
|
||||
case 2:
|
||||
return -0.125f;
|
||||
|
||||
case 3:
|
||||
return 0.3125f;
|
||||
|
||||
case 4:
|
||||
return 0.3125f;
|
||||
|
||||
case 5:
|
||||
return -0.125f;
|
||||
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
private float getYDisplacementForSlot(int slot)
|
||||
{
|
||||
switch (slot)
|
||||
{
|
||||
case 0:
|
||||
return 0.4f;
|
||||
|
||||
case 1:
|
||||
return -0.35f;
|
||||
|
||||
case 6:
|
||||
return 0.4f;
|
||||
|
||||
default:
|
||||
return -0.35f;
|
||||
}
|
||||
}
|
||||
|
||||
private float getZDisplacementForSlot(int slot)
|
||||
{
|
||||
switch (slot)
|
||||
{
|
||||
case 0:
|
||||
return 0.0f;
|
||||
|
||||
case 1:
|
||||
return 0.0f;
|
||||
|
||||
case 2:
|
||||
return 0.375f;
|
||||
|
||||
case 3:
|
||||
return 0.25f;
|
||||
|
||||
case 4:
|
||||
return -0.25f;
|
||||
|
||||
case 5:
|
||||
return -0.375f;
|
||||
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection)
|
||||
{
|
||||
if (ghostItemStack != null)
|
||||
{
|
||||
if (ghostItemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
switch (forgeDirection)
|
||||
{
|
||||
case DOWN:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 2.7F, (float) z + 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
case UP:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
case NORTH:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F);
|
||||
return;
|
||||
}
|
||||
|
||||
case SOUTH:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F);
|
||||
return;
|
||||
}
|
||||
|
||||
case EAST:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
case WEST:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
case UNKNOWN:
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
switch (forgeDirection)
|
||||
{
|
||||
case DOWN:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
case UP:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
case NORTH:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F);
|
||||
return;
|
||||
}
|
||||
|
||||
case SOUTH:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F);
|
||||
return;
|
||||
}
|
||||
|
||||
case EAST:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
case WEST:
|
||||
{
|
||||
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
case UNKNOWN:
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.block;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelAlchemicalCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelCrystalBelljar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RenderCrystalBelljar extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelCrystalBelljar modelConduit = new ModelCrystalBelljar();
|
||||
|
||||
private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/Reagent.png");
|
||||
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f)
|
||||
{
|
||||
if (tileEntity instanceof TEBellJar)
|
||||
{
|
||||
TEBellJar tileAltar = (TEBellJar) tileEntity;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/CrystalBelljar.png");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
|
||||
//A reference to your Model file. Again, very important.
|
||||
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
//Tell it to stop rendering for both the PushMatrix's
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
// GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
|
||||
|
||||
|
||||
ReagentContainerInfo[] info = tileAltar.getContainerInfo(ForgeDirection.UNKNOWN);
|
||||
if(info.length >= 1 && info[0] != null)
|
||||
{
|
||||
ReagentStack reagentStack = info[0].reagent;
|
||||
int capacity = info[0].capacity;
|
||||
if(reagentStack != null && reagentStack.reagent != null)
|
||||
{
|
||||
Reagent reagent = reagentStack.reagent;
|
||||
this.renderTankContents(d0, d1, d2, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity);
|
||||
}
|
||||
}
|
||||
|
||||
// this.renderTankContents(d0, d1, d2, 255, 0, 0, 200);
|
||||
|
||||
|
||||
|
||||
|
||||
// for (int i = 0; i <= 1; i++)
|
||||
// {
|
||||
// GL11.glPushMatrix();
|
||||
//
|
||||
// if (tileAltar.getStackInSlot(i) != null)
|
||||
// {
|
||||
// float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(i));
|
||||
// float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||
// EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
|
||||
// ghostEntityItem.hoverStart = 0.0F;
|
||||
// ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(i));
|
||||
// //translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), d0, d1, d2, ForgeDirection.DOWN);
|
||||
// float displacementX = getXDisplacementForSlot(i);
|
||||
// float displacementY = getYDisplacementForSlot(i);
|
||||
// float displacementZ = getZDisplacementForSlot(i);
|
||||
//
|
||||
// if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)
|
||||
// {
|
||||
// GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.7F, (float) d2 + 0.5F + displacementZ);
|
||||
// } else
|
||||
// {
|
||||
// GL11.glTranslatef((float) d0 + 0.5F + displacementX, (float) d1 + displacementY + 0.6F, (float) d2 + 0.5F + displacementZ);
|
||||
// }
|
||||
//
|
||||
// //GL11.glTranslatef((float) tileAltar.xCoord + 0.5F, (float) tileAltar.yCoord + 2.7F, (float) tileAltar.zCoord + 0.5F);
|
||||
// GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||
// GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||
// customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||
// }
|
||||
//
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTankContents(double x, double y, double z, int colourRed, int colourGreen, int colourBlue, int colourIntensity)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float f1 = 1.0f;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
this.bindTexture(resourceLocation);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
float f2 = 0;
|
||||
float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(colourRed, colourGreen, colourBlue, colourIntensity);
|
||||
|
||||
GL11.glTranslated(x+0.5, y+0.5, z+0.5);
|
||||
//GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis
|
||||
//GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically
|
||||
|
||||
tessellator.setBrightness(240);
|
||||
|
||||
double x1 = -4d/16d;
|
||||
double x2 = 4d/16d;
|
||||
double y1 = -6d/16d;
|
||||
double y2 = 4d/16d;
|
||||
double z1 = -4d/16d;
|
||||
double z2 = 4d/16d;
|
||||
|
||||
double resx1 = 0.0d;
|
||||
double resx2 = 0.0d;
|
||||
double resy1 = 1.0d;
|
||||
double resy2 = 1.0d;
|
||||
|
||||
tessellator.addVertexWithUV(x1, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z1, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x1, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y1, z2, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x2, y1, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y1, z2, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx1, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z1, resx1, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z1, resx2, resy1);
|
||||
tessellator.addVertexWithUV(x2, y2, z2, resx2, resy2);
|
||||
tessellator.addVertexWithUV(x1, y2, z2, resx1, resy2);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@ public class RenderPedestal extends TileEntitySpecialRenderer
|
|||
{
|
||||
TEPedestal tileAltar = (TEPedestal) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ public class RenderPedestal extends TileEntitySpecialRenderer
|
|||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class RenderPlinth extends TileEntitySpecialRenderer
|
|||
{
|
||||
TEPlinth tileAltar = (TEPlinth) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -8,19 +8,24 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.renderer.BeamRenderer;
|
||||
import WayofTime.alchemicalWizardry.common.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RenderReagentConduit extends TileEntitySpecialRenderer
|
||||
{
|
||||
private static final ResourceLocation field_110629_a = new ResourceLocation("alchemicalwizardry:textures/models/TransCircle.png");
|
||||
private static final ResourceLocation field_110629_a = new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f)
|
||||
{
|
||||
if (tileEntity instanceof TEReagentConduit)
|
||||
{
|
||||
int renderCount = ((TEReagentConduit)tileEntity).renderCount;
|
||||
float key1 = (tileEntity.xCoord*54f - tileEntity.yCoord*38.72f + tileEntity.zCoord*10.432f);
|
||||
float key2 = (tileEntity.xCoord*21.43f - tileEntity.yCoord*9.96f + tileEntity.zCoord*12.8f);
|
||||
|
||||
Int3 colourMap = ((TEReagentConduit) tileEntity).getColour();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
float f1 = 1.0f;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
@ -38,14 +43,14 @@ public class RenderReagentConduit extends TileEntitySpecialRenderer
|
|||
GL11.glDepthMask(false);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA(0, 0, 255, 90);
|
||||
tessellator.setColorRGBA(colourMap.xCoord, colourMap.yCoord, colourMap.zCoord, 200);
|
||||
//tessellator.setColorOpaque(255, 255, 255);
|
||||
|
||||
GL11.glTranslated(d0+0.5, d1+0.5, d2+0.5);
|
||||
|
||||
GL11.glRotatef(tileEntity.getWorldObj().getWorldTime()/3.0f, 0F, 1F, 0F); //Rotate on planar axis
|
||||
//GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis
|
||||
//GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically
|
||||
GL11.glRotatef(renderCount + key1, 0F, 0F, 1F); //Rotate vertical axis
|
||||
GL11.glRotatef(renderCount*2f + key2, 1F, 0F, 0F); //Rotate cylindrically
|
||||
|
||||
double offset = 0;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSpellEffectBlock extends TileEntitySpecialRenderer
|
|||
{
|
||||
TESpellEffectBlock tileSpellBlock = (TESpellEffectBlock) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSpellEnhancementBlock extends TileEntitySpecialRenderer
|
|||
{
|
||||
TESpellEnhancementBlock tileSpellBlock = (TESpellEnhancementBlock) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSpellModifierBlock extends TileEntitySpecialRenderer
|
|||
{
|
||||
TESpellModifierBlock tileSpellBlock = (TESpellModifierBlock) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSpellParadigmBlock extends TileEntitySpecialRenderer
|
|||
{
|
||||
TESpellParadigmBlock tileSpellBlock = (TESpellParadigmBlock) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -21,11 +21,6 @@ public class RenderWritingTable extends TileEntitySpecialRenderer
|
|||
{
|
||||
private ModelWritingTable modelWritingTable = new ModelWritingTable();
|
||||
private final RenderItem customRenderItem;
|
||||
// private final RenderItem customRenderItem1;
|
||||
// private final RenderItem customRenderItem2;
|
||||
// private final RenderItem customRenderItem3;
|
||||
// private final RenderItem customRenderItem4;
|
||||
// private final RenderItem customRenderItem5;
|
||||
|
||||
public RenderWritingTable()
|
||||
{
|
||||
|
@ -47,7 +42,7 @@ public class RenderWritingTable extends TileEntitySpecialRenderer
|
|||
{
|
||||
TEWritingTable tileAltar = (TEWritingTable) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/WritingTable.png");
|
||||
|
|
|
@ -42,7 +42,7 @@ public class TEAltarRenderer extends TileEntitySpecialRenderer
|
|||
{
|
||||
TEAltar tileAltar = (TEAltar) tileEntity;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
// GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.block.itemRender;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelAlchemicalCalcinator;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class TEAlchemicalCalcinatorItemRenderer implements IItemRenderer
|
||||
{
|
||||
private ModelAlchemicalCalcinator modelConduit = new ModelAlchemicalCalcinator();
|
||||
|
||||
private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Block block = ModBlocks.blockAlchemicCalcinator;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/AlchemicalCalcinator.png");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
|
||||
//A reference to your Model file. Again, very important.
|
||||
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
//Tell it to stop rendering for both the PushMatrix's
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IItemRenderer implementation *
|
||||
*/
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
return true;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,9 +2,11 @@ package WayofTime.alchemicalWizardry.common.renderer.block.itemRender;
|
|||
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBloodAltar;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TEAltarItemRenderer implements IItemRenderer
|
||||
|
@ -38,30 +40,25 @@ public class TEAltarItemRenderer implements IItemRenderer
|
|||
// TODO Auto-generated method stub
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
{
|
||||
renderBloodAltar(0f, 0f, 0f, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
case EQUIPPED:
|
||||
{
|
||||
renderBloodAltar(0f, 0f, 0f, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
case INVENTORY:
|
||||
{
|
||||
renderBloodAltar(0f, -0.25f, 0f, scale);
|
||||
return;
|
||||
}
|
||||
case ENTITY:
|
||||
renderBloodAltar((RenderBlocks) data[0], item, 0, 0, 0, scale);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderBloodAltar((RenderBlocks) data[0], item, 0, 0, 0.5f, scale);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderBloodAltar((RenderBlocks) data[0], item, +0.5f, 0.5f, +0.5f, scale);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderBloodAltar((RenderBlocks) data[0], item, -0.5f, -0.75f, -0.5f, scale);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBloodAltar(float x, float y, float z, float scale)
|
||||
private void renderBloodAltar(RenderBlocks render, ItemStack item, float x, float y, float z, float scale)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
// Disable Lighting Calculations
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.block.itemRender;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelCrystalBelljar;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class TEBellJarItemRenderer implements IItemRenderer
|
||||
{
|
||||
private ModelCrystalBelljar modelConduit = new ModelCrystalBelljar();
|
||||
|
||||
private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F);
|
||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/CrystalBelljar.png");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
|
||||
//A reference to your Model file. Again, very important.
|
||||
this.modelConduit.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
//Tell it to stop rendering for both the PushMatrix's
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IItemRenderer implementation *
|
||||
*/
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
return true;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderConduitItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@ public class TEConduitItemRenderer implements IItemRenderer
|
|||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
/**
|
||||
* Render the ghost item inside of the Altar, slowly spinning
|
||||
*/
|
||||
|
@ -92,4 +93,4 @@ public class TEConduitItemRenderer implements IItemRenderer
|
|||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelAlchemicalCalcinator extends ModelBase
|
||||
{
|
||||
//fields
|
||||
ModelRenderer top1;
|
||||
ModelRenderer top2;
|
||||
ModelRenderer top3;
|
||||
ModelRenderer top4;
|
||||
ModelRenderer tank;
|
||||
ModelRenderer centreCollumn;
|
||||
ModelRenderer furnaceShape;
|
||||
ModelRenderer glassWindow;
|
||||
ModelRenderer Shape1;
|
||||
ModelRenderer Shape2;
|
||||
ModelRenderer Shape3;
|
||||
ModelRenderer Shape4;
|
||||
ModelRenderer Shape5;
|
||||
|
||||
public ModelAlchemicalCalcinator()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
top1 = new ModelRenderer(this, 0, 34);
|
||||
top1.addBox(4F, -8F, -8F, 4, 3, 16);
|
||||
top1.setRotationPoint(0F, 16F, 0F);
|
||||
top1.setTextureSize(128, 128);
|
||||
top1.mirror = true;
|
||||
setRotation(top1, 0F, 0F, 0F);
|
||||
top2 = new ModelRenderer(this, 41, 34);
|
||||
top2.addBox(-8F, -8F, -8F, 4, 3, 16);
|
||||
top2.setRotationPoint(0F, 16F, 0F);
|
||||
top2.setTextureSize(128, 128);
|
||||
top2.mirror = true;
|
||||
setRotation(top2, 0F, 0F, 0F);
|
||||
top3 = new ModelRenderer(this, 25, 55);
|
||||
top3.addBox(-4F, -8F, 4F, 8, 3, 4);
|
||||
top3.setRotationPoint(0F, 16F, 0F);
|
||||
top3.setTextureSize(128, 128);
|
||||
top3.mirror = true;
|
||||
setRotation(top3, 0F, 0F, 0F);
|
||||
top4 = new ModelRenderer(this, 0, 55);
|
||||
top4.addBox(-4F, -8F, -8F, 8, 3, 4);
|
||||
top4.setRotationPoint(0F, 16F, 0F);
|
||||
top4.setTextureSize(128, 128);
|
||||
top4.mirror = true;
|
||||
setRotation(top4, 0F, 0F, 0F);
|
||||
tank = new ModelRenderer(this, 0, 0);
|
||||
tank.addBox(-8F, -5F, -8F, 16, 4, 16);
|
||||
tank.setRotationPoint(0F, 16F, 0F);
|
||||
tank.setTextureSize(128, 128);
|
||||
tank.mirror = true;
|
||||
setRotation(tank, 0F, 0F, 0F);
|
||||
centreCollumn = new ModelRenderer(this, 0, 21);
|
||||
centreCollumn.addBox(-4F, -5F, -4F, 8, 4, 8);
|
||||
centreCollumn.setRotationPoint(0F, 16F, 0F);
|
||||
centreCollumn.setTextureSize(128, 128);
|
||||
centreCollumn.mirror = true;
|
||||
setRotation(centreCollumn, 0F, 0F, 0F);
|
||||
furnaceShape = new ModelRenderer(this, 0, 63);
|
||||
furnaceShape.addBox(-8F, -1F, -8F, 16, 5, 16);
|
||||
furnaceShape.setRotationPoint(0F, 16F, 0F);
|
||||
furnaceShape.setTextureSize(128, 128);
|
||||
furnaceShape.mirror = true;
|
||||
setRotation(furnaceShape, 0F, 0F, 0F);
|
||||
glassWindow = new ModelRenderer(this, 0, 85);
|
||||
glassWindow.addBox(-4F, -8F, -4F, 8, 0, 8);
|
||||
glassWindow.setRotationPoint(0F, 16F, 0F);
|
||||
glassWindow.setTextureSize(128, 128);
|
||||
glassWindow.mirror = true;
|
||||
setRotation(glassWindow, 0F, 0F, 0F);
|
||||
Shape1 = new ModelRenderer(this, 0, 94);
|
||||
Shape1.addBox(-8F, 4F, -8F, 4, 4, 4);
|
||||
Shape1.setRotationPoint(0F, 16F, 0F);
|
||||
Shape1.setTextureSize(128, 128);
|
||||
Shape1.mirror = true;
|
||||
setRotation(Shape1, 0F, 0F, 0F);
|
||||
Shape2 = new ModelRenderer(this, 0, 103);
|
||||
Shape2.addBox(-4F, 6F, -4F, 8, 1, 8);
|
||||
Shape2.setRotationPoint(0F, 16F, 0F);
|
||||
Shape2.setTextureSize(128, 128);
|
||||
Shape2.mirror = true;
|
||||
setRotation(Shape2, 0F, 0F, 0F);
|
||||
Shape3 = new ModelRenderer(this, 0, 94);
|
||||
Shape3.addBox(4F, 4F, -8F, 4, 4, 4);
|
||||
Shape3.setRotationPoint(0F, 16F, 0F);
|
||||
Shape3.setTextureSize(128, 128);
|
||||
Shape3.mirror = true;
|
||||
setRotation(Shape3, 0F, 0F, 0F);
|
||||
Shape4 = new ModelRenderer(this, 0, 94);
|
||||
Shape4.addBox(-8F, 4F, 4F, 4, 4, 4);
|
||||
Shape4.setRotationPoint(0F, 16F, 0F);
|
||||
Shape4.setTextureSize(128, 128);
|
||||
Shape4.mirror = true;
|
||||
setRotation(Shape4, 0F, 0F, 0F);
|
||||
Shape5 = new ModelRenderer(this, 0, 94);
|
||||
Shape5.addBox(4F, 4F, 4F, 4, 4, 4);
|
||||
Shape5.setRotationPoint(0F, 16F, 0F);
|
||||
Shape5.setTextureSize(128, 128);
|
||||
Shape5.mirror = true;
|
||||
setRotation(Shape5, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
top1.render(f5);
|
||||
top2.render(f5);
|
||||
top3.render(f5);
|
||||
top4.render(f5);
|
||||
tank.render(f5);
|
||||
centreCollumn.render(f5);
|
||||
furnaceShape.render(f5);
|
||||
glassWindow.render(f5);
|
||||
Shape1.render(f5);
|
||||
Shape2.render(f5);
|
||||
Shape3.render(f5);
|
||||
Shape4.render(f5);
|
||||
Shape5.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package WayofTime.alchemicalWizardry.common.renderer.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelCrystalBelljar extends ModelBase
|
||||
{
|
||||
//fields
|
||||
ModelRenderer handle1;
|
||||
ModelRenderer handle2;
|
||||
ModelRenderer jar1;
|
||||
ModelRenderer woodBottom;
|
||||
ModelRenderer jar2;
|
||||
ModelRenderer jar3;
|
||||
ModelRenderer jar4;
|
||||
ModelRenderer jar5;
|
||||
|
||||
public ModelCrystalBelljar()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 64;
|
||||
|
||||
handle1 = new ModelRenderer(this, 0, 17);
|
||||
handle1.addBox(-2F, -7F, -2F, 4, 1, 4);
|
||||
handle1.setRotationPoint(0F, 16F, 0F);
|
||||
handle1.setTextureSize(128, 64);
|
||||
handle1.mirror = true;
|
||||
setRotation(handle1, 0F, 0F, 0F);
|
||||
handle2 = new ModelRenderer(this, 0, 23);
|
||||
handle2.addBox(-1F, -6F, -1F, 2, 1, 2);
|
||||
handle2.setRotationPoint(0F, 16F, 0F);
|
||||
handle2.setTextureSize(128, 64);
|
||||
handle2.mirror = true;
|
||||
setRotation(handle2, 0F, 0F, 0F);
|
||||
jar1 = new ModelRenderer(this, 0, 27);
|
||||
jar1.addBox(-4F, -5F, -4F, 8, 1, 8);
|
||||
jar1.setRotationPoint(0F, 16F, 0F);
|
||||
jar1.setTextureSize(128, 64);
|
||||
jar1.mirror = true;
|
||||
setRotation(jar1, 0F, 0F, 0F);
|
||||
woodBottom = new ModelRenderer(this, 0, 0);
|
||||
woodBottom.addBox(-7F, 6F, -7F, 14, 2, 14);
|
||||
woodBottom.setRotationPoint(0F, 16F, 0F);
|
||||
woodBottom.setTextureSize(128, 64);
|
||||
woodBottom.mirror = true;
|
||||
setRotation(woodBottom, 0F, 0F, 0F);
|
||||
jar2 = new ModelRenderer(this, 0, 38);
|
||||
jar2.addBox(-5F, -4F, 4F, 10, 10, 1);
|
||||
jar2.setRotationPoint(0F, 16F, 0F);
|
||||
jar2.setTextureSize(128, 64);
|
||||
jar2.mirror = true;
|
||||
setRotation(jar2, 0F, 0F, 0F);
|
||||
jar3 = new ModelRenderer(this, 46, 38);
|
||||
jar3.addBox(4F, -4F, -4F, 1, 10, 8);
|
||||
jar3.setRotationPoint(0F, 16F, 0F);
|
||||
jar3.setTextureSize(128, 64);
|
||||
jar3.mirror = true;
|
||||
setRotation(jar3, 0F, 0F, 0F);
|
||||
jar4 = new ModelRenderer(this, 23, 38);
|
||||
jar4.addBox(-5F, -4F, -5F, 10, 10, 1);
|
||||
jar4.setRotationPoint(0F, 16F, 0F);
|
||||
jar4.setTextureSize(128, 64);
|
||||
jar4.mirror = true;
|
||||
setRotation(jar4, 0F, 0F, 0F);
|
||||
jar5 = new ModelRenderer(this, 65, 38);
|
||||
jar5.addBox(-5F, -4F, -4F, 1, 10, 8);
|
||||
jar5.setRotationPoint(0F, 16F, 0F);
|
||||
jar5.setTextureSize(128, 64);
|
||||
jar5.mirror = true;
|
||||
setRotation(jar5, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
handle1.render(f5);
|
||||
handle2.render(f5);
|
||||
jar1.render(f5);
|
||||
woodBottom.render(f5);
|
||||
jar2.render(f5);
|
||||
jar3.render(f5);
|
||||
jar4.render(f5);
|
||||
jar5.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
|
@ -5,20 +5,30 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectAnimalGrowth extends RitualEffect
|
||||
{
|
||||
public static final int breedingCost = 50;
|
||||
public static final int reductusDrain = 1;
|
||||
public static final int virtusDrain = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -43,49 +53,91 @@ public class RitualEffectAnimalGrowth extends RitualEffect
|
|||
return;
|
||||
}
|
||||
|
||||
int d0 = 2;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 3), (double) (z + 1)).expand(d0, 0, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
EntityAgeable entity;
|
||||
double range = 2;
|
||||
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 3), (double) (z + 1)).expand(range, 0, range);
|
||||
List<EntityAgeable> list = world.getEntitiesWithinAABB(EntityAgeable.class, axisalignedbb);
|
||||
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator1.hasNext())
|
||||
if (currentEssence < this.getCostPerRefresh() * list.size())
|
||||
{
|
||||
entity = (EntityAgeable) iterator1.next();
|
||||
entityCount++;
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
Iterator iterator2 = list.iterator();
|
||||
entityCount = 0;
|
||||
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
|
||||
while (iterator2.hasNext())
|
||||
for(EntityAgeable entity : list)
|
||||
{
|
||||
entity = (EntityAgeable) iterator2.next();
|
||||
|
||||
if (entity.getGrowingAge() < 0)
|
||||
{
|
||||
entity.addGrowth(5);
|
||||
entityCount++;
|
||||
}
|
||||
}else
|
||||
{
|
||||
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
if(hasReductus && entity instanceof EntityAnimal && entity.getGrowingAge() > 0)
|
||||
{
|
||||
EntityAnimal animal = (EntityAnimal)entity;
|
||||
entity.setGrowingAge(Math.max(0, animal.getGrowingAge() - 20*2));
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
|
||||
entityCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
|
||||
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
|
||||
|
||||
if(hasVirtus && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost))
|
||||
{
|
||||
List<EntityAnimal> animalList = world.getEntitiesWithinAABB(EntityAnimal.class, axisalignedbb);
|
||||
TileEntity tile = world.getTileEntity(x, y+1, z);
|
||||
IInventory inventory = null;
|
||||
if(tile instanceof IInventory)
|
||||
{
|
||||
inventory = (IInventory)tile;
|
||||
}else
|
||||
{
|
||||
tile = world.getTileEntity(x, y-1, z);
|
||||
if(tile instanceof IInventory)
|
||||
{
|
||||
inventory = (IInventory)tile;
|
||||
}
|
||||
}
|
||||
|
||||
if(inventory != null)
|
||||
{
|
||||
for(EntityAnimal entityAnimal : animalList)
|
||||
{
|
||||
if(entityAnimal.isInLove() || entityAnimal.isChild() || entityAnimal.getGrowingAge() > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
hasVirtus = hasVirtus && this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
|
||||
boolean hasLP = SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, breedingCost);
|
||||
|
||||
for(int i=0; i<inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
|
||||
if(stack != null && entityAnimal.isBreedingItem(stack))
|
||||
{
|
||||
inventory.decrStackSize(i, 1);
|
||||
entityAnimal.func_146082_f(null);
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, breedingCost);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -173,7 +173,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
|
|||
flag++;
|
||||
break;
|
||||
}
|
||||
else if(curStack.isItemEqual(outputStack)&&curStack.stackSize<curStack.getMaxStackSize())
|
||||
else if(curStack.isItemEqual(outputStack)&&curStack.stackSize<curStack.getMaxStackSize() && ItemStack.areItemStackTagsEqual(outputStack, curStack))
|
||||
{
|
||||
outputStack.stackSize--;
|
||||
if(outputStack.stackSize<=0)
|
||||
|
@ -228,7 +228,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect
|
|||
flag++;
|
||||
break;
|
||||
}
|
||||
else if(curStack.isItemEqual(alchStack)&&curStack.stackSize<curStack.getMaxStackSize())
|
||||
else if(curStack.isItemEqual(alchStack)&&curStack.stackSize<curStack.getMaxStackSize()&&ItemStack.areItemStackTagsEqual(alchStack, curStack))
|
||||
{
|
||||
alchStack.stackSize--;
|
||||
if(alchStack.stackSize<=0)
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class RitualEffectContainment extends RitualEffect
|
||||
{
|
||||
public static final String[] TIME_SINCE_IGNITED = new String[] { "timeSinceIgnited", "field_70833_d", "bq" };
|
||||
public static final int crepitousDrain = 1;
|
||||
public static final int terraeDrain = 3;
|
||||
public static final int magicalesDrain = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -40,51 +48,58 @@ public class RitualEffectContainment extends RitualEffect
|
|||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
int d0 = 5;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, d0, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
EntityLivingBase livingEntity;
|
||||
List<Entity> entityList = SpellHelper.getEntitiesInRange(world, x+0.5, y+0.5, z+0.5, d0, d0);
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator.hasNext())
|
||||
boolean hasCrepitous = this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false);
|
||||
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
|
||||
boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
|
||||
|
||||
for(Entity entity : entityList)
|
||||
{
|
||||
livingEntity = (EntityLivingBase) iterator.next();
|
||||
if(!(entity instanceof EntityLivingBase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
EntityLivingBase livingEntity = (EntityLivingBase)entity;
|
||||
|
||||
if (livingEntity instanceof EntityPlayer)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//if (!(livingEntity.getEntityName().equals(owner)))
|
||||
|
||||
double xDif = livingEntity.posX - (x + 0.5);
|
||||
double yDif = livingEntity.posY - (y + 3);
|
||||
double zDif = livingEntity.posZ - (z + 0.5);
|
||||
livingEntity.motionX = -0.05 * xDif;
|
||||
livingEntity.motionY = -0.05 * yDif;
|
||||
livingEntity.motionZ = -0.05 * zDif;
|
||||
flag = true;
|
||||
|
||||
livingEntity.fallDistance = 0;
|
||||
|
||||
if(hasMagicales && this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false))
|
||||
{
|
||||
double xDif = livingEntity.posX - (x + 0.5);
|
||||
double yDif = livingEntity.posY - (y + 3);
|
||||
double zDif = livingEntity.posZ - (z + 0.5);
|
||||
livingEntity.motionX = -0.05 * xDif;
|
||||
livingEntity.motionY = -0.05 * yDif;
|
||||
livingEntity.motionZ = -0.05 * zDif;
|
||||
flag = true;
|
||||
//livingEntity.setVelocity(-0.05 * xDif, -0.05 * yDif, -0.05 * zDif);
|
||||
|
||||
if (world.rand.nextInt(10) == 0)
|
||||
{
|
||||
//PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(livingEntity.posX, livingEntity.posY, livingEntity.posZ, (short) 1));
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, x, y, z, 20, world.provider.dimensionId, 1, x, y, z);
|
||||
}
|
||||
|
||||
livingEntity.fallDistance = 0;
|
||||
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding))
|
||||
{
|
||||
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionPlanarBinding.id,100,0));
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
|
||||
}
|
||||
}
|
||||
|
||||
if(hasCrepitous && this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, false))
|
||||
{
|
||||
if(entity instanceof EntityCreeper)
|
||||
{
|
||||
ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, TIME_SINCE_IGNITED);
|
||||
((EntityCreeper)entity).setAttackTarget(null);
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.crepitousReagent, crepitousDrain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,24 +5,31 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectCrushing extends RitualEffect
|
||||
{
|
||||
public static final int crystallosDrain = 10;
|
||||
public static final int orbisTerraeDrain = 10;
|
||||
public static final int potentiaDrain = 10;
|
||||
public static final int virtusDrain = 10;
|
||||
public static final int incendiumDrain = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -39,12 +46,11 @@ public class RitualEffectCrushing extends RitualEffect
|
|||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
|
||||
if (world.getWorldTime() % 40 != 20)
|
||||
if (world.getWorldTime() % 10 != 5)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
@ -64,19 +70,36 @@ public class RitualEffectCrushing extends RitualEffect
|
|||
return;
|
||||
}
|
||||
|
||||
boolean isSilkTouch = this.isSilkTouch(world, x, y, z);
|
||||
int fortuneLevel = this.getFortuneLevel(world, x, y, z);
|
||||
boolean hasRoom = false;
|
||||
for(int i=0; i<tileEntity.getSizeInventory(); i++)
|
||||
{
|
||||
if(tileEntity.getStackInSlot(i) == null)
|
||||
{
|
||||
hasRoom = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!hasRoom)
|
||||
{
|
||||
return; //Prevents overflow
|
||||
}
|
||||
|
||||
boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
|
||||
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
|
||||
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
|
||||
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
|
||||
boolean hasIncendium = this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false);
|
||||
|
||||
boolean isSilkTouch = hasCrystallos;
|
||||
int fortuneLevel = 0;
|
||||
if(hasOrbisTerrae){fortuneLevel++;}
|
||||
if(hasPotentia){fortuneLevel++;}
|
||||
if(hasVirtus){fortuneLevel++;}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
//boolean flag = false;
|
||||
|
@ -91,50 +114,19 @@ public class RitualEffectCrushing extends RitualEffect
|
|||
|
||||
if (block != null && !world.isAirBlock(x + i, y + j, z + k))
|
||||
{
|
||||
if ((block.equals(ModBlocks.ritualStone) || block.equals(ModBlocks.blockMasterStone)))
|
||||
if ((block.equals(ModBlocks.ritualStone) || block.equals(ModBlocks.blockMasterStone)) || SpellHelper.isBlockFluid(block))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(isSilkTouch && block.canSilkHarvest(world, null, x + i, y + j, z + k, meta))
|
||||
{
|
||||
int invSize = tileEntity.getSizeInventory();
|
||||
//int invSize = tileEntity.getSizeInventory();
|
||||
|
||||
ItemStack item = new ItemStack(block,1,meta);
|
||||
ItemStack copyStack = item.copyItemStack(item);
|
||||
|
||||
for (int n = 0; n < invSize; n++)
|
||||
{
|
||||
if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
|
||||
{
|
||||
ItemStack itemStack = tileEntity.getStackInSlot(n);
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
tileEntity.setInventorySlotContents(n, item);
|
||||
copyStack.stackSize = 0;
|
||||
} else
|
||||
{
|
||||
if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage())
|
||||
{
|
||||
int itemSize = itemStack.stackSize;
|
||||
int copySize = copyStack.stackSize;
|
||||
int maxSize = itemStack.getMaxStackSize();
|
||||
|
||||
if (copySize + itemSize < maxSize)
|
||||
{
|
||||
copyStack.stackSize = 0;
|
||||
itemStack.stackSize = itemSize + copySize;
|
||||
tileEntity.setInventorySlotContents(n, itemStack);
|
||||
} else
|
||||
{
|
||||
copyStack.stackSize = itemSize + copySize - maxSize;
|
||||
itemStack.stackSize = maxSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
|
||||
|
||||
if (copyStack.stackSize > 0)
|
||||
{
|
||||
|
@ -142,6 +134,10 @@ public class RitualEffectCrushing extends RitualEffect
|
|||
//flag=true;
|
||||
}
|
||||
|
||||
if(hasCrystallos)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -153,46 +149,59 @@ public class RitualEffectCrushing extends RitualEffect
|
|||
|
||||
for (ItemStack item : itemDropList)
|
||||
{
|
||||
hasIncendium = hasIncendium && this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, false);
|
||||
ItemStack copyStack = item.copyItemStack(item);
|
||||
|
||||
for (int n = 0; n < invSize; n++)
|
||||
|
||||
if(this.usesIncendium(copyStack))
|
||||
{
|
||||
if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
|
||||
{
|
||||
ItemStack itemStack = tileEntity.getStackInSlot(n);
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
tileEntity.setInventorySlotContents(n, item);
|
||||
copyStack.stackSize = 0;
|
||||
} else
|
||||
{
|
||||
if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage())
|
||||
{
|
||||
int itemSize = itemStack.stackSize;
|
||||
int copySize = copyStack.stackSize;
|
||||
int maxSize = itemStack.getMaxStackSize();
|
||||
|
||||
if (copySize + itemSize < maxSize)
|
||||
{
|
||||
copyStack.stackSize = 0;
|
||||
itemStack.stackSize = itemSize + copySize;
|
||||
tileEntity.setInventorySlotContents(n, itemStack);
|
||||
} else
|
||||
{
|
||||
copyStack.stackSize = itemSize + copySize - maxSize;
|
||||
itemStack.stackSize = maxSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
copyStack = this.transformToNewItem(copyStack, hasIncendium, false);
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, incendiumDrain, true);
|
||||
}
|
||||
|
||||
SpellHelper.insertStackIntoInventory(copyStack, tileEntity);
|
||||
|
||||
// for (int n = 0; n < invSize; n++)
|
||||
// {
|
||||
// if (tileEntity.isItemValidForSlot(n, copyStack) && copyStack.stackSize != 0)
|
||||
// {
|
||||
// ItemStack itemStack = tileEntity.getStackInSlot(n);
|
||||
//
|
||||
// if (itemStack == null)
|
||||
// {
|
||||
// tileEntity.setInventorySlotContents(n, item);
|
||||
// copyStack.stackSize = 0;
|
||||
// } else
|
||||
// {
|
||||
// if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage())
|
||||
// {
|
||||
// int itemSize = itemStack.stackSize;
|
||||
// int copySize = copyStack.stackSize;
|
||||
// int maxSize = itemStack.getMaxStackSize();
|
||||
//
|
||||
// if (copySize + itemSize < maxSize)
|
||||
// {
|
||||
// copyStack.stackSize = 0;
|
||||
// itemStack.stackSize = itemSize + copySize;
|
||||
// tileEntity.setInventorySlotContents(n, itemStack);
|
||||
// } else
|
||||
// {
|
||||
// copyStack.stackSize = itemSize + copySize - maxSize;
|
||||
// itemStack.stackSize = maxSize;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (copyStack.stackSize > 0)
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.4, y + 2, z + 0.5, copyStack));
|
||||
//flag=true;
|
||||
}
|
||||
|
||||
if(hasOrbisTerrae){this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);}
|
||||
if(hasPotentia){this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);}
|
||||
if(hasVirtus){this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,6 +212,9 @@ public class RitualEffectCrushing extends RitualEffect
|
|||
world.playSoundEffect(x + i, y + j, z + k, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -211,6 +223,56 @@ public class RitualEffectCrushing extends RitualEffect
|
|||
}
|
||||
}
|
||||
|
||||
private boolean usesIncendium(ItemStack stack)
|
||||
{
|
||||
if(stack != null)
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
if(item instanceof ItemBlock)
|
||||
{
|
||||
Block block = ((ItemBlock)item).field_150939_a;
|
||||
|
||||
if(block == Blocks.cobblestone || block == Blocks.stone)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private ItemStack transformToNewItem(ItemStack stack, boolean hasIncendium, boolean hasCrepitous)
|
||||
{
|
||||
if(stack != null)
|
||||
{
|
||||
ItemStack copyStack = ItemStack.copyItemStack(stack);
|
||||
int stackSize = copyStack.stackSize;
|
||||
|
||||
Item item = stack.getItem();
|
||||
if(item instanceof ItemBlock)
|
||||
{
|
||||
Block block = ((ItemBlock)item).field_150939_a;
|
||||
|
||||
if(hasIncendium)
|
||||
{
|
||||
if(block == Blocks.cobblestone || block == Blocks.stone)
|
||||
{
|
||||
copyStack = new ItemStack(Blocks.netherrack, stackSize, 0);
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return copyStack;
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public boolean isSilkTouch(World world, int x, int y, int z)
|
||||
{
|
||||
int index = 0;
|
||||
|
|
|
@ -42,14 +42,7 @@ public class RitualEffectEllipsoid extends RitualEffect
|
|||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y+1, z);
|
||||
|
||||
|
||||
if(((IInventory) tile).getSizeInventory() < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y+1, z);
|
||||
|
||||
if(!(tile instanceof IInventory) || ((IInventory)tile).getSizeInventory() < 3)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -10,24 +9,33 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
|
||||
|
||||
public class RitualEffectExpulsion extends RitualEffect
|
||||
{
|
||||
public static final int virtusDrain = 10;
|
||||
public static final int potentiaDrain = 10;
|
||||
public static final int tennebraeDrain = 5;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -49,45 +57,105 @@ public class RitualEffectExpulsion extends RitualEffect
|
|||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
int d0 = 25;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, d0, d0);
|
||||
axisalignedbb.maxY = Math.min((double) world.getHeight(), (double) (y + 1 + d0));
|
||||
List list = world.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
EntityPlayer entityplayer;
|
||||
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
|
||||
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
|
||||
|
||||
int teleportDistance = hasVirtus ? 300 : 100;
|
||||
int range = hasPotentia ? 50 : 25;
|
||||
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator.hasNext())
|
||||
TileEntity tile = world.getTileEntity(x, y+1, z);
|
||||
IInventory inventoryTile = null;
|
||||
if(tile instanceof IInventory)
|
||||
{
|
||||
entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
if (!(SpellHelper.getUsername(entityplayer).equals(owner)))
|
||||
inventoryTile = (IInventory)tile;
|
||||
}
|
||||
|
||||
for(EntityPlayer entityplayer : playerList)
|
||||
{
|
||||
String playerString = SpellHelper.getUsername(entityplayer);
|
||||
if (!playerString.equals(owner))
|
||||
{
|
||||
if(entityplayer.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding)||entityplayer.capabilities.isCreativeMode)
|
||||
if(inventoryTile != null)
|
||||
{
|
||||
continue;
|
||||
for(int i=0; i<inventoryTile.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack stack = inventoryTile.getStackInSlot(i);
|
||||
if(stack != null && stack.getItem() instanceof IBindable && EnergyItems.getOwnerName(stack).equals(playerString))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(entityplayer.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding)||entityplayer.capabilities.isCreativeMode)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
flag = teleportRandomly(entityplayer,100);
|
||||
|
||||
flag = teleportRandomly(entityplayer, teleportDistance) || flag;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if(hasVirtus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
|
||||
}
|
||||
|
||||
if(hasPotentia)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false);
|
||||
if(hasTennebrae && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, 1000))
|
||||
{
|
||||
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
|
||||
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
|
||||
|
||||
int teleportDistance = hasVirtus ? 300 : 100;
|
||||
int range = hasPotentia ? 50 : 25;
|
||||
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
|
||||
boolean flag = false;
|
||||
|
||||
for(EntityLivingBase livingEntity : livingList)
|
||||
{
|
||||
if(livingEntity instanceof EntityPlayer)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
flag = teleportRandomly(livingEntity, teleportDistance) || flag;
|
||||
}
|
||||
|
||||
if(flag)
|
||||
{
|
||||
if(hasVirtus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
|
||||
}
|
||||
|
||||
if(hasPotentia)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
|
||||
}
|
||||
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true);
|
||||
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,17 +11,23 @@ import net.minecraft.potion.PotionEffect;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
|
||||
public class RitualEffectFeatheredKnife extends RitualEffect
|
||||
{
|
||||
public final int timeDelay = 20;
|
||||
public final int amount = 100;
|
||||
|
||||
public static final int sanctusDrain = 5;
|
||||
public static final int reductusDrain = 3;
|
||||
public static final int magicalesDrain = 2;
|
||||
public static final int potentiaDrain = 5;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
|
@ -41,16 +47,16 @@ public class RitualEffectFeatheredKnife extends RitualEffect
|
|||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
|
||||
|
||||
int timeDelay = hasPotentia ? 10 : 20;
|
||||
|
||||
if (world.getWorldTime() % this.timeDelay != 0)
|
||||
if (world.getWorldTime() % timeDelay != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
TEAltar tileAltar = null;
|
||||
boolean testFlag = false;
|
||||
|
||||
|
@ -73,73 +79,72 @@ public class RitualEffectFeatheredKnife extends RitualEffect
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
|
||||
double range = hasReductus ? 8 : 15;
|
||||
double vertRange = hasReductus ? 8 : 20;
|
||||
List<EntityPlayer> list = SpellHelper.getPlayersInRange(world, x+0.5, y+0.5, z+0.5, range, vertRange);
|
||||
|
||||
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
|
||||
int d0 = 15;
|
||||
int vertRange = 20;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
EntityPlayer entity;
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator1.hasNext())
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * list.size())
|
||||
{
|
||||
entity = (EntityPlayer) iterator1.next();
|
||||
|
||||
if (!SpellHelper.isFakePlayer(world, entity))
|
||||
{
|
||||
entityCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
Iterator iterator2 = list.iterator();
|
||||
entityCount = 0;
|
||||
|
||||
while (iterator2.hasNext())
|
||||
boolean hasMagicales = this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, false);
|
||||
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
|
||||
|
||||
EntityPlayer ownerPlayer = SpellHelper.getPlayerForUsername(owner);
|
||||
for(EntityPlayer player : list)
|
||||
{
|
||||
entity = (EntityPlayer) iterator2.next();
|
||||
hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
|
||||
double threshold = hasSanctus ? 0.7d : 0.3d;
|
||||
|
||||
//entity = (EntityPlayer)iterator1.next();
|
||||
if (!SpellHelper.isFakePlayer(world, entity))
|
||||
{
|
||||
if (entity.getHealth()/entity.getMaxHealth() > 0.3d)
|
||||
if((hasMagicales && player == ownerPlayer) || !hasMagicales)
|
||||
{
|
||||
if (!SpellHelper.isFakePlayer(world, player))
|
||||
{
|
||||
entity.setHealth(entity.getHealth() - 1);
|
||||
entityCount++;
|
||||
tileAltar.sacrificialDaggerCall(this.amount, false);
|
||||
if (player.getHealth()/player.getMaxHealth() > threshold)
|
||||
{
|
||||
player.setHealth(player.getHealth() - 1);
|
||||
entityCount++;
|
||||
tileAltar.sacrificialDaggerCall(this.amount, false);
|
||||
if(hasSanctus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
|
||||
}
|
||||
if(hasMagicales)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.magicalesReagent, magicalesDrain, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//entity.setHealth(entity.getHealth()-1);
|
||||
// if(entity.getHealth()<=0.2f)
|
||||
// {
|
||||
// entity.onDeath(DamageSource.inFire);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
if(entityCount > 0)
|
||||
{
|
||||
if(hasReductus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
|
||||
}
|
||||
if(hasPotentia)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
|
||||
}
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,19 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectFlight extends RitualEffect
|
||||
{
|
||||
public static final int aetherDrain = 10;
|
||||
public static final int reductusDrain = 5;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -37,12 +42,6 @@ public class RitualEffectFlight extends RitualEffect
|
|||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (ritualStone.getCooldown() > 0)
|
||||
{
|
||||
//TODO Cool stuffs
|
||||
ritualStone.setCooldown(0);
|
||||
}
|
||||
|
||||
int range = 20;
|
||||
int verticalRange = 30;
|
||||
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, verticalRange, range);
|
||||
|
@ -50,6 +49,9 @@ public class RitualEffectFlight extends RitualEffect
|
|||
axis.minY = 0;
|
||||
List<EntityPlayer> entities = world.getEntitiesWithinAABB(EntityPlayer.class, axis);
|
||||
int entityCount = 0;
|
||||
|
||||
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
|
||||
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
|
||||
for (EntityPlayer entity : entities)
|
||||
{
|
||||
|
@ -58,16 +60,10 @@ public class RitualEffectFlight extends RitualEffect
|
|||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
|
||||
for (EntityPlayer entity : entities)
|
||||
{
|
||||
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlight.id, 20, 0));
|
||||
|
|
|
@ -4,20 +4,25 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectGrowth extends RitualEffect
|
||||
{
|
||||
private static final int aquasalusDrain = 10;
|
||||
private static final int terraeDrain = 20;
|
||||
private static final int orbisTerraeDrain = 20;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -39,20 +44,35 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
|
||||
if (currentEssence < this.getCostPerRefresh()*9)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
if (world.getWorldTime() % 20 != 0)
|
||||
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
|
||||
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
|
||||
|
||||
int speed = this.getSpeedForReagents(hasTerrae, hasOrbisTerrae);
|
||||
if (world.getWorldTime() % speed != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
|
||||
{
|
||||
int hydrationRange = 1;
|
||||
for(int i=-hydrationRange; i<=hydrationRange; i++)
|
||||
{
|
||||
for(int j=-hydrationRange; j<=hydrationRange; j++)
|
||||
{
|
||||
if(this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false))
|
||||
{
|
||||
if(SpellHelper.hydrateSoil(world, x + i, y + 1, z + j))
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int flag = 0;
|
||||
|
||||
|
@ -75,6 +95,9 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
|
||||
if (flag > 0)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh()*flag;
|
||||
data.markDirty();
|
||||
}
|
||||
|
@ -101,4 +124,27 @@ public class RitualEffectGrowth extends RitualEffect
|
|||
growthRitual.add(new RitualComponent(1, 0, -1, 3));
|
||||
return growthRitual;
|
||||
}
|
||||
|
||||
public int getSpeedForReagents(boolean hasTerrae, boolean hasOrbisTerrae)
|
||||
{
|
||||
if(hasOrbisTerrae)
|
||||
{
|
||||
if(hasTerrae)
|
||||
{
|
||||
return 10;
|
||||
}else
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(hasTerrae)
|
||||
{
|
||||
return 20;
|
||||
}else
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,17 +11,20 @@ import net.minecraft.potion.PotionEffect;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectHealing extends RitualEffect
|
||||
{
|
||||
public final int timeDelay = 50;
|
||||
//public final int amount = 10;
|
||||
|
||||
public static final int reductusDrain = 10;
|
||||
public static final int virtusDrain = 10;
|
||||
public static final int praesidiumDrain = 2;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -41,30 +44,25 @@ public class RitualEffectHealing extends RitualEffect
|
|||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (world.getWorldTime() % this.timeDelay != 0)
|
||||
int timeDelay = 50;
|
||||
|
||||
if (world.getWorldTime() % timeDelay != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hasPraesidium = this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, false);
|
||||
|
||||
int range = 15 * (hasPraesidium ? 3 : 1);
|
||||
int vertRange = 15 * (hasPraesidium ? 3 : 1);
|
||||
|
||||
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
|
||||
int d0 = 10;
|
||||
int vertRange = 10;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
EntityLivingBase entity;
|
||||
List<EntityLivingBase> list = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, range, vertRange);
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator1.hasNext())
|
||||
for(EntityLivingBase livingEntity : list)
|
||||
{
|
||||
entity = (EntityLivingBase) iterator1.next();
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
if (livingEntity instanceof EntityPlayer)
|
||||
{
|
||||
entityCount += 10;
|
||||
} else
|
||||
|
@ -72,52 +70,65 @@ public class RitualEffectHealing extends RitualEffect
|
|||
entityCount++;
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
|
||||
|
||||
int cost = this.getCostPerRefresh() * (hasVirtus ? 3 : 1);
|
||||
int potency = hasVirtus ? 1 : 0;
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
if (currentEssence < cost * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
Iterator iterator2 = list.iterator();
|
||||
entityCount = 0;
|
||||
|
||||
while (iterator2.hasNext())
|
||||
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
|
||||
for(EntityLivingBase livingEntity : list)
|
||||
{
|
||||
entity = (EntityLivingBase) iterator2.next();
|
||||
|
||||
if (entity.getHealth() + 0.1f < entity.getMaxHealth())
|
||||
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
if(hasReductus && !(livingEntity instanceof EntityPlayer))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (livingEntity.getHealth() + 0.1f < livingEntity.getMaxHealth())
|
||||
{
|
||||
entity.addPotionEffect(new PotionEffect(Potion.regeneration.id, timeDelay + 2, 0));
|
||||
|
||||
//entity.setHealth(entity.getHealth()-1);
|
||||
|
||||
//entity.attackEntityFrom(DamageSource.outOfWorld, 1);
|
||||
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
entityCount += 10;
|
||||
} else
|
||||
{
|
||||
entityCount++;
|
||||
}
|
||||
PotionEffect effect = livingEntity.getActivePotionEffect(Potion.regeneration);
|
||||
if(effect != null && effect.getAmplifier() <= potency && effect.getDuration() <= timeDelay)
|
||||
{
|
||||
if(!hasVirtus || (this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false)))
|
||||
{
|
||||
livingEntity.addPotionEffect(new PotionEffect(Potion.regeneration.id, timeDelay + 2, potency));
|
||||
if(hasReductus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
|
||||
}
|
||||
if(hasVirtus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
|
||||
}
|
||||
|
||||
if (livingEntity instanceof EntityPlayer)
|
||||
{
|
||||
entityCount += 10;
|
||||
} else
|
||||
{
|
||||
entityCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if(entity.getHealth()<=0.2f)
|
||||
// {
|
||||
// entity.onDeath(DamageSource.inFire);
|
||||
// }
|
||||
//tileAltar.sacrificialDaggerCall(this.amount, true);
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
data.markDirty();
|
||||
if(entityCount > 0)
|
||||
{
|
||||
if(hasPraesidium)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.praesidiumReagent, praesidiumDrain, true);
|
||||
}
|
||||
data.currentEssence = currentEssence - cost * entityCount;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectJumping extends RitualEffect
|
||||
{
|
||||
public static final int aetherDrain = 10;
|
||||
public static final int terraeDrain = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -37,55 +40,62 @@ public class RitualEffectJumping extends RitualEffect
|
|||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
int range = 0;
|
||||
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, range, range);
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
if (currentEssence < this.getCostPerRefresh() * livingList.size())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
int d0 = 0;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y + 1, (double) z, (double) (x + 1), (double) (y + 2), (double) (z + 1)).expand(d0, d0, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
EntityLivingBase entityplayer;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator.hasNext())
|
||||
int flag = 0;
|
||||
|
||||
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
|
||||
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
|
||||
|
||||
for(EntityLivingBase livingEntity : livingList)
|
||||
{
|
||||
entityplayer = (EntityLivingBase) iterator.next();
|
||||
|
||||
if (entityplayer instanceof EntityPlayer)
|
||||
if(livingEntity.isSneaking())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
|
||||
hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
|
||||
|
||||
double motionY = 1.5 * (hasAether ? 2 : 1);
|
||||
|
||||
if (livingEntity instanceof EntityPlayer)
|
||||
{
|
||||
//PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(entityplayer.motionX, 1.5, entityplayer.motionZ), (Player) entityplayer);
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, entityplayer.motionX, 1.5, entityplayer.motionZ);
|
||||
entityplayer.motionY = 1.5;
|
||||
entityplayer.fallDistance = 0;
|
||||
flag = true;
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, livingEntity.motionX, motionY, livingEntity.motionZ);
|
||||
livingEntity.motionY = motionY;
|
||||
livingEntity.fallDistance = 0;
|
||||
flag++;
|
||||
} else
|
||||
//if (!(entityplayer.getEntityName().equals(owner)))
|
||||
{
|
||||
// double xDif = entityplayer.posX - xCoord;
|
||||
// double yDif = entityplayer.posY - (yCoord + 1);
|
||||
// double zDif = entityplayer.posZ - zCoord;
|
||||
//entityplayer.motionX=0.1*xDif;
|
||||
entityplayer.motionY = 1.5;
|
||||
//entityplayer.motionZ=0.1*zDif;
|
||||
entityplayer.fallDistance = 0;
|
||||
flag = true;
|
||||
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
livingEntity.motionY = motionY;
|
||||
livingEntity.fallDistance = 0;
|
||||
flag++;
|
||||
}
|
||||
|
||||
if(hasAether)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
|
||||
}
|
||||
if(hasTerrae)
|
||||
{
|
||||
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
|
||||
{
|
||||
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3 * 20, 0));
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
if (flag > 0)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh()*flag;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,21 +4,35 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectLava extends RitualEffect
|
||||
{
|
||||
public static final int sanctusDrain = 20;
|
||||
public static final int offensaDrain = 50;
|
||||
public static final int reductusDrain = 5;
|
||||
|
||||
public static final int fireFuseCost = 1000;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -44,14 +58,7 @@ public class RitualEffectLava extends RitualEffect
|
|||
{
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
|
@ -63,7 +70,59 @@ public class RitualEffectLava extends RitualEffect
|
|||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}else
|
||||
{
|
||||
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
|
||||
TileEntity tile = world.getTileEntity(x, y + 1, z);
|
||||
if(tile instanceof IFluidHandler)
|
||||
{
|
||||
int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), false);
|
||||
if(amount >= 1000)
|
||||
{
|
||||
((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.LAVA, 1000), true);
|
||||
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost))
|
||||
{
|
||||
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
boolean drainReductus = world.getWorldTime() % 100 == 0;
|
||||
|
||||
int range = 5;
|
||||
List<EntityLivingBase> entityList = SpellHelper.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
|
||||
EntityPlayer player = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
for(EntityLivingBase entity : entityList)
|
||||
{
|
||||
if(entity != player && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false) && SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost) && !entity.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
|
||||
{
|
||||
if(hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false))
|
||||
{
|
||||
if(entity instanceof EntityPlayer)
|
||||
{
|
||||
if(drainReductus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
entity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFireFuse.id,100,0));
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, fireFuseCost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,24 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectLeap extends RitualEffect
|
||||
{
|
||||
public static final int aetherDrain = 10;
|
||||
public static final int terraeDrain = 10;
|
||||
public static final int reductusDrain = 10;
|
||||
public static final int tenebraeDrain = 10;
|
||||
public static final int sanctusDrain = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -38,97 +45,135 @@ public class RitualEffectLeap extends RitualEffect
|
|||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
double range = 2.0;
|
||||
|
||||
List<EntityLivingBase> livingList = SpellHelper.getLivingEntitiesInRange(world, x+0.5, y+0.5, z+0.5, range, range);
|
||||
|
||||
if(livingList == null){return;}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * livingList.size())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
int direction = ritualStone.getDirection();
|
||||
int d0 = 2;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y - 1, (double) z, (double) (x + 1), (double) (y + 2), (double) (z + 1)).expand(d0, 0, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
EntityLivingBase entityplayer;
|
||||
boolean flag = false;
|
||||
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
|
||||
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
|
||||
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
boolean hasTenebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
|
||||
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
|
||||
|
||||
int direction = ritualStone.getDirection();
|
||||
|
||||
while (iterator.hasNext())
|
||||
int flag = 0;
|
||||
|
||||
for(EntityLivingBase livingEntity : livingList)
|
||||
{
|
||||
entityplayer = (EntityLivingBase) iterator.next();
|
||||
|
||||
if (entityplayer instanceof EntityPlayer)
|
||||
if(livingEntity.isSneaking())
|
||||
{
|
||||
entityplayer.motionY = 1.2;
|
||||
entityplayer.fallDistance = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
hasAether = hasAether && this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
|
||||
hasTerrae = hasTerrae && this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
|
||||
hasReductus = hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
hasTenebrae = hasTenebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
|
||||
hasSanctus = hasSanctus && this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
|
||||
|
||||
double motionY = hasTerrae ? 0.6 : 1.2;
|
||||
double speed = hasAether ? 6.0 : 3.0;
|
||||
|
||||
|
||||
|
||||
if (!(hasTenebrae || hasSanctus) && livingEntity instanceof EntityPlayer)
|
||||
{
|
||||
livingEntity.motionY = motionY;
|
||||
livingEntity.fallDistance = 0;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, 0, 1.2, -3.0);
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, 0, motionY, -speed);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, 3.0, 1.2, 0);
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, speed, motionY, 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, 0, 1.2, 3.0);
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, 0, motionY, speed);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)entityplayer, -3.0, 1.2, 0);
|
||||
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)livingEntity, -speed, motionY, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
flag = true;
|
||||
flag++;
|
||||
} else
|
||||
//if (!(entityplayer.getEntityName().equals(owner)))
|
||||
{
|
||||
// double xDif = entityplayer.posX - xCoord;
|
||||
// double yDif = entityplayer.posY - (yCoord + 1);
|
||||
// double zDif = entityplayer.posZ - zCoord;
|
||||
//entityplayer.motionX=0.1*xDif;
|
||||
entityplayer.motionY = 1.2;
|
||||
if((hasSanctus && !livingEntity.isChild()) || (hasTenebrae && livingEntity.isChild()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
livingEntity.motionY = motionY;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
entityplayer.motionX = 0.0;
|
||||
entityplayer.motionZ = -3.0;
|
||||
livingEntity.motionX = 0.0;
|
||||
livingEntity.motionZ = -speed;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
entityplayer.motionX = 3.0;
|
||||
entityplayer.motionZ = 0.0;
|
||||
livingEntity.motionX = speed;
|
||||
livingEntity.motionZ = 0.0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
entityplayer.motionX = 0.0;
|
||||
entityplayer.motionZ = -3.0;
|
||||
livingEntity.motionX = 0.0;
|
||||
livingEntity.motionZ = -speed;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
entityplayer.motionX = -3.0;
|
||||
entityplayer.motionZ = 0.0;
|
||||
livingEntity.motionX = -speed;
|
||||
livingEntity.motionZ = 0.0;
|
||||
break;
|
||||
}
|
||||
|
||||
//entityplayer.motionZ=0.1*zDif;
|
||||
entityplayer.fallDistance = 0;
|
||||
flag = true;
|
||||
//entityplayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
livingEntity.fallDistance = 0;
|
||||
flag++;
|
||||
}
|
||||
|
||||
if(hasAether)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
|
||||
}
|
||||
if(hasTerrae)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
|
||||
}
|
||||
if(hasReductus)
|
||||
{
|
||||
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
|
||||
{
|
||||
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3*20, 0));
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
|
||||
}
|
||||
}
|
||||
if(hasTenebrae)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, true);
|
||||
}
|
||||
if(hasSanctus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
if (flag > 0)
|
||||
{
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * flag;
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,15 +12,21 @@ import net.minecraft.potion.PotionEffect;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectMagnetic extends RitualEffect
|
||||
{
|
||||
private static final int potentiaDrain = 10;
|
||||
private static final int terraeDrain = 10;
|
||||
private static final int orbisTerraeDrain = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
@ -40,24 +46,21 @@ public class RitualEffectMagnetic extends RitualEffect
|
|||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
if (world.getWorldTime() % 40 != 0)
|
||||
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
|
||||
|
||||
if(world.getWorldTime() % (hasPotentia ? 10 : 40) != 0)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
Block powerBlock = world.getBlock(x, y-1, z);
|
||||
int radius = this.getRadiusForModifierBlock(powerBlock);
|
||||
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
|
||||
boolean hasOrbisTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, false);
|
||||
|
||||
int radius = this.getRadiusForReagents(hasTerrae, hasOrbisTerrae);
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
int xRep = 0;
|
||||
|
@ -113,6 +116,22 @@ public class RitualEffectMagnetic extends RitualEffect
|
|||
BlockTeleposer.swapBlocks(world, world, x + i, j, z + k, xRep, yRep, zRep);
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
|
||||
if(hasPotentia)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
|
||||
}
|
||||
|
||||
if(hasTerrae)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
|
||||
}
|
||||
|
||||
if(hasOrbisTerrae)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, orbisTerraeDrain, true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -152,28 +171,26 @@ public class RitualEffectMagnetic extends RitualEffect
|
|||
return magneticRitual;
|
||||
}
|
||||
|
||||
public int getRadiusForModifierBlock(Block block)
|
||||
public int getRadiusForReagents(boolean hasTerrae, boolean hasOrbisTerrae)
|
||||
{
|
||||
if(block == null)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
if(block == Blocks.diamond_block)
|
||||
{
|
||||
return 31;
|
||||
}
|
||||
|
||||
if(block == Blocks.gold_block)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
if(block == Blocks.iron_block)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
return 3;
|
||||
if(hasTerrae)
|
||||
{
|
||||
if(hasOrbisTerrae)
|
||||
{
|
||||
return 31;
|
||||
}else
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(hasOrbisTerrae)
|
||||
{
|
||||
return 12;
|
||||
}else
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
|
||||
import WayofTime.alchemicalWizardry.common.CoordAndRange;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectSpawnWard extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
worldSave.setItemData(owner, data);
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
// if (world.getWorldTime() % 20 != 0)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
int horizRange = 32;
|
||||
int vertRange = 32;
|
||||
|
||||
int dimension = world.provider.dimensionId;
|
||||
|
||||
if(AlchemicalWizardryEventHooks.respawnMap.containsKey(new Integer(dimension)))
|
||||
{
|
||||
List<CoordAndRange> list = AlchemicalWizardryEventHooks.respawnMap.get(new Integer(dimension));
|
||||
if(list != null)
|
||||
{
|
||||
if(!list.contains(new CoordAndRange(x,y,z,horizRange,vertRange)))
|
||||
{
|
||||
boolean hasFoundAndRemoved = false;
|
||||
for(CoordAndRange coords : list)
|
||||
{
|
||||
int xLocation = coords.xCoord;
|
||||
int yLocation = coords.yCoord;
|
||||
int zLocation = coords.zCoord;
|
||||
|
||||
if(xLocation == x && yLocation == y && zLocation == z)
|
||||
{
|
||||
list.remove(coords);
|
||||
hasFoundAndRemoved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
|
||||
}
|
||||
}else
|
||||
{
|
||||
list = new LinkedList();
|
||||
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
|
||||
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
|
||||
}
|
||||
}else
|
||||
{
|
||||
List<CoordAndRange> list = new LinkedList();
|
||||
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
|
||||
AlchemicalWizardryEventHooks.respawnMap.put(new Integer(dimension), list);
|
||||
}
|
||||
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList()
|
||||
{
|
||||
ArrayList<RitualComponent> animalGrowthRitual = new ArrayList();
|
||||
animalGrowthRitual.add(new RitualComponent(0, 0, 2, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(2, 0, 0, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(0, 0, -2, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(1, 0, 0, RitualComponent.WATER));
|
||||
animalGrowthRitual.add(new RitualComponent(0, 0, -1, RitualComponent.WATER));
|
||||
animalGrowthRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.WATER));
|
||||
animalGrowthRitual.add(new RitualComponent(1, 0, 2, RitualComponent.EARTH));
|
||||
animalGrowthRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.EARTH));
|
||||
animalGrowthRitual.add(new RitualComponent(1, 0, -2, RitualComponent.EARTH));
|
||||
animalGrowthRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.EARTH));
|
||||
animalGrowthRitual.add(new RitualComponent(2, 0, 1, RitualComponent.AIR));
|
||||
animalGrowthRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
|
||||
animalGrowthRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
|
||||
animalGrowthRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
|
||||
return animalGrowthRitual;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
package WayofTime.alchemicalWizardry.common.rituals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
|
||||
import WayofTime.alchemicalWizardry.common.CoordAndRange;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectVeilOfEvil extends RitualEffect
|
||||
{
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
World worldSave = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(owner);
|
||||
worldSave.setItemData(owner, data);
|
||||
}
|
||||
|
||||
int currentEssence = data.currentEssence;
|
||||
World world = ritualStone.getWorld();
|
||||
int x = ritualStone.getXCoord();
|
||||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
// if (world.getWorldTime() % 20 != 0)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
int horizRange = 32;
|
||||
int vertRange = 32;
|
||||
|
||||
int dimension = world.provider.dimensionId;
|
||||
|
||||
if(AlchemicalWizardryEventHooks.forceSpawnMap.containsKey(new Integer(dimension)))
|
||||
{
|
||||
List<CoordAndRange> list = AlchemicalWizardryEventHooks.forceSpawnMap.get(new Integer(dimension));
|
||||
if(list != null)
|
||||
{
|
||||
if(!list.contains(new CoordAndRange(x,y,z,horizRange,vertRange)))
|
||||
{
|
||||
boolean hasFoundAndRemoved = false;
|
||||
for(CoordAndRange coords : list)
|
||||
{
|
||||
int xLocation = coords.xCoord;
|
||||
int yLocation = coords.yCoord;
|
||||
int zLocation = coords.zCoord;
|
||||
|
||||
if(xLocation == x && yLocation == y && zLocation == z)
|
||||
{
|
||||
list.remove(coords);
|
||||
hasFoundAndRemoved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
|
||||
}
|
||||
}else
|
||||
{
|
||||
list = new LinkedList();
|
||||
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
|
||||
AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list);
|
||||
}
|
||||
}else
|
||||
{
|
||||
List<CoordAndRange> list = new LinkedList();
|
||||
list.add(new CoordAndRange(x,y,z,horizRange,vertRange));
|
||||
AlchemicalWizardryEventHooks.forceSpawnMap.put(new Integer(dimension), list);
|
||||
}
|
||||
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RitualComponent> getRitualComponentList()
|
||||
{
|
||||
ArrayList<RitualComponent> animalGrowthRitual = new ArrayList();
|
||||
animalGrowthRitual.add(new RitualComponent(0, 0, 2, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(2, 0, 0, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(0, 0, -2, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(0, 0, 1, RitualComponent.DUSK));
|
||||
animalGrowthRitual.add(new RitualComponent(1, 0, 0, RitualComponent.WATER));
|
||||
animalGrowthRitual.add(new RitualComponent(0, 0, -1, RitualComponent.WATER));
|
||||
animalGrowthRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.WATER));
|
||||
animalGrowthRitual.add(new RitualComponent(1, 0, 2, RitualComponent.EARTH));
|
||||
animalGrowthRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.EARTH));
|
||||
animalGrowthRitual.add(new RitualComponent(1, 0, -2, RitualComponent.EARTH));
|
||||
animalGrowthRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.EARTH));
|
||||
animalGrowthRitual.add(new RitualComponent(2, 0, 1, RitualComponent.AIR));
|
||||
animalGrowthRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
|
||||
animalGrowthRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
|
||||
animalGrowthRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
|
||||
return animalGrowthRitual;
|
||||
}
|
||||
}
|
|
@ -4,21 +4,37 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RitualEffectWater extends RitualEffect
|
||||
{
|
||||
public static final int aquasalusDrain = 5;
|
||||
public static final int offensaDrain = 20;
|
||||
public static final int sanctusDrain = 5;
|
||||
public static final int reductusDrain = 2;
|
||||
public static final int crystallosDrain = 10;
|
||||
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
{
|
||||
String owner = ritualStone.getOwner();
|
||||
|
@ -37,20 +53,77 @@ public class RitualEffectWater extends RitualEffect
|
|||
int y = ritualStone.getYCoord();
|
||||
int z = ritualStone.getZCoord();
|
||||
|
||||
boolean hasCrystallos = this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
|
||||
boolean hasAquasalus = this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, false);
|
||||
boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false);
|
||||
|
||||
if(hasAquasalus)
|
||||
{
|
||||
int hydrationRange = 4;
|
||||
int vertRange = 3;
|
||||
|
||||
for(int i=-hydrationRange; i<=hydrationRange; i++)
|
||||
{
|
||||
for(int j=-vertRange; j<=vertRange; j++)
|
||||
{
|
||||
for(int k=-hydrationRange; k<=hydrationRange; k++)
|
||||
{
|
||||
if(SpellHelper.hydrateSoil(world, x+i, y+j, z+k))
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(hasOffensa)
|
||||
{
|
||||
boolean hasReductus = this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
|
||||
boolean drainReductus = world.getWorldTime() % 100 == 0;
|
||||
|
||||
int range = 10;
|
||||
List<Entity> list = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
|
||||
for(Entity entity : list)
|
||||
{
|
||||
if(entity instanceof EntityLivingBase)
|
||||
{
|
||||
EntityLivingBase livingEntity = (EntityLivingBase) entity;
|
||||
|
||||
if(livingEntity == SpellHelper.getPlayerForUsername(owner))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(hasReductus && this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false))
|
||||
{
|
||||
if(entity instanceof EntityPlayer)
|
||||
{
|
||||
if(drainReductus)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!livingEntity.isPotionActive(AlchemicalWizardry.customPotionDrowning))
|
||||
{
|
||||
livingEntity.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id,100,0));
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x, y + 1, z);
|
||||
|
||||
if (world.isAirBlock(x, y + 1, z) && !(block instanceof BlockSpectralContainer))
|
||||
{
|
||||
if (currentEssence < this.getCostPerRefresh())
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
|
@ -62,6 +135,58 @@ public class RitualEffectWater extends RitualEffect
|
|||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}else
|
||||
{
|
||||
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
|
||||
TileEntity tile = world.getTileEntity(x, y + 1, z);
|
||||
if(tile instanceof IFluidHandler)
|
||||
{
|
||||
int amount = ((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), false);
|
||||
if(amount >= 1000)
|
||||
{
|
||||
((IFluidHandler) tile).fill(ForgeDirection.DOWN, new FluidStack(FluidRegistry.WATER, 1000), true);
|
||||
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh();
|
||||
data.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(hasCrystallos)
|
||||
{
|
||||
int range = 2;
|
||||
for(int i=-range; i<=range; i++)
|
||||
{
|
||||
for(int j=-range; j<=range; j++)
|
||||
{
|
||||
for(int k=-range; k<=range; k++)
|
||||
{
|
||||
hasCrystallos = hasCrystallos && this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, false);
|
||||
|
||||
if(hasCrystallos)
|
||||
{
|
||||
boolean success = false;
|
||||
if(!world.isAirBlock(x+i, y+j, z+k) && SpellHelper.freezeWaterBlock(world, x+i, y+j, z+k))
|
||||
{
|
||||
success = true;
|
||||
}else
|
||||
{
|
||||
if(world.rand.nextInt(100) == 0 && world.isSideSolid(x+i, y+j-1, z+k, ForgeDirection.UP))
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(success)
|
||||
{
|
||||
this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, crystallosDrain, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,14 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
|||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
|
||||
public class RitualEffectWellOfSuffering extends RitualEffect
|
||||
{
|
||||
public final int timeDelay = 25;
|
||||
public final int amount = 10;
|
||||
public static final int timeDelay = 25;
|
||||
public static final int amount = 10;
|
||||
|
||||
@Override
|
||||
public void performEffect(IMasterRitualStone ritualStone)
|
||||
|
@ -49,10 +50,6 @@ public class RitualEffectWellOfSuffering extends RitualEffect
|
|||
return;
|
||||
}
|
||||
|
||||
// if(!(world.getBlockTileEntity(x, y-1, z) instanceof TEAltar))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
TEAltar tileAltar = null;
|
||||
boolean testFlag = false;
|
||||
|
||||
|
@ -76,54 +73,30 @@ public class RitualEffectWellOfSuffering extends RitualEffect
|
|||
return;
|
||||
}
|
||||
|
||||
//tileAltar = (TEAltar)world.getBlockTileEntity(x,y-1,z);
|
||||
int d0 = 10;
|
||||
int vertRange = 10;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
Iterator iterator1 = list.iterator();
|
||||
EntityLivingBase entity;
|
||||
List<EntityLivingBase> list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
|
||||
|
||||
int entityCount = 0;
|
||||
boolean flag = false;
|
||||
|
||||
while (iterator1.hasNext())
|
||||
if (currentEssence < this.getCostPerRefresh() * list.size())
|
||||
{
|
||||
entity = (EntityLivingBase) iterator1.next();
|
||||
entityCount++;
|
||||
}
|
||||
|
||||
if (currentEssence < this.getCostPerRefresh() * entityCount)
|
||||
{
|
||||
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
SoulNetworkHandler.causeNauseaToPlayer(owner);
|
||||
} else
|
||||
{
|
||||
Iterator iterator2 = list.iterator();
|
||||
entityCount = 0;
|
||||
|
||||
while (iterator2.hasNext())
|
||||
for(EntityLivingBase livingEntity : list)
|
||||
{
|
||||
entity = (EntityLivingBase) iterator2.next();
|
||||
|
||||
if (entity instanceof EntityPlayer || AlchemicalWizardry.wellBlacklist.contains(entity.getClass()))
|
||||
if (livingEntity instanceof EntityPlayer || AlchemicalWizardry.wellBlacklist.contains(livingEntity.getClass()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//entity.setHealth(entity.getHealth()-1);
|
||||
entity.attackEntityFrom(DamageSource.outOfWorld, 1);
|
||||
entityCount++;
|
||||
// if(entity.getHealth()<=0.2f)
|
||||
// {
|
||||
// entity.onDeath(DamageSource.inFire);
|
||||
// }
|
||||
tileAltar.sacrificialDaggerCall(this.amount, true);
|
||||
if(livingEntity.attackEntityFrom(DamageSource.outOfWorld, 1))
|
||||
{
|
||||
entityCount++;
|
||||
tileAltar.sacrificialDaggerCall(this.amount, true);
|
||||
}
|
||||
}
|
||||
|
||||
data.currentEssence = currentEssence - this.getCostPerRefresh() * entityCount;
|
||||
|
@ -134,7 +107,6 @@ public class RitualEffectWellOfSuffering extends RitualEffect
|
|||
@Override
|
||||
public int getCostPerRefresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,15 +7,16 @@ import java.util.Random;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.management.ServerConfigurationManager;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
@ -25,6 +26,8 @@ import net.minecraftforge.common.util.FakePlayer;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
||||
|
||||
|
@ -52,11 +55,40 @@ public class SpellHelper
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean canPlayerSeeAlchemy(EntityPlayer player)
|
||||
{
|
||||
if(player != null)
|
||||
{
|
||||
ItemStack stack = player.getCurrentArmor(3);
|
||||
if(stack != null)
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
if(item instanceof IAlchemyGoggles && ((IAlchemyGoggles)item).showIngameHUD(player.worldObj, stack, player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack heldStack = player.getHeldItem();
|
||||
if(heldStack != null && heldStack.getItem() instanceof IReagentManipulator)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<Entity> getEntitiesInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius)
|
||||
{
|
||||
return world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(posX-0.5f, posY-0.5f, posZ-0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius));
|
||||
}
|
||||
|
||||
public static List<EntityLivingBase> getLivingEntitiesInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius)
|
||||
{
|
||||
return world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX-0.5f, posY-0.5f, posZ-0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius));
|
||||
}
|
||||
|
||||
public static List<EntityItem> getItemsInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius)
|
||||
{
|
||||
return world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX-0.5f, posY-0.5f, posZ-0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius));
|
||||
|
@ -121,14 +153,17 @@ public class SpellHelper
|
|||
return ForgeDirection.EAST;
|
||||
}
|
||||
|
||||
public static void freezeWaterBlock(World world, int posX, int posY, int posZ)
|
||||
public static boolean freezeWaterBlock(World world, int posX, int posY, int posZ)
|
||||
{
|
||||
Block block = world.getBlock(posX, posY, posZ);
|
||||
|
||||
if(block == Blocks.water || block == Blocks.flowing_water)
|
||||
{
|
||||
world.setBlock(posX, posY, posZ, Blocks.ice);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getUsername(EntityPlayer player)
|
||||
|
@ -138,11 +173,7 @@ public class SpellHelper
|
|||
|
||||
public static EntityPlayer getPlayerForUsername(String str)
|
||||
{
|
||||
if(MinecraftServer.getServer() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str);
|
||||
return SoulNetworkHandler.getPlayerForUsername(str);
|
||||
}
|
||||
|
||||
public static void sendParticleToPlayer(EntityPlayer player, String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
|
||||
|
@ -389,4 +420,99 @@ public class SpellHelper
|
|||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine if stack1 can be placed into stack2. If stack2 is null and stack1 isn't null, returns true. Ignores stack size
|
||||
* @param stack1 Stack that is placed into a slot
|
||||
* @param stack2 Slot content that stack1 is placed into
|
||||
* @return True if they can be combined
|
||||
*/
|
||||
public static boolean canCombine(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
if(stack1 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(stack2 == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean tagsEqual = ItemStack.areItemStackTagsEqual(stack1, stack2);
|
||||
|
||||
return stack1.getItem() == stack2.getItem() && tagsEqual && stack1.getItemDamage() == stack2.getItemDamage() && Math.min(stack2.getMaxStackSize() - stack2.stackSize, stack1.stackSize) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param stack1 Stack that is placed into a slot
|
||||
* @param stack2 Slot content that stack1 is placed into
|
||||
* @return Stacks after stacking
|
||||
*/
|
||||
public static ItemStack[] combineStacks(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
ItemStack[] returned = new ItemStack[2];
|
||||
|
||||
if(canCombine(stack1, stack2))
|
||||
{
|
||||
int transferedAmount = stack2 == null ? stack1.stackSize : Math.min(stack2.getMaxStackSize() - stack2.stackSize, stack1.stackSize);
|
||||
if(transferedAmount > 0)
|
||||
{
|
||||
ItemStack copyStack = stack1.splitStack(transferedAmount);
|
||||
if(stack2 == null)
|
||||
{
|
||||
stack2 = copyStack;
|
||||
}else
|
||||
{
|
||||
stack2.stackSize+=transferedAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returned[0] = stack1;
|
||||
returned[1] = stack2;
|
||||
|
||||
return returned;
|
||||
}
|
||||
|
||||
public static ItemStack insertStackIntoInventory(ItemStack stack, IInventory inventory)
|
||||
{
|
||||
if(stack == null)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
for(int i=0; i<inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack[] combinedStacks = combineStacks(stack, inventory.getStackInSlot(i));
|
||||
stack = combinedStacks[0];
|
||||
inventory.setInventorySlotContents(i, combinedStacks[1]);
|
||||
|
||||
if(stack.stackSize <= 0)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static boolean hydrateSoil(World world, int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if(block == Blocks.dirt || block == Blocks.grass || (block == Blocks.farmland && world.getBlockMetadata(x, y, z) == 0))
|
||||
{
|
||||
world.setBlock(x, y, z, Blocks.farmland, 15, 2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,378 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
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.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory
|
||||
{
|
||||
protected ItemStack[] inv;
|
||||
protected ReagentContainer bufferTank = new ReagentContainer(Reagent.REAGENT_SIZE * 2);
|
||||
|
||||
protected int bufferTransferRate = 20;
|
||||
|
||||
private int lpPerTick = 10;
|
||||
private int ticksPerReagent = 200;
|
||||
|
||||
public int progress;
|
||||
|
||||
public TEAlchemicCalcinator()
|
||||
{
|
||||
super(1, Reagent.REAGENT_SIZE * 4);
|
||||
this.inv = new ItemStack[2];
|
||||
this.tickRate = 20;
|
||||
this.maxConnextions = 1;
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
bufferTransferRate = tag.getInteger("bufferTransferRate");
|
||||
progress = tag.getInteger("progress");
|
||||
|
||||
NBTTagCompound bufferTankTag = tag.getCompoundTag("bufferTank");
|
||||
|
||||
this.bufferTank = ReagentContainer.readFromNBT(bufferTankTag);
|
||||
|
||||
NBTTagList tagList = tag.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
|
||||
if(savedTag.getBoolean("Empty"))
|
||||
{
|
||||
inv[i] = null;
|
||||
}else
|
||||
{
|
||||
inv[i] = ItemStack.loadItemStackFromNBT(savedTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setInteger("bufferTransferRate", bufferTransferRate);
|
||||
tag.setInteger("progress", progress);
|
||||
|
||||
NBTTagCompound bufferTankTag = new NBTTagCompound();
|
||||
|
||||
this.bufferTank.writeToNBT(bufferTankTag);
|
||||
|
||||
tag.setTag("bufferTank", bufferTankTag);
|
||||
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < inv.length; i++)
|
||||
{
|
||||
ItemStack stack = inv[i];
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
|
||||
if (inv[i] != null)
|
||||
{
|
||||
inv[i].writeToNBT(savedTag);
|
||||
}else
|
||||
{
|
||||
savedTag.setBoolean("Empty", true);
|
||||
}
|
||||
|
||||
itemList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("Inventory", itemList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
moveBufferToMain();
|
||||
tickProgress();
|
||||
}
|
||||
}
|
||||
|
||||
public void moveBufferToMain()
|
||||
{
|
||||
ReagentStack amountStack = this.bufferTank.drain(bufferTransferRate, false);
|
||||
int drainAmount = this.fill(ForgeDirection.UNKNOWN, amountStack, false);
|
||||
|
||||
if(drainAmount > 0)
|
||||
{
|
||||
ReagentStack drainedStack = this.bufferTank.drain(drainAmount, true);
|
||||
this.fill(ForgeDirection.UNKNOWN, drainedStack, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void tickProgress()
|
||||
{
|
||||
ItemStack reagentItemStack = this.getStackInSlot(1);
|
||||
if(reagentItemStack == null)
|
||||
{
|
||||
progress = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ReagentStack possibleReagent = ReagentRegistry.getReagentStackForItem(reagentItemStack);
|
||||
if(possibleReagent == null || !this.canReagentFitBuffer(possibleReagent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack orbStack = this.getStackInSlot(0);
|
||||
if(orbStack == null || !(orbStack.getItem() instanceof IBloodOrb))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!SoulNetworkHandler.canSyphonFromOnlyNetwork(orbStack, lpPerTick))
|
||||
{
|
||||
SoulNetworkHandler.causeNauseaToPlayer(orbStack);
|
||||
return;
|
||||
}
|
||||
|
||||
SoulNetworkHandler.syphonFromNetwork(orbStack, lpPerTick);
|
||||
progress++;
|
||||
|
||||
if (worldObj.getWorldTime() % 4 == 0)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if(progress >= this.ticksPerReagent)
|
||||
{
|
||||
progress = 0;
|
||||
this.bufferTank.fill(possibleReagent, true);
|
||||
this.decrStackSize(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canReagentFitBuffer(ReagentStack stack)
|
||||
{
|
||||
int amount = this.bufferTank.fill(stack, false);
|
||||
|
||||
return amount >= stack.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readClientNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readClientNBT(tag);
|
||||
|
||||
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
int size = tagList.tagCount();
|
||||
this.tanks = new ReagentContainer[size];
|
||||
|
||||
for(int i=0; i<size; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
|
||||
}
|
||||
|
||||
NBTTagList invTagList = tag.getTagList("Inventory",Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < invTagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = (NBTTagCompound) invTagList.getCompoundTagAt(i);
|
||||
|
||||
if(savedTag.getBoolean("Empty"))
|
||||
{
|
||||
inv[i] = null;
|
||||
}else
|
||||
{
|
||||
inv[i] = ItemStack.loadItemStackFromNBT(savedTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeClientNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeClientNBT(tag);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for(int i=0; i<this.tanks.length; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if(this.tanks[i] != null)
|
||||
{
|
||||
this.tanks[i].writeToNBT(savedTag);
|
||||
}
|
||||
tagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("reagentTanks", tagList);
|
||||
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < inv.length; i++)
|
||||
{
|
||||
ItemStack stack = inv[i];
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
|
||||
if (inv[i] != null)
|
||||
{
|
||||
inv[i].writeToNBT(savedTag);
|
||||
}else
|
||||
{
|
||||
savedTag.setBoolean("Empty", true);
|
||||
}
|
||||
|
||||
itemList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("Inventory", itemList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeClientNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readClientNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return inv.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return inv[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||
{
|
||||
inv[slot] = stack;
|
||||
|
||||
if (stack != null && stack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
stack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amt)
|
||||
{
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.stackSize <= amt)
|
||||
{
|
||||
setInventorySlotContents(slot, null);
|
||||
} else
|
||||
{
|
||||
stack = stack.splitStack(amt);
|
||||
|
||||
if (stack.stackSize == 0)
|
||||
{
|
||||
setInventorySlotContents(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
|
||||
if (stack != null)
|
||||
{
|
||||
setInventorySlotContents(slot, null);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "AlchemicCalcinator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if(doFill && !worldObj.isRemote)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
return super.fill(from, resource, doFill);
|
||||
}
|
||||
}
|
|
@ -568,8 +568,21 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
|
|||
{
|
||||
this.lockdownDuration += 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(AlchemicalWizardry.causeHungerWithRegen)
|
||||
{
|
||||
List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5, 15, 15);
|
||||
for(EntityPlayer player : list)
|
||||
{
|
||||
PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
|
||||
if(regenEffect != null && regenEffect.getAmplifier() > 0)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier()*2 - 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (worldObj.getWorldTime() % 100 == 0)
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
|
||||
|
||||
public class TEBellJar extends TEReagentConduit
|
||||
{
|
||||
public TEBellJar()
|
||||
{
|
||||
super(1, 16000);
|
||||
this.maxConnextions = 1;
|
||||
this.affectedByRedstone = false;
|
||||
}
|
||||
|
||||
public int getRSPowerOutput()
|
||||
{
|
||||
ReagentContainer thisTank = this.tanks[0];
|
||||
if(thisTank != null)
|
||||
{
|
||||
ReagentStack stack = thisTank.getReagent();
|
||||
if(stack != null)
|
||||
{
|
||||
return (15*stack.amount/thisTank.getCapacity());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void readClientNBT(NBTTagCompound tag)
|
||||
// {
|
||||
// super.readClientNBT(tag);
|
||||
//
|
||||
// NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
//
|
||||
// int size = tagList.tagCount();
|
||||
// this.tanks = new ReagentContainer[size];
|
||||
//
|
||||
// for(int i=0; i<size; i++)
|
||||
// {
|
||||
// NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
// this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void writeClientNBT(NBTTagCompound tag)
|
||||
// {
|
||||
// super.writeClientNBT(tag);
|
||||
//
|
||||
// NBTTagList tagList = new NBTTagList();
|
||||
//
|
||||
// for(int i=0; i<this.tanks.length; i++)
|
||||
// {
|
||||
// NBTTagCompound savedTag = new NBTTagCompound();
|
||||
// if(this.tanks[i] != null)
|
||||
// {
|
||||
// this.tanks[i].writeToNBT(savedTag);
|
||||
// }
|
||||
// tagList.appendTag(savedTag);
|
||||
// }
|
||||
//
|
||||
// tag.setTag("reagentTanks", tagList);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if(hasChanged == 1)
|
||||
{
|
||||
Block block = worldObj.getBlock(xCoord+1, yCoord, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord+1, yCoord, zCoord, block);
|
||||
block = worldObj.getBlock(xCoord-1, yCoord, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord-1, yCoord, zCoord, block);
|
||||
block = worldObj.getBlock(xCoord, yCoord+1, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord, yCoord+1, zCoord, block);
|
||||
block = worldObj.getBlock(xCoord, yCoord-1, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord, yCoord-1, zCoord, block);
|
||||
block = worldObj.getBlock(xCoord, yCoord, zCoord+1);
|
||||
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord+1, block);
|
||||
block = worldObj.getBlock(xCoord, yCoord, zCoord-1);
|
||||
block.onNeighborBlockChange(worldObj, xCoord, yCoord, zCoord-1, block);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
|
||||
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.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
|
||||
|
@ -25,9 +39,15 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
private int direction;
|
||||
public boolean isRunning;
|
||||
public int runningTime;
|
||||
|
||||
protected ReagentContainer[] tanks;
|
||||
protected Map<Reagent, Integer> attunedTankMap;
|
||||
|
||||
public TEMasterStone()
|
||||
{
|
||||
tanks = new ReagentContainer[]{new ReagentContainer(1000),new ReagentContainer(1000),new ReagentContainer(1000)};
|
||||
this.attunedTankMap = new HashMap();
|
||||
|
||||
isActive = false;
|
||||
owner = "";
|
||||
cooldown = 0;
|
||||
|
@ -39,32 +59,117 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
runningTime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
public void readClientNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
isActive = par1NBTTagCompound.getBoolean("isActive");
|
||||
owner = par1NBTTagCompound.getString("owner");
|
||||
cooldown = par1NBTTagCompound.getInteger("cooldown");
|
||||
var1 = par1NBTTagCompound.getInteger("var1");
|
||||
direction = par1NBTTagCompound.getInteger("direction");
|
||||
currentRitualString = par1NBTTagCompound.getString("currentRitualString");
|
||||
isRunning = par1NBTTagCompound.getBoolean("isRunning");
|
||||
runningTime = par1NBTTagCompound.getInteger("runningTime");
|
||||
currentRitualString = tag.getString("currentRitualString");
|
||||
isRunning = tag.getBoolean("isRunning");
|
||||
runningTime = tag.getInteger("runningTime");
|
||||
|
||||
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
int size = tagList.tagCount();
|
||||
this.tanks = new ReagentContainer[size];
|
||||
|
||||
for(int i=0; i<size; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeClientNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setString("currentRitualString", currentRitualString);
|
||||
tag.setBoolean("isRunning", isRunning);
|
||||
tag.setInteger("runningTime",runningTime);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for(int i=0; i<this.tanks.length; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if(this.tanks[i] != null)
|
||||
{
|
||||
this.tanks[i].writeToNBT(savedTag);
|
||||
}
|
||||
tagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("reagentTanks", tagList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
isActive = tag.getBoolean("isActive");
|
||||
owner = tag.getString("owner");
|
||||
cooldown = tag.getInteger("cooldown");
|
||||
var1 = tag.getInteger("var1");
|
||||
direction = tag.getInteger("direction");
|
||||
currentRitualString = tag.getString("currentRitualString");
|
||||
isRunning = tag.getBoolean("isRunning");
|
||||
runningTime = tag.getInteger("runningTime");
|
||||
|
||||
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
int size = tagList.tagCount();
|
||||
this.tanks = new ReagentContainer[size];
|
||||
|
||||
for(int i=0; i<size; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
|
||||
}
|
||||
|
||||
NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for(int i=0; i<attunedTagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i);
|
||||
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
|
||||
this.attunedTankMap.put(reagent, savedTag.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setBoolean("isActive", isActive);
|
||||
par1NBTTagCompound.setString("owner", owner);
|
||||
par1NBTTagCompound.setInteger("cooldown", cooldown);
|
||||
par1NBTTagCompound.setInteger("var1", var1);
|
||||
par1NBTTagCompound.setInteger("direction", direction);
|
||||
par1NBTTagCompound.setString("currentRitualString", currentRitualString);
|
||||
par1NBTTagCompound.setBoolean("isRunning", isRunning);
|
||||
par1NBTTagCompound.setInteger("runningTime",runningTime);
|
||||
super.writeToNBT(tag);
|
||||
tag.setBoolean("isActive", isActive);
|
||||
tag.setString("owner", owner);
|
||||
tag.setInteger("cooldown", cooldown);
|
||||
tag.setInteger("var1", var1);
|
||||
tag.setInteger("direction", direction);
|
||||
tag.setString("currentRitualString", currentRitualString);
|
||||
tag.setBoolean("isRunning", isRunning);
|
||||
tag.setInteger("runningTime",runningTime);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for(int i=0; i<this.tanks.length; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if(this.tanks[i] != null)
|
||||
{
|
||||
this.tanks[i].writeToNBT(savedTag);
|
||||
}
|
||||
tagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("reagentTanks", tagList);
|
||||
|
||||
NBTTagList attunedTagList = new NBTTagList();
|
||||
|
||||
for(Entry<Reagent, Integer> entry : this.attunedTankMap.entrySet())
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey()));
|
||||
savedTag.setInteger("amount", entry.getValue());
|
||||
attunedTagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("attunedTankMap", attunedTagList);
|
||||
}
|
||||
|
||||
public void activateRitual(World world, int crystalLevel, EntityPlayer player)
|
||||
|
@ -269,11 +374,26 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
this.currentRitualString = str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return NewPacketHandler.getPacket(this);
|
||||
}
|
||||
// @Override
|
||||
// public Packet getDescriptionPacket()
|
||||
// {
|
||||
// return NewPacketHandler.getPacket(this);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeClientNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readClientNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
public AxisAlignedBB getRenderBoundingBox()
|
||||
{
|
||||
|
@ -281,4 +401,191 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone
|
|||
AxisAlignedBB bb = AxisAlignedBB. getBoundingBox(xCoord-renderExtention, yCoord-renderExtention, zCoord-renderExtention, xCoord+1+renderExtention, yCoord+1+renderExtention, zCoord+1+renderExtention);
|
||||
return bb;
|
||||
}
|
||||
|
||||
/* ISegmentedReagentHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if(doFill)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
int totalFill = 0;
|
||||
|
||||
boolean useTankLimit = !this.attunedTankMap.isEmpty();
|
||||
|
||||
if(resource != null)
|
||||
{
|
||||
int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
|
||||
int tanksFilled = 0;
|
||||
|
||||
int maxFill = resource.amount;
|
||||
|
||||
for(int i=this.tanks.length-1; i>=0; i--)
|
||||
{
|
||||
ReagentStack remainingStack = resource.copy();
|
||||
remainingStack.amount = maxFill - totalFill;
|
||||
|
||||
boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack);
|
||||
|
||||
if(doesReagentMatch)
|
||||
{
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
}else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(totalFill >= maxFill || tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
return totalFill;
|
||||
}
|
||||
}
|
||||
|
||||
if(tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
return totalFill;
|
||||
}
|
||||
|
||||
for(int i=this.tanks.length-1; i>=0; i--)
|
||||
{
|
||||
ReagentStack remainingStack = resource.copy();
|
||||
remainingStack.amount = maxFill - totalFill;
|
||||
|
||||
boolean isTankEmpty = tanks[i].getReagent() == null;
|
||||
|
||||
if(isTankEmpty)
|
||||
{
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
}else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(totalFill >= maxFill || tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
return totalFill;
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalFill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if(resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(doDrain)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
int maxDrain = resource.amount;
|
||||
Reagent reagent = resource.reagent;
|
||||
int drained = 0;
|
||||
|
||||
for(int i=0; i<tanks.length; i++)
|
||||
{
|
||||
if(drained >= maxDrain)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (resource.isReagentEqual(tanks[i].getReagent()))
|
||||
{
|
||||
ReagentStack drainStack = tanks[i].drain(maxDrain-drained, doDrain);
|
||||
if(drainStack != null)
|
||||
{
|
||||
drained += drainStack.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ReagentStack(reagent, drained);
|
||||
}
|
||||
|
||||
/* Only returns the amount from the first available tank */
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
for(int i=0; i<tanks.length; i++)
|
||||
{
|
||||
ReagentStack stack = tanks[i].drain(maxDrain, doDrain);
|
||||
if(stack != null)
|
||||
{
|
||||
if(doDrain)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
|
||||
{
|
||||
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
|
||||
for(int i=0; i<this.getNumberOfTanks(); i++)
|
||||
{
|
||||
info[i] = tanks[i].getInfo();
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfTanks()
|
||||
{
|
||||
return tanks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTanksTunedToReagent(Reagent reagent)
|
||||
{
|
||||
if(this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null)
|
||||
{
|
||||
return this.attunedTankMap.get(reagent);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTanksTunedToReagent(Reagent reagent, int total)
|
||||
{
|
||||
if(total == 0 && this.attunedTankMap.containsKey(reagent))
|
||||
{
|
||||
this.attunedTankMap.remove(reagent);
|
||||
return;
|
||||
}
|
||||
|
||||
this.attunedTankMap.put(reagent, new Integer(total));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Reagent, Integer> getAttunedTankMap()
|
||||
{
|
||||
return this.attunedTankMap;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,530 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class TEReagentConduit extends TileEntity
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles;
|
||||
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.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class TEReagentConduit extends TileSegmentedReagentHandler
|
||||
{
|
||||
public List<ColourAndCoords> destinationList; //These are offsets
|
||||
public Map<Reagent, List<Int3>> reagentTargetList;
|
||||
public Map<Reagent, Integer> reagentTankDesignationList;
|
||||
public int tickRate = 20; //Rate that the reagents are sent
|
||||
|
||||
}
|
||||
int hasChanged = 0;
|
||||
public boolean affectedByRedstone = true;
|
||||
|
||||
public int maxConnextions = 5;
|
||||
|
||||
public int renderCount = 0;
|
||||
|
||||
public TEReagentConduit()
|
||||
{
|
||||
this(2, 2000);
|
||||
}
|
||||
|
||||
public TEReagentConduit(int numberOfTanks, int size)
|
||||
{
|
||||
super(numberOfTanks, size);
|
||||
|
||||
destinationList = new LinkedList();
|
||||
reagentTargetList = new HashMap();
|
||||
reagentTankDesignationList = new HashMap();
|
||||
}
|
||||
|
||||
public Int3 getColour()
|
||||
{
|
||||
int[] redMap = new int[this.tanks.length];
|
||||
int[] greenMap = new int[this.tanks.length];
|
||||
int[] blueMap = new int[this.tanks.length];
|
||||
|
||||
for(int i=0; i<this.tanks.length; i++)
|
||||
{
|
||||
ReagentContainer container = this.tanks[i];
|
||||
if(container != null && container.getReagent() != null)
|
||||
{
|
||||
Reagent reagent = container.getReagent().reagent;
|
||||
|
||||
redMap[i] = reagent.getColourRed();
|
||||
greenMap[i] = reagent.getColourGreen();
|
||||
blueMap[i] = reagent.getColourBlue();
|
||||
}
|
||||
}
|
||||
|
||||
int red = 0;
|
||||
int green = 0;
|
||||
int blue = 0;
|
||||
|
||||
for(int i=0; i<this.tanks.length; i++)
|
||||
{
|
||||
red += redMap[i];
|
||||
green += greenMap[i];
|
||||
blue += blueMap[i];
|
||||
}
|
||||
|
||||
red /= this.tanks.length;
|
||||
green /= this.tanks.length;
|
||||
blue /= this.tanks.length;
|
||||
|
||||
return new Int3(red, green, blue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
|
||||
tag.setInteger("hasChanged", hasChanged);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for(int i=0; i<destinationList.size(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
tagList.appendTag(destinationList.get(i).writeToNBT(savedTag));
|
||||
}
|
||||
|
||||
tag.setTag("destinationList", tagList);
|
||||
|
||||
NBTTagList reagentTagList = new NBTTagList(); //TODO
|
||||
|
||||
for(Entry<Reagent, List<Int3>> entry : reagentTargetList.entrySet())
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey()));
|
||||
|
||||
NBTTagList coordinateTagList = new NBTTagList();
|
||||
|
||||
for(Int3 coord : entry.getValue())
|
||||
{
|
||||
NBTTagCompound coordinateTag = new NBTTagCompound();
|
||||
|
||||
coord.writeToNBT(coordinateTag);
|
||||
|
||||
coordinateTagList.appendTag(coordinateTag);
|
||||
}
|
||||
|
||||
savedTag.setTag("coordinateList", coordinateTagList);
|
||||
|
||||
reagentTagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("reagentTargetList", reagentTagList);
|
||||
|
||||
NBTTagList tankDesignationList = new NBTTagList();
|
||||
|
||||
for(Entry<Reagent, Integer> entry : this.reagentTankDesignationList.entrySet())
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
|
||||
savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey()));
|
||||
savedTag.setInteger("integer", entry.getValue());
|
||||
|
||||
tankDesignationList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("tankDesignationList", tankDesignationList);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
|
||||
hasChanged = tag.getInteger("hasChanged");
|
||||
|
||||
NBTTagList tagList = tag.getTagList("destinationList", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
destinationList = new LinkedList();
|
||||
|
||||
for(int i=0; i<tagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
|
||||
destinationList.add(ColourAndCoords.readFromNBT(savedTag));
|
||||
}
|
||||
|
||||
reagentTargetList = new HashMap();
|
||||
|
||||
NBTTagList reagentTagList = tag.getTagList("reagentTargetList", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for(int i=0; i<reagentTagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = reagentTagList.getCompoundTagAt(i);
|
||||
|
||||
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
|
||||
|
||||
List<Int3> coordList = new LinkedList();
|
||||
|
||||
NBTTagList coordinateList = savedTag.getTagList("coordinateList", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for(int j=0; j<coordinateList.tagCount(); j++)
|
||||
{
|
||||
coordList.add(Int3.readFromNBT(coordinateList.getCompoundTagAt(j)));
|
||||
}
|
||||
|
||||
reagentTargetList.put(reagent, coordList);
|
||||
}
|
||||
|
||||
reagentTankDesignationList = new HashMap();
|
||||
|
||||
NBTTagList tankDesignationList = tag.getTagList("tankDesignationList", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for(int i=0; i<tankDesignationList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tankDesignationList.getCompoundTagAt(i);
|
||||
|
||||
this.reagentTankDesignationList.put(ReagentRegistry.getReagentForKey(savedTag.getString("reagent")), new Integer(savedTag.getInteger("integer")));
|
||||
}
|
||||
}
|
||||
|
||||
public void readClientNBT(NBTTagCompound tag)
|
||||
{
|
||||
NBTTagList tagList = tag.getTagList("destinationList", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
destinationList = new LinkedList();
|
||||
|
||||
for(int i=0; i<tagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
|
||||
|
||||
destinationList.add(ColourAndCoords.readFromNBT(savedTag));
|
||||
}
|
||||
|
||||
NBTTagList reagentTagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
int size = reagentTagList.tagCount();
|
||||
this.tanks = new ReagentContainer[size];
|
||||
|
||||
for(int i=0; i<size; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = reagentTagList.getCompoundTagAt(i);
|
||||
this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeClientNBT(NBTTagCompound tag)
|
||||
{
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for(int i=0; i<destinationList.size(); i++)
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
tagList.appendTag(destinationList.get(i).writeToNBT(savedTag));
|
||||
}
|
||||
|
||||
tag.setTag("destinationList", tagList);
|
||||
|
||||
NBTTagList reagentTagList = new NBTTagList();
|
||||
|
||||
for(int i=0; i<this.tanks.length; i++)
|
||||
{
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if(this.tanks[i] != null)
|
||||
{
|
||||
this.tanks[i].writeToNBT(savedTag);
|
||||
}
|
||||
reagentTagList.appendTag(savedTag);
|
||||
}
|
||||
|
||||
tag.setTag("reagentTanks", reagentTagList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(hasChanged > 1)
|
||||
{
|
||||
hasChanged = 1;
|
||||
}else if(hasChanged == 1)
|
||||
{
|
||||
hasChanged = 0;
|
||||
}
|
||||
|
||||
if(worldObj.getWorldTime() % 100 == 99)
|
||||
{
|
||||
this.updateColourList();
|
||||
}
|
||||
|
||||
if(affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int totalTransfered = 0;
|
||||
|
||||
for(Entry<Reagent, List<Int3>> entry : this.reagentTargetList.entrySet())
|
||||
{
|
||||
for(Int3 coord : entry.getValue())
|
||||
{
|
||||
if(totalTransfered >= this.tickRate)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ReagentStack maxDrainAmount = this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), this.tickRate - totalTransfered), false);
|
||||
|
||||
if(maxDrainAmount == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int amountLeft = maxDrainAmount.amount;
|
||||
|
||||
if(amountLeft <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int x = xCoord + coord.xCoord;
|
||||
int y = yCoord + coord.yCoord;
|
||||
int z = zCoord + coord.zCoord;
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
if(tile instanceof IReagentHandler)
|
||||
{
|
||||
int amount = Math.min(((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, maxDrainAmount, false), amountLeft);
|
||||
if(amount > 0)
|
||||
{
|
||||
amountLeft -= amount;
|
||||
totalTransfered += amount;
|
||||
|
||||
ReagentStack stack = this.drain(ForgeDirection.UNKNOWN, new ReagentStack(entry.getKey(), amount), true);
|
||||
((IReagentHandler) tile).fill(ForgeDirection.UNKNOWN, stack, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(affectedByRedstone && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
renderCount++;
|
||||
|
||||
if(worldObj.getWorldTime() % 100 != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
World world = mc.theWorld;
|
||||
if(SpellHelper.canPlayerSeeAlchemy(player))
|
||||
{
|
||||
for(ColourAndCoords colourSet : this.destinationList)
|
||||
{
|
||||
if(!(worldObj.getTileEntity(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord) instanceof IReagentHandler))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
EntityParticleBeam beam = new EntityParticleBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
|
||||
double velocity = Math.sqrt(Math.pow(colourSet.xCoord, 2) + Math.pow(colourSet.yCoord, 2) + Math.pow(colourSet.zCoord, 2));
|
||||
double wantedVel = 0.3d;
|
||||
beam.setVelocity(wantedVel*colourSet.xCoord/velocity, wantedVel*colourSet.yCoord/velocity, wantedVel*colourSet.zCoord/velocity);
|
||||
beam.setColour(colourSet.colourRed / 255f, colourSet.colourGreen/255f, colourSet.colourBlue/255f);
|
||||
beam.setDestination(xCoord + colourSet.xCoord, yCoord + colourSet.yCoord, zCoord + colourSet.zCoord);
|
||||
worldObj.spawnEntityInWorld(beam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateColourList()
|
||||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<ColourAndCoords> newList = this.compileListForReagentTargets(this.reagentTargetList);
|
||||
|
||||
if(newList != null && !newList.equals(destinationList))
|
||||
{
|
||||
this.destinationList = newList;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ColourAndCoords> compileListForReagentTargets(Map<Reagent, List<Int3>> map)
|
||||
{
|
||||
List<ColourAndCoords> list = new LinkedList();
|
||||
|
||||
for(Entry<Reagent, List<Int3>> entry : map.entrySet())
|
||||
{
|
||||
if(entry.getValue() != null)
|
||||
{
|
||||
Reagent reagent = entry.getKey();
|
||||
List<Int3> coords = entry.getValue();
|
||||
for(Int3 coord : coords)
|
||||
{
|
||||
list.add(new ColourAndCoords(reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), reagent.getColourIntensity(), coord.xCoord, coord.yCoord, coord.zCoord));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean addDestinationViaOffset(int red, int green, int blue, int intensity, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if(xOffset == 0 && yOffset == 0 && zOffset == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.destinationList.add(new ColourAndCoords(red, green, blue, intensity, xOffset, yOffset, zOffset));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean addDestinationViaActual(int red, int green, int blue, int intensity, int x, int y, int z)
|
||||
{
|
||||
return this.addDestinationViaOffset(red, green, blue, intensity, x - this.xCoord, y - this.yCoord, z - this.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeClientNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 90210, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
super.onDataPacket(net, packet);
|
||||
readClientNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
public boolean addReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
int totalConnections = 0;
|
||||
|
||||
for(Entry<Reagent, List<Int3>> entry : this.reagentTargetList.entrySet())
|
||||
{
|
||||
if(entry.getValue() != null)
|
||||
{
|
||||
totalConnections += entry.getValue().size();
|
||||
}
|
||||
}
|
||||
|
||||
if(totalConnections >= this.maxConnextions)
|
||||
{
|
||||
//Send message that it cannot be done? Maybe add a Player instance
|
||||
return false;
|
||||
}
|
||||
|
||||
if(xOffset == 0 && yOffset == 0 && zOffset == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Int3 newCoord = new Int3(xOffset, yOffset, zOffset);
|
||||
|
||||
if(this.reagentTargetList.containsKey(reagent))
|
||||
{
|
||||
List<Int3> coordList = this.reagentTargetList.get(reagent);
|
||||
if(coordList == null)
|
||||
{
|
||||
List<Int3> newCoordList = new LinkedList();
|
||||
newCoordList.add(newCoord);
|
||||
this.reagentTargetList.put(reagent, newCoordList);
|
||||
}else
|
||||
{
|
||||
coordList.add(newCoord);
|
||||
}
|
||||
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
List<Int3> newCoordList = new LinkedList();
|
||||
newCoordList.add(newCoord);
|
||||
this.reagentTargetList.put(reagent, newCoordList);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addReagentDestinationViaActual(Reagent reagent, int x, int y, int z)
|
||||
{
|
||||
return (this.addReagentDestinationViaOffset(reagent, x-xCoord, y-yCoord, z-zCoord));
|
||||
}
|
||||
|
||||
public boolean removeReagentDestinationViaOffset(Reagent reagent, int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
if(this.reagentTargetList.containsKey(reagent))
|
||||
{
|
||||
List<Int3> coords = this.reagentTargetList.get(reagent);
|
||||
if(coords != null)
|
||||
{
|
||||
Int3 reference = new Int3(xOffset, yOffset, zOffset);
|
||||
|
||||
return coords.remove(reference);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeReagentDestinationViaActual(Reagent reagent, int x, int y, int z)
|
||||
{
|
||||
return this.removeReagentDestinationViaOffset(reagent, x-xCoord, y-yCoord, z-zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if(doFill && !worldObj.isRemote)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
hasChanged = 2;
|
||||
}
|
||||
|
||||
return super.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if(doDrain && !worldObj.isRemote)
|
||||
{
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
hasChanged = 2;
|
||||
}
|
||||
|
||||
return super.drain(from, resource, doDrain);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue