Cyber Crab, electricity pylon

This commit is contained in:
HbmMods 2017-06-13 01:14:17 +02:00
parent da17dfb2c6
commit eb98f5a844
15 changed files with 668 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

View File

@ -52,6 +52,7 @@ import com.hbm.blocks.machine.BlockGasDuct;
import com.hbm.blocks.machine.BlockHatch;
import com.hbm.blocks.machine.BlockOilDuct;
import com.hbm.blocks.machine.OilDuctSolid;
import com.hbm.blocks.machine.PylonRedWire;
import com.hbm.blocks.machine.BlockReactor;
import com.hbm.blocks.machine.BlockSeal;
import com.hbm.blocks.machine.DummyBlockCentrifuge;
@ -343,6 +344,7 @@ public class ModBlocks {
public static Block red_wire_coated;
public static Block red_cable;
public static Block red_pylon;
public static Block oil_duct_solid;
public static Block oil_duct;
public static Block gas_duct_solid;
@ -693,6 +695,7 @@ public class ModBlocks {
red_wire_coated = new WireCoated(Material.iron).setBlockName("red_wire_coated").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":red_wire_coated");
red_cable = new BlockCable(Material.iron).setBlockName("red_cable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":red_cable_icon");
red_pylon = new PylonRedWire(Material.iron).setBlockName("red_pylon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":red_pylon");
oil_duct_solid = new OilDuctSolid(Material.iron).setBlockName("oil_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":oil_duct_solid_alt");
oil_duct = new BlockOilDuct(Material.iron).setBlockName("oil_duct").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":oil_duct_icon_alt");
gas_duct_solid = new GasDuctSolid(Material.iron).setBlockName("gas_duct_solid").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":gas_duct_solid");
@ -994,6 +997,7 @@ public class ModBlocks {
//GameRegistry.registerBlock(machine_rtg_purple, machine_rtg_purple.getUnlocalizedName());
GameRegistry.registerBlock(red_cable, red_cable.getUnlocalizedName());
GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName());
GameRegistry.registerBlock(red_pylon, red_pylon.getUnlocalizedName());
GameRegistry.registerBlock(oil_duct, oil_duct.getUnlocalizedName());
GameRegistry.registerBlock(oil_duct_solid, oil_duct_solid.getUnlocalizedName());
GameRegistry.registerBlock(gas_duct, gas_duct.getUnlocalizedName());

View File

@ -0,0 +1,21 @@
package com.hbm.blocks.machine;
import com.hbm.tileentity.TileEntityPylonRedWire;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class PylonRedWire extends BlockContainer {
public PylonRedWire(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityPylonRedWire();
}
}

View File

@ -0,0 +1,195 @@
package com.hbm.entity.mob;
import java.util.HashSet;
import java.util.List;
import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.entity.logic.EntityNukeExplosionAdvanced;
import com.hbm.entity.projectile.EntityBullet;
import com.hbm.explosion.ExplosionParticle;
import com.hbm.explosion.ExplosionParticleB;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.lib.ModDamageSource;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIAvoidEntity;
import net.minecraft.entity.ai.EntityAIControlledByPlayer;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityCyberCrab extends EntityMob implements IRangedAttackMob {
private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 0.5D, 60, 80, 15.0F);
public EntityCyberCrab(World p_i1733_1_)
{
super(p_i1733_1_);
this.setSize(0.75F, 0.35F);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(0, new EntityAIPanic(this, 0.75D));
this.tasks.addTask(1, new EntityAIWander(this, 0.5F));
//this.tasks.addTask(2, new EntityAIAvoidEntity(this, EntityPlayer.class, 3, 0.75D, 1.0D));
this.tasks.addTask(4, this.aiArrowAttack);
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 3, true));
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(4.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5F);
}
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
return super.attackEntityFrom(source, amount);
}
/**
* Returns true if the newer Entity AI code should be run
*/
@Override
public boolean isAIEnabled()
{
return true;
}
/**
* The number of iterations PathFinder.getSafePoint will execute before giving up.
*/
@Override
public int getMaxSafePointTries()
{
return this.getAttackTarget() == null ? 3 : 3 + (int)(this.getHealth() - 1.0F);
}
@Override
protected void entityInit()
{
super.entityInit();
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT(NBTTagCompound p_70014_1_)
{
super.writeEntityToNBT(p_70014_1_);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
{
super.readEntityFromNBT(p_70037_1_);
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
super.onUpdate();
if(this.isInWater() || this.isWet() || this.isBurning())
this.attackEntityFrom(DamageSource.generic, 10F);
if(this.getHealth() <= 0) {
this.setDead();
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.1F, true);
}
}
/**
* Returns the sound this mob makes when it is hurt.
*/
@Override
protected String getHurtSound()
{
return "mob.creeper.say";
}
/**
* Returns the sound this mob makes on death.
*/
@Override
protected String getDeathSound()
{
return "mob.creeper.death";
}
/**
* Called when the mob's health reaches 0.
*/
@Override
public void onDeath(DamageSource p_70645_1_)
{
super.onDeath(p_70645_1_);
}
@Override
public boolean attackEntityAsMob(Entity p_70652_1_)
{
return true;
}
@Override
protected Item getDropItem()
{
return null;
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase entity, float f) {
EntityBullet bullet = new EntityBullet(worldObj, this, entity, 1.6F, 2);
bullet.setIsCritical(true);
bullet.setTau(true);
bullet.damage = 2;
this.worldObj.spawnEntityInWorld(bullet);
}
}

View File

@ -72,6 +72,7 @@ import com.hbm.items.tool.ItemRamManipulator;
import com.hbm.items.tool.ItemWand;
import com.hbm.items.tool.ItemWandD;
import com.hbm.items.tool.ItemWandS;
import com.hbm.items.tool.ItemWiring;
import com.hbm.items.weapon.GunBaleFlare;
import com.hbm.items.weapon.GunCryolator;
import com.hbm.items.weapon.GunEMPRay;
@ -303,6 +304,8 @@ public class ModItems {
public static Item circuit_gold;
public static Item circuit_schrabidium;
public static Item wiring_red_copper;
public static Item cap_aluminium;
public static Item hull_small_steel;
public static Item hull_small_aluminium;
@ -1266,6 +1269,8 @@ public class ModItems {
circuit_red_copper = new Item().setUnlocalizedName("circuit_red_copper").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":circuit_red_copper");
circuit_gold = new Item().setUnlocalizedName("circuit_gold").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":circuit_gold");
circuit_schrabidium = new ItemCustomLore().setUnlocalizedName("circuit_schrabidium").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":circuit_schrabidium");
wiring_red_copper = new ItemWiring().setUnlocalizedName("wiring_red_copper").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":wiring_red_copper");
pellet_rtg = new ItemCustomLore().setUnlocalizedName("pellet_rtg").setCreativeTab(MainRegistry.tabParts).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg");
pellet_rtg_weak = new ItemCustomLore().setUnlocalizedName("pellet_rtg_weak").setCreativeTab(MainRegistry.tabParts).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_weak");
@ -2185,6 +2190,9 @@ public class ModItems {
GameRegistry.registerItem(circuit_gold, circuit_gold.getUnlocalizedName());
GameRegistry.registerItem(circuit_schrabidium, circuit_schrabidium.getUnlocalizedName());
//Wiring
GameRegistry.registerItem(wiring_red_copper, wiring_red_copper.getUnlocalizedName());
//Flame War in a Box
GameRegistry.registerItem(flame_pony, flame_pony.getUnlocalizedName());
GameRegistry.registerItem(flame_conspiracy, flame_conspiracy.getUnlocalizedName());

View File

@ -0,0 +1,16 @@
package com.hbm.items.tool;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemWiring extends Item {
@Override
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
return false;
}
}

View File

@ -31,6 +31,7 @@ import com.hbm.tileentity.TileEntityMachineDeuterium;
import com.hbm.tileentity.TileEntityMachineElectricFurnace;
import com.hbm.tileentity.TileEntityOilDuct;
import com.hbm.tileentity.TileEntityOilDuctSolid;
import com.hbm.tileentity.TileEntityPylonRedWire;
import com.hbm.tileentity.TileEntityWireCoated;
import net.minecraft.block.Block;
@ -846,6 +847,31 @@ public class Library {
((TileEntityWireCoated)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleans(that, newTact));
}
}
if(tileentity instanceof TileEntityPylonRedWire)
{
if(Library.checkUnionList(((TileEntityPylonRedWire)tileentity).uoteab, that))
{
for(int i = 0; i < ((TileEntityPylonRedWire)tileentity).uoteab.size(); i++)
{
if(((TileEntityPylonRedWire)tileentity).uoteab.get(i).source == that)
{
if(((TileEntityPylonRedWire)tileentity).uoteab.get(i).ticked != newTact)
{
((TileEntityPylonRedWire)tileentity).uoteab.get(i).ticked = newTact;
//that.ffgeua(x, y + 1, z, that.getTact());
//that.ffgeua(x, y - 1, z, that.getTact());
//that.ffgeua(x - 1, y, z, that.getTact());
//that.ffgeua(x + 1, y, z, that.getTact());
//that.ffgeua(x, y, z - 1, that.getTact());
//that.ffgeua(x, y, z + 1, that.getTact());
//TODO: connections
}
}
}
} else {
((TileEntityPylonRedWire)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleans(that, newTact));
}
}
}
if(tileentity instanceof IConsumer && newTact && !(tileentity instanceof TileEntityMachineBattery && ((TileEntityMachineBattery)tileentity).conducts))

View File

@ -54,6 +54,7 @@ import com.hbm.entity.missile.EntityMissileNuclear;
import com.hbm.entity.missile.EntityMissileRain;
import com.hbm.entity.missile.EntityMissileStrong;
import com.hbm.entity.missile.EntityTestMissile;
import com.hbm.entity.mob.EntityCyberCrab;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.mob.EntityNuclearCreeper;
import com.hbm.entity.particle.EntityBSmokeFX;
@ -97,6 +98,7 @@ import com.hbm.render.entity.RenderBigNuke;
import com.hbm.render.entity.RenderBlackHole;
import com.hbm.render.entity.RenderChopperMine;
import com.hbm.render.entity.RenderCloudFleija;
import com.hbm.render.entity.RenderCyberCrab;
import com.hbm.render.entity.RenderEMPBlast;
import com.hbm.render.entity.RenderEmpty;
import com.hbm.render.entity.RenderFallout;
@ -431,6 +433,7 @@ public class ClientProxy extends ServerProxy
RenderingRegistry.registerEntityRenderingHandler(EntityNuclearCreeper.class, new RenderNuclearCreeper());
RenderingRegistry.registerEntityRenderingHandler(EntityHunterChopper.class, new RenderHunterChopper());
RenderingRegistry.registerEntityRenderingHandler(EntityCyberCrab.class, new RenderCyberCrab());
RenderingRegistry.registerEntityRenderingHandler(EntityChopperMine.class, new RenderChopperMine());
RenderingRegistry.registerEntityRenderingHandler(EntityRubble.class, new RenderRubble());

View File

@ -80,6 +80,7 @@ import com.hbm.entity.missile.EntityMissileNuclear;
import com.hbm.entity.missile.EntityMissileRain;
import com.hbm.entity.missile.EntityMissileStrong;
import com.hbm.entity.missile.EntityTestMissile;
import com.hbm.entity.mob.EntityCyberCrab;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.mob.EntityNuclearCreeper;
import com.hbm.entity.particle.EntityBSmokeFX;
@ -168,6 +169,7 @@ import com.hbm.tileentity.TileEntityNukeTsar;
import com.hbm.tileentity.TileEntityObjTester;
import com.hbm.tileentity.TileEntityOilDuct;
import com.hbm.tileentity.TileEntityOilDuctSolid;
import com.hbm.tileentity.TileEntityPylonRedWire;
import com.hbm.tileentity.TileEntityReactorMultiblock;
import com.hbm.tileentity.TileEntityRedBarrel;
import com.hbm.tileentity.TileEntityRotationTester;
@ -443,6 +445,7 @@ public class MainRegistry
GameRegistry.registerTileEntity(TileEntityGasDuct.class, "tileentity_gas_duct");
GameRegistry.registerTileEntity(TileEntityGasDuctSolid.class, "tileentity_gas_duct_solid");
GameRegistry.registerTileEntity(TileEntityMachineRTG.class, "tileentity_machine_rtg");
GameRegistry.registerTileEntity(TileEntityPylonRedWire.class, "tileentity_pylon_redwire");
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
@ -524,6 +527,7 @@ public class MainRegistry
EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00);
EntityRegistry.registerGlobalEntityID(EntityHunterChopper.class, "entity_mob_hunter_chopper", EntityRegistry.findGlobalUniqueEntityId(), 0x000020, 0x2D2D72);
EntityRegistry.registerGlobalEntityID(EntityCyberCrab.class, "entity_cyber_crab", EntityRegistry.findGlobalUniqueEntityId(), 0xAAAAAA, 0x444444);
}
@EventHandler

View File

@ -0,0 +1,43 @@
package com.hbm.render.entity;
import org.lwjgl.opengl.GL11;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.render.model.ModelCrab;
import com.hbm.render.model.ModelHunterChopper;
import com.hbm.render.model.ProtoCopter;
import net.minecraft.client.model.ModelSpider;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.util.ResourceLocation;
public class RenderCyberCrab extends RenderLiving {
public RenderCyberCrab() {
super(new ModelCrab(), 1.0F);
this.shadowOpaque = 0.0F;
}
/*@Override
public void doRender(Entity rocket, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_,
float p_76986_9_) {
GL11.glPushMatrix();
GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_);
GL11.glRotatef(180, 1, 0, 0);
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/entity/Crab.png"));
mine2.renderAll(0.0625F);
GL11.glPopMatrix();
}*/
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return new ResourceLocation(RefStrings.MODID + ":textures/entity/Crab.png");
}
}

View File

@ -27,13 +27,13 @@ public class RenderMiniMIRV extends Render {
GL11.glRotatef(p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_ + 180, 0.0F, 0.0F, 1.0F);
GL11.glScalef(1.5F, 1.5F, 1.5F);
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/MIRV.png"));
bindTexture(new ResourceLocation(RefStrings.MODID + ":textures/models/Mirv.png"));
miniNuke.renderAll(0.0625F);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return new ResourceLocation(RefStrings.MODID + ":textures/models/MIRV.png");
return new ResourceLocation(RefStrings.MODID + ":textures/models/Mirv.png");
}
}

View File

@ -0,0 +1,182 @@
//This File was created with the Minecraft-SMP Modelling Toolbox 2.3.0.0
// Copyright (C) 2017 Minecraft-SMP.de
// This file is for Flan's Flying Mod Version 4.0.x+
// Model: Crab
// Model Creator:
// Created on:07.06.2017 - 08:57:57
// Last changed on: 07.06.2017 - 08:57:57
package com.hbm.render.model;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
public class ModelCrab extends ModelBase {
int textureX = 64;
int textureY = 32;
public ModelRenderer modelcrabModel[];
public ModelCrab() {
this.textureWidth = this.textureX;
this.textureHeight = this.textureY;
modelcrabModel = new ModelRenderer[20];
modelcrabModel[0] = new ModelRenderer(this, 1, 1); // Box 1
modelcrabModel[1] = new ModelRenderer(this, 17, 1); // Box 2
modelcrabModel[2] = new ModelRenderer(this, 33, 1); // Box 3
modelcrabModel[3] = new ModelRenderer(this, 49, 1); // Box 4
modelcrabModel[4] = new ModelRenderer(this, 1, 9); // Box 5
modelcrabModel[5] = new ModelRenderer(this, 25, 9); // Box 6
modelcrabModel[6] = new ModelRenderer(this, 41, 9); // Box 7
modelcrabModel[7] = new ModelRenderer(this, 1, 17); // Box 8
modelcrabModel[8] = new ModelRenderer(this, 17, 17); // Box 9
modelcrabModel[9] = new ModelRenderer(this, 57, 9); // Box 10
modelcrabModel[10] = new ModelRenderer(this, 33, 17); // Box 11
modelcrabModel[11] = new ModelRenderer(this, 41, 17); // Box 12
modelcrabModel[12] = new ModelRenderer(this, 49, 17); // Box 13
modelcrabModel[13] = new ModelRenderer(this, 17, 1); // Box 14
modelcrabModel[14] = new ModelRenderer(this, 33, 9); // Box 15
modelcrabModel[15] = new ModelRenderer(this, 49, 9); // Box 16
modelcrabModel[16] = new ModelRenderer(this, 9, 17); // Box 17
modelcrabModel[17] = new ModelRenderer(this, 1, 25); // Box 18
modelcrabModel[18] = new ModelRenderer(this, 17, 25); // Box 19
modelcrabModel[19] = new ModelRenderer(this, 33, 25); // Box 20
modelcrabModel[0].addBox(0F, 0F, 0F, 4, 1, 4, 0F); // Box 1
modelcrabModel[0].setRotationPoint(-2F, -3F, -2F);
modelcrabModel[1].addBox(0F, 0F, 0F, 4, 1, 6, 0F); // Box 2
modelcrabModel[1].setRotationPoint(-2F, -4F, -3F);
modelcrabModel[2].addBox(0F, 0F, 0F, 3, 1, 3, 0F); // Box 3
modelcrabModel[2].setRotationPoint(-1.5F, -5F, -1.5F);
modelcrabModel[3].addBox(0F, 0F, 0F, 4, 1, 2, 0F); // Box 4
modelcrabModel[3].setRotationPoint(-2F, -4.5F, -1F);
modelcrabModel[4].addBox(0F, 0F, 0F, 6, 1, 4, 0F); // Box 5
modelcrabModel[4].setRotationPoint(-3F, -4F, -2F);
modelcrabModel[5].addBox(-0.5F, 0F, 2F, 1, 1, 3, 0F); // Leg 6
modelcrabModel[5].setRotationPoint(0F, -3F, 0F);
modelcrabModel[5].rotateAngleX = -0.17453293F;
modelcrabModel[5].rotateAngleY = 0.78539816F;
modelcrabModel[10].addBox(-0.5F, 1F, 4F, 1, 3, 1, 0F); // Foot 11
modelcrabModel[10].setRotationPoint(0F, -3F, 0F);
modelcrabModel[10].rotateAngleX = 0.17453293F;
modelcrabModel[10].rotateAngleY = 0.78539816F;
modelcrabModel[6].addBox(-0.5F, 0F, 2F, 1, 1, 3, 0F); // Leg 7
modelcrabModel[6].setRotationPoint(0F, -3F, 0F);
modelcrabModel[6].rotateAngleX = -0.17453293F;
modelcrabModel[6].rotateAngleY = -0.78539816F;
modelcrabModel[9].addBox(-0.5F, 1F, 4F, 1, 3, 1, 0F); // Foot 10
modelcrabModel[9].setRotationPoint(0F, -3F, 0F);
modelcrabModel[9].rotateAngleX = 0.17453293F;
modelcrabModel[9].rotateAngleY = -0.78539816F;
modelcrabModel[7].addBox(-0.5F, 0F, 2F, 1, 1, 3, 0F); // Leg 8
modelcrabModel[7].setRotationPoint(0F, -3F, 0F);
modelcrabModel[7].rotateAngleX = -0.17453293F;
modelcrabModel[7].rotateAngleY = -2.35619449F;
modelcrabModel[11].addBox(-0.5F, 1F, 4F, 1, 3, 1, 0F); // Foot 12
modelcrabModel[11].setRotationPoint(0F, -3F, 0F);
modelcrabModel[11].rotateAngleX = 0.17453293F;
modelcrabModel[11].rotateAngleY = -2.35619449F;
modelcrabModel[8].addBox(-0.5F, 0F, 2F, 1, 1, 3, 0F); // Leg 9
modelcrabModel[8].setRotationPoint(0F, -3F, 0F);
modelcrabModel[8].rotateAngleX = -0.17453293F;
modelcrabModel[8].rotateAngleY = 2.35619449F;
modelcrabModel[12].addBox(-0.5F, 1F, 4F, 1, 3, 1, 0F); // Foot 13
modelcrabModel[12].setRotationPoint(0F, -3F, 0F);
modelcrabModel[12].rotateAngleX = 0.17453293F;
modelcrabModel[12].rotateAngleY = 2.35619449F;
modelcrabModel[13].addBox(-0.5F, 0F, 1.5F, 1, 1, 1, 0F); // Fang 14
modelcrabModel[13].setRotationPoint(0F, -3F, 0F);
modelcrabModel[13].rotateAngleX = -0.43633231F;
modelcrabModel[13].rotateAngleY = -0.6981317F;
modelcrabModel[14].addBox(-0.5F, 0F, 1.5F, 1, 1, 1, 0F); // Fang 15
modelcrabModel[14].setRotationPoint(0F, -3F, 0F);
modelcrabModel[14].rotateAngleX = -0.43633231F;
modelcrabModel[14].rotateAngleY = 0.87266463F;
modelcrabModel[15].addBox(-0.5F, 0F, 1.5F, 1, 1, 1, 0F); // Fang 16
modelcrabModel[15].setRotationPoint(0F, -3F, 0F);
modelcrabModel[15].rotateAngleX = -0.43633231F;
modelcrabModel[15].rotateAngleY = -2.26892803F;
modelcrabModel[16].addBox(-0.5F, 0F, 1.5F, 1, 1, 1, 0F); // Fang 17
modelcrabModel[16].setRotationPoint(0F, -3F, 0F);
modelcrabModel[16].rotateAngleX = -0.43633231F;
modelcrabModel[16].rotateAngleY = 2.44346095F;
modelcrabModel[17].addBox(0F, 0F, 0F, 2, 1, 4, 0F); // Box 18
modelcrabModel[17].setRotationPoint(-1F, -4.5F, -2F);
modelcrabModel[18].addBox(0F, 0F, 0F, 5, 1, 3, 0F); // Box 19
modelcrabModel[18].setRotationPoint(-2.5F, -3.5F, -1.5F);
modelcrabModel[19].addBox(0F, 0F, 0F, 3, 1, 5, 0F); // Box 20
modelcrabModel[19].setRotationPoint(-1.5F, -3.5F, -2.5F);
for (int i = 0; i < 20; i++) {
modelcrabModel[i].setTextureSize(textureX, textureY);
modelcrabModel[i].mirror = true;
}
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
renderAll(f5);
}
public void renderAll(float f5) {
GL11.glPushMatrix();
GL11.glTranslatef(0, 1.5F, 0);
GL11.glRotatef(-90, 0, 1, 0);
for (int i = 0; i < 20; i++) {
modelcrabModel[i].render(f5);
}
GL11.glPopMatrix();
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
modelcrabModel[10].rotateAngleY = 0.78539816F;
modelcrabModel[9].rotateAngleY = -0.78539816F;
modelcrabModel[11].rotateAngleY = -2.35619449F;
modelcrabModel[12].rotateAngleY = 2.35619449F;
modelcrabModel[5].rotateAngleY = modelcrabModel[10].rotateAngleY;
modelcrabModel[6].rotateAngleY = modelcrabModel[9].rotateAngleY;
modelcrabModel[7].rotateAngleY = modelcrabModel[11].rotateAngleY;
modelcrabModel[8].rotateAngleY = modelcrabModel[12].rotateAngleY;
float f9 = -(MathHelper.cos(f * 0.6662F * 2.0F + 0.0F) * 0.4F) * f1;
//float f10 = -(MathHelper.cos(f * 0.6662F * 2.0F + (float) Math.PI) * 0.4F) * f1;
//float f11 = -(MathHelper.cos(f * 0.6662F * 2.0F + ((float) Math.PI / 2F)) * 0.4F) * f1;
//float f12 = -(MathHelper.cos(f * 0.6662F * 2.0F + ((float) Math.PI * 3F / 2F)) * 0.4F) * f1;
//float f13 = Math.abs(MathHelper.sin(f * 0.6662F + 0.0F) * 0.4F) * f1;
//float f14 = Math.abs(MathHelper.sin(f * 0.6662F + (float) Math.PI) * 0.4F) * f1;
//float f15 = Math.abs(MathHelper.sin(f * 0.6662F + ((float) Math.PI / 2F)) * 0.4F) * f1;
//float f16 = Math.abs(MathHelper.sin(f * 0.6662F + ((float) Math.PI * 3F / 2F)) * 0.4F) * f1;
f9 *= 1.5;
modelcrabModel[10].rotateAngleY += f9;
modelcrabModel[9].rotateAngleY -= f9;
modelcrabModel[11].rotateAngleY -= f9;
modelcrabModel[12].rotateAngleY += f9;
modelcrabModel[5].rotateAngleY = modelcrabModel[10].rotateAngleY;
modelcrabModel[6].rotateAngleY = modelcrabModel[9].rotateAngleY;
modelcrabModel[7].rotateAngleY = modelcrabModel[11].rotateAngleY;
modelcrabModel[8].rotateAngleY = modelcrabModel[12].rotateAngleY;
}
}

View File

@ -0,0 +1,164 @@
package com.hbm.tileentity;
import java.util.ArrayList;
import java.util.List;
import com.hbm.calc.UnionOfTileEntitiesAndBooleans;
import com.hbm.interfaces.IConductor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
public class TileEntityPylonRedWire extends TileEntity implements IConductor {
public List<UnionOfTileEntitiesAndBooleans> uoteab = new ArrayList<UnionOfTileEntitiesAndBooleans>();
public List<TileEntityPylonRedWire> connected = new ArrayList<TileEntityPylonRedWire>();
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
int[] conX = nbt.getIntArray("conX");
int[] conY = nbt.getIntArray("conY");
int[] conZ = nbt.getIntArray("conZ");
if(conX.length == conY.length && conY.length == conZ.length)
{
int[][] con = new int[conX.length][3];
for(int i = 0; i < conX.length; i++) {
con[i][0] = conX[i];
con[i][1] = conY[i];
con[i][2] = conZ[i];
}
this.connected = this.convertArrayToList(con);
} else {
throw new RuntimeException(this.getClass() + " failed to read connected electricity poles from NBT!");
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
int[] conX = new int[this.connected.size()];
int[] conY = new int[this.connected.size()];
int[] conZ = new int[this.connected.size()];
for(int i = 0; i < this.connected.size(); i++) {
conX[i] = this.connected.get(i).xCoord;
conY[i] = this.connected.get(i).yCoord;
conZ[i] = this.connected.get(i).zCoord;
}
nbt.setIntArray("conX", conX);
nbt.setIntArray("conY", conY);
nbt.setIntArray("conZ", conZ);
}
public List<TileEntityPylonRedWire> convertArrayToList(int[][] array) {
List<TileEntityPylonRedWire> list = new ArrayList<TileEntityPylonRedWire>();
for(int i = 0; i < array.length; i++) {
TileEntity te = worldObj.getTileEntity(array[i][0], array[i][1], array[i][2]);
if(te != null && te instanceof TileEntityPylonRedWire)
list.add((TileEntityPylonRedWire)te);
}
return list;
}
public int[][] convertListToArray(List<TileEntityPylonRedWire> list) {
int[][] array = new int[list.size()][3];
for(int i = 0; i < list.size(); i++) {
TileEntity te = list.get(i);
array[i][0] = te.xCoord;
array[i][1] = te.yCoord;
array[i][2] = te.zCoord;
}
return array;
}
/*@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}*/
/*Princess cards she sends me with her regards,
Oh, bar-room eyes shine vacancy
To see her you gotta look hard
Wounded deep in battle, I stand stuffed like some soldier undaunted
To her cheshire smile I'll stand on file
She's all I ever wanted
You let your blue walls stand in the way of these facts, honey
Get your carpet baggers off my back
Girl give me time to cover my tracks
You said, "Here's your mirror and your ball and jacks"
But they're not what I came for
Oh I came for so much more
And I know you that too
And I know you know that's true
I came for you
I came for you
I came for you
For you
I came for you
Crawl into my ambulance
Your pulse is getting weak
Reveal yourself all to me now
While you've got the strength to speak
'Cause they're waiting for you at Bellevue
With their oxygen masks
But I could give it all to you now
If only you could ask
Don't call for your surgeon
Even he says it's late
It's not your lungs this time
But your heart holds your fate
Don't give me my money back
Don't want it anymore
It's not that nursery mouth I came back for
It's not the way you're stretched out on the floor
I've broken all your windows
And I've rammed through all your doors
Who am I to ask you to fight my wars
And you should know that's true
You should know that too
I came for you
I came for you
I came for you
For you
I came for you
Don't call for your surgeon
Even he says it's late
It's not your lungs this time
But your heart holds your fate
Don't give me my money back
Don't want it anymore
It's not that nursery mouth I came back for
It's not the way you're stretched out on the floor
I've broken all your windows
And I've rammed through all your doors
Who am I to ask you to fight my wars
You should know that's true
You should know that too
I came for you
I came for you
I came for you
For you
I came for you*/
}