cannon_time
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
package com.kitsu.medievalcraft;
|
||||
|
||||
import com.kitsu.medievalcraft.entity.EntityCannonBall;
|
||||
import com.kitsu.medievalcraft.entity.EntityITSpear;
|
||||
import com.kitsu.medievalcraft.entity.EntityModelArrow;
|
||||
import com.kitsu.medievalcraft.entity.EntityModelITArrow;
|
||||
import com.kitsu.medievalcraft.entity.EntityShit;
|
||||
import com.kitsu.medievalcraft.entity.EntityTester;
|
||||
import com.kitsu.medievalcraft.entity.ProjectileCannonBall;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.renderer.RendererRegistry;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.RenderModelArrow;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.RenderModelITArrow;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.RenderModelITSpear;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.cannons.Render_CannonBall_Iron;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.cannons.Render_CannonBall_Projectile;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@@ -26,6 +30,8 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityModelArrow.class, new RenderModelArrow());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityModelITArrow.class, new RenderModelITArrow());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityITSpear.class, new RenderModelITSpear());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCannonBall.class, new Render_CannonBall_Iron());
|
||||
//RenderingRegistry.registerEntityRenderingHandler(ProjectileCannonBall.class, new Render_CannonBall_Projectile());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,12 +4,14 @@ import com.kitsu.medievalcraft.compat.FuelHandler;
|
||||
import com.kitsu.medievalcraft.compat.ModDict;
|
||||
import com.kitsu.medievalcraft.crafting.CraftingHandle;
|
||||
import com.kitsu.medievalcraft.crafting.ModCrafting;
|
||||
import com.kitsu.medievalcraft.entity.EntityCannonBall;
|
||||
import com.kitsu.medievalcraft.entity.EntityITSpear;
|
||||
import com.kitsu.medievalcraft.entity.EntityModelArrow;
|
||||
import com.kitsu.medievalcraft.entity.EntityModelITArrow;
|
||||
import com.kitsu.medievalcraft.entity.EntityShit;
|
||||
import com.kitsu.medievalcraft.entity.EntityShortLivedShit;
|
||||
import com.kitsu.medievalcraft.entity.EntityTester;
|
||||
import com.kitsu.medievalcraft.entity.ProjectileCannonBall;
|
||||
import com.kitsu.medievalcraft.events.BucketHandle;
|
||||
import com.kitsu.medievalcraft.events.EventHandle;
|
||||
import com.kitsu.medievalcraft.gui.GuiHandler;
|
||||
@@ -117,6 +119,8 @@ public class Main {
|
||||
EntityRegistry.registerModEntity(EntityITSpear.class, "itemITSpear", 4, this, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(EntityTester.class, "itemTester", 5, this, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(EntityShortLivedShit.class, "itemShit", 6, this, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(EntityCannonBall.class, "cannonBall", 7, this, 64, 10, true);
|
||||
//EntityRegistry.registerModEntity(ProjectileCannonBall.class, "cannonBallProjectile", 8, this, 64, 10, true);
|
||||
|
||||
GameRegistry.registerFuelHandler(new FuelHandler());
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.kitsu.medievalcraft.block.crucible.empty.EmptySoftCrucible;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.FilledWaterCrucible;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.SlackWaterCrucible;
|
||||
import com.kitsu.medievalcraft.block.crucible.empty.TanWaterCrucible;
|
||||
import com.kitsu.medievalcraft.block.decorative.CannonBall28;
|
||||
import com.kitsu.medievalcraft.block.decorative.EggWashedBrick;
|
||||
import com.kitsu.medievalcraft.block.decorative.EggWashedWall;
|
||||
import com.kitsu.medievalcraft.block.decorative.LimestoneRaw;
|
||||
@@ -31,6 +32,7 @@ import com.kitsu.medievalcraft.block.ingots.IronPlate;
|
||||
import com.kitsu.medievalcraft.block.ingots.LapisIngot;
|
||||
import com.kitsu.medievalcraft.block.ingots.RedstoneIngot;
|
||||
import com.kitsu.medievalcraft.block.ingots.RefinedIron;
|
||||
import com.kitsu.medievalcraft.block.machines.Cannon_28;
|
||||
import com.kitsu.medievalcraft.block.machines.Firebox;
|
||||
import com.kitsu.medievalcraft.block.machines.Forge;
|
||||
import com.kitsu.medievalcraft.block.machines.ForgeAnvil;
|
||||
@@ -118,6 +120,10 @@ public class ModBlocks {
|
||||
public static Block solidFilter;
|
||||
public static Block forge;
|
||||
|
||||
//CANNONS
|
||||
public static Block cannon_28;
|
||||
public static Block cannonBall_28;
|
||||
|
||||
//GEMS
|
||||
public static Block myDiamond, myEmerald;
|
||||
//IRON INGOTS
|
||||
@@ -184,6 +190,9 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(firebox = new Firebox("firebox", Material.rock), "firebox");
|
||||
GameRegistry.registerBlock(forge = new Forge("forge", Material.rock), "forge");
|
||||
|
||||
GameRegistry.registerBlock(cannon_28 = new Cannon_28("cannon_28", Material.iron), "cannon_28");
|
||||
GameRegistry.registerBlock(cannonBall_28 = new CannonBall28("cannonBall28", Material.iron), "cannonBall28");
|
||||
|
||||
/*GameRegistry.registerBlock(myIronIngot = new MyIronIngot("myIronIngot", Material.iron), "myIronIngot");
|
||||
GameRegistry.registerBlock(damascusIngot = new DamascusIngot("damascusIngot", Material.iron), "damascusIngot");
|
||||
GameRegistry.registerBlock(hotDamascusIngot = new HotDamascusIngot("hotDamascusIngot", Material.iron), "hotDamascusIngot");
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.kitsu.medievalcraft.block.decorative;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.cannon.TileCannonBall28;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileEntityMyDiamond;
|
||||
|
||||
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.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CannonBall28 extends BlockContainer {
|
||||
|
||||
public CannonBall28(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(soundTypeGlass);
|
||||
//this.setLightLevel(2.0F);
|
||||
//xmin, ymin, zmin,
|
||||
this.setBlockBounds(0.38F, 0.0F, 0.38F,
|
||||
//xmax, ymax, zmax
|
||||
0.62F, 0.2F, 0.62F);
|
||||
}
|
||||
|
||||
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.getHeldItem().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 false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int fortune) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
|
||||
return new TileCannonBall28();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.my28CannonBallID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.entity.EntityCannonBall;
|
||||
import com.kitsu.medievalcraft.entity.EntityModelArrow;
|
||||
import com.kitsu.medievalcraft.entity.ProjectileCannonBall;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
|
||||
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;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityLargeFireball;
|
||||
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;
|
||||
|
||||
public class Cannon_28 extends BlockContainer{
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
public Cannon_28(String unlocalizedName, Material material) {
|
||||
super(material.iron);
|
||||
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.soundTypeAnvil);
|
||||
//this.isFlammable(world, x, y, z, face);
|
||||
//(xmin, ymin, zmin,
|
||||
// xmax, ymax, zmax)
|
||||
this.setBlockBounds(0.0F, 0.00F, 0.0F,
|
||||
1.0F, 1.00F, 1.0F);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
|
||||
}
|
||||
|
||||
private Entity shootCannon(World world, Integer x, Integer y, Integer z){
|
||||
EntityCannonBall cannonball = null;
|
||||
|
||||
if(world.getBlockMetadata(x, y, z)==3){
|
||||
cannonball = new EntityCannonBall(world, (double)x+2, (double)y, (double)z, null);
|
||||
cannonball.setVelocity(5+world.rand.nextFloat(), 0.25, (world.rand.nextFloat()*2-1)/5);
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z)==2){
|
||||
cannonball = new EntityCannonBall(world, (double)x, (double)y, (double)z-2, null);
|
||||
cannonball.setVelocity((world.rand.nextFloat()*2-1)/5, 0.25, -5-world.rand.nextFloat());
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z)==1){
|
||||
cannonball = new EntityCannonBall(world, (double)x-2, (double)y, (double)z, null);
|
||||
cannonball.setVelocity(-5-world.rand.nextFloat(), 0.25, (world.rand.nextFloat()*2-1)/5);
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z)==0){
|
||||
cannonball = new EntityCannonBall(world, (double)x, (double)y, (double)z+2, null);
|
||||
cannonball.setVelocity((world.rand.nextFloat()*2-1)/5, 0.25, 5+world.rand.nextFloat());
|
||||
}
|
||||
return cannonball;
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
if(!world.isRemote){
|
||||
TileCannon_28 tileEnt = (TileCannon_28) world.getTileEntity(x, y, z);
|
||||
if(tileEnt.isOn==false){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel){
|
||||
tileEnt.isOn=true;
|
||||
world.playSoundEffect(x, y, z, "random.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F);
|
||||
world.playSoundEffect(x, y, z, "random.explode", 0.5f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F);
|
||||
|
||||
world.spawnEntityInWorld(shootCannon(world,x,y,z));
|
||||
tileEnt.markForUpdate();
|
||||
tileEnt.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
|
||||
if (world.isBlockIndirectlyGettingPowered(x, y, z))
|
||||
{
|
||||
TileCannon_28 tileEnt = (TileCannon_28) world.getTileEntity(x, y, z);
|
||||
if(tileEnt.isOn==false){
|
||||
tileEnt.isOn=true;
|
||||
world.playSoundEffect(x, y, z, "random.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F);
|
||||
world.playSoundEffect(x, y, z, "random.explode", 0.5f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F);
|
||||
world.spawnEntityInWorld(shootCannon(world, x, y, z));
|
||||
tileEnt.markForUpdate();
|
||||
tileEnt.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
|
||||
int dir = MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3;
|
||||
world.setBlockMetadataWithNotify(x, y, z, dir, 0);
|
||||
System.out.println(dir);
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileCannon_28 tileEnt = (TileCannon_28) 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 TileCannon_28();
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.cannon_28ID;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.kitsu.medievalcraft.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.S2BPacketChangeGameState;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityCannonBall extends Entity{
|
||||
|
||||
private EntityLivingBase tntPlacedBy;
|
||||
public int damage = 100;
|
||||
private int field_145791_d = -1;
|
||||
private int field_145792_e = -1;
|
||||
private int field_145789_f = -1;
|
||||
public Entity shootingEntity;
|
||||
|
||||
public EntityCannonBall(World p_i1582_1_) {
|
||||
super(p_i1582_1_);
|
||||
this.preventEntitySpawning = true;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
//this.yOffset = this.height / 2.0F;
|
||||
this.boundingBox.setBounds(0.3, 0.3, 0.3, 0.7, 0.7, 0.7);
|
||||
|
||||
}
|
||||
|
||||
public EntityCannonBall(World world, double x, double y, double z, EntityLivingBase entLiving)
|
||||
{
|
||||
this(world);
|
||||
this.setPosition(x, y, z);
|
||||
float f = (float)(Math.random() * Math.PI * 2.0D);
|
||||
this.motionX = (double)(-((float)Math.sin((double)f)) * 0.02F);
|
||||
this.motionY = 0.20000000298023224D;
|
||||
this.motionZ = (double)(-((float)Math.cos((double)f)) * 0.02F);
|
||||
this.prevPosX = x;
|
||||
this.prevPosY = y;
|
||||
this.prevPosZ = z;
|
||||
this.tntPlacedBy = entLiving;
|
||||
this.renderDistanceWeight = 100;
|
||||
}
|
||||
|
||||
public void onUpdate()
|
||||
{
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.motionY -= 0.03999999910593033D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.9800000190734863D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
|
||||
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition mop = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
|
||||
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if (mop != null)
|
||||
{
|
||||
vec3 = Vec3.createVectorHelper(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
//System.out.println(mop.entityHit);
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote){
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.explode();
|
||||
this.setDead();
|
||||
}
|
||||
if(this.motionX==0||this.motionY==0||this.motionZ==0){
|
||||
this.explode();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private void explode()
|
||||
{
|
||||
float f = 1F+(this.worldObj.rand.nextFloat()/3)+(this.worldObj.rand.nextFloat()/4)+this.worldObj.rand.nextFloat()/5;
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||
|
||||
}
|
||||
|
||||
public EntityLivingBase getTntPlacedBy()
|
||||
{
|
||||
return this.tntPlacedBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -140,24 +140,24 @@ public class EntityITSpear extends EntityArrow implements IProjectile {
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
public void setThrowableHeading(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_)
|
||||
public void setThrowableHeading(double x, double y, double z, float p_70186_7_, float p_70186_8_)
|
||||
{
|
||||
float f2 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_3_ * p_70186_3_ + p_70186_5_ * p_70186_5_);
|
||||
p_70186_1_ /= (double)f2;
|
||||
p_70186_3_ /= (double)f2;
|
||||
p_70186_5_ /= (double)f2;
|
||||
p_70186_1_ += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
p_70186_3_ += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
p_70186_5_ += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
p_70186_1_ *= (double)p_70186_7_;
|
||||
p_70186_3_ *= (double)p_70186_7_;
|
||||
p_70186_5_ *= (double)p_70186_7_;
|
||||
this.motionX = p_70186_1_/2.5;
|
||||
this.motionY = p_70186_3_/1.75;
|
||||
this.motionZ = p_70186_5_/2.5;
|
||||
float f3 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_5_ * p_70186_5_);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70186_1_, p_70186_5_) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70186_3_, (double)f3) * 180.0D / Math.PI);
|
||||
float f2 = MathHelper.sqrt_double(x * x + y * y + z * z);
|
||||
x /= (double)f2;
|
||||
y /= (double)f2;
|
||||
z /= (double)f2;
|
||||
x += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
y += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
z += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
x *= (double)p_70186_7_;
|
||||
y *= (double)p_70186_7_;
|
||||
z *= (double)p_70186_7_;
|
||||
this.motionX = x/2.5;
|
||||
this.motionY = y/1.75;
|
||||
this.motionZ = z/2.5;
|
||||
float f3 = MathHelper.sqrt_double(x * x + z * z);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f3) * 180.0D / Math.PI);
|
||||
this.ticksInGround = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,592 @@
|
||||
package com.kitsu.medievalcraft.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.S2BPacketChangeGameState;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ProjectileCannonBall extends EntityArrow implements IProjectile {
|
||||
private int field_145791_d = -1;
|
||||
private int field_145792_e = -1;
|
||||
private int field_145789_f = -1;
|
||||
private Block field_145790_g;
|
||||
private int inData;
|
||||
private boolean inGround;
|
||||
/** 1 if the player can pick up the arrow */
|
||||
public int canBePickedUp;
|
||||
/** Seems to be some sort of timer for animating an arrow. */
|
||||
public int arrowShake;
|
||||
/** The owner of this arrow. */
|
||||
public Entity shootingEntity;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
private double damage = 35.0D;
|
||||
/** The amount of knockback an arrow applies when it hits a mob. */
|
||||
private int knockbackStrength;
|
||||
|
||||
public ProjectileCannonBall(World world)
|
||||
{
|
||||
super(world);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public ProjectileCannonBall(World world, double x, double y, double z)
|
||||
{
|
||||
super(world);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(x, y, z);
|
||||
this.yOffset = 0.0F;
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
public ProjectileCannonBall(World world, EntityLivingBase player, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_)
|
||||
{
|
||||
super(world);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = player;
|
||||
|
||||
if (player instanceof EntityPlayer)
|
||||
{
|
||||
this.canBePickedUp = 1;
|
||||
}
|
||||
|
||||
this.posY = player.posY + (double)player.getEyeHeight() + 0.10000000149011612D;
|
||||
double d0 = p_i1755_3_.posX - player.posX;
|
||||
double d1 = p_i1755_3_.boundingBox.minY + (double)(p_i1755_3_.height / 3.0F) - this.posY;
|
||||
double d2 = p_i1755_3_.posZ - player.posZ;
|
||||
double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);
|
||||
|
||||
if (d3 >= 1.0E-7D)
|
||||
{
|
||||
float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
|
||||
float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));
|
||||
double d4 = d0 / d3;
|
||||
double d5 = d2 / d3;
|
||||
this.setLocationAndAngles(player.posX + d4, this.posY, player.posZ + d5, f2, f3);
|
||||
this.yOffset = 0.0F;
|
||||
float f4 = (float)d3 * 0.2F;
|
||||
this.setThrowableHeading(d0, d1 + (double)f4, d2, p_i1755_4_, p_i1755_5_);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
public ProjectileCannonBall(World world, EntityLivingBase player, float p_i1756_3_)
|
||||
{
|
||||
super(world);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = player;
|
||||
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setLocationAndAngles(player.posX, player.posY + (double)player.getEyeHeight(), player.posZ, player.rotationYaw, player.rotationPitch);
|
||||
|
||||
this.posX += (player.getLookVec().xCoord);
|
||||
//this.posY -= 0.10000000149011612D;
|
||||
this.posZ += (player.getLookVec().zCoord);
|
||||
//this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
this.posY += player.getLookVec().yCoord;
|
||||
if(player.getLookVec().yCoord < 0){
|
||||
this.posY += player.getLookVec().yCoord * 2;
|
||||
}
|
||||
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
|
||||
//this.setSize(0.5F, 0.5F);
|
||||
//this.setLocationAndAngles(player.posX, player.posY + (double)player.getEyeHeight(), player.posZ, player.rotationYaw, player.rotationPitch);
|
||||
//this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
//this.posY -= 0.10000000149011612D;
|
||||
//this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
|
||||
//this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.yOffset = 0.0F;
|
||||
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
public void setThrowableHeading(double x, double y, double z, float p_70186_7_, float p_70186_8_)
|
||||
{
|
||||
float f2 = MathHelper.sqrt_double(x * x + y * y + z * z);
|
||||
x /= (double)f2;
|
||||
y /= (double)f2;
|
||||
z /= (double)f2;
|
||||
x += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
y += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
z += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)p_70186_8_;
|
||||
x *= (double)p_70186_7_;
|
||||
y *= (double)p_70186_7_;
|
||||
z *= (double)p_70186_7_;
|
||||
this.motionX = x/2.5;
|
||||
this.motionY = y/1.75;
|
||||
this.motionZ = z/2.5;
|
||||
float f3 = MathHelper.sqrt_double(x * x + z * z);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f3) * 180.0D / Math.PI);
|
||||
this.ticksInGround = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
|
||||
* posY, posZ, yaw, pitch
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_)
|
||||
{
|
||||
this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_);
|
||||
this.setRotation(p_70056_7_, p_70056_8_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity to the args. Args: x, y, z
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_)
|
||||
{
|
||||
|
||||
this.motionX = p_70016_1_ ;
|
||||
this.motionY = p_70016_3_ ;
|
||||
this.motionZ = p_70016_5_ ;
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, (double)f) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch;
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
//this.getEntityData().setInteger("blockX", this.field_145791_d);
|
||||
|
||||
if (block.getMaterial() != Material.air)
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))
|
||||
{
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.arrowShake > 0)
|
||||
{
|
||||
--this.arrowShake;
|
||||
}
|
||||
|
||||
if (this.inGround)
|
||||
{
|
||||
int j = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (block == this.field_145790_g && j == this.inData)
|
||||
{
|
||||
++this.ticksInGround;
|
||||
|
||||
if (this.ticksInGround == -1)
|
||||
{
|
||||
//this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inGround = false;
|
||||
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.ticksInGround = 0;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++this.ticksInAir;
|
||||
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
|
||||
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
int i;
|
||||
float f1;
|
||||
|
||||
for (i = 0; i < list.size(); ++i)
|
||||
{
|
||||
Entity entity1 = (Entity)list.get(i);
|
||||
|
||||
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
|
||||
{
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double)f1, (double)f1, (double)f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
this.inGround=true;
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;
|
||||
|
||||
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer))
|
||||
{
|
||||
movingobjectposition = null;
|
||||
}
|
||||
}
|
||||
|
||||
float f2;
|
||||
float f4;
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
if (movingobjectposition.entityHit != null)
|
||||
|
||||
{
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
int k = MathHelper.ceiling_double_int((double)f2 * this.damage);
|
||||
|
||||
DamageSource damagesource = null;
|
||||
|
||||
if (this.shootingEntity == null)
|
||||
{
|
||||
//EntityPlayer player = (EntityPlayer) movingobjectposition.entityHit;
|
||||
//System.out.println(player.inventory.getTotalArmorValue());
|
||||
damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity);
|
||||
//damagesource = DamageSource.
|
||||
}
|
||||
else
|
||||
{
|
||||
damagesource = DamageSource.causeThrownDamage(this, this.shootingEntity);
|
||||
}
|
||||
|
||||
if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
movingobjectposition.entityHit.setFire(5);
|
||||
}
|
||||
|
||||
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)k))
|
||||
{
|
||||
if (movingobjectposition.entityHit instanceof EntityLivingBase)
|
||||
{
|
||||
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
//entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1);
|
||||
}
|
||||
|
||||
if (this.knockbackStrength > 0)
|
||||
{
|
||||
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
|
||||
if (f4 > 0.0F)
|
||||
{
|
||||
movingobjectposition.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase)
|
||||
{
|
||||
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
|
||||
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase);
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
|
||||
}
|
||||
}
|
||||
|
||||
//this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
if (!(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.motionX *= -0.10000000149011612D;
|
||||
this.motionY *= -0.10000000149011612D;
|
||||
this.motionZ *= -0.10000000149011612D;
|
||||
this.rotationYaw += 180.0F;
|
||||
this.prevRotationYaw += 180.0F;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
this.inGround=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
this.field_145791_d = movingobjectposition.blockX;
|
||||
this.field_145792_e = movingobjectposition.blockY;
|
||||
this.field_145789_f = movingobjectposition.blockZ;
|
||||
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX));
|
||||
this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY));
|
||||
this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ));
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;
|
||||
this.posY -= this.motionY / (double)f2 * 0.05000000074505806D;
|
||||
this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D;
|
||||
//this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
this.inGround = true;
|
||||
this.arrowShake = 7;
|
||||
|
||||
|
||||
if (this.field_145790_g.getMaterial() != Material.air)
|
||||
{
|
||||
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
|
||||
}
|
||||
}
|
||||
this.inGround=true;
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
|
||||
{
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
|
||||
{
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
|
||||
{
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}
|
||||
|
||||
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
float f3 = 0.99F;
|
||||
f1 = 0.05F;
|
||||
|
||||
if (this.isInWater())
|
||||
{
|
||||
for (int l = 0; l < 4; ++l)
|
||||
{
|
||||
f4 = 0.25F;
|
||||
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
f3 = 0.8F;
|
||||
}
|
||||
|
||||
if (this.isWet())
|
||||
{
|
||||
this.extinguish();
|
||||
}
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
if (movingobjectposition.entityHit != null)
|
||||
{
|
||||
this.inGround=true;
|
||||
}
|
||||
}
|
||||
|
||||
this.motionX *= (double)f3;
|
||||
this.motionY *= (double)f3;
|
||||
this.motionZ *= (double)f3;
|
||||
this.motionY -= (double)f1;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.func_145775_I();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_)
|
||||
{
|
||||
p_70014_1_.setShort("xTile", (short)this.field_145791_d);
|
||||
p_70014_1_.setShort("yTile", (short)this.field_145792_e);
|
||||
p_70014_1_.setShort("zTile", (short)this.field_145789_f);
|
||||
p_70014_1_.setShort("life", (short)this.ticksInGround);
|
||||
p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145790_g));
|
||||
p_70014_1_.setByte("inData", (byte)this.inData);
|
||||
p_70014_1_.setByte("shake", (byte)this.arrowShake);
|
||||
p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||
p_70014_1_.setByte("pickup", (byte)this.canBePickedUp);
|
||||
p_70014_1_.setDouble("damage", this.damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
|
||||
{
|
||||
this.field_145791_d = p_70037_1_.getShort("xTile");
|
||||
this.field_145792_e = p_70037_1_.getShort("yTile");
|
||||
this.field_145789_f = p_70037_1_.getShort("zTile");
|
||||
this.ticksInGround = p_70037_1_.getShort("life");
|
||||
this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
|
||||
this.inData = p_70037_1_.getByte("inData") & 255;
|
||||
this.arrowShake = p_70037_1_.getByte("shake") & 255;
|
||||
this.inGround = p_70037_1_.getByte("inGround") == 1;
|
||||
|
||||
if (p_70037_1_.hasKey("damage", 99))
|
||||
{
|
||||
this.damage = p_70037_1_.getDouble("damage");
|
||||
}
|
||||
|
||||
if (p_70037_1_.hasKey("pickup", 99))
|
||||
{
|
||||
this.canBePickedUp = p_70037_1_.getByte("pickup");
|
||||
}
|
||||
else if (p_70037_1_.hasKey("player", 99))
|
||||
{
|
||||
this.canBePickedUp = p_70037_1_.getBoolean("player") ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by a player entity when they collide with an entity
|
||||
*/
|
||||
public void onCollideWithPlayer(EntityPlayer p_70100_1_)
|
||||
{
|
||||
if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
|
||||
{
|
||||
boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && p_70100_1_.capabilities.isCreativeMode;
|
||||
|
||||
if (this.canBePickedUp == 1 && !p_70100_1_.inventory.addItemStackToInventory(new ItemStack(ModItems.itemITSpear, 1)))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
p_70100_1_.onItemPickup(this, 1);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
|
||||
* prevent them from trampling crops
|
||||
*/
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize()
|
||||
{
|
||||
return 2.0F;
|
||||
}
|
||||
|
||||
public void setDamage(double p_70239_1_)
|
||||
{
|
||||
this.damage = p_70239_1_;
|
||||
}
|
||||
|
||||
public double getDamage()
|
||||
{
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount of knockback the arrow applies when it hits a mob.
|
||||
*/
|
||||
public void setKnockbackStrength(int p_70240_1_)
|
||||
{
|
||||
this.knockbackStrength = p_70240_1_;
|
||||
}
|
||||
|
||||
/**
|
||||
* If returns false, the item will not inflict any damage against entities.
|
||||
*/
|
||||
public boolean canAttackWithItem()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -173,11 +173,11 @@ public void splitLogEvent(PlayerInteractEvent event){
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
Block test = event.world.getBlock(event.x, event.y, event.z);
|
||||
//Block isEmpty = event.world.getBlock(event.x, event.y + 1, event.z);
|
||||
ItemStack itemStack = new ItemStack(ModItems.itemBark);
|
||||
//ItemStack stickStack = new ItemStack(Items.stick);
|
||||
|
||||
Block test = event.world.getBlock(event.x, event.y, event.z);
|
||||
//Block isEmpty = event.world.getBlock(event.x, event.y + 1, event.z);
|
||||
ItemStack itemStack = new ItemStack(ModItems.itemBark);
|
||||
//ItemStack stickStack = new ItemStack(Items.stick);
|
||||
|
||||
if((player.inventory.getCurrentItem().getItem() == Items.stick)) {
|
||||
if((event.action == event.action.RIGHT_CLICK_BLOCK ) && ((test == Blocks.log)||test == Blocks.log2) ) { //&& (test == ModBlocks.testForge) && (isEmpty == Blocks.air)
|
||||
if(test == Blocks.log){
|
||||
@@ -587,47 +587,50 @@ public void onPlayerUpdateMaceWoodenShield (LivingUpdateEvent event) {
|
||||
@SubscribeEvent
|
||||
public void onPlayerHurtShield (LivingHurtEvent event) {
|
||||
|
||||
if (event.entity instanceof EntityPlayer && event.ammount > 0) {
|
||||
if(event.entity.worldObj.isRemote){
|
||||
if (event.entity instanceof EntityPlayer && event.ammount > 0) {
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
Entity mobEntity = event.source.getEntity();
|
||||
String mobString = event.source.getDamageType();
|
||||
//System.out.println(mobEntity);
|
||||
//System.out.println(mobString);
|
||||
if (player.inventory.getCurrentItem()!=null){
|
||||
if(player.isUsingItem()==true){
|
||||
if (player.inventory.getCurrentItem()!=null){
|
||||
if (player.inventory.getCurrentItem().getItem().equals(checkShield(player.inventory.getCurrentItem().getItem()))) {
|
||||
if ((mobString.equals("explosion")) || (mobString.equals("thrown")) || (mobString.equals("arrow") || (mobString.equals("player")) || (mobString.equals("mob")) || (mobString.equals("fireball")))) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
Entity mobEntity = event.source.getEntity();
|
||||
String mobString = event.source.getDamageType();
|
||||
//System.out.println(mobEntity);
|
||||
//System.out.println(mobString);
|
||||
Vec3 vec3 = player.getLook(1.0F).normalize();
|
||||
Vec3 vec31 = Vec3.createVectorHelper(mobEntity.posX - player.posX, mobEntity.boundingBox.minY + mobEntity.height / 2.0F - (player.posY + player.getEyeHeight()), mobEntity.posZ - player.posZ);
|
||||
double d0 = vec31.lengthVector();
|
||||
vec31 = vec31.normalize();
|
||||
double d1 = vec3.dotProduct(vec31);
|
||||
double d2 = 1.0D - 0.025D / d0;
|
||||
|
||||
if(player.isUsingItem()==true){
|
||||
if (d1 + 0.3 > d2) {
|
||||
|
||||
if (player.inventory.getCurrentItem().getItem().equals(checkShield(player.inventory.getCurrentItem().getItem()))) {
|
||||
if ((mobString.equals("explosion")) || (mobString.equals("thrown")) || (mobString.equals("arrow") || (mobString.equals("player")) || (mobString.equals("mob")) || (mobString.equals("fireball")))) {
|
||||
if(player.inventory.getCurrentItem().getItem().equals(ModItems.woodenShield)){
|
||||
if(event.ammount > 1.5F){
|
||||
event.ammount = event.ammount-2F;
|
||||
} else event.ammount = 0;
|
||||
player.getCurrentEquippedItem().damageItem(2, player);
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":woodshieldbash", 1.0F, 1.0F);
|
||||
//event.entityLiving.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, 0, true));
|
||||
if (mobString.equals("explosion") && rand.nextInt(5) == 1) {
|
||||
--player.getCurrentEquippedItem().stackSize;
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem().getItem().equals(ModItems.ironShield)){
|
||||
if(event.ammount > 4F){
|
||||
event.ammount = event.ammount-4F;
|
||||
} else event.ammount = 0;
|
||||
player.getCurrentEquippedItem().damageItem(4, player);
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":ironShieldBash", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
Vec3 vec3 = player.getLook(1.0F).normalize();
|
||||
Vec3 vec31 = Vec3.createVectorHelper(mobEntity.posX - player.posX, mobEntity.boundingBox.minY + mobEntity.height / 2.0F - (player.posY + player.getEyeHeight()), mobEntity.posZ - player.posZ);
|
||||
double d0 = vec31.lengthVector();
|
||||
vec31 = vec31.normalize();
|
||||
double d1 = vec3.dotProduct(vec31);
|
||||
double d2 = 1.0D - 0.025D / d0;
|
||||
|
||||
if (d1 + 0.3 > d2) {
|
||||
|
||||
if(player.inventory.getCurrentItem().getItem().equals(ModItems.woodenShield)){
|
||||
if(event.ammount > 1.5F){
|
||||
event.ammount = event.ammount-2F;
|
||||
} else event.ammount = 0;
|
||||
player.getCurrentEquippedItem().damageItem(2, player);
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":woodshieldbash", 1.0F, 1.0F);
|
||||
//event.entityLiving.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, 0, true));
|
||||
if (mobString.equals("explosion") && rand.nextInt(5) == 1) {
|
||||
--player.getCurrentEquippedItem().stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.inventory.getCurrentItem().getItem().equals(ModItems.ironShield)){
|
||||
if(event.ammount > 4F){
|
||||
event.ammount = event.ammount-4F;
|
||||
} else event.ammount = 0;
|
||||
player.getCurrentEquippedItem().damageItem(4, player);
|
||||
player.worldObj.playSoundAtEntity(player, Main.MODID + ":ironShieldBash", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
package com.kitsu.medievalcraft.model_loader;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.obj.ObjModelLoader;
|
||||
import net.minecraftforge.client.model.techne.TechneModelLoader;
|
||||
import net.minecraftforge.common.ForgeVersion.Status;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Common interface for advanced model loading from files, based on file suffix
|
||||
* Model support can be queried through the {@link #getSupportedSuffixes()} method.
|
||||
* Instances can be created by calling {loadModel(String)} with a class-loadable-path
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class AdvancedModelLoader {
|
||||
private static Map<String, IModelCustomLoader> instances = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* Register a new model handler
|
||||
* @param modelHandler The model handler to register
|
||||
|
||||
public static void registerModelHandler(IModelCustomLoader modelHandler)
|
||||
{
|
||||
for (String suffix : modelHandler.getSuffixes())
|
||||
{
|
||||
instances.put(suffix, modelHandler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the model from the supplied classpath resolvable resource name
|
||||
* @param resource The resource name
|
||||
* @return A model
|
||||
* @throws IllegalArgumentException if the resource name cannot be understood
|
||||
* @throws ModelFormatException if the underlying model handler cannot parse the model format
|
||||
|
||||
public static IModelCustom loadModel(ResourceLocation resource) throws IllegalArgumentException, ModelFormatException
|
||||
{
|
||||
String name = resource.getResourcePath();
|
||||
int i = name.lastIndexOf('.');
|
||||
if (i == -1)
|
||||
{
|
||||
FMLLog.severe("The resource name %s is not valid", resource);
|
||||
throw new IllegalArgumentException("The resource name is not valid");
|
||||
}
|
||||
String suffix = name.substring(i+1);
|
||||
IModelCustomLoader loader = instances.get(suffix);
|
||||
if (loader == null)
|
||||
{
|
||||
FMLLog.severe("The resource name %s is not supported", resource);
|
||||
throw new IllegalArgumentException("The resource name is not supported");
|
||||
}
|
||||
|
||||
return loader.loadInstance(resource);
|
||||
}
|
||||
|
||||
public static Collection<String> getSupportedSuffixes()
|
||||
{
|
||||
return instances.keySet();
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
registerModelHandler(new ObjModelLoader());
|
||||
registerModelHandler(new TechneModelLoader());
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.kitsu.medievalcraft.model_loader;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IModelCustom
|
||||
{
|
||||
String getType();
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderAll();
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderOnly(String... groupNames);
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderPart(String partName);
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderAllExcept(String... excludedGroupNames);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.kitsu.medievalcraft.model_loader;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelFormatException;
|
||||
|
||||
/**
|
||||
* Instances of this class act as factories for their model type
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public interface IModelCustomLoader {
|
||||
/**
|
||||
* Get the main type name for this loader
|
||||
* @return the type name
|
||||
*/
|
||||
String getType();
|
||||
/**
|
||||
* Get resource suffixes this model loader recognizes
|
||||
* @return a list of suffixes
|
||||
*/
|
||||
String[] getSuffixes();
|
||||
/**
|
||||
* Load a model instance from the supplied path
|
||||
* @param resource The ResourceLocation of the model
|
||||
* @return A model instance
|
||||
* @throws ModelFormatException if the model format is not correct
|
||||
*/
|
||||
IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.kitsu.medievalcraft.model_loader;
|
||||
|
||||
/**
|
||||
* Thrown if there is a problem parsing the model
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class ModelFormatException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 2023547503969671835L;
|
||||
|
||||
public ModelFormatException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public ModelFormatException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ModelFormatException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ModelFormatException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
package com.kitsu.medievalcraft.model_loader.obj;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.model.obj.TextureCoordinate;
|
||||
import net.minecraftforge.client.model.obj.Vertex;
|
||||
|
||||
|
||||
public class Face
|
||||
{
|
||||
public Vertex[] vertices;
|
||||
public Vertex[] vertexNormals;
|
||||
public Vertex faceNormal;
|
||||
public TextureCoordinate[] textureCoordinates;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addFaceForRender(WorldRenderer worldRenderer)
|
||||
{
|
||||
addFaceForRender(worldRenderer, 0.0005F);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addFaceForRender(WorldRenderer worldRenderer, float textureOffset)
|
||||
{
|
||||
if (faceNormal == null)
|
||||
{
|
||||
faceNormal = this.calculateFaceNormal();
|
||||
}
|
||||
|
||||
//worldRenderer.normal(faceNormal.x, faceNormal.y, faceNormal.z);
|
||||
|
||||
|
||||
float averageU = 0F;
|
||||
float averageV = 0F;
|
||||
|
||||
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||
{
|
||||
for (int i = 0; i < textureCoordinates.length; ++i)
|
||||
{
|
||||
averageU += textureCoordinates[i].u;
|
||||
averageV += textureCoordinates[i].v;
|
||||
}
|
||||
|
||||
averageU = averageU / textureCoordinates.length;
|
||||
averageV = averageV / textureCoordinates.length;
|
||||
}
|
||||
|
||||
float offsetU, offsetV;
|
||||
|
||||
for (int i = 0; i < vertices.length; ++i)
|
||||
{
|
||||
|
||||
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||
{
|
||||
offsetU = textureOffset;
|
||||
offsetV = textureOffset;
|
||||
|
||||
if (textureCoordinates[i].u > averageU)
|
||||
{
|
||||
offsetU = -offsetU;
|
||||
}
|
||||
if (textureCoordinates[i].v > averageV)
|
||||
{
|
||||
offsetV = -offsetV;
|
||||
}
|
||||
|
||||
worldRenderer.pos(vertices[i].x, vertices[i].y, vertices[i].z).tex(textureCoordinates[i].u + offsetU,
|
||||
textureCoordinates[i].v + offsetV);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldRenderer.pos(vertices[i].x, vertices[i].y, vertices[i].z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vertex calculateFaceNormal()
|
||||
{
|
||||
Vec3 v0 = new Vec3(vertices[1].x - vertices[0].x, vertices[1].y - vertices[0].y, vertices[1].z - vertices[0].z);
|
||||
//Vec3 v1 = new Vec3(, , );
|
||||
//Vec3 v2 = new Vec3(vertices[2].x - vertices[0].x, vertices[2].y - vertices[0].y, vertices[2].z - vertices[0].z);
|
||||
Vec3 normalVector = null;
|
||||
|
||||
//normalVector = v1.crossProduct(v2).normalize();
|
||||
|
||||
return new Vertex((float) normalVector.xCoord, (float) normalVector.yCoord, (float) normalVector.zCoord);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -35,6 +35,8 @@ public class RenderId {
|
||||
public static int shelfFourID;
|
||||
public static int fireboxID;
|
||||
public static int forgeID;
|
||||
public static int cannon_28ID;
|
||||
public static int my28CannonBallID;
|
||||
|
||||
public static void init(){
|
||||
myironingotID = RenderingRegistry.getNextAvailableRenderId();
|
||||
@@ -68,6 +70,8 @@ public class RenderId {
|
||||
shelfFourID = RenderingRegistry.getNextAvailableRenderId();
|
||||
fireboxID = RenderingRegistry.getNextAvailableRenderId();
|
||||
forgeID = RenderingRegistry.getNextAvailableRenderId();
|
||||
cannon_28ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
my28CannonBallID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
testBlockID = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.BarrelLidRender;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.SmallBarrelRender;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.TestBlockRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.cannons.Render_Cannon_28;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.crucibles.IronOreCrucibleRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.crucibles.LapisCrucibleRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.crucibles.RedstoneCrucibleRenderer;
|
||||
@@ -32,6 +33,7 @@ import com.kitsu.medievalcraft.renderer.itemrenderer.IRITSpear;
|
||||
import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererITModelArrow;
|
||||
import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererLongbow;
|
||||
import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererModelArrow;
|
||||
import com.kitsu.medievalcraft.renderer.itemrenderer.cannons.IR_Cannon_28;
|
||||
import com.kitsu.medievalcraft.renderer.itemrenderer.crucibles.IRCrucible;
|
||||
import com.kitsu.medievalcraft.renderer.itemrenderer.crucibles.empty.IRSlackCrucible;
|
||||
import com.kitsu.medievalcraft.renderer.itemrenderer.crucibles.empty.IRTanninCrucible;
|
||||
@@ -64,6 +66,7 @@ import com.kitsu.medievalcraft.renderer.itemrenderer.weapons.NewIronShield;
|
||||
import com.kitsu.medievalcraft.tileents.TileEntitySmallBarrel;
|
||||
import com.kitsu.medievalcraft.tileents.TileEntitySmallLid;
|
||||
import com.kitsu.medievalcraft.tileents.TileEntityTestBlock;
|
||||
import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleIronOre;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleLapis;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleRedstone;
|
||||
@@ -117,6 +120,8 @@ public class RendererRegistry {
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.itemITSpear, new IRITSpear());
|
||||
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.cannon_28), new IR_Cannon_28());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.emptySoftCrucible), new ItemRendererSECrucible());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.emptyCookedCrucible), new ItemRendererECCrucible());
|
||||
|
||||
@@ -178,7 +183,12 @@ public class RendererRegistry {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileRedstoneIngot.class, new RedstoneIngotRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileLapisIngot.class, new LapisIngotRenderer());
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCannon_28.class, new Render_Cannon_28());
|
||||
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTestBlock.class, new TestBlockRenderer());
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.kitsu.medievalcraft.renderer.blocks.cannons;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.kitsu.medievalcraft.entity.EntityCannonBall;
|
||||
import com.kitsu.medievalcraft.entity.EntityITSpear;
|
||||
|
||||
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;
|
||||
|
||||
public class Render_CannonBall_Iron extends Render
|
||||
{
|
||||
|
||||
//private static final ResourceLocation arrowTextures = new ResourceLocation("textures/entity/arrow.png");
|
||||
private static final ResourceLocation arrowTextures = new ResourceLocation("kitsumedievalcraft:textures/items/Cannon.png");
|
||||
public static final ResourceLocation MODEL = new ResourceLocation("kitsumedievalcraft:models/cannon_ball.obj");
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/Cannon.png");
|
||||
|
||||
public IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
|
||||
|
||||
public void doRender(EntityCannonBall ent, double x, double y, double z, float p_76986_8_, float p_76986_9_)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float scale = 0.01f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef((float)x, (float)y, (float)z );
|
||||
//GL11.glRotatef(ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
//GL11.glRotatef(ent.prevRotationPitch + (ent.rotationPitch - ent.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
model.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(EntityCannonBall 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((EntityCannonBall)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((EntityCannonBall)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.kitsu.medievalcraft.renderer.blocks.cannons;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.kitsu.medievalcraft.entity.EntityCannonBall;
|
||||
import com.kitsu.medievalcraft.entity.ProjectileCannonBall;
|
||||
|
||||
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;
|
||||
|
||||
public class Render_CannonBall_Projectile extends Render
|
||||
{
|
||||
|
||||
//private static final ResourceLocation arrowTextures = new ResourceLocation("textures/entity/arrow.png");
|
||||
private static final ResourceLocation arrowTextures = new ResourceLocation("kitsumedievalcraft:textures/items/Cannon.png");
|
||||
public static final ResourceLocation MODEL = new ResourceLocation("kitsumedievalcraft:models/cannon_ball.obj");
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/Cannon.png");
|
||||
|
||||
public IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
|
||||
|
||||
public void doRender(ProjectileCannonBall ent, double x, double y, double z, float p_76986_8_, float p_76986_9_)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float scale = 0.01f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef((float)x, (float)y, (float)z );
|
||||
//GL11.glRotatef(ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
//GL11.glRotatef(ent.prevRotationPitch + (ent.rotationPitch - ent.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
model.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(ProjectileCannonBall 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((ProjectileCannonBall)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((ProjectileCannonBall)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.kitsu.medievalcraft.renderer.blocks.cannons;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
public class Render_Cannon_28 extends TileEntitySpecialRenderer {
|
||||
|
||||
EntityItem entItem = null;
|
||||
|
||||
private static final ResourceLocation MODEL_CRUCIBLE = new ResourceLocation("kitsumedievalcraft:models/Cannon.obj");
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/Cannon.png");
|
||||
private IModelCustom model = AdvancedModelLoader.loadModel(MODEL_CRUCIBLE);
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
|
||||
TileCannon_28 tileEntity = (TileCannon_28)tile;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
/*if(tileEntity.getStackInSlot(0)==null){
|
||||
entItem=null;
|
||||
}
|
||||
|
||||
if(tileEntity.getStackInSlot(0)!=null){
|
||||
entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(0));
|
||||
GL11.glPushMatrix();
|
||||
this.entItem.hoverStart = 0.0F;
|
||||
RenderItem.renderInFrame = true;
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
RenderManager.instance.renderEntityWithPosYaw(this.entItem, 0.48D, 0.25D, -1.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
tileEntity.markForUpdate();
|
||||
tileEntity.markDirty();
|
||||
}*/
|
||||
|
||||
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.cannon_28);
|
||||
tileEntity.markForUpdate();
|
||||
tileEntity.markDirty();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
public void renderBlock(TileCannon_28 tl, World world, int i, int j,int k, Block block) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
// This will make your block brightness dependent from surroundings
|
||||
// lighting.
|
||||
float f = block.getLightOpacity(world, i, j, k);
|
||||
int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
|
||||
int l1 = l % 65536;
|
||||
int l2 = l / 65536;
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,(float) l1, (float) l2);
|
||||
|
||||
/*
|
||||
* This will rotate your model corresponding to player direction that
|
||||
* was when you placed the block. If you want this to work, add these
|
||||
* lines to onBlockPlacedBy method in your block class. int dir =
|
||||
* MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) +
|
||||
* 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 0);
|
||||
*/
|
||||
|
||||
int dir = world.getBlockMetadata(i, j, k);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
//GL11.glRotatef(15F, 0F, 1F, 0F);
|
||||
float scale = 1.05f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
|
||||
if(dir == 0){
|
||||
GL11.glTranslatef(0.48F, 0.5F, 0.7F);
|
||||
GL11.glRotated(180F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
if(dir == 1){
|
||||
GL11.glTranslatef(0.3F, 0.5F, 0.48F);
|
||||
GL11.glRotated(90F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
if(dir == 2){
|
||||
GL11.glTranslatef(0.48F, 0.5F, 0.3F);
|
||||
GL11.glRotated(0F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
if(dir == 3){
|
||||
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
|
||||
GL11.glRotated(-90F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
//
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
/*
|
||||
* Place your rendering code here.
|
||||
*/
|
||||
this.model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.kitsu.medievalcraft.renderer.itemrenderer.cannons;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
public class IR_Cannon_28 implements IItemRenderer {
|
||||
|
||||
public static final ResourceLocation MODEL_CRUCIBLE = new ResourceLocation("kitsumedievalcraft:models/Cannon.obj");
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/Cannon.png");
|
||||
|
||||
public IModelCustom model = AdvancedModelLoader.loadModel(MODEL_CRUCIBLE);
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
|
||||
switch(type) {
|
||||
case EQUIPPED: {
|
||||
return true;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
return true;
|
||||
}
|
||||
case INVENTORY: {
|
||||
return true;
|
||||
}
|
||||
case ENTITY: {
|
||||
return true;
|
||||
}
|
||||
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
|
||||
ItemRendererHelper helper) {
|
||||
|
||||
switch(type) {
|
||||
case EQUIPPED: {
|
||||
return helper == ItemRendererHelper.BLOCK_3D;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
return helper == ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
}
|
||||
case INVENTORY: {
|
||||
return helper == ItemRendererHelper.INVENTORY_BLOCK;
|
||||
}
|
||||
case ENTITY: {
|
||||
return (helper == ItemRendererHelper.ENTITY_BOBBING ||
|
||||
helper == ItemRendererHelper.ENTITY_ROTATION ||
|
||||
helper == ItemRendererHelper.BLOCK_3D);
|
||||
}
|
||||
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
|
||||
switch(type) {
|
||||
|
||||
case EQUIPPED: {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
float scale = 1.0F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
|
||||
//ANGLE, X ROTATE, Y ROTATE, Z ROTATE
|
||||
//GL11.glRotatef(22F, 0.0F, 0.0F, 1.0F);
|
||||
//GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
GL11.glTranslatef(0.7F, 0.3F, 0.0F);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
model.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
} break;
|
||||
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
float f = 0.8F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(f, f, f);
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.F, 1.0F);
|
||||
//ANGLE, X ROTATE, Y ROTATE, Z ROTATE
|
||||
GL11.glRotatef(-50F, 0.0F, 1.0F, 0.0F);
|
||||
//GL11.glRotatef(-45F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
model.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
} break;
|
||||
|
||||
case INVENTORY: {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
float scale = 0.8F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
|
||||
//GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
GL11.glTranslatef(0.0F, -0.1F, 0.35F);
|
||||
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
model.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
} break;
|
||||
|
||||
case ENTITY: {
|
||||
GL11.glPushMatrix();
|
||||
//GL11.glScalef(1.75F, 1.75F, 1.75F);
|
||||
|
||||
|
||||
|
||||
|
||||
//GL11.glTranslatef(0.0F, 0.0F, 0.0F);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
model.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
} break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,8 +141,4 @@ public class IRForgeAnvil implements IItemRenderer {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kitsu.medievalcraft.tileents;
|
||||
|
||||
import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleIronOre;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleLapis;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleRedstone;
|
||||
@@ -63,6 +64,8 @@ public class TileEntRegister {
|
||||
GameRegistry.registerTileEntity(TileRedstoneIngot.class, "RedstoneIngot");
|
||||
GameRegistry.registerTileEntity(TileLapisIngot.class, "LapisIngot");
|
||||
|
||||
GameRegistry.registerTileEntity(TileCannon_28.class, "Cannon_28");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.kitsu.medievalcraft.tileents.cannon;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileCannonBall28 extends TileEntity {
|
||||
|
||||
private String tileCannonBall28;
|
||||
|
||||
public TileCannonBall28(){
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
package com.kitsu.medievalcraft.tileents.cannon;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileCannon_28 extends TileEntity implements IInventory, ISidedInventory{
|
||||
|
||||
private String tileCannon_28;
|
||||
private ItemStack[] inv;
|
||||
private NBTTagCompound tag = new NBTTagCompound();
|
||||
private int ticks;
|
||||
public boolean isOn;
|
||||
|
||||
public TileCannon_28(){
|
||||
this.inv = new ItemStack[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return this.inv.length;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return this.inv[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_)
|
||||
{
|
||||
if (this.inv[p_70298_1_] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.inv[p_70298_1_].stackSize <= p_70298_2_)
|
||||
{
|
||||
itemstack = this.inv[p_70298_1_];
|
||||
this.inv[p_70298_1_] = null;
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
return itemstack;
|
||||
}
|
||||
itemstack = this.inv[p_70298_1_].splitStack(p_70298_2_);
|
||||
|
||||
if (this.inv[p_70298_1_].stackSize == 0)
|
||||
{
|
||||
this.inv[p_70298_1_] = null;
|
||||
}
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
return itemstack;
|
||||
}
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i)
|
||||
{
|
||||
if (this.inv[i] != null)
|
||||
{
|
||||
ItemStack itemstack = this.inv[i];
|
||||
this.inv[i] = null;
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
return itemstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||
{
|
||||
this.inv[slot] = stack;
|
||||
|
||||
if (stack != null && stack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
stack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.tileCannon_28 : "tileCannon_28";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.tileCannon_28 != null && this.tileCannon_28.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
|
||||
if(slot == 0 && itemstack.getItem() == Items.gunpowder){
|
||||
return true;
|
||||
}
|
||||
if(slot == 1 && itemstack.getItem() == Item.getItemFromBlock(ModBlocks.cannonBall_28)){
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void markForUpdate(){
|
||||
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
|
||||
this.inv = new ItemStack[this.getSizeInventory()];
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
byte slot = tag.getByte("Slot");
|
||||
if (slot >= 0 && slot < this.inv.length) {
|
||||
this.inv[slot] = ItemStack.loadItemStackFromNBT(tag);
|
||||
}
|
||||
}
|
||||
if (tagCompound.hasKey("CustomName", 8)) {
|
||||
this.tileCannon_28 = tagCompound.getString("CustomName");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
for (int i = 0; i < inv.length; i++) {
|
||||
//ItemStack stack = inv[i];
|
||||
if (inv[i] != null) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setByte("Slot", (byte) i);
|
||||
this.inv[i].writeToNBT(tag);
|
||||
itemList.appendTag(tag);
|
||||
}
|
||||
}
|
||||
tagCompound.setTag("Inventory", itemList);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 998, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
World world = getWorldObj();
|
||||
int x = this.xCoord;
|
||||
int y = this.yCoord;
|
||||
int z = this.zCoord;
|
||||
if(!world.isRemote){
|
||||
if(this.isOn==true){
|
||||
ticks++;
|
||||
}
|
||||
if(ticks>=100){
|
||||
this.isOn=false;
|
||||
ticks=0;
|
||||
}
|
||||
}
|
||||
if (worldObj.isRemote) return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Blender MTL File: 'cannon.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl None
|
||||
Ns 0
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.8 0.8 0.8
|
||||
Ks 0.8 0.8 0.8
|
||||
d 1
|
||||
illum 2
|
||||
map_Kd /home/kitsudesktop/Development/Blends/Cannon.png
|
||||
270
src/main/resources/assets/kitsumedievalcraft/models/Cannon.obj
Normal file
270
src/main/resources/assets/kitsumedievalcraft/models/Cannon.obj
Normal file
@@ -0,0 +1,270 @@
|
||||
# Blender v2.71 (sub 0) OBJ File: 'cannon.blend'
|
||||
# www.blender.org
|
||||
mtllib Cannon.mtl
|
||||
o Cube_Cube.001
|
||||
v -0.125000 -0.125000 -1.375000
|
||||
v 0.125000 -0.125000 -1.375000
|
||||
v -0.125000 0.125000 -1.375000
|
||||
v -0.250000 -0.250000 0.650000
|
||||
v -0.225000 -0.225000 -1.225000
|
||||
v 0.225000 -0.225000 -1.225000
|
||||
v 0.250000 -0.250000 0.650000
|
||||
v -0.250000 0.250000 0.650000
|
||||
v -0.225000 0.225000 -1.225000
|
||||
v 0.225000 0.225000 -1.225000
|
||||
v 0.250000 0.250000 0.650000
|
||||
v -0.250000 -0.250000 -1.225000
|
||||
v -0.250000 -0.250000 -1.375000
|
||||
v 0.250000 -0.250000 -1.375000
|
||||
v 0.250000 -0.250000 -1.225000
|
||||
v -0.250000 0.250000 -1.225000
|
||||
v -0.250000 0.250000 -1.375000
|
||||
v 0.250000 0.250000 -1.375000
|
||||
v 0.250000 0.250000 -1.225000
|
||||
v 0.125000 0.125000 -1.375000
|
||||
v -0.125000 0.125000 0.425000
|
||||
v -0.125000 -0.125000 0.425000
|
||||
v 0.125000 -0.125000 0.425000
|
||||
v 0.125000 0.125000 0.425000
|
||||
v -0.100940 -0.100940 0.650000
|
||||
v 0.100940 -0.100940 0.650000
|
||||
v -0.100940 0.100940 0.650000
|
||||
v 0.100940 0.100940 0.650000
|
||||
v -0.100940 -0.100940 0.725000
|
||||
v 0.100940 -0.100940 0.725000
|
||||
v -0.100940 0.100940 0.725000
|
||||
v 0.100940 0.100940 0.725000
|
||||
v 0.505154 -0.054574 -0.256972
|
||||
v 0.505154 -0.054574 -0.150739
|
||||
v 0.505154 0.051659 -0.256972
|
||||
v 0.505154 0.051659 -0.150739
|
||||
v 0.228100 0.051659 -0.256972
|
||||
v 0.228100 0.051659 -0.150739
|
||||
v 0.228100 -0.054574 -0.256972
|
||||
v 0.228100 -0.054574 -0.150739
|
||||
v -0.233931 -0.054574 -0.256972
|
||||
v -0.233931 -0.054574 -0.150739
|
||||
v -0.233931 0.051659 -0.256972
|
||||
v -0.233931 0.051659 -0.150739
|
||||
v -0.510986 0.051659 -0.256972
|
||||
v -0.510986 0.051659 -0.150739
|
||||
v -0.510986 -0.054574 -0.256972
|
||||
v -0.510986 -0.054574 -0.150739
|
||||
vt 0.425000 0.440784
|
||||
vt 0.237500 0.440784
|
||||
vt 0.227083 0.005226
|
||||
vt 0.735416 0.625443
|
||||
vt 0.735416 0.451232
|
||||
vt 0.777083 0.451232
|
||||
vt 0.006250 0.005226
|
||||
vt 0.214583 0.005226
|
||||
vt 0.204167 0.440784
|
||||
vt 0.679167 0.005226
|
||||
vt 0.866667 0.005226
|
||||
vt 0.877083 0.440779
|
||||
vt 0.645833 0.440779
|
||||
vt 0.458333 0.440779
|
||||
vt 0.447917 0.005226
|
||||
vt 0.831249 0.451232
|
||||
vt 0.831249 0.625443
|
||||
vt 0.789583 0.625443
|
||||
vt 0.006250 0.994774
|
||||
vt 0.006250 0.820563
|
||||
vt 0.016667 0.829274
|
||||
vt 0.681250 0.625443
|
||||
vt 0.681250 0.451232
|
||||
vt 0.722916 0.451232
|
||||
vt 0.343750 0.625447
|
||||
vt 0.343750 0.451237
|
||||
vt 0.385416 0.451237
|
||||
vt 0.162500 0.494789
|
||||
vt 0.214583 0.451237
|
||||
vt 0.214583 0.625447
|
||||
vt 0.204167 0.986063
|
||||
vt 0.214583 0.994774
|
||||
vt 0.993750 0.423329
|
||||
vt 0.889583 0.005226
|
||||
vt 0.889583 0.423329
|
||||
vt 0.564583 0.869334
|
||||
vt 0.668750 0.451232
|
||||
vt 0.564583 0.451232
|
||||
vt 0.214583 0.820563
|
||||
vt 0.254436 0.699925
|
||||
vt 0.233603 0.699925
|
||||
vt 0.233603 0.629586
|
||||
vt 0.152475 0.758175
|
||||
vt 0.152475 0.687836
|
||||
vt 0.214583 0.635900
|
||||
vt 0.068359 0.758175
|
||||
vt 0.214583 0.810111
|
||||
vt 0.068359 0.687836
|
||||
vt 0.006250 0.810111
|
||||
vt 0.006250 0.635900
|
||||
vt 0.227083 0.619134
|
||||
vt 0.227083 0.548795
|
||||
vt 0.311200 0.548795
|
||||
vt 0.843749 0.602363
|
||||
vt 0.843749 0.532024
|
||||
vt 0.864582 0.532024
|
||||
vt 0.857619 0.706234
|
||||
vt 0.836786 0.706234
|
||||
vt 0.836786 0.635895
|
||||
vt 0.843749 0.451232
|
||||
vt 0.864582 0.451232
|
||||
vt 0.864582 0.521571
|
||||
vt 0.296445 0.701728
|
||||
vt 0.296445 0.738742
|
||||
vt 0.266936 0.738742
|
||||
vt 0.331250 0.538342
|
||||
vt 0.227083 0.451237
|
||||
vt 0.227083 0.538342
|
||||
vt 0.681250 0.745051
|
||||
vt 0.681250 0.708037
|
||||
vt 0.710759 0.708037
|
||||
vt 0.435417 0.005226
|
||||
vt 0.777083 0.625443
|
||||
vt 0.016667 0.440784
|
||||
vt 0.668750 0.440779
|
||||
vt 0.656250 0.005226
|
||||
vt 0.789583 0.451232
|
||||
vt 0.016667 0.986063
|
||||
vt 0.722916 0.625443
|
||||
vt 0.385416 0.625447
|
||||
vt 0.204167 0.829274
|
||||
vt 0.254436 0.629586
|
||||
vt 0.311200 0.619134
|
||||
vt 0.864582 0.602363
|
||||
vt 0.857619 0.635895
|
||||
vt 0.843749 0.521571
|
||||
vt 0.266936 0.701728
|
||||
vt 0.331250 0.451237
|
||||
vt 0.710759 0.745051
|
||||
vt 0.058333 0.494789
|
||||
vt 0.006250 0.451237
|
||||
vt 0.058333 0.581895
|
||||
vt 0.889583 0.433782
|
||||
vt 0.993750 0.851885
|
||||
vt 0.993750 0.433782
|
||||
vt 0.162500 0.581895
|
||||
vt 0.006250 0.625447
|
||||
vt 0.400513 0.697589
|
||||
vt 0.400513 0.635900
|
||||
vt 0.430022 0.635900
|
||||
vt 0.397916 0.585068
|
||||
vt 0.397916 0.523379
|
||||
vt 0.427425 0.523379
|
||||
vt 0.311200 0.691276
|
||||
vt 0.266936 0.691276
|
||||
vt 0.266936 0.629586
|
||||
vt 0.725514 0.697585
|
||||
vt 0.681250 0.697585
|
||||
vt 0.681250 0.635895
|
||||
vt 0.552083 0.869334
|
||||
vt 0.447917 0.451232
|
||||
vt 0.447917 0.869334
|
||||
vt 0.794777 0.697585
|
||||
vt 0.794777 0.635895
|
||||
vt 0.824286 0.635895
|
||||
vt 0.427425 0.451237
|
||||
vt 0.427425 0.512926
|
||||
vt 0.397916 0.512926
|
||||
vt 0.738014 0.635895
|
||||
vt 0.782277 0.635895
|
||||
vt 0.782277 0.697585
|
||||
vt 0.388013 0.697589
|
||||
vt 0.343750 0.697589
|
||||
vt 0.343750 0.635900
|
||||
vt 0.993750 0.005226
|
||||
vt 0.668750 0.869334
|
||||
vt 0.889583 0.851885
|
||||
vt 0.430022 0.697589
|
||||
vt 0.427425 0.585068
|
||||
vt 0.311200 0.629586
|
||||
vt 0.725514 0.635895
|
||||
vt 0.552083 0.451232
|
||||
vt 0.824286 0.697585
|
||||
vt 0.397916 0.451237
|
||||
vt 0.738014 0.697585
|
||||
vt 0.388013 0.635900
|
||||
usemtl None
|
||||
s off
|
||||
f 9/1 5/2 4/3
|
||||
f 17/4 13/5 12/6
|
||||
f 11/7 7/8 6/9
|
||||
f 5/10 6/11 7/12
|
||||
f 10/13 9/14 8/15
|
||||
f 19/16 15/17 14/18
|
||||
f 15/19 19/20 10/21
|
||||
f 13/22 14/23 15/24
|
||||
f 18/25 17/26 16/27
|
||||
f 20/28 18/29 14/30
|
||||
f 5/31 12/32 15/19
|
||||
f 21/33 20/34 24/35
|
||||
f 20/36 23/37 24/38
|
||||
f 10/21 19/20 16/39
|
||||
f 16/39 12/32 5/31
|
||||
f 27/40 31/41 32/42
|
||||
f 25/43 27/44 8/45
|
||||
f 26/46 25/43 4/47
|
||||
f 28/48 26/46 7/49
|
||||
f 27/44 28/48 11/50
|
||||
f 30/51 32/52 31/53
|
||||
f 26/54 28/55 32/56
|
||||
f 26/57 30/58 29/59
|
||||
f 25/60 29/61 31/62
|
||||
f 36/63 34/64 33/65
|
||||
f 22/66 24/67 23/68
|
||||
f 48/69 46/70 45/71
|
||||
f 8/72 9/1 4/3
|
||||
f 16/73 17/4 12/6
|
||||
f 10/74 11/7 6/9
|
||||
f 4/75 5/10 7/12
|
||||
f 11/76 10/13 8/15
|
||||
f 18/77 19/16 14/18
|
||||
f 6/78 15/19 10/21
|
||||
f 12/79 13/22 15/24
|
||||
f 19/80 18/25 16/27
|
||||
f 6/78 5/31 15/19
|
||||
f 9/81 10/21 16/39
|
||||
f 9/81 16/39 5/31
|
||||
f 28/82 27/40 32/42
|
||||
f 4/47 25/43 8/45
|
||||
f 7/49 26/46 4/47
|
||||
f 11/50 28/48 7/49
|
||||
f 8/45 27/44 11/50
|
||||
f 29/83 30/51 31/53
|
||||
f 30/84 26/54 32/56
|
||||
f 25/85 26/57 29/59
|
||||
f 27/86 25/60 31/62
|
||||
f 35/87 36/63 33/65
|
||||
f 21/88 24/67 22/66
|
||||
f 47/89 48/69 45/71
|
||||
f 3/90 17/91 18/29
|
||||
f 17/91 3/90 1/92
|
||||
f 23/93 1/94 22/95
|
||||
f 2/96 14/30 13/97
|
||||
f 35/98 37/99 38/100
|
||||
f 39/101 33/102 34/103
|
||||
f 38/104 40/105 34/106
|
||||
f 35/107 33/108 39/109
|
||||
f 22/110 3/111 21/112
|
||||
f 43/113 45/114 46/115
|
||||
f 47/116 41/117 42/118
|
||||
f 46/119 48/120 42/121
|
||||
f 43/122 41/123 47/124
|
||||
f 20/28 3/90 18/29
|
||||
f 2/96 20/28 14/30
|
||||
f 13/97 17/91 1/92
|
||||
f 3/125 20/34 21/33
|
||||
f 2/126 23/37 20/36
|
||||
f 2/127 1/94 23/93
|
||||
f 1/92 2/96 13/97
|
||||
f 36/128 35/98 38/100
|
||||
f 40/129 39/101 34/103
|
||||
f 36/130 38/104 34/106
|
||||
f 37/131 35/107 39/109
|
||||
f 1/132 3/111 22/110
|
||||
f 44/133 43/113 46/115
|
||||
f 48/134 47/116 42/118
|
||||
f 44/135 46/119 42/121
|
||||
f 45/136 43/122 47/124
|
||||
BIN
src/main/resources/assets/kitsumedievalcraft/models/Cannon.png
Normal file
BIN
src/main/resources/assets/kitsumedievalcraft/models/Cannon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
@@ -0,0 +1,11 @@
|
||||
# Blender MTL File: 'cannon_ball.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl None
|
||||
Ns 0
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.8 0.8 0.8
|
||||
Ks 0.8 0.8 0.8
|
||||
d 1
|
||||
illum 2
|
||||
map_Kd /home/kitsudesktop/Development/Blends/Cannon.png
|
||||
@@ -0,0 +1,278 @@
|
||||
# Blender v2.71 (sub 0) OBJ File: 'cannon_ball.blend'
|
||||
# www.blender.org
|
||||
mtllib cannon_ball.mtl
|
||||
o Sphere_Sphere.001
|
||||
v -0.191342 0.461940 0.000000
|
||||
v -0.353553 0.353553 0.000000
|
||||
v -0.461940 0.191342 0.000000
|
||||
v -0.500000 -0.000000 0.000000
|
||||
v -0.461940 -0.191342 0.000000
|
||||
v -0.353553 -0.353553 0.000000
|
||||
v -0.191342 -0.461940 0.000000
|
||||
v -0.000000 -0.500000 0.000000
|
||||
v -0.135299 0.461940 -0.135299
|
||||
v -0.250000 0.353553 -0.250000
|
||||
v -0.326641 0.191342 -0.326641
|
||||
v -0.353553 -0.000000 -0.353553
|
||||
v -0.326641 -0.191342 -0.326641
|
||||
v -0.250000 -0.353553 -0.250000
|
||||
v -0.135299 -0.461940 -0.135299
|
||||
v -0.000000 0.461940 -0.191342
|
||||
v -0.000000 0.353553 -0.353553
|
||||
v -0.000000 0.191342 -0.461940
|
||||
v -0.000000 -0.000000 -0.500000
|
||||
v -0.000000 -0.191342 -0.461940
|
||||
v -0.000000 -0.353553 -0.353553
|
||||
v -0.000000 -0.461940 -0.191342
|
||||
v -0.000000 0.500000 0.000000
|
||||
v 0.135299 0.461940 -0.135299
|
||||
v 0.250000 0.353553 -0.250000
|
||||
v 0.326641 0.191342 -0.326641
|
||||
v 0.353553 -0.000000 -0.353553
|
||||
v 0.326641 -0.191342 -0.326641
|
||||
v 0.250000 -0.353553 -0.250000
|
||||
v 0.135299 -0.461940 -0.135299
|
||||
v 0.191342 0.461940 -0.000000
|
||||
v 0.353553 0.353553 -0.000000
|
||||
v 0.461940 0.191342 -0.000000
|
||||
v 0.500000 -0.000000 -0.000000
|
||||
v 0.461940 -0.191342 -0.000000
|
||||
v 0.353553 -0.353553 -0.000000
|
||||
v 0.191342 -0.461940 -0.000000
|
||||
v 0.135299 0.461940 0.135299
|
||||
v 0.250000 0.353553 0.250000
|
||||
v 0.326641 0.191342 0.326641
|
||||
v 0.353553 -0.000000 0.353553
|
||||
v 0.326641 -0.191342 0.326641
|
||||
v 0.250000 -0.353553 0.250000
|
||||
v 0.135299 -0.461940 0.135299
|
||||
v -0.000000 0.461940 0.191342
|
||||
v -0.000000 0.353553 0.353553
|
||||
v -0.000000 0.191342 0.461940
|
||||
v -0.000000 -0.000000 0.500000
|
||||
v -0.000000 -0.191342 0.461940
|
||||
v -0.000000 -0.353553 0.353553
|
||||
v -0.000000 -0.461940 0.191342
|
||||
v -0.135299 0.461940 0.135299
|
||||
v -0.250000 0.353553 0.250000
|
||||
v -0.326641 0.191342 0.326641
|
||||
v -0.353553 -0.000000 0.353553
|
||||
v -0.326641 -0.191342 0.326641
|
||||
v -0.250000 -0.353553 0.250000
|
||||
v -0.135299 -0.461940 0.135299
|
||||
vt 0.282973 0.603467
|
||||
vt 0.154763 0.603467
|
||||
vt 0.184175 0.527020
|
||||
vt 0.302625 0.704900
|
||||
vt 0.135111 0.704900
|
||||
vt 0.309526 0.815877
|
||||
vt 0.128210 0.815877
|
||||
vt 0.302625 0.919502
|
||||
vt 0.135111 0.919502
|
||||
vt 0.282973 1.000000
|
||||
vt 0.154763 1.000000
|
||||
vt 0.743542 0.685153
|
||||
vt 0.694710 0.744502
|
||||
vt 0.619052 0.704111
|
||||
vt 0.691937 0.327230
|
||||
vt 0.691937 0.173593
|
||||
vt 0.757620 0.215589
|
||||
vt 0.016660 0.678766
|
||||
vt 0.000000 0.787590
|
||||
vt 0.266813 0.020059
|
||||
vt 0.245107 0.162669
|
||||
vt 0.152931 0.154361
|
||||
vt 0.345969 0.077180
|
||||
vt 0.329356 0.186330
|
||||
vt 0.694710 0.827650
|
||||
vt 0.782167 0.065979
|
||||
vt 0.806452 0.157349
|
||||
vt 0.066861 0.162669
|
||||
vt 0.066861 0.364351
|
||||
vt 0.000000 0.340690
|
||||
vt 0.152931 0.372659
|
||||
vt 0.245107 0.364351
|
||||
vt 0.329356 0.340690
|
||||
vt 0.743542 0.885890
|
||||
vt 0.709282 0.965362
|
||||
vt 0.909770 0.067428
|
||||
vt 0.875510 0.158133
|
||||
vt 0.770072 0.000000
|
||||
vt 0.936794 0.001894
|
||||
vt 0.176425 0.527020
|
||||
vt 0.088567 0.506961
|
||||
vt 0.266813 0.506961
|
||||
vt 0.345969 0.449840
|
||||
vt 0.812600 0.885106
|
||||
vt 0.836885 0.963913
|
||||
vt 1.000000 0.177091
|
||||
vt 0.924342 0.217482
|
||||
vt 0.612151 0.607518
|
||||
vt 0.444637 0.607518
|
||||
vt 0.464289 0.527020
|
||||
vt 0.619052 0.711143
|
||||
vt 0.437736 0.711143
|
||||
vt 0.612151 0.822120
|
||||
vt 0.444637 0.822120
|
||||
vt 0.592499 0.923553
|
||||
vt 0.464289 0.923553
|
||||
vt 0.563087 1.000000
|
||||
vt 0.493701 1.000000
|
||||
vt 1.000000 0.330729
|
||||
vt 0.924342 0.300630
|
||||
vt 0.612781 0.506961
|
||||
vt 0.591075 0.364351
|
||||
vt 0.675324 0.340690
|
||||
vt 0.522394 0.527020
|
||||
vt 0.498899 0.372659
|
||||
vt 0.326186 0.848253
|
||||
vt 0.309526 0.739430
|
||||
vt 0.373631 0.943554
|
||||
vt 0.861432 0.825756
|
||||
vt 0.861432 0.742608
|
||||
vt 0.927115 0.700612
|
||||
vt 0.909770 0.438342
|
||||
vt 0.875510 0.358870
|
||||
vt 0.591075 0.162669
|
||||
vt 0.675324 0.186330
|
||||
vt 0.498899 0.154361
|
||||
vt 0.412829 0.364351
|
||||
vt 0.412829 0.162669
|
||||
vt 0.345969 0.340690
|
||||
vt 0.345969 0.186330
|
||||
vt 0.812600 0.684368
|
||||
vt 0.839229 0.260198
|
||||
vt 0.806452 0.358086
|
||||
vt 0.757620 0.298737
|
||||
vt 0.779823 0.787218
|
||||
vt 0.782167 0.436893
|
||||
vt 0.612781 0.020059
|
||||
vt 0.691937 0.077180
|
||||
vt 0.522394 0.000000
|
||||
vt 0.434535 0.020059
|
||||
vt 0.836885 0.592999
|
||||
vt 0.709282 0.594448
|
||||
vt 0.682258 0.528913
|
||||
vt 0.253561 0.527020
|
||||
vt 0.064105 0.583465
|
||||
vt 0.176425 0.000000
|
||||
vt 0.619052 0.857749
|
||||
vt 0.000000 0.186330
|
||||
vt 0.592499 0.527020
|
||||
vt 0.691937 0.449839
|
||||
vt 0.927115 0.854250
|
||||
vt 0.848980 0.527020
|
||||
usemtl None
|
||||
s off
|
||||
f 6/1 14/2 15/3
|
||||
f 5/4 13/5 14/2
|
||||
f 4/6 12/7 13/5
|
||||
f 3/8 11/9 12/7
|
||||
f 2/10 10/11 11/9
|
||||
f 1/12 9/13 10/14
|
||||
f 14/15 21/16 22/17
|
||||
f 14/2 13/5 20/18
|
||||
f 13/5 12/7 19/19
|
||||
f 11/20 18/21 19/22
|
||||
f 10/23 17/24 18/21
|
||||
f 10/14 9/13 16/25
|
||||
f 21/16 29/26 30/27
|
||||
f 20/28 28/29 29/30
|
||||
f 19/22 27/31 28/29
|
||||
f 18/21 26/32 27/31
|
||||
f 18/21 17/24 25/33
|
||||
f 16/25 24/34 25/35
|
||||
f 29/26 36/36 37/37
|
||||
f 28/38 35/39 36/36
|
||||
f 27/31 34/40 35/41
|
||||
f 26/32 33/42 34/40
|
||||
f 25/33 32/43 33/42
|
||||
f 24/34 31/44 32/45
|
||||
f 36/36 43/46 44/47
|
||||
f 35/48 42/49 43/50
|
||||
f 34/51 41/52 42/49
|
||||
f 33/53 40/54 41/52
|
||||
f 33/53 32/55 39/56
|
||||
f 31/57 38/58 39/56
|
||||
f 43/46 50/59 51/60
|
||||
f 42/61 49/62 50/63
|
||||
f 41/64 48/65 49/62
|
||||
f 40/54 47/66 48/67
|
||||
f 39/56 46/68 47/66
|
||||
f 38/69 45/70 46/71
|
||||
f 50/59 57/72 58/73
|
||||
f 49/62 56/74 57/75
|
||||
f 48/65 55/76 56/74
|
||||
f 47/77 54/78 55/76
|
||||
f 46/79 53/80 54/78
|
||||
f 46/71 45/70 52/81
|
||||
f 8/82 7/83 15/84
|
||||
f 1/12 23/85 9/13
|
||||
f 8/82 15/84 22/17
|
||||
f 9/13 23/85 16/25
|
||||
f 8/82 22/17 30/27
|
||||
f 16/25 23/85 24/34
|
||||
f 8/82 30/27 37/37
|
||||
f 24/34 23/85 31/44
|
||||
f 8/82 37/37 44/47
|
||||
f 31/44 23/85 38/69
|
||||
f 8/82 44/47 51/60
|
||||
f 38/69 23/85 45/70
|
||||
f 8/82 51/60 58/73
|
||||
f 45/70 23/85 52/81
|
||||
f 8/82 58/73 7/83
|
||||
f 57/72 6/86 7/83
|
||||
f 56/74 5/87 6/88
|
||||
f 55/76 4/89 5/87
|
||||
f 54/78 3/90 4/89
|
||||
f 53/91 2/92 3/93
|
||||
f 52/81 1/12 2/92
|
||||
f 52/81 23/85 1/12
|
||||
f 7/94 6/1 15/3
|
||||
f 6/1 5/4 14/2
|
||||
f 5/4 4/6 13/5
|
||||
f 4/6 3/8 12/7
|
||||
f 3/8 2/10 11/9
|
||||
f 2/92 1/12 10/14
|
||||
f 15/84 14/15 22/17
|
||||
f 21/95 14/2 20/18
|
||||
f 20/18 13/5 19/19
|
||||
f 12/96 11/20 19/22
|
||||
f 11/20 10/23 18/21
|
||||
f 17/97 10/14 16/25
|
||||
f 22/17 21/16 30/27
|
||||
f 21/98 20/28 29/30
|
||||
f 20/28 19/22 28/29
|
||||
f 19/22 18/21 27/31
|
||||
f 26/32 18/21 25/33
|
||||
f 17/97 16/25 25/35
|
||||
f 30/27 29/26 37/37
|
||||
f 29/26 28/38 36/36
|
||||
f 28/29 27/31 35/41
|
||||
f 27/31 26/32 34/40
|
||||
f 26/32 25/33 33/42
|
||||
f 25/35 24/34 32/45
|
||||
f 37/37 36/36 44/47
|
||||
f 36/99 35/48 43/50
|
||||
f 35/48 34/51 42/49
|
||||
f 34/51 33/53 41/52
|
||||
f 40/54 33/53 39/56
|
||||
f 32/55 31/57 39/56
|
||||
f 44/47 43/46 51/60
|
||||
f 43/100 42/61 50/63
|
||||
f 42/61 41/64 49/62
|
||||
f 41/52 40/54 48/67
|
||||
f 40/54 39/56 47/66
|
||||
f 39/101 38/69 46/71
|
||||
f 51/60 50/59 58/73
|
||||
f 50/63 49/62 57/75
|
||||
f 49/62 48/65 56/74
|
||||
f 48/65 47/77 55/76
|
||||
f 47/77 46/79 54/78
|
||||
f 53/91 46/71 52/81
|
||||
f 58/73 57/72 7/83
|
||||
f 57/75 56/74 6/88
|
||||
f 56/74 55/76 5/87
|
||||
f 55/76 54/78 4/89
|
||||
f 54/102 53/91 3/93
|
||||
f 53/91 52/81 2/92
|
||||
Reference in New Issue
Block a user