mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
finished assemfac animation and texture, magnus cartus
This commit is contained in:
parent
eaa727536a
commit
89a41d4859
20
src/main/java/com/hbm/entity/cart/EntityMinecartBogie.java
Normal file
20
src/main/java/com/hbm/entity/cart/EntityMinecartBogie.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.hbm.entity.cart;
|
||||
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityMinecartBogie extends EntityMinecart {
|
||||
|
||||
public EntityMinecartBogie(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityMinecartBogie(World world, double x, double y, double z) {
|
||||
super(world, x, y ,z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinecartType() {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.entity.item;
|
||||
package com.hbm.entity.cart;
|
||||
|
||||
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||
import com.hbm.items.ModItems;
|
||||
107
src/main/java/com/hbm/entity/item/EntityMagnusCartus.java
Normal file
107
src/main/java/com/hbm/entity/item/EntityMagnusCartus.java
Normal file
@ -0,0 +1,107 @@
|
||||
package com.hbm.entity.item;
|
||||
|
||||
import com.hbm.entity.cart.EntityMinecartBogie;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityMagnusCartus extends EntityMinecart {
|
||||
|
||||
public EntityMinecartBogie bogie;
|
||||
|
||||
public EntityMagnusCartus(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityMagnusCartus(World p_i1713_1_, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) {
|
||||
super(p_i1713_1_, p_i1713_2_, p_i1713_4_, p_i1713_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinecartType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(25, new Integer(0));
|
||||
}
|
||||
|
||||
public void setBogie(EntityMinecartBogie bogie) {
|
||||
this.bogie = bogie;
|
||||
this.dataWatcher.updateObject(25, bogie.getEntityId());
|
||||
}
|
||||
|
||||
public int getBogieID() {
|
||||
return this.dataWatcher.getWatchableObjectInt(25);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
double dist = 3.0D;
|
||||
double force = 0.3D;
|
||||
|
||||
if(bogie == null) {
|
||||
Vec3 vec = Vec3.createVectorHelper(dist, 0, 0);
|
||||
vec.rotateAroundY(rand.nextFloat() * 6.28F);
|
||||
EntityMinecartBogie bog = new EntityMinecartBogie(worldObj, posX + vec.xCoord, posY + vec.yCoord, posZ + vec.zCoord);
|
||||
this.setBogie(bog);
|
||||
worldObj.spawnEntityInWorld(bog);
|
||||
}
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(posX - bogie.posX, posY - bogie.posY, posZ - bogie.posZ);
|
||||
delta = delta.normalize();
|
||||
delta.xCoord *= dist;
|
||||
delta.yCoord *= dist;
|
||||
delta.zCoord *= dist;
|
||||
|
||||
double x = posX - delta.xCoord;
|
||||
double y = posY - delta.yCoord;
|
||||
double z = posZ - delta.zCoord;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaExt");
|
||||
data.setString("mode", "reddust");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(this.dimension, x, y, z, 25));
|
||||
|
||||
Vec3 pull = Vec3.createVectorHelper(x - bogie.posX, y - bogie.posY, z - bogie.posZ);
|
||||
bogie.motionX += pull.xCoord * force;
|
||||
bogie.motionY += pull.yCoord * force;
|
||||
bogie.motionZ += pull.zCoord * force;
|
||||
|
||||
if(pull.lengthVector() > 1) {
|
||||
this.motionX -= pull.xCoord * force;
|
||||
this.motionY -= pull.yCoord * force;
|
||||
this.motionZ -= pull.zCoord * force;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
int bogieID = nbt.getInteger("bogie");
|
||||
Entity e = worldObj.getEntityByID(bogieID);
|
||||
|
||||
if(e instanceof EntityMinecartBogie) {
|
||||
this.setBogie((EntityMinecartBogie) e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setInteger("bogie", this.getBogieID());
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,6 @@ package com.hbm.items.tool;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.cart.*;
|
||||
import com.hbm.entity.item.EntityMinecartOre;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.EnumUtil;
|
||||
|
||||
@ -628,6 +628,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMinecartCrate.class, new RenderMinecart());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMinecartDestroyer.class, new RenderNeoCart());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMinecartOre.class, new RenderNeoCart());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMagnusCartus.class, new RenderMagnusCartus());
|
||||
//items
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMovingItem.class, new RenderMovingItem());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityTNTPrimedBase.class, new RenderTNTPrimedBase());
|
||||
|
||||
@ -493,6 +493,8 @@ public class MainRegistry {
|
||||
EntityRegistry.registerModEntity(EntityMinecartCrate.class, "entity_ntm_cart_crate", 170, this, 250, 1, false);
|
||||
EntityRegistry.registerModEntity(EntityMinecartDestroyer.class, "entity_ntm_cart_crate", 171, this, 250, 1, false);
|
||||
EntityRegistry.registerModEntity(EntityMinecartOre.class, "entity_ntm_cart_ore", 172, this, 250, 1, false);
|
||||
EntityRegistry.registerModEntity(EntityMinecartBogie.class, "entity_ntm_cart_bogie", 173, this, 250, 1, false);
|
||||
EntityRegistry.registerModEntity(EntityMagnusCartus.class, "entity_ntm_cart_chungoid", 174, this, 250, 1, false);
|
||||
|
||||
EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00);
|
||||
EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd);
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package com.hbm.render.entity.item;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.cart.EntityMinecartBogie;
|
||||
import com.hbm.entity.item.EntityMagnusCartus;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class RenderMagnusCartus extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
|
||||
EntityMagnusCartus cart = (EntityMagnusCartus) entity;
|
||||
Entity e = entity.worldObj.getEntityByID(cart.getBogieID());
|
||||
EntityMinecartBogie bogie = null;
|
||||
|
||||
if(e instanceof EntityMinecartBogie) {
|
||||
bogie = (EntityMinecartBogie) e;
|
||||
}
|
||||
|
||||
if(bogie == null)
|
||||
return;
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(cart.posX - bogie.posX, cart.posY - bogie.posY, cart.posZ - bogie.posZ);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x - vec.xCoord * 0.5, y - vec.yCoord * 0.5, z - vec.zCoord * 0.5);
|
||||
GL11.glScaled(1.2, 1.2, 1.2);
|
||||
GL11.glRotated(Math.atan2(vec.xCoord, vec.zCoord) / Math.PI * 180D - 90, 0, 1, 0);
|
||||
this.bindTexture(this.getEntityTexture(cart));
|
||||
ResourceManager.b29.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return ResourceManager.b29_0_tex;
|
||||
}
|
||||
}
|
||||
@ -59,8 +59,9 @@ public class TileEntityProxyEnergy extends TileEntityProxyBase implements IEnerg
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
|
||||
if(getTE() instanceof IEnergyUser) {
|
||||
return ((IEnergyUser)getTE()).canConnect(dir);
|
||||
TileEntity te = getTE();
|
||||
if(te instanceof IEnergyUser) {
|
||||
return ((IEnergyUser)te).canConnect(dir); //for some reason two consecutive getTE calls return different things?
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -125,9 +125,9 @@ public class TileEntityMachineAssemfac extends TileEntityMachineBase {
|
||||
targetAngles[1] = -targetAngles[0]; //Arm
|
||||
targetAngles[2] = rand.nextInt(30) - 15; //Piston
|
||||
} else if(this.actionMode == 1) {
|
||||
targetAngles[0] = rand.nextInt(10); //Pivot
|
||||
targetAngles[1] = -targetAngles[0]; //Arm
|
||||
targetAngles[2] = 20; //Piston
|
||||
targetAngles[0] = -rand.nextInt(30) + 10; //Pivot
|
||||
targetAngles[1] = -targetAngles[0]; //Arm
|
||||
targetAngles[2] = rand.nextInt(10) + 10; //Piston
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.7 KiB |
Loading…
x
Reference in New Issue
Block a user