gitignore

This commit is contained in:
KitsuShadow
2015-07-25 15:53:16 -04:00
parent 67b0e46bbe
commit 00287a1f41
486 changed files with 18315 additions and 1529 deletions

1
.gitignore vendored
View File

@@ -1 +0,0 @@
eclipse/*

2965
eclipse/.metadata/.log Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,198 @@
package com.kitsu.medievalcraft.block.machines;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
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.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer{
private final Random random = new Random();
public Forge(String unlocalizedName, Material material) {
super(material.rock);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setHarvestLevel("pickaxe", 1, 0);
this.setStepSound(Block.soundTypeStone);
//this.isFlammable(world, x, y, z, face);
//(xmin, ymin, zmin,
// xmax, ymax, zmax)
this.setBlockBounds(0.0F, 0.00F, 0.0F,
1.0F, 0.5F, 1.0F);
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
if(!world.isRemote){
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
}
world.markBlockForUpdate(x, y, z);
}
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if(player.inventory.getCurrentItem()==new ItemStack(ModBlocks.damascus,1)){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
return true;
}
/* if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
return true;
}
if (!player.isSneaking()) {
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.decrStackSize(0, 1);
}
}
return true;
}
//tileEnt.markDirty();
*/
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
if (tileEnt != null) {
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
ItemStack itemstack = tileEnt.getStackInSlot(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.6F + 0.1F;
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
while (itemstack.stackSize > 0) {
int j = this.random.nextInt(21) + 10;
if (j > itemstack.stackSize) {
j = itemstack.stackSize;
}
itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
}
float f3 = 0.025F;
entityitem.motionX = (float) this.random.nextGaussian() * f3;
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileForge();
}
@Override
public int getRenderType() {
return RenderId.forgeID;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,79 @@
package com.kitsu.medievalcraft.block.crucible;
import java.util.Random;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.util.CustomTab;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public abstract class CrucibleBase extends BlockContainer {
protected CrucibleBase(Material mat, String unlocalizedName) {
super(mat);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(2.0F);
this.setResistance(1.0F);
this.setHarvestLevel("pickaxe", 0);
this.setStepSound(soundTypeStone);
//xmin, ymin, zmin,
//xmax, ymax, zmax
this.setBlockBounds(0.2F, 0.0F, 0.25F,
0.8F, 0.66F, 0.8F);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
int a = player.inventory.currentItem;
if(player.inventory.getStackInSlot(a)!=null){
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(this)){
ItemStack jar = new ItemStack(this);
player.inventory.addItemStackToInventory(jar);
if(!world.isRemote){
world.setBlock(x, y, z, Blocks.air, 0, 2);
}
}
}
if(player.inventory.getStackInSlot(a)==null){
ItemStack jar = new ItemStack(this);
player.inventory.setInventorySlotContents(a, jar);
if(!world.isRemote){
world.setBlock(x, y, z, Blocks.air, 0, 2);
}
}
return true;
}
@Override
public Item getItemDropped(int metadata, Random random, int fortune) {
return Item.getItemFromBlock(this);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
// TODO Auto-generated method stub
return null;
}
@Override
public int getRenderType() {
return 0;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,204 @@
package com.kitsu.medievalcraft.entityAI;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPrey()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPrey();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,229 @@
package com.kitsu.medievalcraft.entityAI;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
protected Entity findPreySquid()
{
//EntitySquid squid = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
AxisAlignedBB ab = this.boundingBox.expand(64D, 16D, 64D);
EntitySquid squid = this.worldObj.getEntitiesWithinAABB(EntitySquid.class, ab);
System.out.println("Finding Squid");
return (squid != null) ? squid : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
this.targetedEntity = findPreySquid();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,229 @@
package com.kitsu.medievalcraft.entityAI;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
protected Entity findPreySquid()
{
//EntitySquid squid = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
AxisAlignedBB ab = this.boundingBox.expand(64D, 16D, 64D);
EntitySquid squid = (EntitySquid) this.worldObj.getEntitiesWithinAABB(EntitySquid.class, ab);
System.out.println("Finding Squid");
return (squid != null) && (canEntityBeSeen(squid)) ? squid : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
this.targetedEntity = findPreySquid();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,221 @@
package com.kitsu.medievalcraft.entityAI;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
protected Entity findPreySquid()
{
//EntitySquid squid = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
//AxisAlignedBB ab = new AxisAlignedBB(-16d, -16d, -16d, 16d, 16d, 16d);
EntitySquid squid = (EntitySquid) this.worldObj.getEntitiesWithinAABB(EntitySquid.class, AxisAlignedBB.getBoundingBox(-106d, -106d, -106d, 106d, 106d, 106d));
System.out.println("Finding Squid");
return (squid != null) && (canEntityBeSeen(squid)) ? squid : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,209 @@
package com.kitsu.medievalcraft.block.machines;
import static net.minecraftforge.common.util.ForgeDirection.UP;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.item.ModItems;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer{
private final Random random = new Random();
EntityItem entCoal = null;
public Forge(String unlocalizedName, Material material) {
super(material.rock);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setHarvestLevel("pickaxe", 1, 0);
this.setStepSound(Block.soundTypeStone);
//this.isFlammable(world, x, y, z, face);
//(xmin, ymin, zmin,
// xmax, ymax, zmax)
this.setBlockBounds(0.0F, 0.00F, 0.0F,
1.0F, 0.5F, 1.0F);
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
if(!world.isRemote){
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
}
world.markBlockForUpdate(x, y, z);
}
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
/* if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
return true;
}
if (!player.isSneaking()) {
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.decrStackSize(0, 1);
}
}
return true;
}
//tileEnt.markDirty();
*/
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
if (tileEnt != null) {
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
ItemStack itemstack = tileEnt.getStackInSlot(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.6F + 0.1F;
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
while (itemstack.stackSize > 0) {
int j = this.random.nextInt(21) + 10;
if (j > itemstack.stackSize) {
j = itemstack.stackSize;
}
itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
}
float f3 = 0.025F;
entityitem.motionX = (float) this.random.nextGaussian() * f3;
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileForge();
}
@Override
public int getRenderType() {
return RenderId.forgeID;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,205 @@
package com.kitsu.medievalcraft.entityAI;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,198 @@
package com.kitsu.medievalcraft.block.machines;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
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.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer{
private final Random random = new Random();
public Forge(String unlocalizedName, Material material) {
super(material.rock);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setHarvestLevel("pickaxe", 1, 0);
this.setStepSound(Block.soundTypeStone);
//this.isFlammable(world, x, y, z, face);
//(xmin, ymin, zmin,
// xmax, ymax, zmax)
this.setBlockBounds(0.0F, 0.00F, 0.0F,
1.0F, 0.5F, 1.0F);
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
if(!world.isRemote){
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
}
world.markBlockForUpdate(x, y, z);
}
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if(player.inventory.getCurrentItem()==new ItemStack(ModBlocks.damascus)){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
}
/* if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
return true;
}
if (!player.isSneaking()) {
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.decrStackSize(0, 1);
}
}
return true;
}
//tileEnt.markDirty();
*/
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
if (tileEnt != null) {
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
ItemStack itemstack = tileEnt.getStackInSlot(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.6F + 0.1F;
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
while (itemstack.stackSize > 0) {
int j = this.random.nextInt(21) + 10;
if (j > itemstack.stackSize) {
j = itemstack.stackSize;
}
itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
}
float f3 = 0.025F;
entityitem.motionX = (float) this.random.nextGaussian() * f3;
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileForge();
}
@Override
public int getRenderType() {
return RenderId.forgeID;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,198 @@
package com.kitsu.medievalcraft.block.machines;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
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.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer{
private final Random random = new Random();
public Forge(String unlocalizedName, Material material) {
super(material.rock);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setHarvestLevel("pickaxe", 1, 0);
this.setStepSound(Block.soundTypeStone);
//this.isFlammable(world, x, y, z, face);
//(xmin, ymin, zmin,
// xmax, ymax, zmax)
this.setBlockBounds(0.0F, 0.00F, 0.0F,
1.0F, 0.5F, 1.0F);
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
if(!world.isRemote){
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
}
world.markBlockForUpdate(x, y, z);
}
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if(player.inventory.getCurrentItem()==new ItemStack(ModBlocks.damascus)){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
return true;
}
/* if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
return true;
}
if (!player.isSneaking()) {
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.decrStackSize(0, 1);
}
}
return true;
}
//tileEnt.markDirty();
*/
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
if (tileEnt != null) {
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
ItemStack itemstack = tileEnt.getStackInSlot(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.6F + 0.1F;
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
while (itemstack.stackSize > 0) {
int j = this.random.nextInt(21) + 10;
if (j > itemstack.stackSize) {
j = itemstack.stackSize;
}
itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
}
float f3 = 0.025F;
entityitem.motionX = (float) this.random.nextGaussian() * f3;
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileForge();
}
@Override
public int getRenderType() {
return RenderId.forgeID;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,5 @@
package com.kitsu.medievalcraft.entityAI;
public class EntityAIWaterMob {
}

View File

@@ -0,0 +1,123 @@
package com.kitsu.medievalcraft.block.ingots;
import java.util.Random;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.item.ModItems;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public abstract class IngotBase extends BlockContainer {
private final Random random = new Random();
public static boolean makeParts;
public static int locX, locY, locZ;
public IngotBase(String unlocalizedName, Material material) {
super(material);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(1.0F);
this.setResistance(1.0F);
this.setHarvestLevel(null, 0);
this.setStepSound(soundTypeMetal);
//xmin, ymin, zmin,
//xmax, ymax, zmax
this.setBlockBounds(0.25F, 0.0F, 0.35F,
0.75F , 0.15F, 0.7F);
}
@Override
public Item getItemDropped(int metadata, Random random, int fortune) {
return Item.getItemFromBlock(this);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return null;
}
@Override
public int quantityDropped(Random p_149745_1_)
{
return 1;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
if(makeParts == true){
parts(world, locX, locY, locZ);
makeParts = false;
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int aa, float bb, float cc, float ff){
//System.out.println(this.getUnlocalizedName());
if(player.inventory.getCurrentItem().getItem()!=ModItems.forgeHammer){
int a = player.inventory.currentItem;
if(player.inventory.getStackInSlot(a)==null){
ItemStack jar = new ItemStack(this);
player.inventory.setInventorySlotContents(a, jar);
if(!world.isRemote){
world.setBlock(x, y, z, Blocks.air, 0, 2);
}
return true;
}
if(player.inventory.getStackInSlot(a)!=null){
if(player.inventory.getStackInSlot(a).getItem()==Item.getItemFromBlock(this)){
ItemStack jar = new ItemStack(this);
player.inventory.addItemStackToInventory(jar);
if(!world.isRemote){
world.setBlock(x, y, z, Blocks.air, 0, 2);
}
}
return true;
}
}
return false;
}
private void parts(World world, int x, int y, int z){
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
world.spawnParticle("lava", x+0.5D, y+0.5D, z+0.5D, 0, 0, 0);
}
@Override
public int getRenderType() {
return 0;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,202 @@
package com.kitsu.medievalcraft.block.machines;
import static net.minecraftforge.common.util.ForgeDirection.UP;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.item.ModItems;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer{
private final Random random = new Random();
EntityItem entCoal = null;
public Forge(String unlocalizedName, Material material) {
super(material.rock);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setHarvestLevel("pickaxe", 1, 0);
this.setStepSound(Block.soundTypeStone);
//this.isFlammable(world, x, y, z, face);
//(xmin, ymin, zmin,
// xmax, ymax, zmax)
this.setBlockBounds(0.0F, 0.00F, 0.0F,
1.0F, 0.5F, 1.0F);
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
if(!world.isRemote){
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
}
world.markBlockForUpdate(x, y, z);
}
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
System.out.println(tileEnt.isCoal);
/* if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
return true;
}
if (!player.isSneaking()) {
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.decrStackSize(0, 1);
}
}
return true;
}
//tileEnt.markDirty();
*/
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
if (tileEnt != null) {
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
ItemStack itemstack = tileEnt.getStackInSlot(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.6F + 0.1F;
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
while (itemstack.stackSize > 0) {
int j = this.random.nextInt(21) + 10;
if (j > itemstack.stackSize) {
j = itemstack.stackSize;
}
itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
}
float f3 = 0.025F;
entityitem.motionX = (float) this.random.nextGaussian() * f3;
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileForge();
}
@Override
public int getRenderType() {
return RenderId.forgeID;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,199 @@
package com.kitsu.medievalcraft.block.machines;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
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.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer{
private final Random random = new Random();
public Forge(String unlocalizedName, Material material) {
super(material.rock);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setHarvestLevel("pickaxe", 1, 0);
this.setStepSound(Block.soundTypeStone);
//this.isFlammable(world, x, y, z, face);
//(xmin, ymin, zmin,
// xmax, ymax, zmax)
this.setBlockBounds(0.0F, 0.00F, 0.0F,
1.0F, 0.5F, 1.0F);
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
if(!world.isRemote){
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
}
world.markBlockForUpdate(x, y, z);
}
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
ItemStack c = new ItemStack(ModBlocks.damascus,1);
if(player.inventory.getCurrentItem()==c){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
return true;
}
/* if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
return true;
}
if (!player.isSneaking()) {
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.decrStackSize(0, 1);
}
}
return true;
}
//tileEnt.markDirty();
*/
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
if (tileEnt != null) {
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
ItemStack itemstack = tileEnt.getStackInSlot(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.6F + 0.1F;
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
while (itemstack.stackSize > 0) {
int j = this.random.nextInt(21) + 10;
if (j > itemstack.stackSize) {
j = itemstack.stackSize;
}
itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
}
float f3 = 0.025F;
entityitem.motionX = (float) this.random.nextGaussian() * f3;
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileForge();
}
@Override
public int getRenderType() {
return RenderId.forgeID;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,210 @@
package com.kitsu.medievalcraft.entityAI;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,210 @@
package com.kitsu.medievalcraft.entityAI;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,256 @@
package com.kitsu.medievalcraft.entityAI;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.pathfinding.PathFinder;
import net.minecraft.profiler.Profiler;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public Profiler theProfiler;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
protected Entity findPreySquid()
{
//EntitySquid squid = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
AxisAlignedBB ab = this.boundingBox.expand(64D, 16D, 64D);
EntityLivingBase squid = this.getpa
System.out.println("Finding Squid");
return (Entity) squid;
}
public PathEntity getPathEntityToEntity(Entity p_72865_1_, Entity p_72865_2_, float p_72865_3_, boolean p_72865_4_, boolean p_72865_5_, boolean p_72865_6_, boolean p_72865_7_)
{
this.theProfiler.startSection("pathfind");
int i = MathHelper.floor_double(p_72865_1_.posX);
int j = MathHelper.floor_double(p_72865_1_.posY + 1.0D);
int k = MathHelper.floor_double(p_72865_1_.posZ);
int l = (int)(p_72865_3_ + 16.0F);
int i1 = i - l;
int j1 = j - l;
int k1 = k - l;
int l1 = i + l;
int i2 = j + l;
int j2 = k + l;
ChunkCache chunkcache = new ChunkCache(this, i1, j1, k1, l1, i2, j2, 0);
PathEntity pathentity = (new PathFinder(chunkcache, p_72865_4_, p_72865_5_, p_72865_6_, p_72865_7_)).createEntityPathTo(p_72865_1_, p_72865_2_, p_72865_3_);
this.theProfiler.endSection();
return pathentity;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
this.targetedEntity = findPreySquid();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,64 @@
package com.kitsu.medievalcraft.renderer.blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import com.kitsu.medievalcraft.entity.EntityModelArrow;
public class RenderModelArrow extends Render
{
//private static final ResourceLocation arrowTextures = new ResourceLocation("textures/entity/arrow.png");
private static final ResourceLocation arrowTextures = new ResourceLocation("kitsumedievalcraft:textures/items/itemModelArrow.png");
public static final ResourceLocation MODEL_CRUCIBLE = new ResourceLocation("kitsumedievalcraft:models/ModelArrow.obj");
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/modelarrow.png");
//public IModelCustom model = AdvancedModelLoader.loadModel(MODEL_CRUCIBLE);
public void doRender(EntityModelArrow p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
GL11.glPushMatrix();
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_ );
GL11.glRotatef(p_76986_1_.prevRotationYaw + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
//model.renderAll();
GL11.glPopMatrix();
}
protected ResourceLocation getEntityTexture(EntityModelArrow p_110775_1_)
{
return arrowTextures;
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
{
return this.getEntityTexture((EntityModelArrow)p_110775_1_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
//System.out.println("doRender Ran");
this.doRender((EntityModelArrow)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}

View File

@@ -0,0 +1,231 @@
package com.kitsu.medievalcraft.entityAI;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
protected Entity findPreySquid()
{
//EntitySquid squid = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
AxisAlignedBB ab = this.boundingBox.expand(64D, 16D, 64D);
List squid = this.worldObj.getEntitiesWithinAABB(EntitySquid.class, ab);
System.out.println("Finding Squid");
return (Entity) ((squid != null) ? squid : null);
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
this.targetedEntity = findPreySquid();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,229 @@
package com.kitsu.medievalcraft.entityAI;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
protected Entity findPreySquid()
{
//EntitySquid squid = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
//AxisAlignedBB ab = new AxisAlignedBB(-16d, -16d, -16d, 16d, 16d, 16d);
EntitySquid squid = (EntitySquid) this.worldObj.getEntitiesWithinAABB(EntitySquid.class, AxisAlignedBB.getBoundingBox(-106d, -106d, -106d, 106d, 106d, 106d));
System.out.println("Finding Squid");
return (squid != null) && (canEntityBeSeen(squid)) ? squid : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
this.targetedEntity = findPreySquid();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,228 @@
package com.kitsu.medievalcraft.entityAI;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.pathfinding.PathFinder;
import net.minecraft.profiler.Profiler;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.World;
public class EntityAIWaterMob extends EntityWaterMob implements IAnimals{
protected int attackInterval = 50;
protected float attackSpeed = 1.2F;
protected float swimSpeed = 0.5F;
private double targetX;
private double targetY;
private double targetZ;
private Entity targetedEntity;
private boolean isAttacking;
protected float swimRadius = 4.0F;
protected float swimRadiusHeight = 4.0F;
protected boolean Agrooed = false;
protected boolean landBounce = true;
protected float moreDamage = 0.5F;
public Profiler theProfiler;
public EntityAIWaterMob(World world)
{
super(world);
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntitySquid.class, 32, true, true, IMob.mobSelector));
}
protected boolean canTriggerWalking()
{
return false;
}
protected boolean isAIEnabled()
{
return true;
}
public boolean canBreatheUnderwater()
{
return true;
}
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
}
public boolean isInWater()
{
return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this);
}
public void onUpdate()
{
super.onUpdate();
if (isInWater()) {
this.motionY *= 0.1D;
}
}
public void applyEntityCollision(Entity entity)
{
super.applyEntityCollision(entity);
if ((this.Agrooed) && (this.targetedEntity == entity))
{
attackEntityAsMob(entity);
}
}
protected Entity findPreyHuman()
{
EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
return (player != null) && (canEntityBeSeen(player)) ? player : null;
}
public boolean attackEntityAsMob(Entity entity)
{
float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
return entity.attackEntityFrom(DamageSource.causeMobDamage(this), f + moreDamage);
}
public void onEntityUpdate()
{
int air = getAir();
super.onEntityUpdate();
if ((isEntityAlive()) && (!isInWater()))
{
air--;
setAir(air);
if (getAir() == -20)
{
setAir(0);
attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
setAir(300);
}
}
protected void updateAITasks()
{
super.updateAITasks();
if (isInWater())
{
double dx = this.targetX - this.posX;
double dy = this.targetY - this.posY;
double dz = this.targetZ - this.posZ;
double dist = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
if ((dist < 1.0D) || (dist > 1000.0D))
{
this.targetX = (this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.targetY = (this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadiusHeight);
this.targetZ = (this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * this.swimRadius);
this.isAttacking = false;
}
if (this.worldObj.getBlock(MathHelper.floor_double(this.targetX), MathHelper.floor_double(this.targetY + this.height), MathHelper.floor_double(this.targetZ)).getMaterial() == Material.water)
{
this.motionX += dx / dist * 0.05D * this.swimSpeed;
this.motionY += dy / dist * 0.1D * this.swimSpeed;
this.motionZ += dz / dist * 0.05D * this.swimSpeed;
}
else
{
this.targetX = this.posX;
this.targetY = (this.posY + 0.1D);
this.targetZ = this.posZ;
}
if (this.isAttacking)
{
this.motionX *= this.attackSpeed;
this.motionY *= this.attackSpeed;
this.motionZ *= this.attackSpeed;
}
if ((this.Agrooed) && (this.rand.nextInt(this.attackInterval) == 0))
{
this.targetedEntity = findPreyHuman();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
this.targetedEntity = findPreySquid();
if ((this.targetedEntity != null) && (this.targetedEntity.isInWater()))
{
this.targetX = this.targetedEntity.posX;
this.targetY = this.targetedEntity.posY;
this.targetZ = this.targetedEntity.posZ;
this.isAttacking = true;
}
}
this.renderYawOffset += (-(float)Math.atan2(this.motionX, this.motionZ) * 180.0F / 3.141593F - this.renderYawOffset) * 0.5F;
this.rotationYaw = this.renderYawOffset;
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationPitch += ((float)Math.atan2(this.motionY, f) * 180.0F / 3.141593F - this.rotationPitch) * 0.5F;
}
else
{
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if ((this.landBounce) && (this.onGround) && (this.rand.nextInt(30) == 0))
{
this.motionY = 0.300000011920929D;
this.motionX = (-0.4F + this.rand.nextFloat() * 0.8F);
this.motionZ = (-0.4F + this.rand.nextFloat() * 0.8F);
}
}
}
}
/*when you extend it,
you want to add these to your constructor:
this.Agrooed = true;
this.swimRadius = 25F;
this.swimSpeed = 0.5F;
this.attackInterval = 23;
this.landBounce = true;
what these stand for are pretty self explanitory. add this to your class:
@Override
protected Entity findPrey()
{
AxisAlignedBB area = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
EntityPlayer player = (EntityPlayer)super.findPrey();
if (player != null) {
return player;
}
return worldObj.findNearestEntityWithinAABB(EntityPlayer.class, area, this);
*/

View File

@@ -0,0 +1,198 @@
package com.kitsu.medievalcraft.block.machines;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
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.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer{
private final Random random = new Random();
ItemStack[] placeArray = new ItemStack[5];
public Forge(String unlocalizedName, Material material) {
super(material.rock);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setHarvestLevel("pickaxe", 1, 0);
this.setStepSound(Block.soundTypeStone);
//this.isFlammable(world, x, y, z, face);
//(xmin, ymin, zmin,
// xmax, ymax, zmax)
this.setBlockBounds(0.0F, 0.00F, 0.0F,
1.0F, 0.5F, 1.0F);
placeArray[0].equals(new ItemStack(ModBlocks.damascus));
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
if(!world.isRemote){
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
}
world.markBlockForUpdate(x, y, z);
}
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if(player.inventory.getCurrentItem()==placeArray[0]){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
}
/* if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
return true;
}
if (!player.isSneaking()) {
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.decrStackSize(0, 1);
}
}
return true;
}
//tileEnt.markDirty();
*/
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
if (tileEnt != null) {
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
ItemStack itemstack = tileEnt.getStackInSlot(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.6F + 0.1F;
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
while (itemstack.stackSize > 0) {
int j = this.random.nextInt(21) + 10;
if (j > itemstack.stackSize) {
j = itemstack.stackSize;
}
itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
}
float f3 = 0.025F;
entityitem.motionX = (float) this.random.nextGaussian() * f3;
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileForge();
}
@Override
public int getRenderType() {
return RenderId.forgeID;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -0,0 +1,198 @@
package com.kitsu.medievalcraft.block.machines;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
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.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer{
private final Random random = new Random();
ItemStack[] placeArray = new ItemStack[5];
public Forge(String unlocalizedName, Material material) {
super(material.rock);
this.setBlockName(unlocalizedName);
this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);
this.setCreativeTab(CustomTab.MedievalCraftTab);
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setHarvestLevel("pickaxe", 1, 0);
this.setStepSound(Block.soundTypeStone);
//this.isFlammable(world, x, y, z, face);
//(xmin, ymin, zmin,
// xmax, ymax, zmax)
this.setBlockBounds(0.0F, 0.00F, 0.0F,
1.0F, 0.5F, 1.0F);
placeArray[0].equals(new ItemStack(ModBlocks.damascus));
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
if(!world.isRemote){
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
}
world.markBlockForUpdate(x, y, z);
}
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if(player.inventory.getCurrentItem()==){
}
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
/* if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
return true;
}
if (!player.isSneaking()) {
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.decrStackSize(0, 1);
}
}
return true;
}
//tileEnt.markDirty();
*/
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
if (tileEnt != null) {
for (int i = 0; i < tileEnt.getSizeInventory(); ++i) {
ItemStack itemstack = tileEnt.getStackInSlot(i);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.6F + 0.1F;
float f1 = this.random.nextFloat() * 0.6F + 0.1F;
float f2 = this.random.nextFloat() * 0.6F + 0.1F;
while (itemstack.stackSize > 0) {
int j = this.random.nextInt(21) + 10;
if (j > itemstack.stackSize) {
j = itemstack.stackSize;
}
itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy()));
}
float f3 = 0.025F;
entityitem.motionX = (float) this.random.nextGaussian() * f3;
entityitem.motionY = (float) this.random.nextGaussian() * f3 + 0.1F;
entityitem.motionZ = (float) this.random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileForge();
}
@Override
public int getRenderType() {
return RenderId.forgeID;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View File

@@ -1,7 +1,16 @@
Console.highWaterMark=88000 Console.highWaterMark=88000
StringVariablePreferencePage=130,107,107,86, StringVariablePreferencePage=130,107,107,86,
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.debug.ui.MemoryHistoryKnownColor=235,235,235
org.eclipse.debug.ui.MemoryHistoryUnknownColor=170,175,185
org.eclipse.debug.ui.PREF_CHANGED_VALUE_BACKGROUND=150,80,115
org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<launchPerspectives/>\n org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<launchPerspectives/>\n
org.eclipse.debug.ui.UseContextualLaunch=false org.eclipse.debug.ui.UseContextualLaunch=false
org.eclipse.debug.ui.changedDebugElement=255,128,128
org.eclipse.debug.ui.consoleBackground=53,53,53
org.eclipse.debug.ui.errorColor=225,30,70
org.eclipse.debug.ui.inColor=140,175,210
org.eclipse.debug.ui.outColor=235,235,235
org.eclipse.debug.ui.user_view_bindings=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<viewBindings>\r\n<view id\="org.eclipse.ui.console.ConsoleView">\r\n<perspective id\="org.eclipse.jdt.ui.JavaPerspective" userAction\="opened"/>\r\n</view>\r\n</viewBindings>\r\n org.eclipse.debug.ui.user_view_bindings=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<viewBindings>\r\n<view id\="org.eclipse.ui.console.ConsoleView">\r\n<perspective id\="org.eclipse.jdt.ui.JavaPerspective" userAction\="opened"/>\r\n</view>\r\n</viewBindings>\r\n
overriddenByCSS=,org.eclipse.debug.ui.MemoryHistoryKnownColor,org.eclipse.debug.ui.MemoryHistoryUnknownColor,org.eclipse.debug.ui.PREF_CHANGED_VALUE_BACKGROUND,org.eclipse.debug.ui.changedDebugElement,org.eclipse.debug.ui.consoleBackground,org.eclipse.debug.ui.errorColor,org.eclipse.debug.ui.inColor,org.eclipse.debug.ui.outColor,
preferredTargets=default\:default| preferredTargets=default\:default|

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
themeid=org.eclipse.e4.ui.css.theme.e4_dark

View File

@@ -1,13 +1,87 @@
content_assist_completion_replacement_background=200,200,0
content_assist_completion_replacement_foreground=200,0,0
content_assist_number_of_computers=18 content_assist_number_of_computers=18
content_assist_parameters_background=52,57,61
content_assist_parameters_foreground=238,238,238
content_assist_proposals_background=18,18,18 content_assist_proposals_background=18,18,18
content_assist_proposals_foreground=252,252,252 content_assist_proposals_foreground=252,252,252
eclipse.preferences.version=1 eclipse.preferences.version=1
fontPropagated=true fontPropagated=true
java_bracket=249,250,244
java_comment_task_tag=154,140,124
java_default=217,232,247
java_doc_default=98,98,98
java_doc_keyword=154,140,124
java_doc_link=169,156,140
java_doc_tag=30,120,155
java_keyword=221,40,103
java_keyword_return=221,40,103
java_multi_line_comment=98,98,98
java_operator=230,230,250
java_single_line_comment=98,98,98
java_string=23,198,163
matchingBracketsColor=102,112,125
org.eclipse.jdt.ui.editor.tab.width= org.eclipse.jdt.ui.editor.tab.width=
org.eclipse.jdt.ui.formatterprofiles.version=12 org.eclipse.jdt.ui.formatterprofiles.version=12
org.eclipse.jdt.ui.javadoclocations.migrated=true org.eclipse.jdt.ui.javadoclocations.migrated=true
org.eclipse.jface.textfont=1|Monospace|10.0|0|GTK|1|; org.eclipse.jface.textfont=1|Monospace|10.0|0|GTK|1|;
overriddenByCSS=,content_assist_completion_replacement_background,content_assist_completion_replacement_foreground,content_assist_parameters_background,content_assist_parameters_foreground,java_bracket,java_comment_task_tag,java_default,java_doc_default,java_doc_keyword,java_doc_link,java_doc_tag,java_keyword,java_keyword_return,java_multi_line_comment,java_operator,java_single_line_comment,java_string,matchingBracketsColor,pf_coloring_argument,pf_coloring_assignment,pf_coloring_comment,pf_coloring_key,pf_coloring_value,semanticHighlighting.abstractClass.bold,semanticHighlighting.abstractClass.color,semanticHighlighting.abstractClass.enabled,semanticHighlighting.abstractMethodInvocation.color,semanticHighlighting.abstractMethodInvocation.enabled,semanticHighlighting.annotation.bold,semanticHighlighting.annotation.color,semanticHighlighting.annotation.enabled,semanticHighlighting.annotation.italic,semanticHighlighting.annotationElementReference.color,semanticHighlighting.annotationElementReference.enabled,semanticHighlighting.class.color,semanticHighlighting.class.enabled,semanticHighlighting.class.bold,semanticHighlighting.deprecatedMember.color,semanticHighlighting.deprecatedMember.enabled,semanticHighlighting.deprecatedMember.underline,semanticHighlighting.deprecatedMember.strikethrough,semanticHighlighting.enum.color,semanticHighlighting.enum.enabled,semanticHighlighting.enum.italic,semanticHighlighting.field.color,semanticHighlighting.field.enabled,semanticHighlighting.inheritedMethodInvocation.color,semanticHighlighting.inheritedMethodInvocation.enabled,semanticHighlighting.interface.color,semanticHighlighting.interface.enabled,semanticHighlighting.localVariable.color,semanticHighlighting.localVariable.enabled,semanticHighlighting.localVariableDeclaration.color,semanticHighlighting.localVariableDeclaration.enabled,semanticHighlighting.method.color,semanticHighlighting.method.enabled,semanticHighlighting.methodDeclarationName.color,semanticHighlighting.methodDeclarationName.enabled,semanticHighlighting.number.color,semanticHighlighting.number.enabled,semanticHighlighting.parameterVariable.color,semanticHighlighting.parameterVariable.enabled,semanticHighlighting.staticField.color,semanticHighlighting.staticField.enabled,semanticHighlighting.staticFinalField.color,semanticHighlighting.staticFinalField.enabled,semanticHighlighting.staticMethodInvocation.color,semanticHighlighting.staticMethodInvocation.enabled,semanticHighlighting.typeArgument.color,semanticHighlighting.typeArgument.enabled,semanticHighlighting.typeParameter.color,semanticHighlighting.typeParameter.enabled,sourceHoverBackgroundColor,
pf_coloring_argument=221,40,103
pf_coloring_assignment=217,232,247
pf_coloring_comment=98,98,98
pf_coloring_key=217,232,247
pf_coloring_value=23,198,163
proposalOrderMigrated=true proposalOrderMigrated=true
semanticHighlighting.abstractClass.bold=true
semanticHighlighting.abstractClass.color=62,171,230
semanticHighlighting.abstractClass.enabled=true
semanticHighlighting.abstractMethodInvocation.color=128,246,167
semanticHighlighting.abstractMethodInvocation.enabled=true
semanticHighlighting.annotation.bold=true
semanticHighlighting.annotation.color=255,147,147
semanticHighlighting.annotation.enabled=true
semanticHighlighting.annotation.italic=true
semanticHighlighting.annotationElementReference.color=235,75,100
semanticHighlighting.annotationElementReference.enabled=true
semanticHighlighting.class.bold=true
semanticHighlighting.class.color=18,144,195
semanticHighlighting.class.enabled=true
semanticHighlighting.deprecatedMember.color=171,31,54
semanticHighlighting.deprecatedMember.enabled=true
semanticHighlighting.deprecatedMember.strikethrough=true
semanticHighlighting.deprecatedMember.underline=false
semanticHighlighting.enum.color=204,129,186
semanticHighlighting.enum.enabled=true
semanticHighlighting.enum.italic=true
semanticHighlighting.field.color=102,225,248
semanticHighlighting.field.enabled=true
semanticHighlighting.inheritedMethodInvocation.color=205,246,104
semanticHighlighting.inheritedMethodInvocation.enabled=true
semanticHighlighting.interface.color=128,242,246
semanticHighlighting.interface.enabled=true
semanticHighlighting.localVariable.color=255,191,38
semanticHighlighting.localVariable.enabled=true
semanticHighlighting.localVariableDeclaration.color=237,127,72
semanticHighlighting.localVariableDeclaration.enabled=true
semanticHighlighting.method.color=167,236,33
semanticHighlighting.method.enabled=true
semanticHighlighting.methodDeclarationName.color=30,181,64
semanticHighlighting.methodDeclarationName.enabled=true
semanticHighlighting.number.color=104,151,187
semanticHighlighting.number.enabled=true
semanticHighlighting.parameterVariable.color=121,171,255
semanticHighlighting.parameterVariable.enabled=true
semanticHighlighting.staticField.color=141,218,248
semanticHighlighting.staticField.enabled=true
semanticHighlighting.staticFinalField.color=141,218,248
semanticHighlighting.staticFinalField.enabled=true
semanticHighlighting.staticMethodInvocation.color=150,236,63
semanticHighlighting.staticMethodInvocation.enabled=true
semanticHighlighting.typeArgument.color=215,131,127
semanticHighlighting.typeArgument.enabled=true
semanticHighlighting.typeParameter.color=191,164,164
semanticHighlighting.typeParameter.enabled=true
sourceHoverBackgroundColor=68,68,68
spelling_locale_initialized=true spelling_locale_initialized=true
tabWidthPropagated=true tabWidthPropagated=true
useAnnotationsPrefPage=true useAnnotationsPrefPage=true

View File

@@ -0,0 +1,3 @@
eclipse.preferences.version=1
org.eclipse.mylyn.java.ui.run.count.3_10_0=1
org.eclipse.mylyn.java.ui.run.count.3_1_0=1

View File

@@ -0,0 +1,2 @@
completion_tips_seen=org.eclipse.recommenders.completion.rcp.tips.discovery\:org.eclipse.recommenders.subwords.rcp.tips.enableSubwords
eclipse.preferences.version=1

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="org.eclipse.debug.ui.SCOPED_SAVE_SELECTION_DIALOG">
<item value="295" key="DIALOG_WIDTH"/>
<item value="1|Noto Sans|9.0|0|GTK|1|" key="DIALOG_FONT_NAME"/>
<item value="377" key="DIALOG_HEIGHT"/>
</section>
</section>

Some files were not shown because too many files have changed in this diff Show More