Attempt to fix repository
This commit is contained in:
parent
e242207d50
commit
1aac4686db
932 changed files with 39272 additions and 11544 deletions
|
@ -7,6 +7,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.achievements.ModAchievements;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -22,26 +24,20 @@ import net.minecraft.potion.Potion;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
|
||||
import net.minecraftforge.event.entity.player.EntityInteractEvent;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
|
@ -49,7 +45,7 @@ import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
|
|||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.items.BoundBlade;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergySword;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
|
||||
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
|
||||
|
@ -57,14 +53,21 @@ import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry;
|
|||
import WayofTime.alchemicalWizardry.common.omega.ReagentRegenConfiguration;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class AlchemicalWizardryEventHooks
|
||||
{
|
||||
public static Map<String, Boolean> playerFlightBuff = new HashMap<String, Boolean>();
|
||||
public static List<String> playersWith1Step = new ArrayList<String>();
|
||||
public static Map<String, Boolean> playerFlightBuff = new HashMap();
|
||||
public static List<String> playersWith1Step = new ArrayList();
|
||||
|
||||
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap<Integer, List<CoordAndRange>>();
|
||||
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap<Integer, List<CoordAndRange>>();
|
||||
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
|
||||
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
|
||||
|
||||
public static Random rand = new Random();
|
||||
|
||||
|
@ -83,7 +86,7 @@ public class AlchemicalWizardryEventHooks
|
|||
parad.onEmptyHandEntityInteract(player, event.target);
|
||||
}else
|
||||
{
|
||||
if(heldItem.getItem() instanceof BoundBlade)
|
||||
if(heldItem.getItem() instanceof EnergySword)
|
||||
{
|
||||
parad.onBoundSwordInteractWithEntity(player, event.target);
|
||||
}
|
||||
|
@ -114,7 +117,7 @@ public class AlchemicalWizardryEventHooks
|
|||
float prevHp = APISpellHelper.getCurrentAdditionalHP((EntityPlayer)event.entityLiving);
|
||||
if(prevHp > 0)
|
||||
{
|
||||
float recalculatedAmount = ArmorProperties.applyArmor(player, player.inventory.armorInventory, event.source, event.ammount);
|
||||
float recalculatedAmount = ArmorProperties.ApplyArmor(player, player.inventory.armorInventory, event.source, event.ammount);
|
||||
if (recalculatedAmount <= 0) return;
|
||||
recalculatedAmount = SpellHelper.applyPotionDamageCalculations(player, event.source, recalculatedAmount); //Recalculated damage
|
||||
|
||||
|
@ -332,7 +335,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
String respawnRitual = "AW028SpawnWard";
|
||||
|
||||
int dimension = event.world.provider.getDimensionId();
|
||||
int dimension = event.world.provider.dimensionId;
|
||||
if (respawnMap.containsKey(dimension))
|
||||
{
|
||||
List<CoordAndRange> list = respawnMap.get(dimension);
|
||||
|
@ -341,7 +344,7 @@ public class AlchemicalWizardryEventHooks
|
|||
{
|
||||
for (CoordAndRange coords : list)
|
||||
{
|
||||
TileEntity tile = event.world.getTileEntity(coords.getPos());
|
||||
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
|
||||
if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual))
|
||||
{
|
||||
|
@ -385,7 +388,7 @@ public class AlchemicalWizardryEventHooks
|
|||
{
|
||||
for (CoordAndRange coords : list)
|
||||
{
|
||||
TileEntity tile = event.world.getTileEntity(coords.getPos());
|
||||
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
|
||||
if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual))
|
||||
{
|
||||
|
@ -505,10 +508,10 @@ public class AlchemicalWizardryEventHooks
|
|||
double y = entityLiving.posY;
|
||||
double z = entityLiving.posZ;
|
||||
|
||||
BlockPos blockVector = entityLiving.getPosition();
|
||||
int xPos = blockVector.getX();
|
||||
int yPos = blockVector.getY();
|
||||
int zPos = blockVector.getZ();
|
||||
Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving);
|
||||
int xPos = (int) (blockVector.xCoord);
|
||||
int yPos = (int) (blockVector.yCoord);
|
||||
int zPos = (int) (blockVector.zCoord);
|
||||
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
|
@ -589,7 +592,7 @@ public class AlchemicalWizardryEventHooks
|
|||
int posY = (int) Math.round(entity.posY);
|
||||
int posZ = (int) Math.round(entity.posZ - 0.5f);
|
||||
int d0 = (int) ((i + 1) * 2.5);
|
||||
AxisAlignedBB axisalignedbb = new AxisAlignedBB(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0);
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0);
|
||||
List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
|
@ -694,7 +697,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle(EnumParticleTypes.FLAME, x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier();
|
||||
double range = i * 0.5;
|
||||
|
@ -715,7 +718,7 @@ public class AlchemicalWizardryEventHooks
|
|||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak))
|
||||
{
|
||||
if (entityLiving.worldObj.getWorldTime() % 2 == 0)
|
||||
entityLiving.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0x74, 0xbb, 0xfb);
|
||||
entityLiving.worldObj.spawnParticle("reddust", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0x74, 0xbb, 0xfb);
|
||||
|
||||
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak).getAmplifier();
|
||||
int horizRange = r + 1;
|
||||
|
@ -729,7 +732,7 @@ public class AlchemicalWizardryEventHooks
|
|||
{
|
||||
for (int j = -vertRange - 1; j <= vertRange - 1; j++)
|
||||
{
|
||||
SpellHelper.freezeWaterBlock(entityLiving.worldObj, new BlockPos(xPos + i, yPos + j, zPos + k));
|
||||
SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos + i, yPos + j, zPos + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -738,7 +741,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle(EnumParticleTypes.FLAME, x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart).getAmplifier();
|
||||
double decrease = 0.025 * (i + 1);
|
||||
|
@ -756,7 +759,7 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle(EnumParticleTypes.FLAME, x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getAmplifier();
|
||||
int radius = r + 1;
|
||||
|
@ -788,7 +791,7 @@ public class AlchemicalWizardryEventHooks
|
|||
meta = 0;
|
||||
|
||||
if (block != null)
|
||||
if ((block == event.initialBlock || block == event.finalBlock) && (meta == event.initialBlock.getMetaFromState(event.initialState) || meta == event.finalBlock.getMetaFromState(event.finalState) || meta == OreDictionary.WILDCARD_VALUE))
|
||||
if (( block == event.initialBlock || block == event.finalBlock) && (meta == event.initialMetadata || meta == event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE))
|
||||
event.setCanceled(true);
|
||||
|
||||
// If the block uses shorthand syntax: modid:blockname
|
||||
|
@ -798,12 +801,31 @@ public class AlchemicalWizardryEventHooks
|
|||
int meta = 0;
|
||||
|
||||
if (block != null)
|
||||
if (( block == event.initialBlock || block == event.finalBlock) && (meta == event.initialBlock.getMetaFromState(event.initialState) || meta == event.finalBlock.getMetaFromState(event.finalState) || meta == OreDictionary.WILDCARD_VALUE))
|
||||
if (( block == event.initialBlock || block == event.finalBlock) && (meta == event.initialMetadata || meta == event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDeath(LivingDeathEvent event)
|
||||
{
|
||||
EntityLivingBase entityLiving = event.entityLiving;
|
||||
|
||||
if (entityLiving instanceof IDemon && event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
player.addStat(ModAchievements.demonSpawn, 1);
|
||||
}
|
||||
if (entityLiving instanceof IHoardDemon && event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
player.addStat(ModAchievements.demons, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||
if (event.modID.equals("AWWayofTime")) {
|
||||
|
@ -815,11 +837,11 @@ public class AlchemicalWizardryEventHooks
|
|||
@Optional.Method(modid = "Botania")
|
||||
private boolean isManaBurst(Entity entity)
|
||||
{
|
||||
// if(entity instanceof IManaBurst) {
|
||||
// ItemStack lens = ((IManaBurst)entity).getSourceLens();
|
||||
// return !(lens.getItemDamage()!=8 && lens.getItemDamage()!=11);
|
||||
// }
|
||||
// else
|
||||
if(entity instanceof IManaBurst) {
|
||||
ItemStack lens = ((IManaBurst)entity).getSourceLens();
|
||||
return !(lens.getItemDamage()!=8 && lens.getItemDamage()!=11);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -7,10 +11,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class AlchemicalWizardryFuelHandler implements IFuelHandler
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class ClientToServerPacketHandler
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.spell.EntitySpellProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.BookEntityItem;
|
||||
|
@ -21,6 +20,10 @@ import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile;
|
|||
import WayofTime.alchemicalWizardry.common.entity.projectile.TeleportProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.WaterProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class CommonProxy
|
||||
{
|
||||
|
@ -30,16 +33,38 @@ public class CommonProxy
|
|||
// Nothing here as the server doesn't render graphics!
|
||||
}
|
||||
|
||||
public void registerPostSideObjects() {}
|
||||
public void registerPostSideObjects()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void registerEntities() {}
|
||||
public void registerEntities()
|
||||
{
|
||||
}
|
||||
|
||||
public World getClientWorld()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void registerEvents() {}
|
||||
public void registerActions()
|
||||
{
|
||||
}
|
||||
|
||||
public void registerEvents()
|
||||
{
|
||||
}
|
||||
|
||||
public void registerSoundHandler()
|
||||
{
|
||||
// Nothing here as this is a server side proxy
|
||||
}
|
||||
|
||||
public void registerTileEntities()
|
||||
{
|
||||
GameRegistry.registerTileEntity(TEAltar.class, "containerAltar");
|
||||
GameRegistry.registerTileEntity(TEMasterStone.class, "containerMasterStone");
|
||||
}
|
||||
|
||||
public void registerEntityTrackers()
|
||||
{
|
||||
|
@ -63,5 +88,12 @@ public class CommonProxy
|
|||
EntityRegistry.registerModEntity(BookEntityItem.class, "bookEntityItem", 17, AlchemicalWizardry.instance, 120, 3, true);
|
||||
}
|
||||
|
||||
public void initRendering() {}
|
||||
public void registerTickHandlers()
|
||||
{
|
||||
}
|
||||
|
||||
public void InitRendering()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public class CoordAndRange
|
||||
{
|
||||
public int xCoord;
|
||||
|
@ -10,11 +8,6 @@ public class CoordAndRange
|
|||
public int horizRadius;
|
||||
public int vertRadius;
|
||||
|
||||
public CoordAndRange(BlockPos pos, int horiz, int vert)
|
||||
{
|
||||
this(pos.getX(), pos.getY(), pos.getZ(), horiz, vert);
|
||||
}
|
||||
|
||||
public CoordAndRange(int x, int y, int z, int horiz, int vert)
|
||||
{
|
||||
this.xCoord = x;
|
||||
|
@ -23,11 +16,6 @@ public class CoordAndRange
|
|||
this.horizRadius = horiz;
|
||||
this.vertRadius = vert;
|
||||
}
|
||||
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return new BlockPos(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
|
|
|
@ -9,7 +9,7 @@ public class EntityAITargetAggro extends EntityAINearestAttackableTarget
|
|||
|
||||
public EntityAITargetAggro(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4)
|
||||
{
|
||||
super(par1EntityDemon, par2Class, par4);
|
||||
super(par1EntityDemon, par2Class, par3, par4);
|
||||
this.theCreature = par1EntityDemon;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ItemType
|
|||
public ItemStack createStack(int count)
|
||||
{
|
||||
ItemStack result = new ItemStack(item, count, meta);
|
||||
result.setTagCompound(nbtTag);
|
||||
result.stackTagCompound = nbtTag;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class ItemType
|
|||
|
||||
public static ItemType fromStack(ItemStack stack)
|
||||
{
|
||||
return new ItemType(stack.getItem(), stack.getItemDamage(), stack.getTagCompound());
|
||||
return new ItemType(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
|
||||
public class LifeBucketHandler
|
||||
{
|
||||
|
@ -29,12 +28,11 @@ public class LifeBucketHandler
|
|||
|
||||
public ItemStack fillCustomBucket(World world, MovingObjectPosition pos)
|
||||
{
|
||||
IBlockState state = world.getBlockState(pos.func_178782_a());
|
||||
Block block = state.getBlock();
|
||||
Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
|
||||
if (block != null && (block.equals(ModBlocks.blockLifeEssence)) && block.getMetaFromState(state) == 0)
|
||||
if (block != null && (block.equals(ModBlocks.blockLifeEssence)) && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0)
|
||||
{
|
||||
world.setBlockToAir(pos.func_178782_a());
|
||||
world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
|
||||
return new ItemStack(ModItems.bucketLife);
|
||||
} else
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class LifeEssence extends Fluid
|
||||
{
|
||||
|
@ -18,7 +19,7 @@ public class LifeEssence extends Fluid
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedName()
|
||||
public String getLocalizedName(FluidStack fluidStack)
|
||||
{
|
||||
return "Life Essence";
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@ package WayofTime.alchemicalWizardry.common;
|
|||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public class MessageKeyPressed implements IMessage, IMessageHandler<MessageKeyPressed, IMessage>
|
||||
{
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
|
||||
public class ModLivingDropsEvent
|
||||
{
|
||||
|
|
|
@ -13,19 +13,9 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.network.FMLEmbeddedChannel;
|
||||
import net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
import net.minecraftforge.fml.common.network.FMLOutboundHandler;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
|
@ -39,7 +29,14 @@ 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.TEChemistrySet;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum NewPacketHandler
|
||||
{
|
||||
|
@ -98,7 +95,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEAltarMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEAltar)
|
||||
{
|
||||
TEAltar altar = (TEAltar) te;
|
||||
|
@ -114,11 +111,11 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEOrientableMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEOrientable)
|
||||
{
|
||||
((TEOrientable) te).setInputDirection(EnumFacing.getFront(msg.input));
|
||||
((TEOrientable) te).setOutputDirection(EnumFacing.getFront(msg.output));
|
||||
((TEOrientable) te).setInputDirection(ForgeDirection.getOrientation(msg.input));
|
||||
((TEOrientable) te).setOutputDirection(ForgeDirection.getOrientation(msg.output));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +126,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEPedestalMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEPedestal)
|
||||
{
|
||||
TEPedestal pedestal = (TEPedestal) te;
|
||||
|
@ -145,7 +142,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEPlinthMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEPlinth)
|
||||
{
|
||||
TEPlinth Plinth = (TEPlinth) te;
|
||||
|
@ -161,7 +158,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TESocketMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TESocket)
|
||||
{
|
||||
TESocket Socket = (TESocket) te;
|
||||
|
@ -177,7 +174,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TETeleposerMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TETeleposer)
|
||||
{
|
||||
TETeleposer Teleposer = (TETeleposer) te;
|
||||
|
@ -193,10 +190,10 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEWritingTableMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
if (te instanceof TEChemistrySet)
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEWritingTable)
|
||||
{
|
||||
TEChemistrySet WritingTable = (TEChemistrySet) te;
|
||||
TEWritingTable WritingTable = (TEWritingTable) te;
|
||||
|
||||
WritingTable.handlePacketData(msg.items);
|
||||
}
|
||||
|
@ -210,7 +207,7 @@ public enum NewPacketHandler
|
|||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
|
||||
world.spawnParticle(EnumParticleTypes.func_179342_a(msg.particle), msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel);
|
||||
world.spawnParticle(msg.particle, msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +233,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEMasterStoneMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEMasterStone)
|
||||
{
|
||||
TEMasterStone masterStone = (TEMasterStone) te;
|
||||
|
@ -253,7 +250,7 @@ public enum NewPacketHandler
|
|||
protected void channelRead0(ChannelHandlerContext ctx, TEReagentConduitMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.pos);
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEReagentConduit)
|
||||
{
|
||||
TEReagentConduit reagentConduit = (TEReagentConduit) te;
|
||||
|
@ -321,7 +318,9 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEAltarMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
int[] fluids;
|
||||
|
@ -330,7 +329,9 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEOrientableMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int input;
|
||||
int output;
|
||||
|
@ -338,42 +339,52 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEPedestalMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TEPlinthMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TESocketMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TETeleposerMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TEWritingTableMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class ParticleMessage extends BMMessage
|
||||
{
|
||||
int particle;
|
||||
String particle;
|
||||
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
|
@ -393,7 +404,9 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEMasterStoneMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
String ritual;
|
||||
boolean isRunning;
|
||||
|
@ -401,7 +414,9 @@ public enum NewPacketHandler
|
|||
|
||||
public static class TEReagentConduitMessage extends BMMessage
|
||||
{
|
||||
BlockPos pos;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
List<ColourAndCoords> destinationList;
|
||||
}
|
||||
|
@ -486,209 +501,231 @@ public enum NewPacketHandler
|
|||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception
|
||||
{
|
||||
PacketBuffer newBuffer = new PacketBuffer(target);
|
||||
newBuffer.writeInt(msg.index);
|
||||
target.writeInt(msg.index);
|
||||
|
||||
switch (msg.index)
|
||||
{
|
||||
case 0:
|
||||
newBuffer.writeBlockPos(((TEAltarMessage) msg).pos);
|
||||
target.writeInt(((TEAltarMessage) msg).x);
|
||||
target.writeInt(((TEAltarMessage) msg).y);
|
||||
target.writeInt(((TEAltarMessage) msg).z);
|
||||
|
||||
newBuffer.writeBoolean(((TEAltarMessage) msg).items != null);
|
||||
target.writeBoolean(((TEAltarMessage) msg).items != null);
|
||||
if (((TEAltarMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEAltarMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
newBuffer.writeInt(i);
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
newBuffer.writeBoolean(((TEAltarMessage) msg).fluids != null);
|
||||
target.writeBoolean(((TEAltarMessage) msg).fluids != null);
|
||||
if (((TEAltarMessage) msg).fluids != null)
|
||||
{
|
||||
int[] fluids = ((TEAltarMessage) msg).fluids;
|
||||
for (int j = 0; j < fluids.length; j++)
|
||||
{
|
||||
int i = fluids[j];
|
||||
newBuffer.writeInt(i);
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
newBuffer.writeInt(((TEAltarMessage) msg).capacity);
|
||||
target.writeInt(((TEAltarMessage) msg).capacity);
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
newBuffer.writeBlockPos(((TEOrientableMessage) msg).pos);
|
||||
target.writeInt(((TEOrientableMessage) msg).x);
|
||||
target.writeInt(((TEOrientableMessage) msg).y);
|
||||
target.writeInt(((TEOrientableMessage) msg).z);
|
||||
|
||||
newBuffer.writeInt(((TEOrientableMessage) msg).input);
|
||||
newBuffer.writeInt(((TEOrientableMessage) msg).output);
|
||||
target.writeInt(((TEOrientableMessage) msg).input);
|
||||
target.writeInt(((TEOrientableMessage) msg).output);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
newBuffer.writeBlockPos(((TEPedestalMessage) msg).pos);
|
||||
target.writeInt(((TEPedestalMessage) msg).x);
|
||||
target.writeInt(((TEPedestalMessage) msg).y);
|
||||
target.writeInt(((TEPedestalMessage) msg).z);
|
||||
|
||||
newBuffer.writeBoolean(((TEPedestalMessage) msg).items != null);
|
||||
target.writeBoolean(((TEPedestalMessage) msg).items != null);
|
||||
if (((TEPedestalMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEPedestalMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
newBuffer.writeInt(i);
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
newBuffer.writeBlockPos(((TEPlinthMessage) msg).pos);
|
||||
target.writeInt(((TEPlinthMessage) msg).x);
|
||||
target.writeInt(((TEPlinthMessage) msg).y);
|
||||
target.writeInt(((TEPlinthMessage) msg).z);
|
||||
|
||||
newBuffer.writeBoolean(((TEPlinthMessage) msg).items != null);
|
||||
target.writeBoolean(((TEPlinthMessage) msg).items != null);
|
||||
if (((TEPlinthMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEPlinthMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
newBuffer.writeInt(i);
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
newBuffer.writeBlockPos(((TESocketMessage) msg).pos);
|
||||
target.writeInt(((TESocketMessage) msg).x);
|
||||
target.writeInt(((TESocketMessage) msg).y);
|
||||
target.writeInt(((TESocketMessage) msg).z);
|
||||
|
||||
newBuffer.writeBoolean(((TESocketMessage) msg).items != null);
|
||||
target.writeBoolean(((TESocketMessage) msg).items != null);
|
||||
if (((TESocketMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TESocketMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
newBuffer.writeInt(i);
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
newBuffer.writeBlockPos(((TETeleposerMessage) msg).pos);
|
||||
target.writeInt(((TETeleposerMessage) msg).x);
|
||||
target.writeInt(((TETeleposerMessage) msg).y);
|
||||
target.writeInt(((TETeleposerMessage) msg).z);
|
||||
|
||||
newBuffer.writeBoolean(((TETeleposerMessage) msg).items != null);
|
||||
target.writeBoolean(((TETeleposerMessage) msg).items != null);
|
||||
if (((TETeleposerMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TETeleposerMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
newBuffer.writeInt(i);
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
newBuffer.writeBlockPos(((TEWritingTableMessage) msg).pos);
|
||||
target.writeInt(((TEWritingTableMessage) msg).x);
|
||||
target.writeInt(((TEWritingTableMessage) msg).y);
|
||||
target.writeInt(((TEWritingTableMessage) msg).z);
|
||||
|
||||
newBuffer.writeBoolean(((TEWritingTableMessage) msg).items != null);
|
||||
target.writeBoolean(((TEWritingTableMessage) msg).items != null);
|
||||
if (((TEWritingTableMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEWritingTableMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
newBuffer.writeInt(i);
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
newBuffer.writeInt(((ParticleMessage) msg).particle);
|
||||
String str = ((ParticleMessage) msg).particle;
|
||||
target.writeInt(str.length());
|
||||
for (int i = 0; i < str.length(); i++)
|
||||
{
|
||||
target.writeChar(str.charAt(i));
|
||||
}
|
||||
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).xCoord);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).yCoord);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).zCoord);
|
||||
target.writeDouble(((ParticleMessage) msg).xCoord);
|
||||
target.writeDouble(((ParticleMessage) msg).yCoord);
|
||||
target.writeDouble(((ParticleMessage) msg).zCoord);
|
||||
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).xVel);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).yVel);
|
||||
newBuffer.writeDouble(((ParticleMessage) msg).zVel);
|
||||
target.writeDouble(((ParticleMessage) msg).xVel);
|
||||
target.writeDouble(((ParticleMessage) msg).yVel);
|
||||
target.writeDouble(((ParticleMessage) msg).zVel);
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
newBuffer.writeDouble(((VelocityMessage) msg).xVel);
|
||||
newBuffer.writeDouble(((VelocityMessage) msg).yVel);
|
||||
newBuffer.writeDouble(((VelocityMessage) msg).zVel);
|
||||
target.writeDouble(((VelocityMessage) msg).xVel);
|
||||
target.writeDouble(((VelocityMessage) msg).yVel);
|
||||
target.writeDouble(((VelocityMessage) msg).zVel);
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
newBuffer.writeBlockPos(((TEMasterStoneMessage) msg).pos);
|
||||
target.writeInt(((TEMasterStoneMessage) msg).x);
|
||||
target.writeInt(((TEMasterStoneMessage) msg).y);
|
||||
target.writeInt(((TEMasterStoneMessage) msg).z);
|
||||
|
||||
String ritual = ((TEMasterStoneMessage) msg).ritual;
|
||||
newBuffer.writeInt(ritual.length());
|
||||
target.writeInt(ritual.length());
|
||||
for (int i = 0; i < ritual.length(); i++)
|
||||
{
|
||||
newBuffer.writeChar(ritual.charAt(i));
|
||||
target.writeChar(ritual.charAt(i));
|
||||
}
|
||||
|
||||
newBuffer.writeBoolean(((TEMasterStoneMessage) msg).isRunning);
|
||||
target.writeBoolean(((TEMasterStoneMessage) msg).isRunning);
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
newBuffer.writeBlockPos(((TEReagentConduitMessage) msg).pos);
|
||||
target.writeInt(((TEReagentConduitMessage) msg).x);
|
||||
target.writeInt(((TEReagentConduitMessage) msg).y);
|
||||
target.writeInt(((TEReagentConduitMessage) msg).z);
|
||||
|
||||
List<ColourAndCoords> list = ((TEReagentConduitMessage) msg).destinationList;
|
||||
newBuffer.writeInt(list.size());
|
||||
target.writeInt(list.size());
|
||||
|
||||
for (ColourAndCoords colourSet : list)
|
||||
{
|
||||
newBuffer.writeInt(colourSet.colourRed);
|
||||
newBuffer.writeInt(colourSet.colourGreen);
|
||||
newBuffer.writeInt(colourSet.colourBlue);
|
||||
newBuffer.writeInt(colourSet.colourIntensity);
|
||||
newBuffer.writeInt(colourSet.xCoord);
|
||||
newBuffer.writeInt(colourSet.yCoord);
|
||||
newBuffer.writeInt(colourSet.zCoord);
|
||||
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;
|
||||
|
||||
case 11:
|
||||
newBuffer.writeInt(((CurrentLPMessage) msg).currentLP);
|
||||
newBuffer.writeInt(((CurrentLPMessage) msg).maxLP);
|
||||
target.writeInt(((CurrentLPMessage) msg).currentLP);
|
||||
target.writeInt(((CurrentLPMessage) msg).maxLP);
|
||||
|
||||
break;
|
||||
|
||||
case 12:
|
||||
char[] charSet = ((CurrentReagentBarMessage)msg).reagent.toCharArray();
|
||||
newBuffer.writeInt(charSet.length);
|
||||
target.writeInt(charSet.length);
|
||||
for(char cha : charSet)
|
||||
{
|
||||
newBuffer.writeChar(cha);
|
||||
target.writeChar(cha);
|
||||
}
|
||||
newBuffer.writeFloat(((CurrentReagentBarMessage)msg).currentAR);
|
||||
newBuffer.writeFloat(((CurrentReagentBarMessage)msg).maxAR);
|
||||
target.writeFloat(((CurrentReagentBarMessage)msg).currentAR);
|
||||
target.writeFloat(((CurrentReagentBarMessage)msg).maxAR);
|
||||
|
||||
break;
|
||||
|
||||
case 13:
|
||||
newBuffer.writeFloat(((CurrentAddedHPMessage) msg).currentHP);
|
||||
newBuffer.writeFloat(((CurrentAddedHPMessage) msg).maxHP);
|
||||
target.writeFloat(((CurrentAddedHPMessage) msg).currentHP);
|
||||
target.writeFloat(((CurrentAddedHPMessage) msg).maxHP);
|
||||
|
||||
break;
|
||||
|
||||
case 14:
|
||||
System.out.println("Packet is being encoded");
|
||||
|
||||
newBuffer.writeByte(((KeyboardMessage)msg).keyPressed);
|
||||
target.writeByte(((KeyboardMessage)msg).keyPressed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -697,14 +734,15 @@ public enum NewPacketHandler
|
|||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BMMessage msg)
|
||||
{
|
||||
PacketBuffer newBuffer = new PacketBuffer(dat);
|
||||
int index = newBuffer.readInt();
|
||||
int index = dat.readInt();
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
((TEAltarMessage) msg).pos = newBuffer.readBlockPos();
|
||||
boolean hasStacks = newBuffer.readBoolean();
|
||||
((TEAltarMessage) msg).x = dat.readInt();
|
||||
((TEAltarMessage) msg).y = dat.readInt();
|
||||
((TEAltarMessage) msg).z = dat.readInt();
|
||||
boolean hasStacks = dat.readBoolean();
|
||||
|
||||
((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3];
|
||||
if (hasStacks)
|
||||
|
@ -712,34 +750,38 @@ public enum NewPacketHandler
|
|||
((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEAltarMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEAltarMessage) msg).items[i] = newBuffer.readInt();
|
||||
((TEAltarMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasFluids = newBuffer.readBoolean();
|
||||
boolean hasFluids = dat.readBoolean();
|
||||
((TEAltarMessage) msg).fluids = new int[6];
|
||||
if (hasFluids)
|
||||
for (int i = 0; i < ((TEAltarMessage) msg).fluids.length; i++)
|
||||
{
|
||||
((TEAltarMessage) msg).fluids[i] = newBuffer.readInt();
|
||||
((TEAltarMessage) msg).fluids[i] = dat.readInt();
|
||||
}
|
||||
|
||||
((TEAltarMessage) msg).capacity = newBuffer.readInt();
|
||||
((TEAltarMessage) msg).capacity = dat.readInt();
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
((TEOrientableMessage) msg).pos = newBuffer.readBlockPos();
|
||||
((TEOrientableMessage) msg).x = dat.readInt();
|
||||
((TEOrientableMessage) msg).y = dat.readInt();
|
||||
((TEOrientableMessage) msg).z = dat.readInt();
|
||||
|
||||
((TEOrientableMessage) msg).input = newBuffer.readInt();
|
||||
((TEOrientableMessage) msg).output = newBuffer.readInt();
|
||||
((TEOrientableMessage) msg).input = dat.readInt();
|
||||
((TEOrientableMessage) msg).output = dat.readInt();
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
((TEPedestalMessage) msg).pos = newBuffer.readBlockPos();
|
||||
((TEPedestalMessage) msg).x = dat.readInt();
|
||||
((TEPedestalMessage) msg).y = dat.readInt();
|
||||
((TEPedestalMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks1 = newBuffer.readBoolean();
|
||||
boolean hasStacks1 = dat.readBoolean();
|
||||
|
||||
((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3];
|
||||
if (hasStacks1)
|
||||
|
@ -747,16 +789,18 @@ public enum NewPacketHandler
|
|||
((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEPedestalMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEPedestalMessage) msg).items[i] = newBuffer.readInt();
|
||||
((TEPedestalMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
((TEPlinthMessage) msg).pos = newBuffer.readBlockPos();
|
||||
((TEPlinthMessage) msg).x = dat.readInt();
|
||||
((TEPlinthMessage) msg).y = dat.readInt();
|
||||
((TEPlinthMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks2 = newBuffer.readBoolean();
|
||||
boolean hasStacks2 = dat.readBoolean();
|
||||
|
||||
((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3];
|
||||
if (hasStacks2)
|
||||
|
@ -764,16 +808,18 @@ public enum NewPacketHandler
|
|||
((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEPlinthMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEPlinthMessage) msg).items[i] = newBuffer.readInt();
|
||||
((TEPlinthMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
((TESocketMessage) msg).pos = newBuffer.readBlockPos();
|
||||
((TESocketMessage) msg).x = dat.readInt();
|
||||
((TESocketMessage) msg).y = dat.readInt();
|
||||
((TESocketMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks3 = newBuffer.readBoolean();
|
||||
boolean hasStacks3 = dat.readBoolean();
|
||||
|
||||
((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3];
|
||||
if (hasStacks3)
|
||||
|
@ -781,16 +827,18 @@ public enum NewPacketHandler
|
|||
((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3];
|
||||
for (int i = 0; i < ((TESocketMessage) msg).items.length; i++)
|
||||
{
|
||||
((TESocketMessage) msg).items[i] = newBuffer.readInt();
|
||||
((TESocketMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
((TETeleposerMessage) msg).pos = newBuffer.readBlockPos();
|
||||
((TETeleposerMessage) msg).x = dat.readInt();
|
||||
((TETeleposerMessage) msg).y = dat.readInt();
|
||||
((TETeleposerMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks4 = newBuffer.readBoolean();
|
||||
boolean hasStacks4 = dat.readBoolean();
|
||||
|
||||
((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3];
|
||||
if (hasStacks4)
|
||||
|
@ -798,75 +846,89 @@ public enum NewPacketHandler
|
|||
((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3];
|
||||
for (int i = 0; i < ((TETeleposerMessage) msg).items.length; i++)
|
||||
{
|
||||
((TETeleposerMessage) msg).items[i] = newBuffer.readInt();
|
||||
((TETeleposerMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
((TEWritingTableMessage) msg).pos = newBuffer.readBlockPos();
|
||||
((TEWritingTableMessage) msg).x = dat.readInt();
|
||||
((TEWritingTableMessage) msg).y = dat.readInt();
|
||||
((TEWritingTableMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks5 = newBuffer.readBoolean();
|
||||
boolean hasStacks5 = dat.readBoolean();
|
||||
|
||||
((TEWritingTableMessage) msg).items = new int[TEChemistrySet.sizeInv * 3];
|
||||
((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3];
|
||||
if (hasStacks5)
|
||||
{
|
||||
((TEWritingTableMessage) msg).items = new int[TEChemistrySet.sizeInv * 3];
|
||||
((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEWritingTableMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEWritingTableMessage) msg).items[i] = newBuffer.readInt();
|
||||
((TEWritingTableMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
((ParticleMessage) msg).particle = newBuffer.readInt();
|
||||
int size = dat.readInt();
|
||||
String str = "";
|
||||
|
||||
((ParticleMessage) msg).xCoord = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).yCoord = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).zCoord = newBuffer.readDouble();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
str = str + dat.readChar();
|
||||
}
|
||||
|
||||
((ParticleMessage) msg).xVel = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).yVel = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).zVel = newBuffer.readDouble();
|
||||
((ParticleMessage) msg).particle = str;
|
||||
|
||||
((ParticleMessage) msg).xCoord = dat.readDouble();
|
||||
((ParticleMessage) msg).yCoord = dat.readDouble();
|
||||
((ParticleMessage) msg).zCoord = dat.readDouble();
|
||||
|
||||
((ParticleMessage) msg).xVel = dat.readDouble();
|
||||
((ParticleMessage) msg).yVel = dat.readDouble();
|
||||
((ParticleMessage) msg).zVel = dat.readDouble();
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
((VelocityMessage) msg).xVel = newBuffer.readDouble();
|
||||
((VelocityMessage) msg).yVel = newBuffer.readDouble();
|
||||
((VelocityMessage) msg).zVel = newBuffer.readDouble();
|
||||
((VelocityMessage) msg).xVel = dat.readDouble();
|
||||
((VelocityMessage) msg).yVel = dat.readDouble();
|
||||
((VelocityMessage) msg).zVel = dat.readDouble();
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
((TEMasterStoneMessage) msg).pos = newBuffer.readBlockPos();
|
||||
((TEMasterStoneMessage) msg).x = dat.readInt();
|
||||
((TEMasterStoneMessage) msg).y = dat.readInt();
|
||||
((TEMasterStoneMessage) msg).z = dat.readInt();
|
||||
|
||||
int ritualStrSize = newBuffer.readInt();
|
||||
int ritualStrSize = dat.readInt();
|
||||
String ritual = "";
|
||||
|
||||
for (int i = 0; i < ritualStrSize; i++)
|
||||
{
|
||||
ritual = ritual + newBuffer.readChar();
|
||||
ritual = ritual + dat.readChar();
|
||||
}
|
||||
|
||||
((TEMasterStoneMessage) msg).ritual = ritual;
|
||||
((TEMasterStoneMessage) msg).isRunning = newBuffer.readBoolean();
|
||||
((TEMasterStoneMessage) msg).isRunning = dat.readBoolean();
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
((TEReagentConduitMessage) msg).pos = newBuffer.readBlockPos();
|
||||
|
||||
int listSize = newBuffer.readInt();
|
||||
((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(newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt(), newBuffer.readInt()));
|
||||
list.add(new ColourAndCoords(dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt()));
|
||||
}
|
||||
|
||||
((TEReagentConduitMessage) msg).destinationList = list;
|
||||
|
@ -874,34 +936,34 @@ public enum NewPacketHandler
|
|||
break;
|
||||
|
||||
case 11:
|
||||
((CurrentLPMessage) msg).currentLP = newBuffer.readInt();
|
||||
((CurrentLPMessage) msg).maxLP = newBuffer.readInt();
|
||||
((CurrentLPMessage) msg).currentLP = dat.readInt();
|
||||
((CurrentLPMessage) msg).maxLP = dat.readInt();
|
||||
|
||||
break;
|
||||
|
||||
case 12:
|
||||
int size1 = newBuffer.readInt();
|
||||
int size1 = dat.readInt();
|
||||
String str1 = "";
|
||||
for(int i=0; i<size1; i++)
|
||||
{
|
||||
str1 = str1 + newBuffer.readChar();
|
||||
str1 = str1 + dat.readChar();
|
||||
}
|
||||
|
||||
((CurrentReagentBarMessage) msg).reagent = str1;
|
||||
((CurrentReagentBarMessage) msg).currentAR = newBuffer.readFloat();
|
||||
((CurrentReagentBarMessage) msg).maxAR = newBuffer.readFloat();
|
||||
((CurrentReagentBarMessage) msg).currentAR = dat.readFloat();
|
||||
((CurrentReagentBarMessage) msg).maxAR = dat.readFloat();
|
||||
|
||||
break;
|
||||
|
||||
case 13:
|
||||
((CurrentAddedHPMessage) msg).currentHP = newBuffer.readFloat();
|
||||
((CurrentAddedHPMessage) msg).maxHP = newBuffer.readFloat();
|
||||
((CurrentAddedHPMessage) msg).currentHP = dat.readFloat();
|
||||
((CurrentAddedHPMessage) msg).maxHP = dat.readFloat();
|
||||
|
||||
break;
|
||||
|
||||
case 14:
|
||||
System.out.println("Packet recieved: being decoded");
|
||||
((KeyboardMessage)msg).keyPressed = newBuffer.readByte();
|
||||
((KeyboardMessage)msg).keyPressed = dat.readByte();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -912,7 +974,9 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEAltarMessage msg = new TEAltarMessage();
|
||||
msg.index = 0;
|
||||
msg.pos = tileAltar.getPos();
|
||||
msg.x = tileAltar.xCoord;
|
||||
msg.y = tileAltar.yCoord;
|
||||
msg.z = tileAltar.zCoord;
|
||||
msg.items = tileAltar.buildIntDataList();
|
||||
msg.fluids = tileAltar.buildFluidList();
|
||||
msg.capacity = tileAltar.getCapacity();
|
||||
|
@ -924,9 +988,11 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEOrientableMessage msg = new TEOrientableMessage();
|
||||
msg.index = 1;
|
||||
msg.pos = tileOrientable.getPos();
|
||||
msg.input = tileOrientable.getIntForEnumFacing(tileOrientable.getInputDirection());
|
||||
msg.output = tileOrientable.getIntForEnumFacing(tileOrientable.getOutputDirection());
|
||||
msg.x = tileOrientable.xCoord;
|
||||
msg.y = tileOrientable.yCoord;
|
||||
msg.z = tileOrientable.zCoord;
|
||||
msg.input = tileOrientable.getIntForForgeDirection(tileOrientable.getInputDirection());
|
||||
msg.output = tileOrientable.getIntForForgeDirection(tileOrientable.getOutputDirection());
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
@ -935,7 +1001,9 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEPedestalMessage msg = new TEPedestalMessage();
|
||||
msg.index = 2;
|
||||
msg.pos = tilePedestal.getPos();
|
||||
msg.x = tilePedestal.xCoord;
|
||||
msg.y = tilePedestal.yCoord;
|
||||
msg.z = tilePedestal.zCoord;
|
||||
msg.items = tilePedestal.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
|
@ -945,7 +1013,9 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEPlinthMessage msg = new TEPlinthMessage();
|
||||
msg.index = 3;
|
||||
msg.pos = tilePlinth.getPos();
|
||||
msg.x = tilePlinth.xCoord;
|
||||
msg.y = tilePlinth.yCoord;
|
||||
msg.z = tilePlinth.zCoord;
|
||||
msg.items = tilePlinth.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
|
@ -955,7 +1025,9 @@ public enum NewPacketHandler
|
|||
{
|
||||
TESocketMessage msg = new TESocketMessage();
|
||||
msg.index = 4;
|
||||
msg.pos = tileSocket.getPos();
|
||||
msg.x = tileSocket.xCoord;
|
||||
msg.y = tileSocket.yCoord;
|
||||
msg.z = tileSocket.zCoord;
|
||||
msg.items = tileSocket.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
|
@ -965,27 +1037,31 @@ public enum NewPacketHandler
|
|||
{
|
||||
TETeleposerMessage msg = new TETeleposerMessage();
|
||||
msg.index = 5;
|
||||
msg.pos = tileTeleposer.getPos();
|
||||
msg.x = tileTeleposer.xCoord;
|
||||
msg.y = tileTeleposer.yCoord;
|
||||
msg.z = tileTeleposer.zCoord;
|
||||
msg.items = tileTeleposer.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TEChemistrySet tileWritingTable)
|
||||
public static Packet getPacket(TEWritingTable tileWritingTable)
|
||||
{
|
||||
TEWritingTableMessage msg = new TEWritingTableMessage();
|
||||
msg.index = 6;
|
||||
msg.pos = tileWritingTable.getPos();
|
||||
msg.x = tileWritingTable.xCoord;
|
||||
msg.y = tileWritingTable.yCoord;
|
||||
msg.z = tileWritingTable.zCoord;
|
||||
msg.items = tileWritingTable.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getParticlePacket(EnumParticleTypes type, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
|
||||
public static Packet getParticlePacket(String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
|
||||
{
|
||||
ParticleMessage msg = new ParticleMessage();
|
||||
msg.index = 7;
|
||||
msg.particle = type.ordinal();
|
||||
msg.particle = str;
|
||||
msg.xCoord = xCoord;
|
||||
msg.yCoord = yCoord;
|
||||
msg.zCoord = zCoord;
|
||||
|
@ -1011,7 +1087,9 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEMasterStoneMessage msg = new TEMasterStoneMessage();
|
||||
msg.index = 9;
|
||||
msg.pos = tile.getPos();
|
||||
msg.x = tile.xCoord;
|
||||
msg.y = tile.yCoord;
|
||||
msg.z = tile.zCoord;
|
||||
|
||||
msg.ritual = tile.getCurrentRitual();
|
||||
msg.isRunning = tile.isRunning;
|
||||
|
@ -1023,7 +1101,9 @@ public enum NewPacketHandler
|
|||
{
|
||||
TEReagentConduitMessage msg = new TEReagentConduitMessage();
|
||||
msg.index = 10;
|
||||
msg.pos = tile.getPos();
|
||||
msg.x = tile.xCoord;
|
||||
msg.y = tile.yCoord;
|
||||
msg.z = tile.zCoord;
|
||||
|
||||
msg.destinationList = tile.destinationList;
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
|
||||
public class AchievementTrigger
|
||||
{
|
||||
|
@ -32,13 +33,25 @@ public class AchievementTrigger
|
|||
{
|
||||
for (Item item : AchievementsRegistry.craftinglist)
|
||||
{
|
||||
if (event.crafting != null && event.crafting.getItem() == item)
|
||||
if (event.crafting != null)
|
||||
{
|
||||
Achievement achievement = AchievementsRegistry.getAchievementForItem(event.crafting.getItem());
|
||||
|
||||
if (achievement != null)
|
||||
if (event.crafting.getItem() == item)
|
||||
{
|
||||
event.player.addStat(achievement, 1);
|
||||
Achievement achievement = AchievementsRegistry.getAchievementForItem(event.crafting.getItem());
|
||||
|
||||
if (achievement != null)
|
||||
{
|
||||
event.player.addStat(achievement, 1);
|
||||
}
|
||||
}
|
||||
if (event.crafting.getItem() instanceof ItemBlock)
|
||||
{
|
||||
Achievement achievement = AchievementsRegistry.getAchievementForBlock(((ItemBlock) event.crafting.getItem()).field_150939_a);
|
||||
|
||||
if (achievement != null)
|
||||
{
|
||||
event.player.addStat(achievement, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
|
||||
public class AchievementsMod extends Achievement
|
||||
{
|
||||
public static List<Achievement> achievements = new ArrayList<Achievement>();
|
||||
public static List<Achievement> achievements = new ArrayList();
|
||||
|
||||
public AchievementsMod(String name, int x, int y, ItemStack icon, Achievement parent)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
@ -12,38 +15,90 @@ public class AchievementsRegistry
|
|||
{
|
||||
public final static List<Item> craftinglist = new ArrayList<Item>();
|
||||
public final static List<Item> pickupList = new ArrayList<Item>();
|
||||
public final static List<Block> blockCraftingList = new ArrayList<Block>();
|
||||
// public final static List<Block> blockPickupList = new ArrayList<Block>();
|
||||
|
||||
public static void init()
|
||||
{
|
||||
addItemsToCraftingList();
|
||||
addBlocksToCraftingList();
|
||||
addItemsToPickupList();
|
||||
// addBlocksToPickupList();
|
||||
}
|
||||
|
||||
public static void addItemsToCraftingList()
|
||||
{
|
||||
craftinglist.add(ModItems.sacrificialDagger);
|
||||
craftinglist.add(ModItems.itemBloodPack);
|
||||
craftinglist.add(ModItems.waterSigil);
|
||||
craftinglist.add(ModItems.airSigil);
|
||||
craftinglist.add(ModItems.sigilOfHolding);
|
||||
craftinglist.add(ModItems.itemRitualDiviner);
|
||||
craftinglist.add(ModItems.sigilOfTheBridge);
|
||||
craftinglist.add(ModItems.itemSigilOfSupression);
|
||||
craftinglist.add(ModItems.energyBazooka);
|
||||
}
|
||||
|
||||
public static void addBlocksToCraftingList()
|
||||
{
|
||||
blockCraftingList.add(ModBlocks.bloodRune);
|
||||
blockCraftingList.add(ModBlocks.blockWritingTable);
|
||||
blockCraftingList.add(ModBlocks.blockTeleposer);
|
||||
}
|
||||
|
||||
public static void addItemsToPickupList()
|
||||
{
|
||||
pickupList.add(ModItems.weakBloodOrb);
|
||||
pickupList.add(ModItems.apprenticeBloodOrb);
|
||||
pickupList.add(ModItems.daggerOfSacrifice);
|
||||
pickupList.add(ModItems.magicianBloodOrb);
|
||||
pickupList.add(ModItems.energySword);
|
||||
pickupList.add(ModItems.boundHelmet);
|
||||
pickupList.add(ModItems.boundPlate);
|
||||
pickupList.add(ModItems.boundLeggings);
|
||||
pickupList.add(ModItems.boundBoots);
|
||||
pickupList.add(ModItems.itemComplexSpellCrystal);
|
||||
pickupList.add(ModItems.masterBloodOrb);
|
||||
pickupList.add(ModItems.archmageBloodOrb);
|
||||
pickupList.add(ModItems.transcendentBloodOrb);
|
||||
}
|
||||
|
||||
public static void addBlocksToPickupList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static Achievement getAchievementForItem(Item item)
|
||||
{
|
||||
if (item == ModItems.sacrificialDagger)
|
||||
{
|
||||
return ModAchievements.firstPrick;
|
||||
}
|
||||
if (item == ModItems.weakBloodOrb)
|
||||
{
|
||||
return ModAchievements.weakOrb;
|
||||
}
|
||||
if (item == ModItems.sacrificialDagger) return ModAchievements.firstPrick;
|
||||
if (item == ModItems.weakBloodOrb) return ModAchievements.weakOrb;
|
||||
if (item == ModItems.itemBloodPack) return ModAchievements.bloodLettersPack;
|
||||
if (item == ModItems.waterSigil) return ModAchievements.waterSigil;
|
||||
if (item == ModItems.apprenticeBloodOrb) return ModAchievements.apprenticeOrb;
|
||||
if (item == ModItems.airSigil) return ModAchievements.airSigil;
|
||||
if (item == ModItems.daggerOfSacrifice) return ModAchievements.daggerOfSacrifice;
|
||||
if (item == ModItems.magicianBloodOrb) return ModAchievements.magicianOrb;
|
||||
if (item == ModItems.sigilOfHolding) return ModAchievements.sigilHolding;
|
||||
if (item == ModItems.energySword) return ModAchievements.boundBlade;
|
||||
if (item instanceof BoundArmour) return ModAchievements.boundArmor;
|
||||
if (item == ModItems.itemComplexSpellCrystal) return ModAchievements.complexSpells;
|
||||
if (item instanceof ItemRitualDiviner) return ModAchievements.ritualDiviner;
|
||||
if (item == ModItems.masterBloodOrb) return ModAchievements.masterOrb;
|
||||
if (item == ModItems.sigilOfTheBridge) return ModAchievements.phantomBridgeSigil;
|
||||
if (item == ModItems.itemSigilOfSupression) return ModAchievements.suppressionSigil;
|
||||
if (item == ModItems.archmageBloodOrb) return ModAchievements.archmageOrb;
|
||||
if (item == ModItems.energyBazooka) return ModAchievements.energyBazooka;
|
||||
if (item == ModItems.transcendentBloodOrb) return ModAchievements.transcendentOrb;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Achievement getAchievementForBlock(Block block)
|
||||
{
|
||||
if (block == ModBlocks.bloodRune) return ModAchievements.blankRunes;
|
||||
if (block == ModBlocks.blockWritingTable) return ModAchievements.brewingPotions;
|
||||
if (block == ModBlocks.blockTeleposer) return ModAchievements.teleposer;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public interface ICraftAchievement
|
||||
{
|
||||
Achievement getAchievementOnCraft(ItemStack stack, EntityPlayer player, IInventory matrix);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public interface IPickupAchievement
|
||||
{
|
||||
Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item);
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.achievements;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class ModAchievements
|
||||
{
|
||||
|
@ -12,13 +13,57 @@ public class ModAchievements
|
|||
|
||||
public static Achievement firstPrick;
|
||||
public static Achievement weakOrb;
|
||||
public static Achievement bloodLettersPack;
|
||||
public static Achievement waterSigil;
|
||||
public static Achievement blankRunes;
|
||||
public static Achievement apprenticeOrb;
|
||||
public static Achievement airSigil;
|
||||
public static Achievement daggerOfSacrifice;
|
||||
public static Achievement brewingPotions;
|
||||
public static Achievement magicianOrb;
|
||||
public static Achievement sigilHolding;
|
||||
public static Achievement boundBlade;
|
||||
public static Achievement boundArmor;
|
||||
public static Achievement complexSpells;
|
||||
public static Achievement ritualDiviner;
|
||||
public static Achievement masterOrb;
|
||||
public static Achievement demonSpawn;
|
||||
public static Achievement phantomBridgeSigil;
|
||||
public static Achievement teleposer;
|
||||
public static Achievement suppressionSigil;
|
||||
public static Achievement archmageOrb;
|
||||
public static Achievement energyBazooka;
|
||||
public static Achievement demons;
|
||||
public static Achievement transcendentOrb;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
firstPrick = new AchievementsMod(StatCollector.translateToLocal("firstPrick"), 0, 0, ModItems.sacrificialDagger, null);
|
||||
weakOrb = new AchievementsMod(StatCollector.translateToLocal("weakOrb"), 3, 0, ModItems.weakBloodOrb, firstPrick);
|
||||
firstPrick = new AchievementsMod("firstPrick", 0, 0, ModItems.sacrificialDagger, null).setSpecial();
|
||||
weakOrb = new AchievementsMod("weakOrb", 3, 0, ModItems.weakBloodOrb, firstPrick);
|
||||
bloodLettersPack = new AchievementsMod("bloodLettersPack", 3, 2, ModItems.itemBloodPack, weakOrb);
|
||||
waterSigil = new AchievementsMod("waterSigil", 6, 2, ModItems.waterSigil, weakOrb);
|
||||
blankRunes = new AchievementsMod("blankRunes", 4, -2, ModBlocks.bloodRune, weakOrb);
|
||||
apprenticeOrb = new AchievementsMod("apprenticeOrb", 4, -4, ModItems.apprenticeBloodOrb, blankRunes);
|
||||
airSigil = new AchievementsMod("airSigil", 6, 1, ModItems.airSigil, apprenticeOrb);
|
||||
daggerOfSacrifice = new AchievementsMod("daggerSacrifice", 4, -5, ModItems.daggerOfSacrifice, apprenticeOrb);
|
||||
brewingPotions = new AchievementsMod("brewingPotions", 6, -3, ModBlocks.blockWritingTable, apprenticeOrb);
|
||||
magicianOrb = new AchievementsMod("magicianOrb", 2, -2, ModItems.magicianBloodOrb, apprenticeOrb);
|
||||
sigilHolding = new AchievementsMod("sigilHolding", 6, 0, ModItems.sigilOfHolding, magicianOrb);
|
||||
boundBlade = new AchievementsMod("boundBlade", 0, -2, ModItems.energySword, magicianOrb);
|
||||
boundArmor = new AchievementsMod("boundArmor", 1, -1, ModItems.boundPlate, magicianOrb);
|
||||
complexSpells = new AchievementsMod("complexSpells", 1, -4, ModItems.itemComplexSpellCrystal, magicianOrb);
|
||||
ritualDiviner = new AchievementsMod("ritualDiviner", 1, -3, ModItems.itemRitualDiviner, magicianOrb);
|
||||
masterOrb = new AchievementsMod("masterOrb", -2, -1, ModItems.masterBloodOrb, boundBlade);
|
||||
demonSpawn = new AchievementsMod("demonSpawn", -3, -2, ModItems.demonPlacer, masterOrb);
|
||||
phantomBridgeSigil = new AchievementsMod("phantomBridgeSigil", 6, -1, ModItems.sigilOfTheBridge, masterOrb);
|
||||
teleposer = new AchievementsMod("teleposer", -4, -1, ModBlocks.blockTeleposer, masterOrb);
|
||||
suppressionSigil = new AchievementsMod("suppressionSigil", 6, -2, ModItems.itemSigilOfSupression, masterOrb);
|
||||
archmageOrb = new AchievementsMod("archmageOrb", -1, 2, ModItems.archmageBloodOrb, masterOrb);
|
||||
energyBazooka = new AchievementsMod("energyBazooka", -3, 2, ModItems.energyBazooka, archmageOrb);
|
||||
demons = new AchievementsMod("demons", 0, 3, new ItemStack(ModItems.baseItems, 1, 29), archmageOrb).setSpecial();
|
||||
transcendentOrb = new AchievementsMod("trancsendentOrb", 0, 5, ModItems.transcendentBloodOrb, demons);
|
||||
|
||||
alchemicalWizardryPage = new AchievementPage("AlchemicalWizardry", AchievementsMod.achievements.toArray(new Achievement[AchievementsMod.achievements.size()]));
|
||||
alchemicalWizardryPage = new AchievementPage("Blood Magic", AchievementsMod.achievements.toArray(new Achievement[AchievementsMod.achievements.size()]));
|
||||
AchievementPage.registerAchievementPage(alchemicalWizardryPage);
|
||||
AchievementsRegistry.init();
|
||||
FMLCommonHandler.instance().bus().register(new AchievementTrigger());
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||
|
||||
public class CombinedPotionRegistry
|
||||
{
|
||||
public static List<CombinedPotionComponent> potionList = new ArrayList<CombinedPotionComponent>();
|
||||
public static List<CombinedPotionComponent> potionList = new ArrayList();
|
||||
|
||||
public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2)
|
||||
{
|
||||
|
|
|
@ -7,9 +7,11 @@ import WayofTime.alchemicalWizardry.common.ArmourComponent;
|
|||
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -17,46 +19,52 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockArmourForge extends Block
|
||||
public class ArmourForge extends Block
|
||||
{
|
||||
public static List<ArmourComponent> helmetList = new ArrayList<ArmourComponent>();
|
||||
public static List<ArmourComponent> plateList = new ArrayList<ArmourComponent>();
|
||||
public static List<ArmourComponent> leggingsList = new ArrayList<ArmourComponent>();
|
||||
public static List<ArmourComponent> bootsList = new ArrayList<ArmourComponent>();
|
||||
public static List<ArmourComponent> helmetList = new ArrayList();
|
||||
public static List<ArmourComponent> plateList = new ArrayList();
|
||||
public static List<ArmourComponent> leggingsList = new ArrayList();
|
||||
public static List<ArmourComponent> bootsList = new ArrayList();
|
||||
|
||||
public BlockArmourForge()
|
||||
public ArmourForge()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("armourForge");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SoulForge");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int armourType = getArmourType(world, blockPos);
|
||||
int armourType = getArmourType(world, x, y, z);
|
||||
|
||||
if (armourType == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int direction = getDirectionForArmourType(world, blockPos, armourType);
|
||||
int direction = getDirectionForArmourType(world, x, y, z, armourType);
|
||||
|
||||
if (!isParadigmValid(armourType, direction, world, blockPos))
|
||||
if (!isParadigmValid(armourType, direction, world, x, y, z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -68,7 +76,7 @@ public class BlockArmourForge extends Block
|
|||
{
|
||||
case 0:
|
||||
list = plateList;
|
||||
armourPiece = new ItemStack(ModItems.boundChestplate, 1, 0);
|
||||
armourPiece = new ItemStack(ModItems.boundPlate, 1, 0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
@ -111,27 +119,27 @@ public class BlockArmourForge extends Block
|
|||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
tileEntity = world.getTileEntity(blockPos.add(xOff, 0, -zOff));
|
||||
tileEntity = world.getTileEntity(x + xOff, y, z - zOff);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tileEntity = world.getTileEntity(blockPos.add(zOff, 0, xOff));
|
||||
tileEntity = world.getTileEntity(x + zOff, y, z + xOff);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
tileEntity = world.getTileEntity(blockPos.add(-xOff, 0, zOff));
|
||||
tileEntity = world.getTileEntity(x - xOff, y, z + zOff);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
tileEntity = world.getTileEntity(blockPos.add(-zOff, 0, -xOff));
|
||||
tileEntity = world.getTileEntity(x - zOff, y, z - xOff);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
tileEntity = world.getTileEntity(blockPos.add(xOff, zOff, 0));
|
||||
tileEntity = world.getTileEntity(x + xOff, y + zOff, z);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
tileEntity = world.getTileEntity(blockPos.add(0, zOff, xOff));
|
||||
tileEntity = world.getTileEntity(x, y + zOff, z + xOff);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -141,13 +149,15 @@ public class BlockArmourForge extends Block
|
|||
if (tileEntity instanceof TESocket)
|
||||
{
|
||||
ItemStack itemStack = ((TESocket) tileEntity).getStackInSlot(0);
|
||||
BlockPos tilePos = tileEntity.getPos();
|
||||
int xCoord = tileEntity.xCoord;
|
||||
int yCoord = tileEntity.yCoord;
|
||||
int zCoord = tileEntity.zCoord;
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
world.setBlockToAir(tilePos);
|
||||
world.setBlockToAir(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, tilePos, 20, world.provider.getDimensionId(), 1, tilePos);
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
|
@ -167,19 +177,19 @@ public class BlockArmourForge extends Block
|
|||
{
|
||||
int xOff = (world.rand.nextInt(11) - 5);
|
||||
int zOff = (int) (Math.sqrt(25 - xOff * xOff) * (world.rand.nextInt(2) - 0.5) * 2);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX() + xOff, blockPos.getY() + 5, blockPos.getZ() + zOff));
|
||||
world.spawnEntityInWorld(new EntityItem(world, blockPos.getX(), blockPos.getY() + 1, blockPos.getZ(), armourPiece));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + xOff, y + 5, z + zOff));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y + 1, z, armourPiece));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//0 for plate, 1 for leggings, 2 for helmet, 3 for boots
|
||||
public int getArmourType(World world, BlockPos blockPos)
|
||||
public int getArmourType(World world, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
if (getDirectionForArmourType(world, blockPos, i) != -1)
|
||||
if (getDirectionForArmourType(world, x, y, z, i) != -1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -188,11 +198,11 @@ public class BlockArmourForge extends Block
|
|||
return -1;
|
||||
}
|
||||
|
||||
public int getDirectionForArmourType(World world, BlockPos blockPos, int armourType)
|
||||
public int getDirectionForArmourType(World world, int x, int y, int z, int armourType)
|
||||
{
|
||||
for (int i = 1; i <= 6; i++)
|
||||
{
|
||||
if (isParadigmValid(armourType, i, world, blockPos))
|
||||
if (isParadigmValid(armourType, i, world, x, y, z))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -201,7 +211,7 @@ public class BlockArmourForge extends Block
|
|||
return -1;
|
||||
}
|
||||
|
||||
public boolean isParadigmValid(int armourType, int direction, World world, BlockPos blockPos)
|
||||
public boolean isParadigmValid(int armourType, int direction, World world, int x, int y, int z)
|
||||
{
|
||||
List<ArmourComponent> list = null;
|
||||
|
||||
|
@ -237,7 +247,7 @@ public class BlockArmourForge extends Block
|
|||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
if (!(world.getTileEntity(blockPos.add(xOff, 0, -zOff)) instanceof TESocket))
|
||||
if (!(world.getTileEntity(x + xOff, y, z - zOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -245,7 +255,7 @@ public class BlockArmourForge extends Block
|
|||
break;
|
||||
|
||||
case 2:
|
||||
if (!(world.getTileEntity(blockPos.add(zOff, 0, xOff)) instanceof TESocket))
|
||||
if (!(world.getTileEntity(x + zOff, y, z + xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -253,7 +263,7 @@ public class BlockArmourForge extends Block
|
|||
break;
|
||||
|
||||
case 3:
|
||||
if (!(world.getTileEntity(blockPos.add(-xOff, 0, zOff)) instanceof TESocket))
|
||||
if (!(world.getTileEntity(x - xOff, y, z + zOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -261,7 +271,7 @@ public class BlockArmourForge extends Block
|
|||
break;
|
||||
|
||||
case 4:
|
||||
if (!(world.getTileEntity(blockPos.add(-zOff, 0, -xOff)) instanceof TESocket))
|
||||
if (!(world.getTileEntity(x - zOff, y, z - xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -269,7 +279,7 @@ public class BlockArmourForge extends Block
|
|||
break;
|
||||
|
||||
case 5:
|
||||
if (!(world.getTileEntity(blockPos.add(xOff, zOff, 0)) instanceof TESocket))
|
||||
if (!(world.getTileEntity(x + xOff, y + zOff, z) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -277,7 +287,7 @@ public class BlockArmourForge extends Block
|
|||
break;
|
||||
|
||||
case 6:
|
||||
if (!(world.getTileEntity(blockPos.add(0, zOff, xOff)) instanceof TESocket))
|
||||
if (!(world.getTileEntity(x, y + zOff, z + xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -1,36 +1,43 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicalCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
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.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAlchemicalCalcinator extends BlockContainer
|
||||
public class BlockAlchemicCalcinator extends BlockContainer
|
||||
{
|
||||
public BlockAlchemicalCalcinator()
|
||||
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 TEAlchemicalCalcinator();
|
||||
return new TEAlchemicCalcinator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +53,7 @@ public class BlockAlchemicalCalcinator extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState blockState)
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -58,16 +65,16 @@ public class BlockAlchemicalCalcinator extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, blockPos);
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, BlockPos blockPos)
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -85,7 +92,9 @@ public class BlockAlchemicalCalcinator extends BlockContainer
|
|||
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, blockPos.getX() + rx, blockPos.getY() + ry, blockPos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
|
@ -103,9 +112,9 @@ public class BlockAlchemicalCalcinator extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEAlchemicalCalcinator tileEntity = (TEAlchemicalCalcinator) world.getTileEntity(blockPos);
|
||||
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -151,7 +160,7 @@ public class BlockAlchemicalCalcinator extends BlockContainer
|
|||
}
|
||||
}
|
||||
|
||||
tileEntity.getWorld().markBlockForUpdate(blockPos);
|
||||
tileEntity.getWorldObj().markBlockForUpdate(x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -2,33 +2,67 @@ 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.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.items.IAltarManipulator;
|
||||
import WayofTime.alchemicalWizardry.common.items.Orb;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAltar extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockAltar()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodAltar");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,17 +72,17 @@ public class BlockAltar extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, BlockPos blockPos)
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEAltar)
|
||||
{
|
||||
ItemStack stack = ((TEAltar) tile).getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.getItem() instanceof Orb)
|
||||
if (stack != null && stack.getItem() instanceof EnergyBattery)
|
||||
{
|
||||
Orb bloodOrb = (Orb) stack.getItem();
|
||||
EnergyBattery bloodOrb = (EnergyBattery) stack.getItem();
|
||||
int maxEssence = bloodOrb.getMaxEssence();
|
||||
int currentEssence = bloodOrb.getCurrentEssence(stack);
|
||||
int level = currentEssence * 15 / maxEssence;
|
||||
|
@ -60,9 +94,9 @@ public class BlockAltar extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEAltar tileEntity = (TEAltar) world.getTileEntity(blockPos);
|
||||
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -77,7 +111,7 @@ public class BlockAltar extends BlockContainer
|
|||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
|
@ -88,7 +122,7 @@ public class BlockAltar extends BlockContainer
|
|||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
|
@ -107,7 +141,7 @@ public class BlockAltar extends BlockContainer
|
|||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
|
@ -118,7 +152,7 @@ public class BlockAltar extends BlockContainer
|
|||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
|
@ -142,21 +176,21 @@ public class BlockAltar extends BlockContainer
|
|||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, blockPos);
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, BlockPos blockPos)
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -174,7 +208,9 @@ public class BlockAltar extends BlockContainer
|
|||
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, blockPos.getX() + rx, blockPos.getY() + ry, blockPos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
|
@ -191,6 +227,12 @@ public class BlockAltar extends BlockContainer
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
@ -204,16 +246,15 @@ public class BlockAltar extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState blockState)
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, BlockPos blockPos, IBlockState blockState, Random rand)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
TEAltar tileEntity = (TEAltar) world.getTileEntity(blockPos);
|
||||
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
|
||||
|
||||
if (!tileEntity.isActive())
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -14,16 +13,15 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainer;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBelljar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBelljar extends BlockContainer
|
||||
{
|
||||
|
@ -32,9 +30,11 @@ public class BlockBelljar extends BlockContainer
|
|||
super(Material.glass);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("crystalBelljar");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
@ -73,16 +73,16 @@ public class BlockBelljar extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos blockPos, IBlockState blockState, EntityLivingBase entityLiving, ItemStack stack)
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEBelljar)
|
||||
if (tile instanceof TEBellJar)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag != null)
|
||||
{
|
||||
((TEBelljar) tile).readTankNBTOnPlace(tag);
|
||||
((TEBellJar) tile).readTankNBTOnPlace(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,13 @@ public class BlockBelljar extends BlockContainer
|
|||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEBelljar();
|
||||
return new TEBellJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,7 +112,7 @@ public class BlockBelljar extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState blockState)
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -118,35 +124,35 @@ public class BlockBelljar extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, BlockPos blockPos)
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TEBelljar)
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TEBellJar)
|
||||
{
|
||||
return ((TEBelljar) tile).getRSPowerOutput();
|
||||
return ((TEBellJar) tile).getRSPowerOutput();
|
||||
}
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player)
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
|
||||
{
|
||||
this.dropBlockAsItem(world, blockPos, blockState, 0);
|
||||
super.onBlockHarvested(world, blockPos, blockState, player);
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos blockPos, IBlockState blockState, int fortune)
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEBelljar)
|
||||
if (tile instanceof TEBellJar)
|
||||
{
|
||||
ItemStack drop = new ItemStack(this);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
((TEBelljar) tile).writeTankNBT(tag);
|
||||
((TEBellJar) tile).writeTankNBT(tag);
|
||||
drop.setTagCompound(tag);
|
||||
|
||||
list.add(drop);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -18,10 +18,18 @@ public class BlockBloodLightSource extends Block
|
|||
public BlockBloodLightSource()
|
||||
{
|
||||
super(Material.cloth);
|
||||
this.setBlockName("blockBloodLightSource");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, BlockPos blockPos)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
@ -33,7 +41,13 @@ public class BlockBloodLightSource extends Block
|
|||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, BlockPos blockPos, IBlockState blockState, Random rand)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
|
@ -41,12 +55,13 @@ public class BlockBloodLightSource extends Block
|
|||
float f1 = f * 0.6F + 0.4F;
|
||||
float f2 = f * f * 0.7F - 0.5F;
|
||||
float f3 = f * f * 0.6F - 0.7F;
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, blockPos.getX() + 0.5D + rand.nextGaussian() / 8, blockPos.getY() + 0.5D, blockPos.getZ() + 0.5D + rand.nextGaussian() / 8, f1, f2, f3);
|
||||
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, f1, f2, f3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, BlockPos blockPos, IBlockState blockState, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F);
|
||||
}
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
|
||||
public class BlockBloodRune extends Block
|
||||
{
|
||||
public static final PropertyInteger INTEGER = PropertyInteger.create("rune", 0, 5);
|
||||
|
||||
public BlockBloodRune()
|
||||
{
|
||||
super(Material.iron);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(INTEGER, Integer.valueOf(0)));
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState()
|
||||
{
|
||||
return new BlockState(this, new IProperty[] {INTEGER});
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(INTEGER, Integer.valueOf(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return ((Integer)state.getValue(INTEGER)).intValue();
|
||||
}
|
||||
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
switch (metaData)
|
||||
{
|
||||
case 0:
|
||||
return 0;
|
||||
|
||||
case 1: //Altar Capacity rune
|
||||
return 5;
|
||||
|
||||
case 2: //Filling/emptying rune
|
||||
return 6;
|
||||
|
||||
case 3: //Orb Capacity rune
|
||||
return 7;
|
||||
|
||||
case 4: //Better Capacity rune
|
||||
return 8;
|
||||
|
||||
case 5: //Acceleration rune
|
||||
return 9;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.bloodRune))
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 5));
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState blockState)
|
||||
{
|
||||
return blockState.getBlock().damageDropped(blockState);
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockBloodStoneBrick extends Block
|
||||
{
|
||||
public BlockBloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
}
|
|
@ -1,24 +1,61 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockConduit extends BlockOrientable
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockConduit()
|
||||
{
|
||||
super();
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockConduit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,6 +64,12 @@ public class BlockConduit extends BlockOrientable
|
|||
return new TEConduit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
@ -40,7 +83,7 @@ public class BlockConduit extends BlockOrientable
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState blockState)
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,36 +2,48 @@ 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.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.sacrifice.IIncense;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TECrucible;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockIncenseCrucible extends BlockContainer
|
||||
public class BlockCrucible extends BlockContainer
|
||||
{
|
||||
public BlockIncenseCrucible()
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockCrucible()
|
||||
{
|
||||
super(Material.anvil);
|
||||
this.setHardness(2.0f);
|
||||
this.setResistance(1.5f);
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockCrucible");
|
||||
this.setBlockBounds(0.3125F, 0.0F, 0.3125F, 0.6875F, 0.625F, 0.6875F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TECrucible tileEntity = (TECrucible) world.getTileEntity(blockPos);
|
||||
TECrucible tileEntity = (TECrucible) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -51,10 +63,34 @@ public class BlockIncenseCrucible extends BlockContainer
|
|||
// player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
// tileEntity.setInventorySlotContents(0, null);
|
||||
}
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Crucible_Top");
|
||||
this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:Crucible_Side");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Crucible_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon;
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
// {
|
||||
|
@ -62,7 +98,7 @@ public class BlockIncenseCrucible extends BlockContainer
|
|||
// }
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos blockPos)
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
this.setBlockBounds(0.3125F, 0.0F, 0.3125F, 0.6875F, 0.625F, 0.6875F);
|
||||
}
|
||||
|
@ -72,6 +108,12 @@ public class BlockIncenseCrucible extends BlockContainer
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
|
@ -80,20 +122,20 @@ public class BlockIncenseCrucible extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, BlockPos blockPos, IBlockState blockState, Random rand)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
TECrucible tile = (TECrucible)world.getTileEntity(blockPos);
|
||||
tile.spawnClientParticle(world, blockPos, rand);
|
||||
TECrucible tile = (TECrucible)world.getTileEntity(x, y, z);
|
||||
tile.spawnClientParticle(world, x, y, z, rand);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, blockPos);
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,9 +145,9 @@ public class BlockIncenseCrucible extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, BlockPos blockPos)
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TECrucible)
|
||||
{
|
||||
return ((TECrucible) tile).getRSPowerOutput();
|
||||
|
@ -113,10 +155,10 @@ public class BlockIncenseCrucible extends BlockContainer
|
|||
return 15;
|
||||
}
|
||||
|
||||
private void dropItems(World world, BlockPos blockPos)
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -134,7 +176,9 @@ public class BlockIncenseCrucible extends BlockContainer
|
|||
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, blockPos.getX() + rx, blockPos.getY() + ry, blockPos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
|
@ -1,28 +1,48 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCrystal extends Block
|
||||
{
|
||||
//private Icon bloodRuneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon fullIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon brickIcon;
|
||||
|
||||
|
||||
public BlockCrystal()
|
||||
{
|
||||
super(Material.iron);
|
||||
this.setBlockName("crystalBlock");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankRune");
|
||||
this.fullIcon = iconRegister.registerIcon("AlchemicalWizardry:ShardCluster");
|
||||
this.brickIcon = iconRegister.registerIcon("AlchemicalWizardry:ShardClusterBrick");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
|
@ -39,8 +59,25 @@ public class BlockCrystal extends Block
|
|||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState blockState)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return blockState.getBlock().damageDropped(blockState);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return fullIcon;
|
||||
|
||||
case 1:
|
||||
return brickIcon;
|
||||
|
||||
default:
|
||||
return blockIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
public class BlockDemonPortal extends BlockContainer
|
||||
|
@ -17,18 +18,27 @@ public class BlockDemonPortal extends BlockContainer
|
|||
super(Material.rock);
|
||||
setHardness(1000);
|
||||
setResistance(10000);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("demonPortal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:DemonPortal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TEDemonPortal)
|
||||
{
|
||||
((TEDemonPortal) tile).notifyPortalOfBreak();
|
||||
}
|
||||
|
||||
super.onBlockHarvested(world, blockPos, blockState, player);
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,16 +48,16 @@ public class BlockDemonPortal extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(blockPos);
|
||||
TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(x, y, z);
|
||||
|
||||
tileEntity.rightClickBlock(player, side.getIndex());
|
||||
tileEntity.rightClickBlock(player, side);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
public class BlockEfficiencyRune extends BlockBloodRune
|
||||
{
|
||||
public BlockEfficiencyRune()
|
||||
{
|
||||
super();
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockEmptySocket extends Block
|
||||
{
|
||||
public BlockEmptySocket()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -4,27 +4,59 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.omega.IEnchantmentGlyph;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon enchantability;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon enchantmentLevel;
|
||||
|
||||
public BlockEnchantmentGlyph()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("enchantmentGlyph");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick");
|
||||
this.enchantability = iconRegister.registerIcon("AlchemicalWizardry:GlyphEnchantability");
|
||||
this.enchantmentLevel = iconRegister.registerIcon("AlchemicalWizardry:GlyphEnchantmentLevel");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return enchantability;
|
||||
case 1:
|
||||
return enchantmentLevel;
|
||||
default:
|
||||
return this.blockIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAdditionalStabilityForFaceCount(World world, BlockPos pos, int meta, int faceCount)
|
||||
public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount)
|
||||
{
|
||||
switch(meta)
|
||||
{
|
||||
|
@ -38,7 +70,7 @@ public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantability(World world, BlockPos pos, int meta)
|
||||
public int getEnchantability(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
switch(meta)
|
||||
{
|
||||
|
@ -50,7 +82,7 @@ public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantmentLevel(World world, BlockPos pos, int meta)
|
||||
public int getEnchantmentLevel(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
switch(meta)
|
||||
{
|
||||
|
@ -60,8 +92,7 @@ public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
@ -70,10 +101,10 @@ public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph
|
|||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState blockState)
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return blockState.getBlock().damageDropped(blockState);
|
||||
return metadata;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHomHeart extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon;
|
||||
|
||||
public BlockHomHeart()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockHomHeart");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_top");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_bottom");
|
||||
this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEHomHeart tileEntity = (TEHomHeart) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof BlankSpell)
|
||||
{
|
||||
if (playerItem.getTagCompound() == null)
|
||||
{
|
||||
playerItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.getTagCompound();
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metaMaybe)
|
||||
{
|
||||
return new TEHomHeart();
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockLargeBloodStoneBrick extends Block
|
||||
{
|
||||
public BlockLargeBloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
|
||||
public class BlockLifeEssence extends BlockFluidClassic
|
||||
{
|
||||
public BlockLifeEssence()
|
||||
{
|
||||
super(AlchemicalWizardry.lifeEssenceFluid, Material.water);
|
||||
AlchemicalWizardry.lifeEssenceFluid.setBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos blockPos)
|
||||
{
|
||||
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.canDisplace(world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, BlockPos blockPos)
|
||||
{
|
||||
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.displaceIfPossible(world, blockPos);
|
||||
}
|
||||
}
|
|
@ -1,16 +1,17 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
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.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -21,25 +22,34 @@ public class BlockMasterStone extends BlockContainer
|
|||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockMasterStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TEMasterStone)
|
||||
{
|
||||
((TEMasterStone) tile).useOnRitualBroken();
|
||||
}
|
||||
|
||||
super.onBlockHarvested(world, blockPos, blockState, player);
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World world, BlockPos blockPos, Explosion explosion)
|
||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion)
|
||||
{
|
||||
super.onBlockDestroyedByExplosion(world, blockPos, explosion);
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
super.onBlockDestroyedByExplosion(world, x, y, z, explosion);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TEMasterStone)
|
||||
{
|
||||
((TEMasterStone) tile).useOnRitualBrokenExplosion();
|
||||
|
@ -47,9 +57,9 @@ public class BlockMasterStone extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEMasterStone tileEntity = (TEMasterStone) world.getTileEntity(blockPos);
|
||||
TEMasterStone tileEntity = (TEMasterStone) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -72,8 +82,8 @@ public class BlockMasterStone extends BlockContainer
|
|||
|
||||
ActivationCrystal acItem = (ActivationCrystal) item;
|
||||
// tileEntity.setOwner(acItem.getOwnerName(playerItem));
|
||||
tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), playerItem, player, ActivationCrystal.getOwnerName(playerItem));
|
||||
world.markBlockForUpdate(blockPos);
|
||||
tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), playerItem, player, acItem.getOwnerName(playerItem));
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,210 +0,0 @@
|
|||
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.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockMimic extends BlockContainer
|
||||
{
|
||||
public BlockMimic()
|
||||
{
|
||||
super(Material.water);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
// this.setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, BlockPos blockPos, EnumFacing side)
|
||||
{
|
||||
TileEntity TE = world.getTileEntity(blockPos);
|
||||
if(!(TE instanceof TEMimicBlock))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
TEMimicBlock mimic = (TEMimicBlock)TE;
|
||||
|
||||
Block block = mimic.getBlock();
|
||||
|
||||
return block == null || block.shouldSideBeRendered(world, blockPos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCollideCheck(IBlockState blockState, boolean bool)
|
||||
{
|
||||
return blockState.getBlock().getMetaFromState(blockState) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEMimicBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolid(IBlockAccess world, BlockPos blockPos, EnumFacing side)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if(tile instanceof TEMimicBlock)
|
||||
{
|
||||
Block block = ((TEMimicBlock) tile).getBlock();
|
||||
int mimicMeta = ((TEMimicBlock) tile).getMetaOfMimic();
|
||||
|
||||
if(block != null)
|
||||
{
|
||||
return block.isBlockSolid(world, blockPos, side); //side was mimicM
|
||||
}
|
||||
}
|
||||
return super.isBlockSolid(world, blockPos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(target.func_178782_a());
|
||||
|
||||
TEMimicBlock TE = (TEMimicBlock)tile;
|
||||
|
||||
if (TE != null)
|
||||
{
|
||||
Block block = TE.getBlock();
|
||||
|
||||
double xOffset = target.func_178782_a().getX() + world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinX();
|
||||
double yOffset = target.func_178782_a().getY() + world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinY();
|
||||
double zOffset = target.func_178782_a().getZ() + world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinZ();
|
||||
|
||||
switch (target.subHit)
|
||||
{
|
||||
case 0:
|
||||
yOffset = target.func_178782_a().getY() + block.getBlockBoundsMinY() - 0.1D;
|
||||
break;
|
||||
case 1:
|
||||
yOffset = target.func_178782_a().getY() + block.getBlockBoundsMaxY() + 0.1D;
|
||||
break;
|
||||
case 2:
|
||||
zOffset = target.func_178782_a().getZ() + block.getBlockBoundsMinZ() - 0.1D;
|
||||
break;
|
||||
case 3:
|
||||
zOffset = target.func_178782_a().getZ() + block.getBlockBoundsMaxZ() + 0.1D;
|
||||
break;
|
||||
case 4:
|
||||
xOffset = target.func_178782_a().getX() + block.getBlockBoundsMinX() - 0.1D;
|
||||
break;
|
||||
case 5:
|
||||
xOffset = target.func_178782_a().getX() + block.getBlockBoundsMaxX() + 0.1D;
|
||||
break;
|
||||
}
|
||||
|
||||
// BlockMimic.addHitEffect(TE, target, xOffset, yOffset, zOffset, null, effectRenderer);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return super.addHitEffects(world, target, effectRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
TEMimicBlock tile = (TEMimicBlock)world.getTileEntity(blockPos);
|
||||
Block block = tile.getBlock();
|
||||
|
||||
return block != null ? block.getCollisionBoundingBox(world, blockPos, blockState) : super.getCollisionBoundingBox(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess blockAccess, BlockPos blockPos, int renderPass)
|
||||
{
|
||||
TEMimicBlock TE = (TEMimicBlock)blockAccess.getTileEntity(blockPos);
|
||||
if (TE != null)
|
||||
{
|
||||
Block block = TE.getBlock();
|
||||
if(block != null)
|
||||
{
|
||||
return block.colorMultiplier(blockAccess, blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
return super.colorMultiplier(blockAccess, blockPos);
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public void velocityToAddToEntity(World world, BlockPos, Entity entity, Vec3 vec)
|
||||
{
|
||||
TEMimicBlock TE = (TEMimicBlock)world.getTileEntity(x, y, z);
|
||||
if (TE != null)
|
||||
{
|
||||
Block block = TE.getBlock();
|
||||
if(block != null)
|
||||
{
|
||||
block.velocityToAddToEntity(world, x, y, z, entity, vec);
|
||||
}
|
||||
}
|
||||
}
|
||||
No longer in 1.8 apparently
|
||||
|
||||
public static void addHitEffect(TEMimicBlock TE, MovingObjectPosition target, double x, double y, double z, ItemStack itemStack, EffectRenderer effectRenderer)
|
||||
{
|
||||
EntityDiggingFX particle = new EntityDiggingFX(TE.getWorld(), x, y, z, 0.0D, 0.0D, 0.0D, TE.getBlock(), TE.getMetaOfMimic());
|
||||
effectRenderer.addEffect(particle.func_174846_a(target.func_178782_a()).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos blockPos, Entity entity)
|
||||
{
|
||||
TEMimicBlock TE = (TEMimicBlock)world.getTileEntity(blockPos);
|
||||
if (TE != null)
|
||||
{
|
||||
if(TE.getBlockEffectWhileInside(entity, blockPos))
|
||||
{
|
||||
return;
|
||||
}else
|
||||
{
|
||||
Block block = TE.getBlock();
|
||||
if(block != null)
|
||||
{
|
||||
block.onEntityCollidedWithBlock(world, blockPos, entity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onEntityCollidedWithBlock(world, blockPos, entity);
|
||||
}
|
||||
}
|
|
@ -1,14 +1,13 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockOrientable extends BlockContainer
|
||||
{
|
||||
|
@ -17,6 +16,7 @@ public class BlockOrientable extends BlockContainer
|
|||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,7 @@ public class BlockOrientable extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
//Right-click orients the output face. Shift-right-click orients the input face.
|
||||
if (world.isRemote)
|
||||
|
@ -34,20 +34,20 @@ public class BlockOrientable extends BlockContainer
|
|||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEOrientable)
|
||||
{
|
||||
TEOrientable newTile = (TEOrientable) tile;
|
||||
if (player.isSneaking())
|
||||
{
|
||||
int nextSide = TEOrientable.getIntForEnumFacing(newTile.getInputDirection()) + 1;
|
||||
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection()) + 1;
|
||||
|
||||
if (nextSide > 5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
if (EnumFacing.getFront(nextSide) == newTile.getOutputDirection())
|
||||
if (ForgeDirection.getOrientation(nextSide) == newTile.getOutputDirection())
|
||||
{
|
||||
nextSide++;
|
||||
if (nextSide > 5)
|
||||
|
@ -56,16 +56,16 @@ public class BlockOrientable extends BlockContainer
|
|||
}
|
||||
}
|
||||
|
||||
newTile.setInputDirection(EnumFacing.getFront(nextSide));
|
||||
newTile.setInputDirection(ForgeDirection.getOrientation(nextSide));
|
||||
} else
|
||||
{
|
||||
int nextSide = TEOrientable.getIntForEnumFacing(newTile.getOutputDirection()) + 1;
|
||||
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection()) + 1;
|
||||
|
||||
if (nextSide > 5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
if (EnumFacing.getFront(nextSide) == newTile.getInputDirection())
|
||||
if (ForgeDirection.getOrientation(nextSide) == newTile.getInputDirection())
|
||||
{
|
||||
nextSide++;
|
||||
if (nextSide > 5)
|
||||
|
@ -74,17 +74,17 @@ public class BlockOrientable extends BlockContainer
|
|||
}
|
||||
}
|
||||
|
||||
newTile.setOutputDirection(EnumFacing.getFront(nextSide));
|
||||
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
|
||||
}
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState blockState)
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return blockState.getBlock().damageDropped(blockState);
|
||||
return metadata;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,35 +2,71 @@ 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.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPedestal extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockPedestal()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodPedestal");
|
||||
float f = 0.3125F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
TEPedestal tileEntity = (TEPedestal) world.getTileEntity(blockPos);
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePedestal");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEPedestal tileEntity = (TEPedestal) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -51,21 +87,21 @@ public class BlockPedestal extends BlockContainer
|
|||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, blockPos);
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, BlockPos blockPos)
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -83,7 +119,7 @@ public class BlockPedestal extends BlockContainer
|
|||
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, blockPos.getX() + rx, blockPos.getY() + ry, blockPos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
|
@ -106,6 +142,12 @@ public class BlockPedestal extends BlockContainer
|
|||
return new TEPedestal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
@ -119,7 +161,7 @@ public class BlockPedestal extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState blockState)
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,35 +2,71 @@ 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.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPlinth extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockPlinth()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodPlinth");
|
||||
float f = 0.0625F;
|
||||
this.setBlockBounds(f, 0.0F, f, 1.0f - f, 0.875f, 1.0f - f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
TEPlinth tileEntity = (TEPlinth) world.getTileEntity(blockPos);
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePlinth");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEPlinth tileEntity = (TEPlinth) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -51,21 +87,21 @@ public class BlockPlinth extends BlockContainer
|
|||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, blockPos);
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, BlockPos blockPos)
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -83,7 +119,7 @@ public class BlockPlinth extends BlockContainer
|
|||
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, blockPos.getX() + rx, blockPos.getY() + ry, blockPos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
|
@ -106,6 +142,12 @@ public class BlockPlinth extends BlockContainer
|
|||
return new TEPlinth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
@ -119,7 +161,7 @@ public class BlockPlinth extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState blockState)
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,13 +2,14 @@ package WayofTime.alchemicalWizardry.common.block;
|
|||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockReagentConduit extends BlockContainer
|
||||
{
|
||||
|
@ -17,6 +18,15 @@ public class BlockReagentConduit extends BlockContainer
|
|||
super(Material.cloth);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockReagentConduit");
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleTransCircle");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,9 +42,9 @@ public class BlockReagentConduit extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
return super.onBlockActivated(world, blockPos, state, player, side, hitX, hitY, hitZ);
|
||||
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,6 +53,12 @@ public class BlockReagentConduit extends BlockContainer
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
|
||||
import WayofTime.alchemicalWizardry.common.items.ScribeTool;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockRitualStone extends Block implements IRitualStone
|
||||
{
|
||||
public BlockRitualStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState blockState)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ScribeTool))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (playerItem.getMaxDamage() <= playerItem.getItemDamage() && !(playerItem.getMaxDamage() == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ScribeTool scribeTool = (ScribeTool) item;
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
playerItem.setItemDamage(playerItem.getItemDamage() + 1);
|
||||
}
|
||||
|
||||
world.setBlockState(blockPos, state.getBlock().getStateFromMeta(scribeTool.getType()), 3);
|
||||
world.markBlockForUpdate(blockPos);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuneType(World world, BlockPos blockPos, IBlockState blockState, int runeType)
|
||||
{
|
||||
return blockState.getBlock().getMetaFromState(blockState) == runeType;
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
public class BlockRuneOfSacrifice extends BlockBloodRune
|
||||
{
|
||||
public BlockRuneOfSacrifice()
|
||||
{
|
||||
super();
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
public class BlockRuneOfSelfSacrifice extends BlockBloodRune
|
||||
{
|
||||
public BlockRuneOfSelfSacrifice()
|
||||
{
|
||||
super();
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSchematicSaver extends BlockContainer
|
||||
|
@ -17,6 +15,8 @@ public class BlockSchematicSaver extends BlockContainer
|
|||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
// setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("schematicSaver");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,16 +26,16 @@ public class BlockSchematicSaver extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TESchematicSaver tileEntity = (TESchematicSaver) world.getTileEntity(blockPos);
|
||||
TESchematicSaver tileEntity = (TESchematicSaver) world.getTileEntity(x, y, z);
|
||||
|
||||
tileEntity.rightClickBlock();
|
||||
tileEntity.rightClickBlock(player, side);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,36 +1,72 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFilledSocket extends BlockContainer
|
||||
public class BlockSocket extends BlockContainer
|
||||
{
|
||||
public BlockFilledSocket()
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockSocket()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodSocket");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
TESocket tileEntity = (TESocket) world.getTileEntity(blockPos);
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TESocket tileEntity = (TESocket) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -60,21 +96,21 @@ public class BlockFilledSocket extends BlockContainer
|
|||
tileEntity.setActive();
|
||||
return true;
|
||||
}
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, blockPos);
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, BlockPos blockPos)
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -92,7 +128,7 @@ public class BlockFilledSocket extends BlockContainer
|
|||
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, blockPos.getX() + rx, blockPos.getY() + ry, blockPos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
|
@ -1,13 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -19,9 +20,17 @@ public class BlockSpectralContainer extends BlockContainer
|
|||
public BlockSpectralContainer()
|
||||
{
|
||||
super(Material.cloth);
|
||||
this.setBlockName("blockSpectralContainer");
|
||||
this.setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
|
@ -29,22 +38,30 @@ public class BlockSpectralContainer extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) {}
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(World world, BlockPos blockPos)
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, BlockPos blockPos)
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
public class BlockSpeedRune extends BlockBloodRune
|
||||
{
|
||||
public BlockSpeedRune()
|
||||
{
|
||||
super();
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -2,21 +2,23 @@ package WayofTime.alchemicalWizardry.common.block;
|
|||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BlockSpellEffect extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEffect()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEffect");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,6 +27,12 @@ public class BlockSpellEffect extends BlockOrientable
|
|||
return new TESpellEffectBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
@ -37,7 +45,6 @@ public class BlockSpellEffect extends BlockOrientable
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
|
|
@ -2,13 +2,13 @@ package WayofTime.alchemicalWizardry.common.block;
|
|||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -17,6 +17,7 @@ public class BlockSpellEnhancement extends BlockOrientable
|
|||
public BlockSpellEnhancement()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEnhancement");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,6 +26,12 @@ public class BlockSpellEnhancement extends BlockOrientable
|
|||
return new TESpellEnhancementBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
@ -37,7 +44,6 @@ public class BlockSpellEnhancement extends BlockOrientable
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
|
|
@ -2,13 +2,13 @@ package WayofTime.alchemicalWizardry.common.block;
|
|||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -17,6 +17,7 @@ public class BlockSpellModifier extends BlockOrientable
|
|||
public BlockSpellModifier()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellModifier");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +26,6 @@ public class BlockSpellModifier extends BlockOrientable
|
|||
return new TESpellModifierBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
@ -47,6 +47,12 @@ public class BlockSpellModifier extends BlockOrientable
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
|
|
@ -3,18 +3,15 @@ package WayofTime.alchemicalWizardry.common.block;
|
|||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
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.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -23,6 +20,7 @@ public class BlockSpellParadigm extends BlockOrientable
|
|||
public BlockSpellParadigm()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellParadigm");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,8 +29,8 @@ public class BlockSpellParadigm extends BlockOrientable
|
|||
return new TESpellParadigmBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
|
@ -51,7 +49,7 @@ public class BlockSpellParadigm extends BlockOrientable
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
|
@ -63,14 +61,14 @@ public class BlockSpellParadigm extends BlockOrientable
|
|||
}
|
||||
|
||||
NBTTagCompound itemTag = stack.getTagCompound();
|
||||
itemTag.setInteger("xCoord", blockPos.getX());
|
||||
itemTag.setInteger("yCoord", blockPos.getY());
|
||||
itemTag.setInteger("zCoord", blockPos.getZ());
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onBlockActivated(world, blockPos, state, player, side, hitX, hitY, hitZ);
|
||||
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,6 +77,12 @@ public class BlockSpellParadigm extends BlockOrientable
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellTable;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSpellTable extends BlockContainer
|
||||
{
|
||||
public BlockSpellTable()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TESpellTable tileEntity = (TESpellTable) world.getTileEntity(blockPos);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof BlankSpell)
|
||||
{
|
||||
if (playerItem.getTagCompound() == null)
|
||||
{
|
||||
playerItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.getTagCompound();
|
||||
itemTag.setInteger("xCoord", blockPos.getX());
|
||||
itemTag.setInteger("yCoord", blockPos.getY());
|
||||
itemTag.setInteger("zCoord", blockPos.getZ());
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metaMaybe)
|
||||
{
|
||||
return new TESpellTable();
|
||||
}
|
||||
}
|
|
@ -4,26 +4,54 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.omega.IStabilityGlyph;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockStabilityGlyph extends Block implements IStabilityGlyph
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon stability1;
|
||||
|
||||
public BlockStabilityGlyph()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("stabilityGlyph");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick");
|
||||
this.stability1 = iconRegister.registerIcon("AlchemicalWizardry:GlyphStability1");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return stability1;
|
||||
default:
|
||||
return this.blockIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAdditionalStabilityForFaceCount(World world, BlockPos pos, int meta, int faceCount)
|
||||
public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount)
|
||||
{
|
||||
switch(meta)
|
||||
{
|
||||
|
@ -34,7 +62,7 @@ public class BlockStabilityGlyph extends Block implements IStabilityGlyph
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.block.BlockContainer;
|
|||
import net.minecraft.block.BlockMobSpawner;
|
||||
import net.minecraft.block.BlockPortal;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -15,31 +15,65 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
//import net.minecraftforge.fml.common.Optional;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
||||
//import codechicken.multipart.MultipartHelper;
|
||||
//import codechicken.multipart.TileMultipart;
|
||||
import codechicken.multipart.MultipartHelper;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockTeleposer extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockTeleposer()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodTeleposer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
|
@ -55,28 +89,28 @@ public class BlockTeleposer extends BlockContainer
|
|||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.getTagCompound();
|
||||
itemTag.setInteger("xCoord", pos.getX());
|
||||
itemTag.setInteger("yCoord", pos.getY());
|
||||
itemTag.setInteger("zCoord", pos.getZ());
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, BlockPos pos)
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -94,7 +128,7 @@ public class BlockTeleposer extends BlockContainer
|
|||
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, pos.getX() + rx, pos.getY() + ry, pos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
|
@ -117,20 +151,20 @@ public class BlockTeleposer extends BlockContainer
|
|||
return new TETeleposer();
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf)
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
{
|
||||
return swapBlocks(caller, worldI, worldF, posi, posf, true, 3);
|
||||
return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, true, 3);
|
||||
}
|
||||
|
||||
public static boolean swapBlocksWithoutSound(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf)
|
||||
public static boolean swapBlocksWithoutSound(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
{
|
||||
return swapBlocks(caller, worldI, worldF, posi, posf, false, 3);
|
||||
return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, false, 3);
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf, boolean doSound, int flag)
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf, boolean doSound, int flag)
|
||||
{
|
||||
TileEntity tileEntityI = worldI.getTileEntity(posi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(posf);
|
||||
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
|
||||
|
||||
NBTTagCompound nbttag1 = new NBTTagCompound();
|
||||
NBTTagCompound nbttag2 = new NBTTagCompound();
|
||||
|
@ -145,10 +179,8 @@ public class BlockTeleposer extends BlockContainer
|
|||
tileEntityF.writeToNBT(nbttag2);
|
||||
}
|
||||
|
||||
IBlockState stateI = worldI.getBlockState(posi);
|
||||
Block blockI = stateI.getBlock();
|
||||
IBlockState stateF = worldF.getBlockState(posf);
|
||||
Block blockF = stateF.getBlock();
|
||||
Block blockI = worldI.getBlock(xi, yi, zi);
|
||||
Block blockF = worldF.getBlock(xf, yf, zf);
|
||||
|
||||
|
||||
if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air))
|
||||
|
@ -160,15 +192,18 @@ public class BlockTeleposer extends BlockContainer
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int metaI = worldI.getBlockMetadata(xi, yi, zi);
|
||||
int metaF = worldF.getBlockMetadata(xf, yf, zf);
|
||||
|
||||
TeleposeEvent evt = new TeleposeEvent(worldI, posi, stateI, worldF, posf, stateF);
|
||||
TeleposeEvent evt = new TeleposeEvent(worldI, xi, yi, zi, blockI, metaI, worldF, xf, yf, zf, blockF, metaF);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt))
|
||||
return false;
|
||||
|
||||
if(doSound)
|
||||
{
|
||||
worldI.playSoundEffect(posi.getX(), posi.getY(), posi.getZ(), "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(posf.getX(), posf.getY(), posf.getZ(), "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(xf, yf, zf, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
//CLEAR TILES
|
||||
|
@ -176,68 +211,73 @@ public class BlockTeleposer extends BlockContainer
|
|||
|
||||
if (finalBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, stateF);
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, metaF);
|
||||
|
||||
worldF.setTileEntity(posf, tileToSet);
|
||||
worldF.setTileEntity(xf, yf, zf, tileToSet);
|
||||
}
|
||||
|
||||
if (blockI != null)
|
||||
{
|
||||
TileEntity tileToSet = blockI.createTileEntity(worldI, stateI);
|
||||
TileEntity tileToSet = blockI.createTileEntity(worldI, metaI);
|
||||
|
||||
worldI.setTileEntity(posi, tileToSet);
|
||||
worldI.setTileEntity(xi, yi, zi, tileToSet);
|
||||
}
|
||||
|
||||
//TILES CLEARED
|
||||
worldF.setBlockState(posf, stateI, flag);
|
||||
worldF.setBlock(xf, yf, zf, blockI, metaI, flag);
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
TileEntity newTileEntityI = TileEntity.createAndLoadEntity(nbttag1);
|
||||
|
||||
// if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI))
|
||||
if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI))
|
||||
{
|
||||
// newTileEntityI = createMultipartFromNBT(worldF, nbttag1);
|
||||
newTileEntityI = createMultipartFromNBT(worldF, nbttag1);
|
||||
}
|
||||
|
||||
worldF.setTileEntity(posf, newTileEntityI);
|
||||
worldF.setTileEntity(xf, yf, zf, newTileEntityI);
|
||||
|
||||
newTileEntityI.setPos(posf);
|
||||
// if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI))
|
||||
newTileEntityI.xCoord = xf;
|
||||
newTileEntityI.yCoord = yf;
|
||||
newTileEntityI.zCoord = zf;
|
||||
|
||||
if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI))
|
||||
{
|
||||
// sendDescriptorOfTile(worldF, newTileEntityI);
|
||||
sendDescriptorOfTile(worldF, newTileEntityI);
|
||||
}
|
||||
}
|
||||
|
||||
worldI.setBlockState(posi, stateF, flag);
|
||||
worldI.setBlock(xi, yi, zi, finalBlock, metaF, flag);
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
TileEntity newTileEntityF = TileEntity.createAndLoadEntity(nbttag2);
|
||||
// if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF))
|
||||
if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF))
|
||||
{
|
||||
// newTileEntityF = createMultipartFromNBT(worldI, nbttag2);
|
||||
newTileEntityF = createMultipartFromNBT(worldI, nbttag2);
|
||||
}
|
||||
|
||||
worldI.setTileEntity(posi, newTileEntityF);
|
||||
worldI.setTileEntity(xi, yi, zi, newTileEntityF);
|
||||
|
||||
newTileEntityF.setPos(posi);
|
||||
newTileEntityF.xCoord = xi;
|
||||
newTileEntityF.yCoord = yi;
|
||||
newTileEntityF.zCoord = zi;
|
||||
|
||||
// if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF))
|
||||
if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF))
|
||||
{
|
||||
// sendDescriptorOfTile(worldI, newTileEntityF);
|
||||
sendDescriptorOfTile(worldI, newTileEntityF);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* @Optional.Method(modid = "ForgeMultipart")
|
||||
@Optional.Method(modid = "ForgeMultipart")
|
||||
public static boolean isMultipart(TileEntity tile)
|
||||
{
|
||||
return tile instanceof TileMultipart;
|
||||
}
|
||||
|
||||
|
||||
@Optional.Method(modid = "ForgeMultipart")
|
||||
public static TileEntity createMultipartFromNBT(World world, NBTTagCompound tag)
|
||||
{
|
||||
|
@ -249,5 +289,4 @@ public class BlockTeleposer extends BlockContainer
|
|||
{
|
||||
MultipartHelper.sendDescPacket(world, tile);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEChemistrySet;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -13,26 +16,58 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockChemistrySet extends BlockContainer
|
||||
public class BlockWritingTable extends BlockContainer
|
||||
{
|
||||
public BlockChemistrySet()
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockWritingTable()
|
||||
{
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockWritingTable");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:AlchemicChemistrySet");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float what, float these, float are)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -40,21 +75,21 @@ public class BlockChemistrySet extends BlockContainer
|
|||
}
|
||||
|
||||
//code to open gui explained later
|
||||
player.openGui(AlchemicalWizardry.instance, 0, world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, blockPos);
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, BlockPos blockPos)
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -72,7 +107,9 @@ public class BlockChemistrySet extends BlockContainer
|
|||
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, blockPos.getX() + rx, blockPos.getY() + ry, blockPos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
|
@ -92,7 +129,13 @@ public class BlockChemistrySet extends BlockContainer
|
|||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEChemistrySet();
|
||||
return new TEWritingTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -108,21 +151,20 @@ public class BlockChemistrySet extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState blockState)
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.9375F, 0.5625F);
|
||||
super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
this.setBlockBoundsForItemRender();
|
||||
super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender()
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
|
@ -0,0 +1,132 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BloodRune extends Block
|
||||
{
|
||||
//private Icon bloodRuneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon altarCapacityRuneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon dislocationRuneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon orbCapacityRuneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon betterCapacityRuneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon accelerationRuneIcon;
|
||||
|
||||
public BloodRune()
|
||||
{
|
||||
super(Material.iron);
|
||||
this.setBlockName("bloodRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankRune");
|
||||
this.altarCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AltarCapacityRune");
|
||||
this.dislocationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:DislocationRune");
|
||||
this.orbCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:OrbCapacityRune");
|
||||
this.betterCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:BetterCapacityRune");
|
||||
this.accelerationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AccelerationRune");
|
||||
}
|
||||
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
switch (metaData)
|
||||
{
|
||||
case 0:
|
||||
return 0;
|
||||
|
||||
case 1: //Altar Capacity rune
|
||||
return 5;
|
||||
|
||||
case 2: //Filling/emptying rune
|
||||
return 6;
|
||||
|
||||
case 3: //Orb Capacity rune
|
||||
return 7;
|
||||
|
||||
case 4: //Better Capacity rune
|
||||
return 8;
|
||||
|
||||
case 5: //Acceleration rune
|
||||
return 9;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.bloodRune))
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 5));
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return blockIcon;
|
||||
|
||||
case 1:
|
||||
return altarCapacityRuneIcon;
|
||||
|
||||
case 2:
|
||||
return dislocationRuneIcon;
|
||||
|
||||
case 3:
|
||||
return this.orbCapacityRuneIcon;
|
||||
|
||||
case 4:
|
||||
return this.betterCapacityRuneIcon;
|
||||
|
||||
case 5:
|
||||
return this.accelerationRuneIcon;
|
||||
default:
|
||||
return blockIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class BloodStoneBrick extends Block
|
||||
{
|
||||
public BloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodStoneBrick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodStoneBrick");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class EfficiencyRune extends BloodRune
|
||||
{
|
||||
public EfficiencyRune()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("efficiencyRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:EfficiencyRune");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class EmptySocket extends Block
|
||||
{
|
||||
public EmptySocket()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("emptySocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:EmptySocket");
|
||||
}
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IOrientable
|
||||
{
|
||||
EnumFacing getInputDirection();
|
||||
ForgeDirection getInputDirection();
|
||||
|
||||
EnumFacing getOutputDirection();
|
||||
ForgeDirection getOutputDirection();
|
||||
|
||||
void setInputDirection(EnumFacing direction);
|
||||
void setInputDirection(ForgeDirection direction);
|
||||
|
||||
void setOutputDirection(EnumFacing direction);
|
||||
void setOutputDirection(ForgeDirection direction);
|
||||
}
|
||||
|
|
|
@ -1,49 +1,59 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockImperfectRitualStone extends Block
|
||||
public class ImperfectRitualStone extends Block
|
||||
{
|
||||
public BlockImperfectRitualStone()
|
||||
public ImperfectRitualStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("imperfectRitualStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:ImperfectRitualStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOff, float yOff, float zOff)
|
||||
{
|
||||
if(SpellHelper.isFakePlayer(player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
Block block = world.getBlockState(blockPos.add(0, 1, 0)).getBlock();
|
||||
Block block = world.getBlock(x, y + 1, z);
|
||||
|
||||
if (block == Blocks.water)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote)
|
||||
{
|
||||
SoulNetworkHandler.hurtPlayer(player, 5000);
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY() + 2, blockPos.getZ()));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
}
|
||||
|
||||
world.getWorldInfo().setRaining(true);
|
||||
|
@ -61,11 +71,11 @@ public class BlockImperfectRitualStone extends Block
|
|||
{
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote)
|
||||
{
|
||||
SoulNetworkHandler.hurtPlayer(player, 5000);
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
EntityZombie zomb = new EntityZombie(world);
|
||||
zomb.setPosition(blockPos.getX() + 0.5, blockPos.getY() + 2, blockPos.getZ() + 0.5);
|
||||
zomb.setPosition(x + 0.5, y + 2, z + 0.5);
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2000));
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20000, 7));
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 3));
|
||||
|
@ -73,7 +83,7 @@ public class BlockImperfectRitualStone extends Block
|
|||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(zomb);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY() + 2, blockPos.getZ()));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -81,24 +91,24 @@ public class BlockImperfectRitualStone extends Block
|
|||
{
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote)
|
||||
{
|
||||
SoulNetworkHandler.hurtPlayer(player, 5000);
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY() + 2, blockPos.getZ()));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
world.setWorldTime((world.getWorldTime() / 24000) * 24000 + 13800);
|
||||
}
|
||||
} else if (block == Blocks.bedrock)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote)
|
||||
{
|
||||
SoulNetworkHandler.hurtPlayer(player, 5000);
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY() + 2, blockPos.getZ()));
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 1));
|
|
@ -0,0 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class LargeBloodStoneBrick extends Block
|
||||
{
|
||||
public LargeBloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("largeBloodStoneBrick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
|
||||
public class LifeEssenceBlock extends BlockFluidClassic
|
||||
{
|
||||
public LifeEssenceBlock()
|
||||
{
|
||||
super(AlchemicalWizardry.lifeEssenceFluid, Material.water);
|
||||
AlchemicalWizardry.lifeEssenceFluid.setBlock(this);
|
||||
this.setBlockName("lifeEssenceFluidBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:lifeEssenceStill");
|
||||
AlchemicalWizardry.lifeEssenceFluid.setFlowingIcon(blockIcon);
|
||||
AlchemicalWizardry.lifeEssenceFluid.setStillIcon(blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.canDisplace(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z)
|
||||
{
|
||||
return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,231 @@
|
|||
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.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class MimicBlock extends BlockContainer
|
||||
{
|
||||
public MimicBlock()
|
||||
{
|
||||
super(Material.water);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockMimic");
|
||||
// this.setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntity TE = world.getTileEntity(x, y, z);
|
||||
if(!(TE instanceof TEMimicBlock))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
TEMimicBlock mimic = (TEMimicBlock)TE;
|
||||
|
||||
Block block = mimic.getBlock();
|
||||
|
||||
return block == null || block.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCollideCheck(int meta, boolean bool)
|
||||
{
|
||||
return meta == 1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
/**
|
||||
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
||||
*/
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntity TE = blockAccess.getTileEntity(x, y, z);
|
||||
TEMimicBlock mimic = (TEMimicBlock)TE;
|
||||
Block block = mimic.getBlock();
|
||||
int meta = mimic.getMetaOfMimic();
|
||||
|
||||
return block != null ? block.getIcon(side, meta) : this.blockIcon;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEMimicBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(int meta, int fortune, Random random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolid(IBlockAccess world, int x, int y, int z, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TEMimicBlock)
|
||||
{
|
||||
Block block = ((TEMimicBlock) tile).getBlock();
|
||||
int mimicMeta = ((TEMimicBlock) tile).getMetaOfMimic();
|
||||
|
||||
if(block != null)
|
||||
{
|
||||
return block.isBlockSolid(world, x, y, z, mimicMeta);
|
||||
}
|
||||
}
|
||||
return super.isBlockSolid(world, x, y, z, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(target.blockX, target.blockY, target.blockZ);
|
||||
|
||||
TEMimicBlock TE = (TEMimicBlock)tile;
|
||||
|
||||
if (TE != null)
|
||||
{
|
||||
Block block = TE.getBlock();
|
||||
|
||||
double xOffset = target.blockX + world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinX();
|
||||
double yOffset = target.blockY + world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinY();
|
||||
double zOffset = target.blockZ + world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - 0.1F * 2.0F) + 0.1F + block.getBlockBoundsMinZ();
|
||||
|
||||
switch (target.sideHit) {
|
||||
case 0:
|
||||
yOffset = target.blockY + block.getBlockBoundsMinY() - 0.1D;
|
||||
break;
|
||||
case 1:
|
||||
yOffset = target.blockY + block.getBlockBoundsMaxY() + 0.1D;
|
||||
break;
|
||||
case 2:
|
||||
zOffset = target.blockZ + block.getBlockBoundsMinZ() - 0.1D;
|
||||
break;
|
||||
case 3:
|
||||
zOffset = target.blockZ + block.getBlockBoundsMaxZ() + 0.1D;
|
||||
break;
|
||||
case 4:
|
||||
xOffset = target.blockX + block.getBlockBoundsMinX() - 0.1D;
|
||||
break;
|
||||
case 5:
|
||||
xOffset = target.blockX + block.getBlockBoundsMaxX() + 0.1D;
|
||||
break;
|
||||
}
|
||||
|
||||
MimicBlock.addHitEffect(TE, target, xOffset, yOffset, zOffset, null, effectRenderer);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return super.addHitEffects(world, target, effectRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
TEMimicBlock tile = (TEMimicBlock)world.getTileEntity(x, y, z);
|
||||
Block block = tile.getBlock();
|
||||
|
||||
return block != null ? block.getCollisionBoundingBoxFromPool(world, x, y, z) : super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z)
|
||||
{
|
||||
TEMimicBlock TE = (TEMimicBlock)blockAccess.getTileEntity(x, y, z);
|
||||
if (TE != null)
|
||||
{
|
||||
Block block = TE.getBlock();
|
||||
if(block != null)
|
||||
{
|
||||
return block.colorMultiplier(blockAccess, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
return super.colorMultiplier(blockAccess, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec)
|
||||
{
|
||||
TEMimicBlock TE = (TEMimicBlock)world.getTileEntity(x, y, z);
|
||||
if (TE != null)
|
||||
{
|
||||
Block block = TE.getBlock();
|
||||
if(block != null)
|
||||
{
|
||||
block.velocityToAddToEntity(world, x, y, z, entity, vec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addHitEffect(TEMimicBlock TE, MovingObjectPosition target, double x, double y, double z, ItemStack itemStack, EffectRenderer effectRenderer)
|
||||
{
|
||||
EntityDiggingFX particle = new EntityDiggingFX(TE.getWorldObj(), x, y, z, 0.0D, 0.0D, 0.0D, TE.getBlock(), TE.getMetaOfMimic());
|
||||
effectRenderer.addEffect(particle.applyColourMultiplier(target.blockX, target.blockY, target.blockZ).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
TEMimicBlock TE = (TEMimicBlock)world.getTileEntity(x, y, z);
|
||||
if (TE != null)
|
||||
{
|
||||
if(TE.getBlockEffectWhileInside(entity, x, y, z))
|
||||
{
|
||||
return;
|
||||
}else
|
||||
{
|
||||
Block block = TE.getBlock();
|
||||
if(block != null)
|
||||
{
|
||||
block.onEntityCollidedWithBlock(world, x, y, z, entity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onEntityCollidedWithBlock(world, x, y, z, entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
|
||||
import WayofTime.alchemicalWizardry.common.items.ScribeTool;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
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.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RitualStone extends Block implements IRitualStone
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon blankIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon waterStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon fireStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon earthStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon airStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon duskStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon dawnStoneIcon;
|
||||
|
||||
public RitualStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("ritualStone");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blankIcon = iconRegister.registerIcon("AlchemicalWizardry:RitualStone");
|
||||
this.waterStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterRitualStone");
|
||||
this.fireStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:FireRitualStone");
|
||||
this.earthStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:EarthRitualStone");
|
||||
this.airStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:AirRitualStone");
|
||||
this.duskStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:DuskRitualStone");
|
||||
this.dawnStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:LightRitualStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ScribeTool))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (playerItem.getMaxDamage() <= playerItem.getItemDamage() && !(playerItem.getMaxDamage() == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ScribeTool scribeTool = (ScribeTool) item;
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
playerItem.setItemDamage(playerItem.getItemDamage() + 1);
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, scribeTool.getType(), 3);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return blankIcon;
|
||||
|
||||
case 1:
|
||||
return waterStoneIcon;
|
||||
|
||||
case 2:
|
||||
return fireStoneIcon;
|
||||
|
||||
case 3:
|
||||
return earthStoneIcon;
|
||||
|
||||
case 4:
|
||||
return airStoneIcon;
|
||||
|
||||
case 5:
|
||||
return duskStoneIcon;
|
||||
|
||||
case 6:
|
||||
return dawnStoneIcon;
|
||||
|
||||
default:
|
||||
return blankIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuneType(World world, int x, int y, int z, int meta, int runeType)
|
||||
{
|
||||
return meta == runeType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class RuneOfSacrifice extends BloodRune
|
||||
{
|
||||
public RuneOfSacrifice()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("runeOfSacrifice");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:RuneOfSacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class RuneOfSelfSacrifice extends BloodRune
|
||||
{
|
||||
public RuneOfSelfSacrifice()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("runeOfSelfSacrifice");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:RuneOfSelfSacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
|
@ -1,33 +1,41 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSpectral extends BlockContainer
|
||||
public class SpectralBlock extends BlockContainer
|
||||
{
|
||||
public BlockSpectral()
|
||||
public SpectralBlock()
|
||||
{
|
||||
super(Material.rock);
|
||||
this.setBlockName("spectralBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SpectralBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
Block d;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -37,13 +45,12 @@ public class BlockSpectral extends BlockContainer
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, BlockPos blockPos, EnumFacing side)
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
|
||||
{
|
||||
Block block = p_149646_1_.getBlockState(blockPos).getBlock();
|
||||
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
|
||||
if (p_149646_1_.getBlockState(blockPos) != p_149646_1_.getBlockState(blockPos.add(-side.getFrontOffsetX(), -side.getFrontOffsetY(), -side.getFrontOffsetZ())))
|
||||
if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -53,11 +60,20 @@ public class BlockSpectral extends BlockContainer
|
|||
return false;
|
||||
}
|
||||
|
||||
return block != this && super.shouldSideBeRendered(p_149646_1_, blockPos, side);
|
||||
return block != this && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
|
||||
*/
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
|
@ -70,7 +86,7 @@ public class BlockSpectral extends BlockContainer
|
|||
{
|
||||
if (playerItem.getItem() instanceof ItemBlock)
|
||||
{
|
||||
world.addBlockEvent(blockPos, ((ItemBlock) playerItem.getItem()).getBlock(), playerItem.getItemDamage(), 3);
|
||||
world.setBlock(x, y, z, ((ItemBlock) (playerItem.getItem())).field_150939_a, playerItem.getItemDamage(), 3);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class SpeedRune extends BloodRune
|
||||
{
|
||||
public SpeedRune()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("speedRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SpeedRune");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public class AltarComponent
|
||||
{
|
||||
|
@ -48,11 +47,6 @@ public class AltarComponent
|
|||
{
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public IBlockState getBlockState()
|
||||
{
|
||||
return block.getStateFromMeta(getMetadata());
|
||||
}
|
||||
|
||||
public boolean isBloodRune()
|
||||
{
|
||||
|
|
|
@ -4,28 +4,26 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.IFadedRune;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockBloodRune;
|
||||
import WayofTime.alchemicalWizardry.common.block.BloodRune;
|
||||
|
||||
public class UpgradedAltars
|
||||
{
|
||||
public static List<AltarComponent> secondTierAltar = new ArrayList<AltarComponent>();
|
||||
public static List<AltarComponent> thirdTierAltar = new ArrayList<AltarComponent>();
|
||||
public static List<AltarComponent> fourthTierAltar = new ArrayList<AltarComponent>();
|
||||
public static List<AltarComponent> fifthTierAltar = new ArrayList<AltarComponent>();
|
||||
public static List<AltarComponent> sixthTierAltar = new ArrayList<AltarComponent>();
|
||||
public static List<AltarComponent> secondTierAltar = new ArrayList();
|
||||
public static List<AltarComponent> thirdTierAltar = new ArrayList();
|
||||
public static List<AltarComponent> fourthTierAltar = new ArrayList();
|
||||
public static List<AltarComponent> fifthTierAltar = new ArrayList();
|
||||
public static List<AltarComponent> sixthTierAltar = new ArrayList();
|
||||
public static int highestAltar = 6;
|
||||
|
||||
public static int isAltarValid(World world, BlockPos pos)
|
||||
public static int isAltarValid(World world, int x, int y, int z)
|
||||
{
|
||||
for (int i = highestAltar; i >= 2; i--)
|
||||
{
|
||||
if (checkAltarIsValid(world, pos, i))
|
||||
if (checkAltarIsValid(world, x, y, z, i))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -34,37 +32,144 @@ public class UpgradedAltars
|
|||
return 1;
|
||||
}
|
||||
|
||||
public static boolean checkAltarIsValid(World world, BlockPos pos, int altarTier)
|
||||
public static boolean checkAltarIsValid(World world, int x, int y, int z, int altarTier)
|
||||
{
|
||||
List<AltarComponent> list = UpgradedAltars.getAltarUpgradeListForTier(altarTier);
|
||||
|
||||
for (AltarComponent ac : list)
|
||||
switch (altarTier)
|
||||
{
|
||||
BlockPos newPos = pos.add(ac.getX(), ac.getY(), ac.getZ());
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
if (!(block instanceof BlockBloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
int metadata = block.getMetaFromState(state);
|
||||
case 1:
|
||||
return true;
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(newPos)))
|
||||
case 2:
|
||||
for (AltarComponent ac : secondTierAltar)
|
||||
{
|
||||
return false;
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
for (AltarComponent ac : thirdTierAltar)
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 4:
|
||||
for (AltarComponent ac : fourthTierAltar)
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 5:
|
||||
for (AltarComponent ac : fifthTierAltar)
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 6:
|
||||
for (AltarComponent ac : sixthTierAltar)
|
||||
{
|
||||
if (ac.isBloodRune())
|
||||
{
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (!(testBlock instanceof BloodRune))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int metadata = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static AltarUpgradeComponent getUpgrades(World world, BlockPos pos, int altarTier)
|
||||
public static AltarUpgradeComponent getUpgrades(World world, int x, int y, int z, int altarTier)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
|
@ -75,24 +180,21 @@ public class UpgradedAltars
|
|||
|
||||
for (AltarComponent ac : list)
|
||||
{
|
||||
BlockPos newPos = pos.add(ac.getX(), ac.getY(), ac.getZ());
|
||||
|
||||
if (ac.isUpgradeSlot())
|
||||
{
|
||||
//Currently checks the getRuneEffect.
|
||||
//TODO Change so that it uses the metadata instead, with the BlockID.
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block testBlock = state.getBlock();
|
||||
int meta = testBlock.getMetaFromState(state);
|
||||
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
int meta = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
|
||||
|
||||
if (testBlock instanceof BlockBloodRune)
|
||||
if (testBlock instanceof BloodRune)
|
||||
{
|
||||
if (testBlock instanceof IFadedRune && altarTier > ((IFadedRune)testBlock).getAltarTierLimit(meta))
|
||||
{
|
||||
return UpgradedAltars.getUpgrades(world, pos, ((IFadedRune)testBlock).getAltarTierLimit(meta));
|
||||
return UpgradedAltars.getUpgrades(world, x, y, z, ((IFadedRune)testBlock).getAltarTierLimit(meta));
|
||||
}
|
||||
|
||||
switch (((BlockBloodRune) testBlock).getRuneEffect(meta))
|
||||
switch (((BloodRune) testBlock).getRuneEffect(meta))
|
||||
{
|
||||
case 1:
|
||||
upgrades.addSpeedUpgrade();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,76 @@
|
|||
package WayofTime.alchemicalWizardry.common.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
|
||||
public class CommandBind extends CommandBase
|
||||
{
|
||||
public CommandBind() {}
|
||||
|
||||
public String getCommandName()
|
||||
{
|
||||
return "bind";
|
||||
}
|
||||
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public String getCommandUsage(ICommandSender icommandsender)
|
||||
{
|
||||
return "commands.bind.usage";
|
||||
}
|
||||
|
||||
public void processCommand(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
EntityPlayerMP entityplayermp = getCommandSenderAsPlayer(iCommandSender);
|
||||
ItemStack item = entityplayermp.getCurrentEquippedItem();
|
||||
EntityPlayerMP targetPlayer = getPlayer(iCommandSender, astring[0]);
|
||||
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
throw new CommandException("commands.bind.failed.noPlayer");
|
||||
}
|
||||
|
||||
if (item != null && item.getItem() instanceof IBindable)
|
||||
{
|
||||
if (EnergyItems.getOwnerName(item).isEmpty())
|
||||
{
|
||||
EnergyItems.checkAndSetItemOwner(item, targetPlayer);
|
||||
func_152373_a(iCommandSender, this, "commands.bind.success");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandException("commands.bind.failed.alreadyBound");
|
||||
}
|
||||
}
|
||||
else if (!(item.getItem() instanceof IBindable))
|
||||
{
|
||||
throw new CommandException("commands.bind.failed.notBindable");
|
||||
}
|
||||
}
|
||||
|
||||
public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(astring, this.getPlayer());
|
||||
}
|
||||
|
||||
protected String[] getPlayer()
|
||||
{
|
||||
return MinecraftServer.getServer().getAllUsernames();
|
||||
}
|
||||
|
||||
public boolean isUsernameIndex(String[] astring, int par2)
|
||||
{
|
||||
return par2 == 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
package WayofTime.alchemicalWizardry.common.commands;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandSN extends CommandBase
|
||||
{
|
||||
public CommandSN() {}
|
||||
|
||||
@Override
|
||||
public String getCommandName()
|
||||
{
|
||||
return "soulnetwork";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender icommandsender)
|
||||
{
|
||||
return "commands.soulnetwork.usage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring)
|
||||
{
|
||||
EntityPlayerMP targetPlayer = getPlayer(icommandsender, astring[0]);
|
||||
String owner = targetPlayer.getDisplayName();
|
||||
EntityPlayerMP proxyPlayerName = getPlayer(icommandsender, astring[0]);
|
||||
|
||||
if (astring.length >= 2 && astring.length <= 3)
|
||||
{
|
||||
if ("add".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int amount = parseIntBounded(icommandsender, astring[2], Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, amount, Integer.MAX_VALUE);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.add.success", amount, owner);
|
||||
}
|
||||
else if ("subtract".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int amount = parseIntBounded(icommandsender, astring[2], Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
if (amount > SoulNetworkHandler.getCurrentEssence(owner))
|
||||
{
|
||||
int lp = SoulNetworkHandler.getCurrentEssence(owner);
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, lp);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", SoulNetworkHandler.getCurrentEssence(owner), owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, amount);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", amount, owner);
|
||||
}
|
||||
}
|
||||
else if ("fill".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int amount = Integer.MAX_VALUE - SoulNetworkHandler.getCurrentEssence(owner);
|
||||
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, amount, Integer.MAX_VALUE);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.fill.success", owner);
|
||||
}
|
||||
else if ("empty".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
SoulNetworkHandler.syphonFromNetwork(owner, SoulNetworkHandler.getCurrentEssence(owner));
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.empty.success", owner);
|
||||
}
|
||||
else if ("get".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.get.success", currentEssence, owner);
|
||||
}
|
||||
else if ("fillMax".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
|
||||
int orbTier = SoulNetworkHandler.getCurrentMaxOrb(owner);
|
||||
int maxForOrb = SoulNetworkHandler.getMaximumForOrbTier(orbTier);
|
||||
int fillAmount = maxForOrb - currentEssence;
|
||||
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, fillAmount, fillAmount);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.fillMax.success", owner);
|
||||
}
|
||||
else if ("create".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int orbTier = parseIntBounded(icommandsender, astring[2], 1, 6);
|
||||
SoulNetworkHandler.setMaxOrbToMax(proxyPlayerName.getDisplayName(), orbTier);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.create.success", owner, orbTier);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandException("commands.soulnetwork.notACommand");
|
||||
}
|
||||
}
|
||||
else if (astring.length == 0)
|
||||
{
|
||||
throw new CommandException("commands.soulnetwork.noPlayer");
|
||||
}
|
||||
else if (astring.length == 1)
|
||||
{
|
||||
throw new CommandException("commands.soulnetwork.noCommand");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
if (astring.length == 1)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(astring, this.getPlayer());
|
||||
}
|
||||
else if (astring.length == 2)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(astring, "add", "subtract", "fill", "empty", "get", "fillMax", "create");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String[] getPlayer()
|
||||
{
|
||||
return MinecraftServer.getServer().getAllUsernames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsernameIndex(String[] astring, int par2)
|
||||
{
|
||||
return par2 == 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package WayofTime.alchemicalWizardry.common.commands;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CommandUnbind extends CommandBase
|
||||
{
|
||||
public CommandUnbind() {}
|
||||
|
||||
public String getCommandName()
|
||||
{
|
||||
return "unbind";
|
||||
}
|
||||
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public String getCommandUsage(ICommandSender icommandsender)
|
||||
{
|
||||
return "commands.unbind.usage";
|
||||
}
|
||||
|
||||
public void processCommand(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
EntityPlayerMP entityplayermp = getCommandSenderAsPlayer(iCommandSender);
|
||||
ItemStack item = entityplayermp.getCurrentEquippedItem();
|
||||
|
||||
if (item != null && item.getItem() instanceof IBindable)
|
||||
{
|
||||
if (!EnergyItems.getOwnerName(item).isEmpty())
|
||||
{
|
||||
item.getTagCompound().removeTag("ownerName");
|
||||
func_152373_a(iCommandSender, this, "commands.unbind.success");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandException("commands.unbind.failed.notBindable");
|
||||
}
|
||||
}
|
||||
else if (!(item.getItem() instanceof IBindable))
|
||||
{
|
||||
throw new CommandException("commands.unbind.failed.notBindable");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -231,8 +231,8 @@ public class StorageBlockCraftingManager
|
|||
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable())
|
||||
{
|
||||
Item item = itemstack.getItem();
|
||||
int j1 = item.getMaxDamage() - itemstack.getItemDamage();
|
||||
int k = item.getMaxDamage() - itemstack1.getItemDamage();
|
||||
int j1 = item.getMaxDamage() - itemstack.getItemDamageForDisplay();
|
||||
int k = item.getMaxDamage() - itemstack1.getItemDamageForDisplay();
|
||||
int l = j1 + k + item.getMaxDamage() * 5 / 100;
|
||||
int i1 = item.getMaxDamage() - l;
|
||||
|
||||
|
|
|
@ -14,16 +14,15 @@ import net.minecraft.block.BlockTrapDoor;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.loot.DemonVillageLootRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IBlockPortalNode;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.ITilePortalNode;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
|
||||
public class BlockSet
|
||||
{
|
||||
|
@ -40,7 +39,7 @@ public class BlockSet
|
|||
{
|
||||
this.blockid = blockid;
|
||||
this.metadata = new int[4];
|
||||
positions = new ArrayList<Int3>();
|
||||
positions = new ArrayList();
|
||||
}
|
||||
|
||||
public BlockSet(Block block)
|
||||
|
@ -277,7 +276,7 @@ public class BlockSet
|
|||
return GameRegistry.findBlock(modId, name);
|
||||
}
|
||||
|
||||
public int getMetaForDirection(EnumFacing dir)
|
||||
public int getMetaForDirection(ForgeDirection dir)
|
||||
{
|
||||
if (metadata.length < 4)
|
||||
{
|
||||
|
@ -299,7 +298,7 @@ public class BlockSet
|
|||
}
|
||||
}
|
||||
|
||||
public void buildAtIndex(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, int index, boolean populateInventories, int tier)
|
||||
public void buildAtIndex(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, int index, boolean populateInventories, int tier)
|
||||
{
|
||||
Block block = this.getBlock();
|
||||
if (index >= positions.size() || block == null)
|
||||
|
@ -334,15 +333,14 @@ public class BlockSet
|
|||
default:
|
||||
}
|
||||
|
||||
BlockPos newPos = new BlockPos(xCoord + xOff, yCoord + yOff, zCoord + zOff);
|
||||
world.setBlockState(newPos, block.getStateFromMeta(meta), 3);
|
||||
world.setBlock(xCoord + xOff, yCoord + yOff, zCoord + zOff, block, meta, 3);
|
||||
if(populateInventories)
|
||||
{
|
||||
this.populateIfIInventory(world, newPos, tier);
|
||||
this.populateIfIInventory(world, xCoord + xOff, yCoord + yOff, zCoord + zOff, tier);
|
||||
}
|
||||
if(block instanceof IBlockPortalNode)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(newPos);
|
||||
TileEntity tile = world.getTileEntity(xCoord + xOff, yCoord + yOff, zCoord + zOff);
|
||||
if(tile instanceof ITilePortalNode)
|
||||
{
|
||||
((ITilePortalNode) tile).setPortalLocation(teDemonPortal);
|
||||
|
@ -350,16 +348,16 @@ public class BlockSet
|
|||
}
|
||||
}
|
||||
|
||||
public void populateIfIInventory(World world, BlockPos pos, int tier)
|
||||
public void populateIfIInventory(World world, int x, int y, int z, int tier)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof IInventory)
|
||||
{
|
||||
DemonVillageLootRegistry.populateChest((IInventory)tile, tier);
|
||||
}
|
||||
}
|
||||
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories, int tier)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories, int tier)
|
||||
{
|
||||
for (int i = 0; i < positions.size(); i++)
|
||||
{
|
||||
|
|
|
@ -4,10 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
@ -30,7 +28,7 @@ public class BuildingSchematic
|
|||
public BuildingSchematic(String name)
|
||||
{
|
||||
this.name = name;
|
||||
blockList = new ArrayList<BlockSet>();
|
||||
blockList = new ArrayList();
|
||||
this.doorX = 0;
|
||||
this.doorZ = 0;
|
||||
this.doorY = 0;
|
||||
|
@ -54,7 +52,7 @@ public class BuildingSchematic
|
|||
blockList.add(set);
|
||||
}
|
||||
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories)
|
||||
{
|
||||
for (BlockSet set : blockList)
|
||||
{
|
||||
|
@ -88,9 +86,9 @@ public class BuildingSchematic
|
|||
return new Int3(gridX, doorY, gridZ);
|
||||
}
|
||||
|
||||
public List<Int3> getGriddedPositions(EnumFacing dir)
|
||||
public List<Int3> getGriddedPositions(ForgeDirection dir)
|
||||
{
|
||||
List<Int3> positionList = new ArrayList<Int3>();
|
||||
List<Int3> positionList = new ArrayList();
|
||||
|
||||
for (BlockSet blockSet : blockList)
|
||||
{
|
||||
|
@ -129,7 +127,7 @@ public class BuildingSchematic
|
|||
return positionList;
|
||||
}
|
||||
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
{
|
||||
// GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use the schematic
|
||||
|
||||
|
@ -139,12 +137,10 @@ public class BuildingSchematic
|
|||
{
|
||||
for (Int3 pos : positionList)
|
||||
{
|
||||
BlockPos newPos = new BlockPos(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
|
||||
if (block != ModBlocks.blockDemonPortal)
|
||||
{
|
||||
world.setBlockToAir(newPos);
|
||||
world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
|
@ -30,17 +30,17 @@ public class DemonBuilding
|
|||
return schematic.getName();
|
||||
}
|
||||
|
||||
public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, EnumFacing dir)
|
||||
public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, ForgeDirection dir)
|
||||
{
|
||||
return area.doesContainAll(master, gridX, gridZ, dir);
|
||||
}
|
||||
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, EnumFacing dir, boolean populateInventories)
|
||||
public void buildAll(TEDemonPortal teDemonPortal, World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, boolean populateInventories)
|
||||
{
|
||||
schematic.buildAll(teDemonPortal, world, xCoord, yCoord, zCoord, dir, populateInventories);
|
||||
}
|
||||
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, EnumFacing dir, int type, GridSpaceHolder master)
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
|
||||
{
|
||||
area.setAllGridSpaces(xInit, zInit, yLevel, dir, type, master);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class DemonBuilding
|
|||
return scheme.createGSH();
|
||||
}
|
||||
|
||||
public Int3 getDoorSpace(EnumFacing dir)
|
||||
public Int3 getDoorSpace(ForgeDirection dir)
|
||||
{
|
||||
int x;
|
||||
int z;
|
||||
|
@ -84,7 +84,7 @@ public class DemonBuilding
|
|||
return new Int3(x, doorGridSpace.yCoord, z);
|
||||
}
|
||||
|
||||
public Int3 getGridOffsetFromRoad(EnumFacing sideOfRoad, int yLevel)
|
||||
public Int3 getGridOffsetFromRoad(ForgeDirection sideOfRoad, int yLevel)
|
||||
{
|
||||
Int3 doorSpace = this.getDoorSpace(sideOfRoad);
|
||||
int x = doorSpace.xCoord;
|
||||
|
@ -109,7 +109,7 @@ public class DemonBuilding
|
|||
return new Int3(x, yLevel, z);
|
||||
}
|
||||
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
|
||||
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
{
|
||||
schematic.destroyAllInField(world, xCoord, yCoord, zCoord, dir);
|
||||
}
|
||||
|
|
|
@ -3,11 +3,9 @@ package WayofTime.alchemicalWizardry.common.demonVillage;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.IRoadWard;
|
||||
|
@ -18,19 +16,19 @@ public class DemonVillagePath
|
|||
public int xPos;
|
||||
public int yPos;
|
||||
public int zPos;
|
||||
public EnumFacing dir;
|
||||
public ForgeDirection dir;
|
||||
public int length;
|
||||
|
||||
public static boolean canGoDown = true;
|
||||
public static boolean tunnelIfObstructed = false;
|
||||
public static boolean createBridgeInAirIfObstructed = false;
|
||||
|
||||
public DemonVillagePath(int xi, int yi, int zi, EnumFacing dir2, int length)
|
||||
public DemonVillagePath(int xi, int yi, int zi, ForgeDirection dir, int length)
|
||||
{
|
||||
this.xPos = xi;
|
||||
this.yPos = yi;
|
||||
this.zPos = zi;
|
||||
this.dir = dir2;
|
||||
this.dir = dir;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
|
@ -42,11 +40,11 @@ public class DemonVillagePath
|
|||
int rad = this.getRoadRadius();
|
||||
int value = 0;
|
||||
|
||||
int finalYPos = this.constructPartialPath(portal, world, clearance, xi - rad * dir.getFrontOffsetX(), yi, zi - rad * dir.getFrontOffsetZ(), dir, length + rad, false);
|
||||
int finalYPos = this.constructPartialPath(portal, world, clearance, xi - rad * dir.offsetX, yi, zi - rad * dir.offsetZ, dir, length + rad, false);
|
||||
|
||||
for (int i = -rad; i <= rad; i++)
|
||||
{
|
||||
value = Math.max(this.constructPartialPath(portal, world, clearance, xi - rad * dir.getFrontOffsetX() + i * dir.getFrontOffsetZ(), yi, zi - rad * dir.getFrontOffsetZ() + i * dir.getFrontOffsetX(), dir, length + 2 * rad, true), value);
|
||||
value = Math.max(this.constructPartialPath(portal, world, clearance, xi - rad * dir.offsetX + i * dir.offsetZ, yi, zi - rad * dir.offsetZ + i * dir.offsetX, dir, length + 2 * rad, true), value);
|
||||
if(TEDemonPortal.printDebug)
|
||||
System.out.println("" + (length + 2 * rad) + ", " + value + "");
|
||||
}
|
||||
|
@ -82,12 +80,12 @@ public class DemonVillagePath
|
|||
* @param doConstruct
|
||||
* @return length if doConstruct, yi if !doConstruct
|
||||
*/
|
||||
public int constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, EnumFacing dir, int length, boolean doConstruct)
|
||||
public int constructPartialPath(TEDemonPortal portal, World world, int clearance, int xi, int yi, int zi, ForgeDirection dir, int length, boolean doConstruct)
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
int xOffset = i * dir.getFrontOffsetX();
|
||||
int zOffset = i * dir.getFrontOffsetZ();
|
||||
int xOffset = i * dir.offsetX;
|
||||
int zOffset = i * dir.offsetZ;
|
||||
|
||||
boolean completed = false;
|
||||
|
||||
|
@ -95,19 +93,14 @@ public class DemonVillagePath
|
|||
{
|
||||
int sign = 1;
|
||||
|
||||
BlockPos pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
BlockPos highPos1 = pos1.offsetUp();
|
||||
|
||||
IBlockState state1 = world.getBlockState(pos1);
|
||||
IBlockState highState1 = world.getBlockState(highPos1);
|
||||
Block block1 = state1.getBlock();
|
||||
Block highBlock1 = highState1.getBlock();
|
||||
Block block1 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
Block highBlock1 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
|
||||
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
|
||||
{
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlockState(pos1, portal.getRoadState(), 3);
|
||||
world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
}
|
||||
yi += sign * yOffset;
|
||||
completed = true;
|
||||
|
@ -115,19 +108,14 @@ public class DemonVillagePath
|
|||
} else if(canGoDown)
|
||||
{
|
||||
sign = -1;
|
||||
pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
highPos1 = pos1.offsetUp();
|
||||
|
||||
state1 = world.getBlockState(pos1);
|
||||
highState1 = world.getBlockState(highPos1);
|
||||
block1 = state1.getBlock();
|
||||
highBlock1 = highState1.getBlock();
|
||||
Block block2 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
Block highBlock2 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
|
||||
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
|
||||
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block2)) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
|
||||
{
|
||||
if(doConstruct)
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlockState(pos1, portal.getRoadState(), 3);
|
||||
world.setBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
}
|
||||
yi += sign * yOffset;
|
||||
completed = true;
|
||||
|
@ -141,17 +129,15 @@ public class DemonVillagePath
|
|||
boolean returnAmount = true;
|
||||
if(createBridgeInAirIfObstructed)
|
||||
{
|
||||
BlockPos pos1 = new BlockPos(xi + xOffset, yi, zi + zOffset);
|
||||
IBlockState state1 = world.getBlockState(pos1);
|
||||
Block block1 = state1.getBlock();
|
||||
Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset);
|
||||
|
||||
if (block1.isReplaceable(world, pos1) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
if (block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
{
|
||||
returnAmount = false;
|
||||
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlockState(pos1, portal.getRoadState(), 3);
|
||||
world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
@ -160,20 +146,18 @@ public class DemonVillagePath
|
|||
|
||||
}else if(tunnelIfObstructed)
|
||||
{
|
||||
BlockPos pos1 = new BlockPos(xi + xOffset, yi, zi + zOffset);
|
||||
IBlockState state1 = world.getBlockState(pos1);
|
||||
Block block1 = state1.getBlock();
|
||||
Block block1 = world.getBlock(xi + xOffset, yi, zi + zOffset);
|
||||
|
||||
if (!block1.isReplaceable(world, pos1) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
if (!block1.isReplaceable(world, xi + xOffset, yi, zi + zOffset) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1))
|
||||
{
|
||||
returnAmount = false;
|
||||
|
||||
if(doConstruct)
|
||||
{
|
||||
world.setBlockState(pos1, portal.getRoadState(), 3);
|
||||
world.setBlockToAir(pos1.offsetUp(1));
|
||||
world.setBlockToAir(pos1.offsetUp(2));
|
||||
world.setBlockToAir(pos1.offsetUp(3));
|
||||
world.setBlock(xi + xOffset, yi, zi + zOffset, portal.getRoadBlock(), portal.getRoadMeta(), 3);
|
||||
world.setBlockToAir(xi + xOffset, yi + 1, zi + zOffset);
|
||||
world.setBlockToAir(xi + xOffset, yi + 2, zi + zOffset);
|
||||
world.setBlockToAir(xi + xOffset, yi + 3, zi + zOffset);
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
@ -199,37 +183,27 @@ public class DemonVillagePath
|
|||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
int xOffset = i * dir.getFrontOffsetX();
|
||||
int zOffset = i * dir.getFrontOffsetZ();
|
||||
int xOffset = i * dir.offsetX;
|
||||
int zOffset = i * dir.offsetZ;
|
||||
|
||||
for (int yOffset = 0; yOffset <= clearance; yOffset++)
|
||||
{
|
||||
int sign = 1;
|
||||
|
||||
BlockPos pos1 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
BlockPos highPos1 = pos1.offsetUp();
|
||||
|
||||
IBlockState state1 = world.getBlockState(pos1);
|
||||
IBlockState highState1 = world.getBlockState(highPos1);
|
||||
Block block1 = state1.getBlock();
|
||||
Block highBlock1 = highState1.getBlock();
|
||||
Block block1 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
Block highBlock1 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
|
||||
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, pos1) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, highPos1)))
|
||||
if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
|
||||
{
|
||||
yi += sign * yOffset;
|
||||
break;
|
||||
} else
|
||||
{
|
||||
sign = -1;
|
||||
BlockPos pos2 = new BlockPos(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
BlockPos highPos2 = pos2.offsetUp();
|
||||
|
||||
IBlockState state2 = world.getBlockState(pos2);
|
||||
IBlockState highState2 = world.getBlockState(highPos2);
|
||||
Block block2 = state2.getBlock();
|
||||
Block highBlock2 = highState2.getBlock();
|
||||
Block block2 = world.getBlock(xi + xOffset, yi + sign * yOffset, zi + zOffset);
|
||||
Block highBlock2 = world.getBlock(xi + xOffset, yi + sign * yOffset + 1, zi + zOffset);
|
||||
|
||||
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, pos2) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, highPos2)))
|
||||
if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xi + xOffset, yi + sign * yOffset, zi + zOffset) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xi + xOffset, yi + sign * yOffset + 1, zi + zOffset)))
|
||||
{
|
||||
yi += sign * yOffset;
|
||||
break;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class GridSpaceHolder
|
||||
{
|
||||
|
@ -141,7 +139,7 @@ public class GridSpaceHolder
|
|||
}
|
||||
}
|
||||
|
||||
public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, EnumFacing dir)
|
||||
public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, ForgeDirection dir)
|
||||
{
|
||||
if (master != null)
|
||||
{
|
||||
|
@ -193,7 +191,7 @@ public class GridSpaceHolder
|
|||
return false;
|
||||
}
|
||||
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, EnumFacing dir, int type, GridSpaceHolder master)
|
||||
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
|
||||
{
|
||||
if(TEDemonPortal.printDebug)
|
||||
AlchemicalWizardry.logger.info("Grid space selected: (" + xInit + "," + zInit + ")");
|
||||
|
@ -241,7 +239,7 @@ public class GridSpaceHolder
|
|||
}
|
||||
}
|
||||
|
||||
public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, EnumFacing dir)
|
||||
public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
{
|
||||
for (int i = -negXRadius; i <= posXRadius; i++)
|
||||
{
|
||||
|
@ -280,14 +278,12 @@ public class GridSpaceHolder
|
|||
{
|
||||
for (int m = -2; m <= 2; m++)
|
||||
{
|
||||
BlockPos newPos = new BlockPos(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
Block block = world.getBlock(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
|
||||
if (block == ModBlocks.blockDemonPortal)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
world.setBlockToAir(newPos);
|
||||
world.setBlockToAir(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileBlockSet extends BlockSet
|
||||
{
|
||||
public NBTTagCompound tag;
|
||||
}
|
|
@ -24,6 +24,7 @@ public class EntityAIOccasionalRangedAttack extends EntityAIBase
|
|||
private int maxRangedAttackTime;
|
||||
private float field_96562_i;
|
||||
private float field_82642_h;
|
||||
private static final String __OBFID = "CL_00001609";
|
||||
private double range;
|
||||
|
||||
public EntityAIOccasionalRangedAttack(IOccasionalRangedAttackMob p_i1649_1_, double p_i1649_2_, int p_i1649_4_, float p_i1649_5_, double range)
|
||||
|
@ -109,7 +110,7 @@ public class EntityAIOccasionalRangedAttack extends EntityAIBase
|
|||
*/
|
||||
public void updateTask()
|
||||
{
|
||||
double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.getBoundingBox().minY, this.attackTarget.posZ);
|
||||
double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ);
|
||||
boolean flag = this.entityHost.getEntitySenses().canSee(this.attackTarget);
|
||||
|
||||
if (flag)
|
||||
|
|
|
@ -3,7 +3,7 @@ package WayofTime.alchemicalWizardry.common.demonVillage.ai;
|
|||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
|
||||
|
@ -20,14 +20,14 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
|
|||
@Override
|
||||
public void startExecuting()
|
||||
{
|
||||
BlockPos portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation();
|
||||
Int3 portalPosition = ((IHoardDemon)this.taskOwner).getPortalLocation();
|
||||
if(portalPosition == null)
|
||||
{
|
||||
super.startExecuting();
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition);
|
||||
TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord);
|
||||
|
||||
if((this.taskOwner.getAITarget() instanceof IHoardDemon && portalPosition.equals(((IHoardDemon)this.taskOwner.getAITarget()).getPortalLocation())))
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
|
|||
|
||||
this.taskOwner.setAttackTarget(this.taskOwner.getAITarget());
|
||||
|
||||
if (this.entityCallsForHelp)
|
||||
if (this.entityCallsForHelp && this.taskOwner instanceof IHoardDemon)
|
||||
{
|
||||
|
||||
if(portal instanceof TEDemonPortal)
|
||||
|
@ -45,7 +45,7 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
|
|||
}
|
||||
|
||||
// double d0 = this.getTargetDistance();
|
||||
// List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0));
|
||||
// List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), AxisAlignedBB.getBoundingBox(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0));
|
||||
// Iterator iterator = list.iterator();
|
||||
//
|
||||
// while (iterator.hasNext())
|
||||
|
|
|
@ -5,7 +5,10 @@ import net.minecraft.world.World;
|
|||
|
||||
public abstract class DemonHoardPacket
|
||||
{
|
||||
public DemonHoardPacket() {}
|
||||
public DemonHoardPacket()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.world.World;
|
|||
|
||||
public class DemonPacketRegistry
|
||||
{
|
||||
public static Map<String, DemonHoardPacket> packetMap = new HashMap<String, DemonHoardPacket>();
|
||||
public static Map<String, DemonHoardPacket> packetMap = new HashMap();
|
||||
|
||||
public static boolean registerDemonPacket(String string, DemonHoardPacket packet)
|
||||
{
|
||||
|
|
|
@ -20,11 +20,11 @@ import net.minecraft.item.ItemFood;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggroCloaking;
|
||||
|
@ -34,6 +34,7 @@ import WayofTime.alchemicalWizardry.common.demonVillage.ai.IOccasionalRangedAtta
|
|||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.rituals.LocalStorageAlphaPact;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRangedAttackMob, IHoardDemon
|
||||
|
@ -42,7 +43,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
|
||||
|
||||
private boolean isAngry = true;
|
||||
private BlockPos demonPortal;
|
||||
private Int3 demonPortal;
|
||||
|
||||
private static float maxTamedHealth = 200.0F;
|
||||
private static float maxUntamedHealth = 200.0F;
|
||||
|
@ -53,7 +54,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
super(par1World, AlchemicalWizardry.entityMinorDemonGruntID);
|
||||
this.setSize(0.7F, 1.8F);
|
||||
// this.getNavigator().setAvoidsWater(true);
|
||||
this.getNavigator().setAvoidsWater(true);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, this.aiSit);
|
||||
this.tasks.addTask(3, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
|
||||
|
@ -67,7 +68,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
this.setAggro(false);
|
||||
this.setTamed(false);
|
||||
|
||||
demonPortal = new BlockPos(0,0,0);
|
||||
demonPortal = new Int3(0,0,0);
|
||||
|
||||
if (par1World != null && !par1World.isRemote)
|
||||
{
|
||||
|
@ -127,13 +128,13 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setPortalLocation(BlockPos position)
|
||||
public void setPortalLocation(Int3 position)
|
||||
{
|
||||
this.demonPortal = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getPortalLocation()
|
||||
public Int3 getPortalLocation()
|
||||
{
|
||||
return this.demonPortal;
|
||||
}
|
||||
|
@ -175,25 +176,23 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound tag)
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(tag);
|
||||
tag.setBoolean("Angry", this.isAngry());
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
|
||||
|
||||
tag.setInteger("xCoord", this.demonPortal.getX());
|
||||
tag.setInteger("yCoord", this.demonPortal.getY());
|
||||
tag.setInteger("zCoord", this.demonPortal.getZ());
|
||||
this.demonPortal.writeToNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound tag)
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(tag);
|
||||
this.setAngry(tag.getBoolean("Angry"));
|
||||
this.demonPortal = new BlockPos(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
this.demonPortal = Int3.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
this.setCombatTask();
|
||||
}
|
||||
|
@ -253,7 +252,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
if(!this.enthralled)
|
||||
{
|
||||
TileEntity tile = this.worldObj.getTileEntity(this.demonPortal);
|
||||
TileEntity tile = this.worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord);
|
||||
if(tile instanceof TEDemonPortal)
|
||||
{
|
||||
((TEDemonPortal) tile).enthrallDemon(this);
|
||||
|
@ -262,12 +261,12 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
IMasterRitualStone stone = (IMasterRitualStone)tile;
|
||||
LocalRitualStorage stor = stone.getLocalStorage();
|
||||
// if(stor instanceof LocalStorageAlphaPact)
|
||||
// {
|
||||
// LocalStorageAlphaPact storage = (LocalStorageAlphaPact)stor;
|
||||
//
|
||||
// storage.thrallDemon(this);
|
||||
// }
|
||||
if(stor instanceof LocalStorageAlphaPact)
|
||||
{
|
||||
LocalStorageAlphaPact storage = (LocalStorageAlphaPact)stor;
|
||||
|
||||
storage.thrallDemon(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onUpdate();
|
||||
|
@ -326,7 +325,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.getHealAmount(itemstack));
|
||||
this.heal((float) itemfood.func_150905_g(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
|
@ -344,8 +343,8 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
// this.setPathToEntity(null);
|
||||
// this.setTarget(null);
|
||||
this.setPathToEntity(null);
|
||||
this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
|
@ -368,7 +367,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
// this.setPathToEntity(null);
|
||||
this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
|
@ -501,7 +500,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean thrallDemon(BlockPos location)
|
||||
public boolean thrallDemon(Int3 location)
|
||||
{
|
||||
this.setPortalLocation(location);
|
||||
return true;
|
||||
|
@ -510,9 +509,9 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
|
|||
@Override
|
||||
public boolean isSamePortal(IHoardDemon demon)
|
||||
{
|
||||
BlockPos position = demon.getPortalLocation();
|
||||
TileEntity portal = worldObj.getTileEntity(this.demonPortal);
|
||||
Int3 position = demon.getPortalLocation();
|
||||
TileEntity portal = worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord);
|
||||
|
||||
return portal instanceof TEDemonPortal && portal == worldObj.getTileEntity(position);
|
||||
return portal instanceof TEDemonPortal ? portal == worldObj.getTileEntity(position.xCoord, position.yCoord, position.zCoord) : false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
|
||||
public interface IHoardDemon
|
||||
{
|
||||
void setPortalLocation(BlockPos position);
|
||||
|
||||
BlockPos getPortalLocation();
|
||||
|
||||
boolean thrallDemon(BlockPos location);
|
||||
|
||||
void setPortalLocation(Int3 position);
|
||||
Int3 getPortalLocation();
|
||||
boolean thrallDemon(Int3 location);
|
||||
boolean isSamePortal(IHoardDemon demon);
|
||||
}
|
||||
|
|
|
@ -11,14 +11,14 @@ import WayofTime.alchemicalWizardry.ModItems;
|
|||
|
||||
public class DemonVillageLootRegistry
|
||||
{
|
||||
public static ArrayList<WeightedRandomChestContent> list1 = new ArrayList<WeightedRandomChestContent>();
|
||||
public static ArrayList<WeightedRandomChestContent> list1 = new ArrayList();
|
||||
|
||||
public static void init()
|
||||
{
|
||||
String[] tier1Strings = new String[]{ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.PYRAMID_DESERT_CHEST};
|
||||
for(String str : tier1Strings)
|
||||
{
|
||||
List<WeightedRandomChestContent> contents = ChestGenHooks.getItems(str, new Random());
|
||||
WeightedRandomChestContent[] contents = ChestGenHooks.getItems(str, new Random());
|
||||
if(contents != null)
|
||||
{
|
||||
for(WeightedRandomChestContent content : contents)
|
||||
|
@ -34,6 +34,16 @@ public class DemonVillageLootRegistry
|
|||
|
||||
public static void populateChest(IInventory tile, int tier)
|
||||
{
|
||||
WeightedRandomChestContent.generateChestContents(new Random(), list1, tile, tile.getSizeInventory() / 3);
|
||||
WeightedRandomChestContent.generateChestContents(new Random(), toArray(list1), tile, tile.getSizeInventory() / 3);
|
||||
}
|
||||
|
||||
public static WeightedRandomChestContent[] toArray(List<WeightedRandomChestContent> aList)
|
||||
{
|
||||
int size = aList.size();
|
||||
WeightedRandomChestContent[] contents = new WeightedRandomChestContent[size];
|
||||
|
||||
contents = aList.toArray(contents);
|
||||
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockChest;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
|
||||
|
@ -12,10 +12,15 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
|
|||
public BlockDemonChest()
|
||||
{
|
||||
super(0);
|
||||
this.setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("demonChest");
|
||||
this.setHardness(2.5F).setStepSound(soundTypeWood).setBlockName("demonChest");
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
public IInventory func_149951_m(World world, int x, int y, int z)
|
||||
{
|
||||
return (IInventory)world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
|
@ -23,18 +28,18 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TEDemonChest)
|
||||
{
|
||||
((TEDemonChest) tile).notifyPortalOfInteraction();
|
||||
}
|
||||
super.breakBlock(world, pos, state);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos)
|
||||
public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package WayofTime.alchemicalWizardry.common.demonVillage.tileEntity;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
|
||||
public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
||||
{
|
||||
public BlockPos portalLocation = BlockPos.ORIGIN;
|
||||
public Int3 portalLocation = new Int3(0,0,0);
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "Demon's Chest";
|
||||
}
|
||||
|
@ -21,42 +20,42 @@ public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
|||
{
|
||||
super.readFromNBT(tag);
|
||||
NBTTagCompound portalTag = tag.getCompoundTag("portalLocation");
|
||||
portalLocation = new BlockPos(portalTag.getInteger("xCoord"), portalTag.getInteger("yCoord"), portalTag.getInteger("zCoord"));
|
||||
portalLocation = Int3.readFromNBT(portalTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
NBTTagCompound portalTag = new NBTTagCompound();
|
||||
portalTag.setInteger("xCoord", portalLocation.getX());
|
||||
portalTag.setInteger("yCoord", portalLocation.getY());
|
||||
portalTag.setInteger("zCoord", portalLocation.getZ());
|
||||
NBTTagCompound portalTag = portalLocation.writeToNBT(new NBTTagCompound());
|
||||
tag.setTag("portalLocation", portalTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
public void openInventory()
|
||||
{
|
||||
super.openInventory(player);
|
||||
super.openInventory();
|
||||
this.notifyPortalOfInteraction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkForAdjacentChests() {}
|
||||
public void checkForAdjacentChests()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortalLocation(TEDemonPortal teDemonPortal)
|
||||
{
|
||||
if(teDemonPortal != null)
|
||||
{
|
||||
portalLocation = teDemonPortal.getPos();
|
||||
portalLocation = new Int3(teDemonPortal.xCoord, teDemonPortal.yCoord, teDemonPortal.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public TEDemonPortal getDemonPortal()
|
||||
{
|
||||
TileEntity tile = worldObj.getTileEntity(portalLocation);
|
||||
TileEntity tile = worldObj.getTileEntity(portalLocation.xCoord, portalLocation.yCoord, portalLocation.zCoord);
|
||||
if(tile instanceof TEDemonPortal)
|
||||
{
|
||||
return (TEDemonPortal)tile;
|
||||
|
@ -72,6 +71,6 @@ public class TEDemonChest extends TileEntityChest implements ITilePortalNode
|
|||
return;
|
||||
}
|
||||
|
||||
portal.notifyDemons(pos.getX(), pos.getY(), pos.getZ(), 50);
|
||||
portal.notifyDemons(xCoord, yCoord, zCoord, 50);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Random;
|
|||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -23,11 +22,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.Int3;
|
||||
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
|
||||
|
@ -45,7 +42,7 @@ import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardD
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
||||
public class TEDemonPortal extends TileEntity
|
||||
{
|
||||
public DemonType type = DemonType.FIRE;
|
||||
|
||||
|
@ -66,9 +63,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
|
||||
public static int[] tierCostList = new int[]{1500};
|
||||
|
||||
public Set<IHoardDemon> hoardList = new HashSet<IHoardDemon>();
|
||||
public Set<IHoardDemon> hoardList = new HashSet();
|
||||
|
||||
public static List<DemonBuilding> buildingList = new ArrayList<DemonBuilding>();
|
||||
public static List<DemonBuilding> buildingList = new ArrayList();
|
||||
public Random rand = new Random();
|
||||
private GridSpace[][] area;
|
||||
|
||||
|
@ -88,7 +85,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
public float pointPool;
|
||||
|
||||
public String nextDemonPortalName = "";
|
||||
public EnumFacing nextDemonPortalDirection = EnumFacing.DOWN;
|
||||
public ForgeDirection nextDemonPortalDirection = ForgeDirection.DOWN;
|
||||
|
||||
public int buildingStage = -1;
|
||||
|
||||
|
@ -119,7 +116,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
|
||||
isInitialized = false;
|
||||
|
||||
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, pos.getY()));
|
||||
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, yCoord));
|
||||
|
||||
this.houseCooldown = 0;
|
||||
this.roadCooldown = 0;
|
||||
|
@ -168,7 +165,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
{
|
||||
float totalChance = 0;
|
||||
|
||||
Map<String, Float> map = new HashMap<String, Float>();
|
||||
Map<String, Float> map = new HashMap();
|
||||
map.put("roadChance", this.getRoadChance());
|
||||
map.put("houseChance", this.getHouseChance());
|
||||
map.put("demonPortalChance", this.getDemonPortalChance());
|
||||
|
@ -285,7 +282,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
{
|
||||
if(demon instanceof IHoardDemon)
|
||||
{
|
||||
boolean enthrall = ((IHoardDemon) demon).thrallDemon(pos);
|
||||
boolean enthrall = ((IHoardDemon) demon).thrallDemon(new Int3(this.xCoord, this.yCoord, this.zCoord));
|
||||
if(enthrall)
|
||||
{
|
||||
this.hoardList.add((IHoardDemon)demon);
|
||||
|
@ -309,10 +306,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
{
|
||||
if (Math.abs(xIndex) == 1 || Math.abs(zIndex) == 1)
|
||||
{
|
||||
this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, pos.getY()));
|
||||
this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, yCoord));
|
||||
} else if (xIndex == 0 && zIndex == 0)
|
||||
{
|
||||
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, pos.getY()));
|
||||
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, yCoord));
|
||||
} else
|
||||
{
|
||||
this.setGridSpace(xIndex, zIndex, new GridSpace());
|
||||
|
@ -337,7 +334,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
|
||||
public void createParty()
|
||||
{
|
||||
worldObj.createExplosion(null, pos.getX() + rand.nextInt(10) - rand.nextInt(10), pos.getY(), pos.getZ() + rand.nextInt(10) - rand.nextInt(10), 5*rand.nextFloat(), false);
|
||||
worldObj.createExplosion(null, xCoord + rand.nextInt(10) - rand.nextInt(10), yCoord, zCoord + rand.nextInt(10) - rand.nextInt(10), 5*rand.nextFloat(), false);
|
||||
}
|
||||
|
||||
public void start()
|
||||
|
@ -349,7 +346,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
* Randomly increase one of the cooldowns such that a road, house, or a demon portal tier is caused. Demons are also randomly spawned via this mechanic.
|
||||
*/
|
||||
@Override
|
||||
public void update()
|
||||
public void updateEntity()
|
||||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
|
@ -367,7 +364,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
|
||||
if(delayBeforeParty <= 0)
|
||||
{
|
||||
worldObj.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 15, false);
|
||||
worldObj.createExplosion(null, xCoord, yCoord, zCoord, 15, false);
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
|
@ -496,7 +493,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
|
||||
this.nextDemonPortalName = par1NBTTagCompound.getString("nextDemonPortalName");
|
||||
this.buildingStage = par1NBTTagCompound.getInteger("buildingStage");
|
||||
this.nextDemonPortalDirection = EnumFacing.getFront(par1NBTTagCompound.getInteger("nextDemonPortalDirection"));
|
||||
this.nextDemonPortalDirection = ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection"));
|
||||
|
||||
this.pointPool = par1NBTTagCompound.getFloat("pointPool");
|
||||
this.lockdownTimer = par1NBTTagCompound.getInteger("lockdownTimer");
|
||||
|
@ -556,24 +553,24 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
public int createRandomDemonHoard(TEDemonPortal teDemonPortal, int tier, DemonType type, boolean spawnGuardian)
|
||||
{
|
||||
int next = rand.nextInt(4);
|
||||
EnumFacing dir;
|
||||
ForgeDirection dir;
|
||||
|
||||
switch (next)
|
||||
{
|
||||
case 0:
|
||||
dir = EnumFacing.NORTH;
|
||||
dir = ForgeDirection.NORTH;
|
||||
break;
|
||||
case 1:
|
||||
dir = EnumFacing.SOUTH;
|
||||
dir = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case 2:
|
||||
dir = EnumFacing.EAST;
|
||||
dir = ForgeDirection.EAST;
|
||||
break;
|
||||
case 3:
|
||||
dir = EnumFacing.WEST;
|
||||
dir = ForgeDirection.WEST;
|
||||
break;
|
||||
default:
|
||||
dir = EnumFacing.NORTH;
|
||||
dir = ForgeDirection.NORTH;
|
||||
}
|
||||
|
||||
Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
|
||||
|
@ -585,30 +582,30 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
if(TEDemonPortal.printDebug)
|
||||
System.out.println("Spawning Demons");
|
||||
|
||||
return DemonPacketRegistry.spawnDemons(teDemonPortal, worldObj, pos.getX() + road.xCoord * 5, road.yCoord + 1, pos.getZ() + road.zCoord * 5, type, tier, spawnGuardian);
|
||||
return DemonPacketRegistry.spawnDemons(teDemonPortal, worldObj, xCoord + road.xCoord * 5, road.yCoord + 1, zCoord + road.zCoord * 5, type, tier, spawnGuardian);
|
||||
}
|
||||
|
||||
public int createRandomRoad() //Return the number of road spaces
|
||||
{
|
||||
int next = rand.nextInt(4);
|
||||
EnumFacing dir;
|
||||
ForgeDirection dir;
|
||||
|
||||
switch (next)
|
||||
{
|
||||
case 0:
|
||||
dir = EnumFacing.NORTH;
|
||||
dir = ForgeDirection.NORTH;
|
||||
break;
|
||||
case 1:
|
||||
dir = EnumFacing.SOUTH;
|
||||
dir = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case 2:
|
||||
dir = EnumFacing.EAST;
|
||||
dir = ForgeDirection.EAST;
|
||||
break;
|
||||
case 3:
|
||||
dir = EnumFacing.WEST;
|
||||
dir = ForgeDirection.WEST;
|
||||
break;
|
||||
default:
|
||||
dir = EnumFacing.NORTH;
|
||||
dir = ForgeDirection.NORTH;
|
||||
}
|
||||
|
||||
Int3 road = findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1);
|
||||
|
@ -620,7 +617,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
if(printDebug)
|
||||
AlchemicalWizardry.logger.info("X: " + x + " Z: " + z + " Direction: " + dir.toString());
|
||||
|
||||
List<EnumFacing> directions = this.findValidExtentionDirection(x, z);
|
||||
List<ForgeDirection> directions = this.findValidExtentionDirection(x, z);
|
||||
|
||||
if (directions.size() <= 0)
|
||||
{
|
||||
|
@ -630,9 +627,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
int maxDistance = 5;
|
||||
|
||||
int distance = 0;
|
||||
EnumFacing dominantDirection = null;
|
||||
ForgeDirection dominantDirection = null;
|
||||
|
||||
for (EnumFacing direction : directions)
|
||||
for (ForgeDirection direction : directions)
|
||||
{
|
||||
int amt = this.getLength(direction, maxDistance, x, z);
|
||||
if (amt > distance)
|
||||
|
@ -659,9 +656,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return distance;
|
||||
}
|
||||
|
||||
public List<EnumFacing> findValidExtentionDirection(int x, int z)
|
||||
public List<ForgeDirection> findValidExtentionDirection(int x, int z)
|
||||
{
|
||||
List<EnumFacing> directions = new LinkedList<EnumFacing>();
|
||||
List<ForgeDirection> directions = new LinkedList();
|
||||
|
||||
if (this.getGridSpace(x, z) == null || !this.getGridSpace(x, z).isRoadSegment())
|
||||
{
|
||||
|
@ -671,41 +668,41 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
GridSpace nextGrid = this.getGridSpace(x + 1, z);
|
||||
if (nextGrid.isEmpty())
|
||||
{
|
||||
directions.add(EnumFacing.EAST);
|
||||
directions.add(ForgeDirection.EAST);
|
||||
}
|
||||
|
||||
nextGrid = this.getGridSpace(x - 1, z);
|
||||
if (nextGrid.isEmpty())
|
||||
{
|
||||
directions.add(EnumFacing.WEST);
|
||||
directions.add(ForgeDirection.WEST);
|
||||
}
|
||||
|
||||
nextGrid = this.getGridSpace(x, z + 1);
|
||||
if (nextGrid.isEmpty())
|
||||
{
|
||||
directions.add(EnumFacing.SOUTH);
|
||||
directions.add(ForgeDirection.SOUTH);
|
||||
}
|
||||
|
||||
nextGrid = this.getGridSpace(x, z - 1);
|
||||
if (nextGrid.isEmpty())
|
||||
{
|
||||
directions.add(EnumFacing.NORTH);
|
||||
directions.add(ForgeDirection.NORTH);
|
||||
}
|
||||
|
||||
return directions;
|
||||
}
|
||||
|
||||
public int getLength(EnumFacing dir, int maxLength, int x, int z) //Number of spaces forward
|
||||
public int getLength(ForgeDirection dir, int maxLength, int x, int z) //Number of spaces forward
|
||||
{
|
||||
for (int i = 1; i <= maxLength; i++)
|
||||
{
|
||||
GridSpace space = this.getGridSpace(x + i * dir.getFrontOffsetX(), z + i * dir.getFrontOffsetZ());
|
||||
GridSpace space = this.getGridSpace(x + i * dir.offsetX, z + i * dir.offsetZ);
|
||||
if (space.isEmpty())
|
||||
{
|
||||
for (int k = 1; k <= this.getRoadSpacer(); k++)
|
||||
{
|
||||
GridSpace space1 = this.getGridSpace(x + i * dir.getFrontOffsetX() + dir.getFrontOffsetZ() * k, z + i * dir.getFrontOffsetZ() + dir.getFrontOffsetX() * k);
|
||||
GridSpace space2 = this.getGridSpace(x + i * dir.getFrontOffsetX() - dir.getFrontOffsetZ() * k, z + i * dir.getFrontOffsetZ() - dir.getFrontOffsetX() * k);
|
||||
GridSpace space1 = this.getGridSpace(x + i * dir.offsetX + dir.offsetZ * k, z + i * dir.offsetZ + dir.offsetX * k);
|
||||
GridSpace space2 = this.getGridSpace(x + i * dir.offsetX - dir.offsetZ * k, z + i * dir.offsetZ - dir.offsetX * k);
|
||||
|
||||
if (space1.isRoadSegment() || space2.isRoadSegment())
|
||||
{
|
||||
|
@ -726,10 +723,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return maxLength;
|
||||
}
|
||||
|
||||
public Int3 findRoadSpaceFromDirection(EnumFacing dir, int amount) //TODO
|
||||
public Int3 findRoadSpaceFromDirection(ForgeDirection dir, int amount) //TODO
|
||||
{
|
||||
int index = 0;
|
||||
if (dir == EnumFacing.NORTH)
|
||||
if (dir == ForgeDirection.NORTH)
|
||||
{
|
||||
if(printDebug)
|
||||
System.out.print("NORTH!");
|
||||
|
@ -748,7 +745,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.SOUTH)
|
||||
} else if (dir == ForgeDirection.SOUTH)
|
||||
{
|
||||
for (int i = negZRadius + Math.min(posZRadius, limit); i >= Math.max(0, -limit + negZRadius); i--)
|
||||
{
|
||||
|
@ -765,7 +762,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.EAST)
|
||||
} else if (dir == ForgeDirection.EAST)
|
||||
{
|
||||
for (int i = negXRadius + Math.min(posXRadius, limit); i >= Math.max(0, -limit + negXRadius); i--)
|
||||
{
|
||||
|
@ -782,7 +779,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.WEST)
|
||||
} else if (dir == ForgeDirection.WEST)
|
||||
{
|
||||
for (int i = Math.max(0, -limit + negXRadius); i <= negXRadius + Math.min(posXRadius, limit); i++)
|
||||
{
|
||||
|
@ -804,10 +801,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return new Int3(0, 0, 0);
|
||||
}
|
||||
|
||||
public Int3 findEmptySpaceNearRoad(EnumFacing dir, int amount, int closeness)
|
||||
public Int3 findEmptySpaceNearRoad(ForgeDirection dir, int amount, int closeness)
|
||||
{
|
||||
int index = 0;
|
||||
if (dir == EnumFacing.NORTH)
|
||||
if (dir == ForgeDirection.NORTH)
|
||||
{
|
||||
if(printDebug)
|
||||
System.out.print("NORTH!");
|
||||
|
@ -831,7 +828,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.SOUTH)
|
||||
} else if (dir == ForgeDirection.SOUTH)
|
||||
{
|
||||
for (int i = negZRadius + posZRadius; i >= 0; i--)
|
||||
{
|
||||
|
@ -853,7 +850,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.EAST)
|
||||
} else if (dir == ForgeDirection.EAST)
|
||||
{
|
||||
for (int i = negXRadius + posXRadius; i >= 0; i--)
|
||||
{
|
||||
|
@ -875,7 +872,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.WEST)
|
||||
} else if (dir == ForgeDirection.WEST)
|
||||
{
|
||||
for (int i = 0; i <= negXRadius + posXRadius; i++)
|
||||
{
|
||||
|
@ -902,10 +899,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return new Int3(0, 0, 0);
|
||||
}
|
||||
|
||||
public Int3 findEmptySpaceFromDirection(EnumFacing dir, int amount)
|
||||
public Int3 findEmptySpaceFromDirection(ForgeDirection dir, int amount)
|
||||
{
|
||||
int index = 0;
|
||||
if (dir == EnumFacing.NORTH)
|
||||
if (dir == ForgeDirection.NORTH)
|
||||
{
|
||||
if(printDebug)
|
||||
System.out.print("NORTH!");
|
||||
|
@ -924,7 +921,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.SOUTH)
|
||||
} else if (dir == ForgeDirection.SOUTH)
|
||||
{
|
||||
for (int i = negZRadius + posZRadius; i >= 0; i--)
|
||||
{
|
||||
|
@ -941,7 +938,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.EAST)
|
||||
} else if (dir == ForgeDirection.EAST)
|
||||
{
|
||||
for (int i = negXRadius + posXRadius; i >= 0; i--)
|
||||
{
|
||||
|
@ -958,7 +955,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (dir == EnumFacing.WEST)
|
||||
} else if (dir == ForgeDirection.WEST)
|
||||
{
|
||||
for (int i = 0; i <= negXRadius + posXRadius; i++)
|
||||
{
|
||||
|
@ -980,7 +977,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return new Int3(0, 0, 0);
|
||||
}
|
||||
|
||||
public int createGriddedRoad(int gridXi, int yi, int gridZi, EnumFacing dir, int gridLength, boolean convertStarter) //Total grid length
|
||||
public int createGriddedRoad(int gridXi, int yi, int gridZi, ForgeDirection dir, int gridLength, boolean convertStarter) //Total grid length
|
||||
{
|
||||
if (gridLength == 0 || gridLength == 1)
|
||||
{
|
||||
|
@ -995,13 +992,13 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
{
|
||||
this.setGridSpace(initGridX, initGridZ, new GridSpace(GridSpace.CROSSROAD, initY));
|
||||
|
||||
DemonCrosspath crosspath = new DemonCrosspath(pos.getX() + initGridX * 5, initY, pos.getZ() + initGridZ * 5);
|
||||
DemonCrosspath crosspath = new DemonCrosspath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5);
|
||||
crosspath.createCrosspath(worldObj);
|
||||
}
|
||||
|
||||
for (int index = 0; index < gridLength - 1; index++)
|
||||
{
|
||||
DemonVillagePath path = new DemonVillagePath(pos.getX() + initGridX * 5, initY, pos.getZ() + initGridZ * 5, dir, 6);
|
||||
DemonVillagePath path = new DemonVillagePath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5, dir, 6);
|
||||
|
||||
Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance());
|
||||
Int3 next = temp.coords;
|
||||
|
@ -1018,8 +1015,8 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return index;
|
||||
}
|
||||
|
||||
initGridX += dir.getFrontOffsetX();
|
||||
initGridZ += dir.getFrontOffsetZ();
|
||||
initGridX += dir.offsetX;
|
||||
initGridZ += dir.offsetZ;
|
||||
|
||||
if (!this.getGridSpace(initGridX, initGridZ).isRoadSegment())
|
||||
{
|
||||
|
@ -1160,10 +1157,10 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
//
|
||||
// this.initialize();
|
||||
//
|
||||
// if (EnumFacing.getOrientation(side) == EnumFacing.UP)
|
||||
// if (ForgeDirection.getOrientation(side) == ForgeDirection.UP)
|
||||
// {
|
||||
// this.createRandomBuilding(DemonBuilding.BUILDING_HOUSE, 0);
|
||||
// } else if (EnumFacing.getOrientation(side) == EnumFacing.DOWN)
|
||||
// } else if (ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
// {
|
||||
// this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, 0);
|
||||
// } else
|
||||
|
@ -1197,11 +1194,11 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
|
||||
// GridSpaceHolder grid = this.createGSH();
|
||||
|
||||
List<EnumFacing> directions = new ArrayList<EnumFacing>();
|
||||
List<ForgeDirection> directions = new ArrayList();
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
EnumFacing testDir = EnumFacing.getFront(i);
|
||||
ForgeDirection testDir = ForgeDirection.getOrientation(i);
|
||||
directions.add(testDir);
|
||||
}
|
||||
|
||||
|
@ -1210,9 +1207,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return 0;
|
||||
}
|
||||
|
||||
HashMap<EnumFacing, List<DemonBuilding>> schemMap = new HashMap<EnumFacing, List<DemonBuilding>>();
|
||||
HashMap<ForgeDirection, List<DemonBuilding>> schemMap = new HashMap();
|
||||
|
||||
for (EnumFacing nextDir : directions)
|
||||
for (ForgeDirection nextDir : directions)
|
||||
{
|
||||
for (DemonBuilding build : TEDemonPortal.buildingList)
|
||||
{
|
||||
|
@ -1226,7 +1223,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
schemMap.get(nextDir).add(build);
|
||||
} else
|
||||
{
|
||||
schemMap.put(nextDir, new ArrayList<DemonBuilding>());
|
||||
schemMap.put(nextDir, new ArrayList());
|
||||
schemMap.get(nextDir).add(build);
|
||||
}
|
||||
}
|
||||
|
@ -1237,7 +1234,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return 0;
|
||||
}
|
||||
|
||||
EnumFacing chosenDirection = (EnumFacing) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
DemonBuilding build = schemMap.get(chosenDirection).get(new Random().nextInt(schemMap.get(chosenDirection).size()));
|
||||
// Int3 portalSpace = build.getDoorSpace(chosenDirection);
|
||||
|
||||
|
@ -1279,7 +1276,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
|
||||
GridSpaceHolder grid = this.createGSH();
|
||||
|
||||
EnumFacing chosenDirection = this.nextDemonPortalDirection;
|
||||
ForgeDirection chosenDirection = this.nextDemonPortalDirection;
|
||||
Int3 portalSpace = build.getDoorSpace(chosenDirection);
|
||||
int yOffset = portalSpace.yCoord;
|
||||
|
||||
|
@ -1291,9 +1288,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
|
||||
case 1:
|
||||
int yDestination = yLevel + yOffset;
|
||||
if(pos.getY() != yDestination)
|
||||
if(yCoord != yDestination)
|
||||
{
|
||||
BlockTeleposer.swapBlocks(this, worldObj, worldObj, pos, new BlockPos(pos.getX(), yDestination, pos.getZ()));
|
||||
BlockTeleposer.swapBlocks(this, worldObj, worldObj, xCoord, yCoord, zCoord, xCoord, yDestination, zCoord);
|
||||
}else
|
||||
{
|
||||
//Nuthin - just as a reminder that we can now increment properly
|
||||
|
@ -1301,9 +1298,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
break;
|
||||
|
||||
case 2:
|
||||
build.destroyAllInField(worldObj, pos.getX() + (x) * 5, yLevel, pos.getZ() + (z) * 5, chosenDirection.getOpposite());
|
||||
build.destroyAllInField(worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite());
|
||||
|
||||
build.buildAll(this, worldObj, pos.getX() + (x) * 5, yLevel, pos.getZ() + (z) * 5, chosenDirection.getOpposite(), true);
|
||||
build.buildAll(this, worldObj, xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection.getOpposite(), true);
|
||||
build.setAllGridSpaces(x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid);
|
||||
this.loadGSH(grid);
|
||||
break;
|
||||
|
@ -1317,24 +1314,24 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
public int createRandomHouse(int buildingTier)
|
||||
{
|
||||
int next = rand.nextInt(4);
|
||||
EnumFacing dir;
|
||||
ForgeDirection dir;
|
||||
|
||||
switch (next)
|
||||
{
|
||||
case 0:
|
||||
dir = EnumFacing.NORTH;
|
||||
dir = ForgeDirection.NORTH;
|
||||
break;
|
||||
case 1:
|
||||
dir = EnumFacing.SOUTH;
|
||||
dir = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case 2:
|
||||
dir = EnumFacing.EAST;
|
||||
dir = ForgeDirection.EAST;
|
||||
break;
|
||||
case 3:
|
||||
dir = EnumFacing.WEST;
|
||||
dir = ForgeDirection.WEST;
|
||||
break;
|
||||
default:
|
||||
dir = EnumFacing.NORTH;
|
||||
dir = ForgeDirection.NORTH;
|
||||
}
|
||||
|
||||
Int3 space = this.findRoadSpaceFromDirection(dir, (rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius)) + 1); // Second: 1 *
|
||||
|
@ -1353,12 +1350,12 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return 0;
|
||||
}
|
||||
|
||||
List<EnumFacing> directions = new ArrayList<EnumFacing>();
|
||||
List<ForgeDirection> directions = new ArrayList();
|
||||
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
EnumFacing testDir = EnumFacing.getFront(i);
|
||||
if (this.getGridSpace(x + testDir.getFrontOffsetX(), z + testDir.getFrontOffsetZ()).isEmpty())
|
||||
ForgeDirection testDir = ForgeDirection.getOrientation(i);
|
||||
if (this.getGridSpace(x + testDir.offsetX, z + testDir.offsetZ).isEmpty())
|
||||
{
|
||||
directions.add(testDir);
|
||||
}
|
||||
|
@ -1369,9 +1366,9 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return 0;
|
||||
}
|
||||
|
||||
HashMap<EnumFacing, List<DemonBuilding>> schemMap = new HashMap<EnumFacing, List<DemonBuilding>>();
|
||||
HashMap<ForgeDirection, List<DemonBuilding>> schemMap = new HashMap();
|
||||
|
||||
for (EnumFacing nextDir : directions)
|
||||
for (ForgeDirection nextDir : directions)
|
||||
{
|
||||
for (DemonBuilding build : TEDemonPortal.buildingList)
|
||||
{
|
||||
|
@ -1390,7 +1387,7 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
schemMap.get(nextDir).add(build);
|
||||
} else
|
||||
{
|
||||
schemMap.put(nextDir, new ArrayList<DemonBuilding>());
|
||||
schemMap.put(nextDir, new ArrayList());
|
||||
schemMap.get(nextDir).add(build);
|
||||
}
|
||||
} else
|
||||
|
@ -1406,18 +1403,22 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return 0;
|
||||
}
|
||||
|
||||
EnumFacing chosenDirection = (EnumFacing) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())];
|
||||
DemonBuilding build = schemMap.get(chosenDirection).get(new Random().nextInt(schemMap.get(chosenDirection).size()));
|
||||
|
||||
Int3 offsetSpace = build.getGridOffsetFromRoad(chosenDirection, yLevel);
|
||||
int xOff = offsetSpace.xCoord;
|
||||
int zOff = offsetSpace.zCoord;
|
||||
|
||||
build.destroyAllInField(worldObj, pos.getX() + (x + xOff) * 5, yLevel, pos.getZ() + (z + zOff) * 5, chosenDirection.getOpposite());
|
||||
build.buildAll(this, worldObj, pos.getX() + (x + xOff) * 5, yLevel, pos.getZ() + (z + zOff) * 5, chosenDirection.getOpposite(), true);
|
||||
build.destroyAllInField(worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite());
|
||||
build.buildAll(this, worldObj, xCoord + (x + xOff) * 5, yLevel, zCoord + (z + zOff) * 5, chosenDirection.getOpposite(), true);
|
||||
build.setAllGridSpaces(x + xOff, z + zOff, yLevel, chosenDirection.getOpposite(), GridSpace.HOUSE, grid);
|
||||
this.loadGSH(grid);
|
||||
|
||||
DemonVillagePath path = new DemonVillagePath(xCoord + (x) * 5, yLevel, zCoord + (z) * 5, chosenDirection, 2);
|
||||
|
||||
Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance());
|
||||
|
||||
return build.getNumberOfGridSpaces();
|
||||
}
|
||||
|
||||
|
@ -1445,9 +1446,14 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
return -1;
|
||||
}
|
||||
|
||||
public void createRoad(int xi, int yi, int zi, EnumFacing dir, int length, boolean doesNotDrop)
|
||||
public void createRoad(int xi, int yi, int zi, ForgeDirection dir, int length, boolean doesNotDrop)
|
||||
{
|
||||
if (dir.getFrontOffsetY() != 0)
|
||||
int curX = xi;
|
||||
int curY = yi;
|
||||
int curZ = zi;
|
||||
int roadRadius = this.getRoadRadius();
|
||||
|
||||
if (dir.offsetY != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1489,11 +1495,6 @@ public class TEDemonPortal extends TileEntity implements IUpdatePlayerListBox
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public IBlockState getRoadState()
|
||||
{
|
||||
return getRoadBlock().getStateFromMeta(getRoadMeta());
|
||||
}
|
||||
|
||||
public int getRoadStepClearance()
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BookEntityItem extends EntityItem
|
|||
public BookEntityItem(World world, Entity original, ItemStack stack)
|
||||
{
|
||||
this(world, original.posX, original.posY, original.posZ);
|
||||
this.setDefaultPickupDelay();
|
||||
this.delayBeforeCanPickup = 20;
|
||||
this.motionX = original.motionX;
|
||||
this.motionY = original.motionY;
|
||||
this.motionZ = original.motionZ;
|
||||
|
|
|
@ -1,29 +1,34 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.mob;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIFollowOwner;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.pathfinding.PathNavigateGround;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.*;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBileDemon extends EntityDemon
|
||||
{
|
||||
private static float maxTamedHealth = 100.0F;
|
||||
private static float maxUntamedHealth = 200.0F;
|
||||
private int attackTimer;
|
||||
|
||||
public EntityBileDemon(World par1World)
|
||||
{
|
||||
super(par1World, AlchemicalWizardry.entityBileDemonID);
|
||||
maxTamedHealth = 100.0F;
|
||||
maxUntamedHealth = 200.0F;
|
||||
this.setSize(1.3F, 2.0F);
|
||||
((PathNavigateGround)this.getNavigator()).func_179690_a(true);
|
||||
this.getNavigator().setAvoidsWater(true);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAIAttackOnCollide(this, 1.0D, true));
|
||||
this.tasks.addTask(3, this.aiSit);
|
||||
|
@ -36,7 +41,6 @@ public class EntityBileDemon extends EntityDemon
|
|||
this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
|
||||
this.setTamed(false);
|
||||
attackTimer = 0;
|
||||
this.applyEntityAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,4 +61,338 @@ public class EntityBileDemon extends EntityDemon
|
|||
|
||||
//this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(10.0D);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the newer Entity AI code should be run
|
||||
*/
|
||||
public boolean isAIEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active target the Task system uses for tracking
|
||||
*/
|
||||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
protected void updateAITick()
|
||||
{
|
||||
this.dataWatcher.updateObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
//this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays step sound at given x, y, z for the entity
|
||||
*/
|
||||
protected void playStepSound(int par1, int par2, int par3, int par4)
|
||||
{
|
||||
this.playSound("mob.zombie.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
|
||||
par1NBTTagCompound.setByte("attackTimer", (byte) attackTimer);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
attackTimer = par1NBTTagCompound.getByte("attackTimer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes while it's alive.
|
||||
*/
|
||||
protected String getLivingSound()
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.irongolem.hit";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
protected String getDeathSound()
|
||||
{
|
||||
return "mob.irongolem.death";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
protected float getSoundVolume()
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
|
||||
* use this to react to sunlight and start to burn.
|
||||
*/
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
|
||||
if (attackTimer > 0)
|
||||
{
|
||||
attackTimer--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.8F;
|
||||
}
|
||||
|
||||
/**
|
||||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
*/
|
||||
public int getVerticalFaceSpeed()
|
||||
{
|
||||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
{
|
||||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
this.attackTimer = 10;
|
||||
this.worldObj.setEntityState(this, (byte) 4);
|
||||
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15)));
|
||||
|
||||
if (flag)
|
||||
{
|
||||
par1Entity.motionY += 0.4000000059604645D;
|
||||
}
|
||||
|
||||
this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
@Override
|
||||
public boolean interact(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
|
||||
|
||||
if (this.isTamed())
|
||||
{
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.getItem() instanceof ItemFood)
|
||||
{
|
||||
ItemFood itemfood = (ItemFood) itemstack.getItem();
|
||||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth)
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.func_150905_g(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
this.setPathToEntity(null);
|
||||
this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
|
||||
this.playTameEffect(true);
|
||||
this.worldObj.setEntityState(this, (byte) 7);
|
||||
} else
|
||||
{
|
||||
this.playTameEffect(false);
|
||||
this.worldObj.setEntityState(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
protected boolean canDespawn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
|
||||
{
|
||||
if (par1EntityLivingBase instanceof EntityBileDemon)
|
||||
{
|
||||
EntityBileDemon entitywolf = (EntityBileDemon) par1EntityLivingBase;
|
||||
|
||||
if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,31 +1,37 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.mob;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIFollowOwner;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILeapAtTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.pathfinding.PathNavigateGround;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.*;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBoulderFist extends EntityDemon
|
||||
{
|
||||
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
|
||||
|
||||
private static float maxTamedHealth = 60.0F;
|
||||
private static float maxUntamedHealth = 50.0F;
|
||||
|
||||
public EntityBoulderFist(World par1World)
|
||||
{
|
||||
super(par1World, AlchemicalWizardry.entityBoulderFistID);
|
||||
this.setSize(0.8F, 1.2F);
|
||||
((PathNavigateGround)this.getNavigator()).func_179690_a(true);
|
||||
this.getNavigator().setAvoidsWater(true);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, this.aiSit);
|
||||
this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
|
||||
|
@ -53,8 +59,6 @@ public class EntityBoulderFist extends EntityDemon
|
|||
super.applyEntityAttributes();
|
||||
//This line affects the speed of the monster
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
|
||||
float maxTamedHealth = 60.0F;
|
||||
float maxUntamedHealth = 50.0F;
|
||||
|
||||
//My guess is that this will alter the max health
|
||||
if (this.isTamed())
|
||||
|
@ -66,6 +70,334 @@ public class EntityBoulderFist extends EntityDemon
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the newer Entity AI code should be run
|
||||
*/
|
||||
public boolean isAIEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active target the Task system uses for tracking
|
||||
*/
|
||||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
protected void updateAITick()
|
||||
{
|
||||
this.dataWatcher.updateObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays step sound at given x, y, z for the entity
|
||||
*/
|
||||
protected void playStepSound(int par1, int par2, int par3, int par4)
|
||||
{
|
||||
this.playSound("mob.zombie.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
this.setCombatTask();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes while it's alive.
|
||||
*/
|
||||
protected String getLivingSound()
|
||||
{
|
||||
//TODO change sounds
|
||||
return this.isAngry() ? "mob.wolf.growl" : (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.wolf.hurt";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
protected String getDeathSound()
|
||||
{
|
||||
return "mob.wolf.death";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
protected float getSoundVolume()
|
||||
{
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
|
||||
* use this to react to sunlight and start to burn.
|
||||
*/
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.8F;
|
||||
}
|
||||
|
||||
/**
|
||||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
*/
|
||||
public int getVerticalFaceSpeed()
|
||||
{
|
||||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
{
|
||||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 6 : 7;
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
@Override
|
||||
public boolean interact(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
|
||||
|
||||
if (this.isTamed())
|
||||
{
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.getItem() instanceof ItemFood)
|
||||
{
|
||||
ItemFood itemfood = (ItemFood) itemstack.getItem();
|
||||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth)
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.func_150905_g(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
this.setPathToEntity(null);
|
||||
this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
|
||||
this.playTameEffect(true);
|
||||
this.worldObj.setEntityState(this, (byte) 7);
|
||||
} else
|
||||
{
|
||||
this.playTameEffect(false);
|
||||
this.worldObj.setEntityState(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
protected boolean canDespawn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
|
||||
{
|
||||
if (par1EntityLivingBase instanceof EntityBoulderFist)
|
||||
{
|
||||
EntityBoulderFist entitywolf = (EntityBoulderFist) par1EntityLivingBase;
|
||||
|
||||
if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attack the specified entity using a ranged attack.
|
||||
*/
|
||||
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 5, 600);
|
||||
this.worldObj.spawnEntityInWorld(hol);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets this entity's combat AI.
|
||||
*/
|
||||
|
|
|
@ -1,35 +1,21 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.mob;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.IDemon;
|
||||
import WayofTime.alchemicalWizardry.common.items.DemonCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.items.DemonPlacer;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class EntityDemon extends EntityTameable implements IDemon
|
||||
{
|
||||
protected boolean isAggro;
|
||||
protected String demonID;
|
||||
|
||||
protected float maxTamedHealth = 100.0F;
|
||||
protected float maxUntamedHealth = 200.0F;
|
||||
protected int attackTimer;
|
||||
private boolean isAggro;
|
||||
private String demonID;
|
||||
|
||||
protected boolean dropCrystal = true;
|
||||
|
||||
|
@ -75,15 +61,13 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
|
||||
tag.setBoolean("dropCrystal", this.getDoesDropCrystal());
|
||||
tag.setBoolean("isAggro", isAggro);
|
||||
tag.setString("demonID", demonID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,8 +76,6 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
super.readFromNBT(tag);
|
||||
|
||||
this.setDropCrystal(tag.getBoolean("dropCrystal"));
|
||||
isAggro = tag.getBoolean("isAggro");
|
||||
demonID = tag.getString("demonID");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,14 +85,14 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
{
|
||||
ItemStack drop = new ItemStack(ModItems.demonPlacer);
|
||||
|
||||
DemonCrystal.setDemonString(drop, this.getDemonID());
|
||||
DemonPlacer.setDemonString(drop, this.getDemonID());
|
||||
|
||||
if ((this.getOwner() instanceof EntityPlayer))
|
||||
{
|
||||
DemonCrystal.setOwnerName(drop, SpellHelper.getUsername((EntityPlayer) this.getOwner()));
|
||||
DemonPlacer.setOwnerName(drop, SpellHelper.getUsername((EntityPlayer) this.getOwner()));
|
||||
}
|
||||
|
||||
if (this.hasCustomName())
|
||||
if (this.hasCustomNameTag())
|
||||
{
|
||||
drop.setStackDisplayName(this.getCustomNameTag());
|
||||
}
|
||||
|
@ -156,368 +138,4 @@ public class EntityDemon extends EntityTameable implements IDemon
|
|||
{
|
||||
this.demonID = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the newer Entity AI code should be run
|
||||
*/
|
||||
public boolean isAIEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active target the Task system uses for tracking
|
||||
*/
|
||||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
protected void updateAITick()
|
||||
{
|
||||
this.dataWatcher.updateObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
this.dataWatcher.addObject(19, 0);
|
||||
//this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays step sound at given x, y, z for the entity
|
||||
*/
|
||||
protected void playStepSound(int par1, int par2, int par3, int par4)
|
||||
{
|
||||
this.playSound("mob.zombie.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
|
||||
par1NBTTagCompound.setByte("attackTimer", (byte) attackTimer);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
attackTimer = par1NBTTagCompound.getByte("attackTimer");
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the sound this mob makes while it's alive.
|
||||
*/
|
||||
protected String getLivingSound()
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.irongolem.hit";
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
protected String getDeathSound()
|
||||
{
|
||||
return "mob.irongolem.death";
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
protected float getSoundVolume()
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the item ID for the item the mob drops on death.
|
||||
*/
|
||||
protected int getDropItemId()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getAttackTimer()
|
||||
{
|
||||
return attackTimer;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.8F;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
*/
|
||||
public int getVerticalFaceSpeed()
|
||||
{
|
||||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
// if (this.isEntityInvulnerable())
|
||||
// {
|
||||
// return false;
|
||||
// } else
|
||||
{
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
{
|
||||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
this.attackTimer = 10;
|
||||
this.worldObj.setEntityState(this, (byte) 4);
|
||||
boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15)));
|
||||
|
||||
if (flag)
|
||||
{
|
||||
par1Entity.motionY += 0.4000000059604645D;
|
||||
}
|
||||
|
||||
this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
@Override
|
||||
public boolean interact(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
|
||||
|
||||
if (this.isTamed())
|
||||
{
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.getItem() instanceof ItemFood)
|
||||
{
|
||||
ItemFood itemfood = (ItemFood) itemstack.getItem();
|
||||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth)
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.getHealAmount(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
// this.setPathToEntity(null);
|
||||
// this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
// this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
|
||||
this.playTameEffect(true);
|
||||
this.worldObj.setEntityState(this, (byte) 7);
|
||||
} else
|
||||
{
|
||||
this.playTameEffect(false);
|
||||
this.worldObj.setEntityState(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, b0 | 2);
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, b0 & -3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns true if the mob is currently able to mate with the specified mob.
|
||||
*/
|
||||
public boolean canMateWith(EntityAnimal par1EntityAnimal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean func_70922_bv()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectByte(19) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
protected boolean canDespawn()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
|
||||
{
|
||||
if (par1EntityLivingBase instanceof EntityBileDemon)
|
||||
{
|
||||
EntityBileDemon entitywolf = (EntityBileDemon) par1EntityLivingBase;
|
||||
|
||||
if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
|
@ -16,12 +16,9 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
|
||||
|
@ -45,20 +42,19 @@ public class EntityElemental extends EntityDemon
|
|||
}
|
||||
}
|
||||
|
||||
// public int courseChangeCooldown;
|
||||
public int courseChangeCooldown;
|
||||
public double waypointX;
|
||||
public double waypointY;
|
||||
public double waypointZ;
|
||||
/* private Entity targetedEntity;
|
||||
private Entity targetedEntity;
|
||||
|
||||
/**
|
||||
* Cooldown time between target loss and new target aquirement.
|
||||
|
||||
*/
|
||||
private int aggroCooldown;
|
||||
public int prevAttackCounter;
|
||||
public int attackCounter;
|
||||
*/
|
||||
@Override
|
||||
|
||||
/**
|
||||
* The explosion radius of spawned fireballs.
|
||||
*/
|
||||
|
@ -70,67 +66,74 @@ public class EntityElemental extends EntityDemon
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fall(float par1)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance
|
||||
* and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround
|
||||
*/
|
||||
protected void updateFallState(double par1, boolean par3)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the entity based on the specified heading. Args: strafe, forward
|
||||
*/
|
||||
public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
|
||||
public void moveEntityWithHeading(float par1, float par2)
|
||||
{
|
||||
if (this.isInWater())
|
||||
{
|
||||
this.moveFlying(p_70612_1_, p_70612_2_, 0.02F);
|
||||
this.moveFlying(par1, par2, 0.02F);
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.800000011920929D;
|
||||
this.motionY *= 0.800000011920929D;
|
||||
this.motionZ *= 0.800000011920929D;
|
||||
}
|
||||
else if (this.isInLava())
|
||||
} else if (this.handleLavaMovement())
|
||||
{
|
||||
this.moveFlying(p_70612_1_, p_70612_2_, 0.02F);
|
||||
this.moveFlying(par1, par2, 0.02F);
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.5D;
|
||||
this.motionY *= 0.5D;
|
||||
this.motionZ *= 0.5D;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
float f2 = 0.91F;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
f2 = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F;
|
||||
f2 = 0.54600006F;
|
||||
Block i = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ));
|
||||
|
||||
if (i != null)
|
||||
{
|
||||
f2 = i.slipperiness * 0.91F;
|
||||
}
|
||||
}
|
||||
|
||||
float f3 = 0.16277136F / (f2 * f2 * f2);
|
||||
this.moveFlying(p_70612_1_, p_70612_2_, this.onGround ? 0.1F * f3 : 0.02F);
|
||||
this.moveFlying(par1, par2, this.onGround ? 0.1F * f3 : 0.02F);
|
||||
f2 = 0.91F;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
f2 = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F;
|
||||
f2 = 0.54600006F;
|
||||
Block j = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ));
|
||||
|
||||
if (j != null)
|
||||
{
|
||||
f2 = j.slipperiness * 0.91F;
|
||||
}
|
||||
}
|
||||
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= (double)f2;
|
||||
this.motionY *= (double)f2;
|
||||
this.motionZ *= (double)f2;
|
||||
this.motionX *= (double) f2;
|
||||
this.motionY *= (double) f2;
|
||||
this.motionZ *= (double) f2;
|
||||
}
|
||||
|
||||
this.prevLimbSwingAmount = this.limbSwingAmount;
|
||||
double d1 = this.posX - this.prevPosX;
|
||||
double d0 = this.posZ - this.prevPosZ;
|
||||
float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F;
|
||||
|
||||
if (f4 > 1.0F)
|
||||
{
|
||||
f4 = 1.0F;
|
||||
}
|
||||
|
||||
this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
|
||||
this.limbSwing += this.limbSwingAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* returns true if this entity is by a ladder, false otherwise
|
||||
*/
|
||||
|
@ -139,10 +142,115 @@ public class EntityElemental extends EntityDemon
|
|||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_110182_bF()
|
||||
protected void updateEntityActionState()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectByte(25) != 0;
|
||||
if (this.getHealth() <= this.getMaxHealth() / 2.0f && worldObj.rand.nextInt(200) == 0)
|
||||
{
|
||||
this.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionReciprocation.id, 100, 1));
|
||||
}
|
||||
|
||||
this.prevAttackCounter = this.attackCounter;
|
||||
double d0 = this.waypointX - this.posX;
|
||||
double d1 = this.waypointY - this.posY;
|
||||
double d2 = this.waypointZ - this.posZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
if (d3 < 1.0D || d3 > 3600.0D)
|
||||
{
|
||||
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
}
|
||||
|
||||
if (this.courseChangeCooldown-- <= 0)
|
||||
{
|
||||
this.courseChangeCooldown += this.rand.nextInt(5) + 2;
|
||||
d3 = (double) MathHelper.sqrt_double(d3);
|
||||
|
||||
if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3))
|
||||
{
|
||||
this.motionX += d0 / d3 * 0.1D;
|
||||
this.motionY += d1 / d3 * 0.1D;
|
||||
this.motionZ += d2 / d3 * 0.1D;
|
||||
} else
|
||||
{
|
||||
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.targetedEntity != null && this.targetedEntity.isDead)
|
||||
{
|
||||
this.targetedEntity = null;
|
||||
}
|
||||
|
||||
if (this.targetedEntity == null || this.aggroCooldown-- <= 0)
|
||||
{
|
||||
this.targetedEntity = getClosestVulnerableMonsterToEntity(this, 100.0D);
|
||||
|
||||
if (this.targetedEntity != null)
|
||||
{
|
||||
this.aggroCooldown = 20;
|
||||
}
|
||||
}
|
||||
|
||||
double d4 = 64.0D;
|
||||
|
||||
if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4)
|
||||
{
|
||||
double d5 = this.targetedEntity.posX - this.posX;
|
||||
double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - (this.posY + (double) (this.height / 2.0F));
|
||||
double d7 = this.targetedEntity.posZ - this.posZ;
|
||||
this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI;
|
||||
|
||||
if (this.courseChangeCooldown <= 0)
|
||||
{
|
||||
if (isCourseTraversable(this.targetedEntity.posX, this.targetedEntity.posY, this.targetedEntity.posZ, Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7)))
|
||||
{
|
||||
this.waypointX = this.targetedEntity.posX;
|
||||
this.waypointY = this.targetedEntity.posY;
|
||||
this.waypointZ = this.targetedEntity.posZ;
|
||||
this.motionX += d5 / d3 * 0.1D;
|
||||
this.motionY += d6 / d3 * 0.1D;
|
||||
this.motionZ += d7 / d3 * 0.1D;
|
||||
} else
|
||||
{
|
||||
this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.motionX += d5 / d3 * 0.1D;
|
||||
this.motionY += d6 / d3 * 0.1D;
|
||||
this.motionZ += d7 / d3 * 0.1D;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.canEntityBeSeen(this.targetedEntity))
|
||||
{
|
||||
if (Math.sqrt(d5 * d5 + d6 * d6 + d7 * d7) < 4)
|
||||
{
|
||||
++this.attackCounter;
|
||||
|
||||
if (this.attackCounter >= 10)
|
||||
{
|
||||
this.worldObj.playAuxSFXAtEntity(null, 1008, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
|
||||
this.inflictEffectOnEntity(this.targetedEntity);
|
||||
this.attackCounter = -40;
|
||||
}
|
||||
}
|
||||
} else if (this.attackCounter > 0)
|
||||
{
|
||||
--this.attackCounter;
|
||||
}
|
||||
} else
|
||||
{
|
||||
this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(motionX, this.motionZ)) * 180.0F / (float) Math.PI;
|
||||
|
||||
if (this.attackCounter > 0)
|
||||
{
|
||||
--this.attackCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +261,7 @@ public class EntityElemental extends EntityDemon
|
|||
double d4 = (this.waypointX - this.posX) / par7;
|
||||
double d5 = (this.waypointY - this.posY) / par7;
|
||||
double d6 = (this.waypointZ - this.posZ) / par7;
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
|
||||
|
||||
for (int i = 1; (double) i < par7; ++i)
|
||||
{
|
||||
|
@ -168,7 +276,6 @@ public class EntityElemental extends EntityDemon
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Will return how many at most can spawn in a chunk at once.
|
||||
*/
|
||||
|
@ -177,7 +284,6 @@ public class EntityElemental extends EntityDemon
|
|||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
|
@ -186,14 +292,12 @@ public class EntityElemental extends EntityDemon
|
|||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
this.setCombatTask();
|
||||
}
|
||||
|
@ -215,7 +319,6 @@ public class EntityElemental extends EntityDemon
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns true if the newer Entity AI code should be run
|
||||
*/
|
||||
|
@ -224,24 +327,14 @@ public class EntityElemental extends EntityDemon
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Sets the active target the Task system uses for tracking
|
||||
*/
|
||||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
|
@ -250,16 +343,13 @@ public class EntityElemental extends EntityDemon
|
|||
this.dataWatcher.updateObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
this.dataWatcher.addObject(19, 0);
|
||||
this.dataWatcher.addObject(25, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Plays step sound at given x, y, z for the entity
|
||||
*/
|
||||
|
@ -268,7 +358,6 @@ public class EntityElemental extends EntityDemon
|
|||
this.playSound("mob.zombie.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the sound this mob makes while it's alive.
|
||||
*/
|
||||
|
@ -278,7 +367,6 @@ public class EntityElemental extends EntityDemon
|
|||
return "none";
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
|
@ -287,7 +375,6 @@ public class EntityElemental extends EntityDemon
|
|||
return "none";
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
|
@ -296,7 +383,6 @@ public class EntityElemental extends EntityDemon
|
|||
return "none";
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
|
@ -305,36 +391,28 @@ public class EntityElemental extends EntityDemon
|
|||
return 0.4F;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the item ID for the item the mob drops on death.
|
||||
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
|
||||
* use this to react to sunlight and start to burn.
|
||||
*/
|
||||
protected int getDropItemId()
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
return -1;
|
||||
super.onLivingUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (this.getHealth() <= this.getMaxHealth() / 2.0f && worldObj.rand.nextInt(200) == 0)
|
||||
{
|
||||
this.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionReciprocation.id, 100, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.8F;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
|
@ -344,18 +422,17 @@ public class EntityElemental extends EntityDemon
|
|||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource source, float par2)
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
if (this.func_180431_b(source))
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
Entity entity = source.getEntity();
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
|
@ -363,18 +440,16 @@ public class EntityElemental extends EntityDemon
|
|||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, par2);
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 6 : 7;
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
@ -388,7 +463,10 @@ public class EntityElemental extends EntityDemon
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
|
@ -398,59 +476,6 @@ public class EntityElemental extends EntityDemon
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, b0 | 2);
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, b0 & -3);
|
||||
}
|
||||
}
|
||||
|
||||
public void func_70918_i(boolean par1)
|
||||
{
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(19, 1);
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(19, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns true if the mob is currently able to mate with the specified mob.
|
||||
*/
|
||||
public boolean canMateWith(EntityAnimal par1EntityAnimal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_70922_bv()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectByte(19) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
|
@ -511,7 +536,7 @@ public class EntityElemental extends EntityDemon
|
|||
|
||||
double range = Math.sqrt(par2);
|
||||
double verticalRange = Math.sqrt(par2);
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(par1 - 0.5f, par3 - 0.5f, par5 - 0.5f, par1 + 0.5f, par3 + 0.5f, par5 + 0.5f).expand(range, verticalRange, range));
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(par1 - 0.5f, par3 - 0.5f, par5 - 0.5f, par1 + 0.5f, par3 + 0.5f, par5 + 0.5f).expand(range, verticalRange, range));
|
||||
if (entities == null)
|
||||
{
|
||||
return null;
|
||||
|
|
|
@ -1,35 +1,36 @@
|
|||
package WayofTime.alchemicalWizardry.common.entity.mob;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IRangedAttackMob;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIArrowAttack;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIFollowOwner;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.pathfinding.PathNavigateGround;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.ai.*;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob
|
||||
{
|
||||
private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F);
|
||||
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
|
||||
|
||||
private static float maxTamedHealth = 50.0F;
|
||||
private static float maxUntamedHealth = 50.0F;
|
||||
|
||||
public EntityFallenAngel(World par1World)
|
||||
{
|
||||
super(par1World, AlchemicalWizardry.entityFallenAngelID);
|
||||
this.setSize(0.7F, 1.8F);
|
||||
((PathNavigateGround)this.getNavigator()).func_179690_a(true);
|
||||
this.getNavigator().setAvoidsWater(true);
|
||||
this.tasks.addTask(1, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, this.aiSit);
|
||||
this.tasks.addTask(3, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
|
||||
|
@ -57,8 +58,6 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob
|
|||
super.applyEntityAttributes();
|
||||
//This line affects the speed of the monster
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
|
||||
float maxTamedHealth = 50.0F;
|
||||
float maxUntamedHealth = 50.0F;
|
||||
|
||||
//My guess is that this will alter the max health
|
||||
if (this.isTamed())
|
||||
|
@ -70,6 +69,327 @@ public class EntityFallenAngel extends EntityDemon implements IRangedAttackMob
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the newer Entity AI code should be run
|
||||
*/
|
||||
public boolean isAIEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active target the Task system uses for tracking
|
||||
*/
|
||||
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
super.setAttackTarget(par1EntityLivingBase);
|
||||
|
||||
if (par1EntityLivingBase == null)
|
||||
{
|
||||
this.setAngry(false);
|
||||
} else if (!this.isTamed())
|
||||
{
|
||||
this.setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* main AI tick function, replaces updateEntityActionState
|
||||
*/
|
||||
protected void updateAITick()
|
||||
{
|
||||
this.dataWatcher.updateObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(18, this.getHealth());
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays step sound at given x, y, z for the entity
|
||||
*/
|
||||
protected void playStepSound(int par1, int par2, int par3, int par4)
|
||||
{
|
||||
this.playSound("mob.zombie.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setBoolean("Angry", this.isAngry());
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
this.setAngry(par1NBTTagCompound.getBoolean("Angry"));
|
||||
|
||||
this.setCombatTask();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes while it's alive.
|
||||
*/
|
||||
protected String getLivingSound()
|
||||
{
|
||||
//TODO change sounds
|
||||
return "none";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
protected String getDeathSound()
|
||||
{
|
||||
return "mob.wolf.death";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
protected float getSoundVolume()
|
||||
{
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
|
||||
* use this to react to sunlight and start to burn.
|
||||
*/
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.8F;
|
||||
}
|
||||
|
||||
/**
|
||||
* The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
|
||||
* use in wolves.
|
||||
*/
|
||||
public int getVerticalFaceSpeed()
|
||||
{
|
||||
return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
Entity entity = par1DamageSource.getEntity();
|
||||
this.aiSit.setSitting(false);
|
||||
|
||||
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow))
|
||||
{
|
||||
par2 = (par2 + 1.0F) / 2.0F;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attackEntityAsMob(Entity par1Entity)
|
||||
{
|
||||
int i = this.isTamed() ? 4 : 2;
|
||||
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
|
||||
}
|
||||
|
||||
public void setTamed(boolean par1)
|
||||
{
|
||||
super.setTamed(par1);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxTamedHealth);
|
||||
} else
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxUntamedHealth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
@Override
|
||||
public boolean interact(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
|
||||
|
||||
if (this.isTamed())
|
||||
{
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.getItem() instanceof ItemFood)
|
||||
{
|
||||
ItemFood itemfood = (ItemFood) itemstack.getItem();
|
||||
|
||||
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < maxTamedHealth)
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
this.heal((float) itemfood.func_150905_g(itemstack));
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.aiSit.setSitting(!this.isSitting());
|
||||
this.isJumping = false;
|
||||
this.setPathToEntity(null);
|
||||
this.setTarget(null);
|
||||
this.setAttackTarget(null);
|
||||
}
|
||||
|
||||
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting());
|
||||
}
|
||||
} else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry())
|
||||
{
|
||||
if (!par1EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.setTamed(true);
|
||||
this.setPathToEntity(null);
|
||||
this.setAttackTarget(null);
|
||||
this.aiSit.setSitting(true);
|
||||
this.setHealth(maxTamedHealth);
|
||||
this.func_152115_b(par1EntityPlayer.getUniqueID().toString());
|
||||
this.playTameEffect(true);
|
||||
this.worldObj.setEntityState(this, (byte) 7);
|
||||
} else
|
||||
{
|
||||
this.playTameEffect(false);
|
||||
this.worldObj.setEntityState(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
public boolean isBreedingItem(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
//return par1ItemStack == null ? false : (!(Item.itemsList[par1ItemStack.itemID] instanceof ItemFood) ? false : ((ItemFood)Item.itemsList[par1ItemStack.itemID]).isWolfsFavoriteMeat());
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this wolf is angry or not.
|
||||
*/
|
||||
public boolean isAngry()
|
||||
{
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this wolf is angry or not.
|
||||
*/
|
||||
public void setAngry(boolean par1)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2)));
|
||||
} else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an entity can be despawned, used on idle far away entities
|
||||
*/
|
||||
protected boolean canDespawn()
|
||||
{
|
||||
//return !this.isTamed() && this.ticksExisted > 2400;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
|
||||
{
|
||||
if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
|
||||
{
|
||||
if (par1EntityLivingBase instanceof EntityFallenAngel)
|
||||
{
|
||||
EntityFallenAngel entitywolf = (EntityFallenAngel) par1EntityLivingBase;
|
||||
|
||||
if (entitywolf.isTamed() && entitywolf.getOwner() == par2EntityLivingBase)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame();
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attack the specified entity using a ranged attack.
|
||||
*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue