Screw it, doesn't work :<

This commit is contained in:
Aidan Brady 2013-08-03 03:10:59 -04:00
parent 9a710b803c
commit 06000aff4c
3 changed files with 46 additions and 138 deletions

View file

@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.oredict.ShapedOreRecipe;
import resonantinduction.contractor.BlockEMContractor;
import resonantinduction.contractor.EntityContractorItem;
import resonantinduction.contractor.TileEntityEMContractor;
import resonantinduction.entangler.ItemQuantumEntangler;
import resonantinduction.tesla.BlockTesla;
@ -26,7 +25,6 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@ -135,8 +133,6 @@ public class ResonantInduction
GameRegistry.registerTileEntity(TileEntityTesla.class, blockTesla.getUnlocalizedName());
GameRegistry.registerTileEntity(TileEntityEMContractor.class, blockEMContractor.getUnlocalizedName());
EntityRegistry.registerModEntity(EntityContractorItem.class, "EntityContractorItem", 0, this, 40, 5, true);
ResonantInduction.proxy.registerRenderers();
TabRI.ITEMSTACK = new ItemStack(blockTesla);

View file

@ -1,62 +0,0 @@
package resonantinduction.contractor;
import java.lang.reflect.Method;
import java.util.Iterator;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.item.ItemExpireEvent;
/**
* Spinoff of EntityItem for Contractors.
* @author AidanBrady
*
*/
public class EntityContractorItem extends EntityItem
{
public boolean doGravityThisTick = true;
public EntityContractorItem(World par1World)
{
super(par1World);
}
@Override
public void onUpdate()
{
super.onUpdate();
System.out.println(worldObj.isRemote + " " + motionX + " " + motionY + " " + motionZ);
if(!doGravityThisTick)
{
motionY = 0;
}
}
public static EntityContractorItem get(EntityItem entityItem)
{
EntityContractorItem item = new EntityContractorItem(entityItem.worldObj);
item.posX = entityItem.posX;
item.posY = entityItem.posY;
item.posZ = entityItem.posZ;
item.setEntityItemStack(entityItem.getEntityItem());
item.motionX = entityItem.motionX;
item.motionY = entityItem.motionY;
item.motionZ = entityItem.motionZ;
item.dataWatcher = entityItem.getDataWatcher();
item.delayBeforeCanPickup = entityItem.delayBeforeCanPickup;
return item;
}
}

View file

@ -38,94 +38,68 @@ public class TileEntityEMContractor extends TileEntity
{
EntityItem entityItem = (EntityItem)entity;
if(!(entityItem instanceof EntityContractorItem))
switch(facing)
{
entityItem.setDead();
case DOWN:
entityItem.setPosition(xCoord+0.5, entityItem.posY, zCoord+0.5);
if(worldObj.isRemote)
{
continue;
}
entityItem.motionX = 0;
entityItem.motionZ = 0;
EntityContractorItem newItem = EntityContractorItem.get(entityItem);
worldObj.spawnEntityInWorld(newItem);
entityItem.motionY = Math.max(-MAX_SPEED, entityItem.motionY-ACCELERATION);
entityItem = newItem;
}
entityItem.isAirBorne = true;
break;
case UP:
entityItem.setPosition(xCoord+0.5, entityItem.posY, zCoord+0.5);
if(entityItem instanceof EntityContractorItem)
{
switch(facing)
{
case DOWN:
entityItem.setPosition(xCoord+0.5, entityItem.posY, zCoord+0.5);
entityItem.motionX = 0;
entityItem.motionZ = 0;
entityItem.motionX = 0;
entityItem.motionZ = 0;
entityItem.motionY = Math.min(MAX_SPEED, entityItem.motionY+ACCELERATION);
entityItem.motionY = Math.max(-MAX_SPEED, entityItem.motionY-ACCELERATION);
entityItem.isAirBorne = true;
break;
case NORTH:
entityItem.setPosition(entityItem.posX, yCoord+0.5, zCoord+0.5);
entityItem.isAirBorne = true;
break;
case UP:
entityItem.setPosition(xCoord+0.5, entityItem.posY, zCoord+0.5);
entityItem.motionY = 0;
entityItem.motionZ = 0;
entityItem.motionX = 0;
entityItem.motionZ = 0;
entityItem.motionX = Math.min(MAX_SPEED, entityItem.motionZ+ACCELERATION);
entityItem.motionY = Math.min(MAX_SPEED, entityItem.motionY+ACCELERATION);
entityItem.isAirBorne = true;
break;
case SOUTH:
entityItem.setPosition(entityItem.posX, yCoord+0.5, zCoord+0.5);
entityItem.isAirBorne = true;
break;
case NORTH:
((EntityContractorItem)entityItem).doGravityThisTick = false;
entityItem.motionY = 0;
entityItem.motionZ = 0;
entityItem.setPosition(entityItem.posX, yCoord+0.5, zCoord+0.5);
entityItem.motionX = Math.max(-MAX_SPEED, entityItem.motionZ-ACCELERATION);
entityItem.motionY = 0;
entityItem.motionZ = 0;
entityItem.isAirBorne = true;
break;
case WEST:
entityItem.setPosition(xCoord+0.5, yCoord+0.5, entityItem.posZ);
entityItem.motionX = Math.min(MAX_SPEED, entityItem.motionZ+ACCELERATION);
entityItem.motionX = 0;
entityItem.motionY = 0;
entityItem.isAirBorne = true;
break;
case SOUTH:
((EntityContractorItem)entityItem).doGravityThisTick = false;
entityItem.motionZ = Math.min(MAX_SPEED, entityItem.motionX+ACCELERATION);
entityItem.setPosition(entityItem.posX, yCoord+0.5, zCoord+0.5);
entityItem.isAirBorne = true;
break;
case EAST:
entityItem.setPosition(xCoord+0.5, yCoord+0.5, entityItem.posZ);
entityItem.motionY = 0;
entityItem.motionZ = 0;
entityItem.motionX = 0;
entityItem.motionY = 0;
entityItem.motionX = Math.max(-MAX_SPEED, entityItem.motionZ-ACCELERATION);
entityItem.motionZ = Math.max(-MAX_SPEED, entityItem.motionX-ACCELERATION);
entityItem.isAirBorne = true;
break;
case WEST:
((EntityContractorItem)entityItem).doGravityThisTick = false;
entityItem.setPosition(xCoord+0.5, yCoord+0.5, entityItem.posZ);
entityItem.motionX = 0;
entityItem.motionY = 0;
entityItem.motionZ = Math.min(MAX_SPEED, entityItem.motionX+ACCELERATION);
entityItem.isAirBorne = true;
break;
case EAST:
((EntityContractorItem)entityItem).doGravityThisTick = false;
entityItem.setPosition(xCoord+0.5, yCoord+0.5, entityItem.posZ);
entityItem.motionX = 0;
entityItem.motionY = 0;
entityItem.motionZ = Math.max(-MAX_SPEED, entityItem.motionX-ACCELERATION);
entityItem.isAirBorne = true;
break;
}
entityItem.isAirBorne = true;
break;
}
}
}