Created the start of a mining laser gun, pulled from old assembly line mod

This commit is contained in:
Robert S 2014-05-04 03:18:13 -04:00
parent 990f83d5ce
commit e3260ef2e1
8 changed files with 645 additions and 19 deletions

View file

@ -3,12 +3,14 @@ package resonantinduction.electrical;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import resonantinduction.electrical.battery.RenderBattery;
import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.charger.RenderCharger;
import resonantinduction.electrical.encoder.TileEncoder;
import resonantinduction.electrical.encoder.gui.GuiEncoderInventory;
import resonantinduction.electrical.generator.solar.TileSolarPanel;
import resonantinduction.electrical.laser.gun.RenderMiningLaserGun;
import resonantinduction.electrical.levitator.RenderLevitator;
import resonantinduction.electrical.multimeter.GuiMultimeter;
import resonantinduction.electrical.multimeter.PartMultimeter;
@ -40,6 +42,7 @@ public class ClientProxy extends CommonProxy
GlobalItemRenderer.register(Electrical.itemCharger.itemID, RenderCharger.INSTANCE);
GlobalItemRenderer.register(Electrical.itemLevitator.itemID, RenderLevitator.INSTANCE);
GlobalItemRenderer.register(Electrical.itemQuantumGlyph.itemID, RenderQuantumGlyph.INSTANCE);
MinecraftForgeClient.registerItemRenderer(Electrical.itemLaserGun.itemID, new RenderMiningLaserGun());
ClientRegistry.bindTileEntitySpecialRenderer(TileTesla.class, new RenderTesla());
ClientRegistry.bindTileEntitySpecialRenderer(TileBattery.class, new RenderBattery());
}

View file

@ -22,6 +22,7 @@ import resonantinduction.electrical.generator.solar.TileSolarPanel;
import resonantinduction.electrical.generator.thermopile.BlockThermopile;
import resonantinduction.electrical.generator.thermopile.TileThermopile;
import resonantinduction.electrical.itemrailing.ItemItemRailing;
import resonantinduction.electrical.laser.gun.ItemMiningLaser;
import resonantinduction.electrical.levitator.ItemLevitator;
import resonantinduction.electrical.multimeter.ItemMultimeter;
import resonantinduction.electrical.tesla.BlockTesla;
@ -79,7 +80,7 @@ public class Electrical
public static Item itemCharger;
public static Block blockTesla;
public static Block blockBattery;
public static Block blockEncoder;
public static Block blockEncoder;
// Railings
public static Item itemRailing;
@ -99,6 +100,9 @@ public class Electrical
public static Block blockQuantumGate;
public static Item itemQuantumGlyph;
// Tools
public static Item itemLaserGun;
public ProxyHandler modproxies;
@EventHandler
@ -123,6 +127,7 @@ public class Electrical
// blockEncoder = contentRegistry.createTile(BlockEncoder.cass);
// itemDisk = contentRegistry.createItem(ItemDisk.class);
itemInsulation = contentRegistry.createItem("insulation", ItemResourcePart.class);
itemLaserGun = contentRegistry.createItem("laserDrill", ItemMiningLaser.class);
// Generator
blockSolarPanel = contentRegistry.newBlock(TileSolarPanel.class);

View file

@ -0,0 +1,234 @@
package resonantinduction.electrical.laser.gun;
import java.awt.Color;
import java.util.HashMap;
import java.util.List;
import resonantinduction.core.ResonantInduction;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import universalelectricity.api.item.ItemElectric;
import universalelectricity.api.vector.IVector3;
import universalelectricity.api.vector.Vector3;
import calclavia.api.resonantinduction.electrical.LaserEvent;
import calclavia.lib.type.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** Stream laser mining tool, When held down it will slowly mine away at the block in front of it.
*
*
* TODO create model for this that is 3D. The front should spin around the barrel as its mines
* generating a laser. As well the player should be wearing a battery pack when the laser is out.
* Other option is to force the player to wear a battery pack as armor when using the tool
*
* TODO when the laser hits the block there should be a flaring effect that simi blinds the player.
* That way they are force to wear wielding googles. As well this will gear the player more towards
* mining and less to fighting. Though the laser should still be a very effect fighting weapon, with
* only down side being its battery, and that it slows you down when held. Eg its a heavy peace of
* mining gear and the player will be simi-stationary when using it
*
* @author DarkGuardsman */
public class ItemMiningLaser extends ItemElectric
{
long batterySize = 100000;
float wattPerShot = 1;
float damageToEntities = 3.3f;
int blockRange = 50;
int firingDelay = 5;
int breakTime = 15;
boolean createLava = true, setFire = true;
HashMap<EntityPlayer, Pair<Vector3, Integer>> miningMap = new HashMap<EntityPlayer, Pair<Vector3, Integer>>();
public ItemMiningLaser(int id)
{
super(id);
this.setUnlocalizedName("MiningLaser");
this.setMaxStackSize(1);
this.setCreativeTab(CreativeTabs.tabTools);
}
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
@Override
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
//TODO change render of the laser too show it slowly over heat, when it over heats eg gets to max use damage the player, and tool
return 1000;
}
@Override
public void onUpdate(ItemStack itemStack, World par2World, Entity entity, int par4, boolean par5)
{
//Slow any entity that carries this down as a side effect of using heavy mining gear
if (entity instanceof EntityLivingBase)
{
boolean flag = entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode;
if (!flag)
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 0));
}
else
{
//((EntityPlayer) entity).setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
}
}
}
@Override
public void onCreated(ItemStack stack, World par2World, EntityPlayer entityPlayer)
{
this.setEnergy(stack, 0);
if (stack.getTagCompound() == null)
{
stack.setTagCompound(new NBTTagCompound());
}
if (entityPlayer != null)
{
stack.getTagCompound().setString("Creator", entityPlayer.username);
}
}
@Override
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
{
if (count > 5)
{
Vec3 playerPosition = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ);
Vec3 playerLook = RayTraceHelper.getLook(player, 1.0f);
Vec3 p = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord, playerPosition.yCoord + playerLook.yCoord, playerPosition.zCoord + playerLook.zCoord);
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * blockRange, playerPosition.yCoord + playerLook.yCoord * blockRange, playerPosition.zCoord + playerLook.zCoord * blockRange);
MovingObjectPosition hit = RayTraceHelper.do_rayTraceFromEntity(player, new Vector3().toVec3(), blockRange, true);
//TODO fix sound
if (hit != null)
{
LaserEvent event = new LaserEvent.LaserFiredPlayerEvent(player, hit, stack);
MinecraftForge.EVENT_BUS.post(event);
if (!player.worldObj.isRemote && !event.isCanceled())
{
if (hit.typeOfHit == EnumMovingObjectType.ENTITY && hit.entityHit != null)
{
//TODO re-implements laser damage source
DamageSource damageSource = DamageSource.causeMobDamage(player);
hit.entityHit.attackEntityFrom(damageSource, damageToEntities);
hit.entityHit.setFire(5);
}
else if (hit.typeOfHit == EnumMovingObjectType.TILE)
{
int time = 1;
boolean mined = false;
if (miningMap.containsKey(player))
{
Pair<Vector3, Integer> lastHit = miningMap.get(player);
if (lastHit != null && lastHit.left() != null && lastHit.left().equals(new Vector3(hit)))
{
time = lastHit.right() + 1;
if (time >= breakTime)
{
LaserEvent.onBlockMinedByLaser(player.worldObj, player, new Vector3(hit));
mined = true;
miningMap.remove(player);
}
else
{
//TODO get the actual hit side from the angle of the ray trace
LaserEvent.onLaserHitBlock(player.worldObj, player, new Vector3(hit), ForgeDirection.UP);
}
}
}
if (!mined)
{
miningMap.put(player, new Pair<Vector3, Integer>(new Vector3(hit), time));
}
}
}
playerViewOffset = hit.hitVec;
}
//TODO make beam brighter the longer it has been used
//TODO adjust the laser for the end of the gun
float x = (float) (MathHelper.cos((float) (player.rotationYawHead * 0.0174532925)) * (-.4) - MathHelper.sin((float) (player.rotationYawHead * 0.0174532925)) * (-.1));
float z = (float) (MathHelper.sin((float) (player.rotationYawHead * 0.0174532925)) * (-.4) + MathHelper.cos((float) (player.rotationYawHead * 0.0174532925)) * (-.1));
ResonantInduction.proxy.renderBeam(player.worldObj, (IVector3)new Vector3(p).translate(new Vector3(x, -.25, z)), (IVector3)new Vector3(playerViewOffset), Color.ORANGE, 1);
ResonantInduction.proxy.renderBeam(player.worldObj, (IVector3)new Vector3(p).translate(new Vector3(x, -.45, z)), (IVector3)new Vector3(playerViewOffset), Color.ORANGE, 1);
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World par2World, EntityPlayer player)
{
if (player.capabilities.isCreativeMode || this.getEnergy(itemStack) > this.wattPerShot)
{
player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
}
return itemStack;
}
@Override
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer player, int par4)
{
if (miningMap.containsKey(player))
{
miningMap.remove(player);
}
}
@Override
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
super.addInformation(stack, player, list, par4);
if (stack.getTagCompound() == null)
{
stack.setTagCompound(new NBTTagCompound());
}
String creator = stack.getTagCompound().getString("Creator");
if (!creator.equalsIgnoreCase("creative") && creator != "")
{
list.add("Created by: " + creator);
}
else if (creator.equalsIgnoreCase("creative"))
{
list.add("Created by Magic Dwarfs");
}
}
@Override
public long getEnergyCapacity(ItemStack theItem)
{
return this.batterySize;
}
}

View file

@ -0,0 +1,278 @@
package resonantinduction.electrical.laser.gun;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import universalelectricity.api.vector.Vector3;
public class RayTraceHelper
{
public static MovingObjectPosition raytraceEntities_fromAnEntity(World world, Entity entity, Vec3 error, double reachDistance, boolean collisionFlag)
{
MovingObjectPosition pickedEntity = null;
Vec3 playerPosition = Vec3.createVectorHelper(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ);
Vec3 playerLook = entity.getLookVec();
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * reachDistance + error.xCoord, playerPosition.yCoord + playerLook.yCoord * reachDistance + error.yCoord, playerPosition.zCoord + playerLook.zCoord * reachDistance + error.zCoord);
double playerBorder = 1.1 * reachDistance;
AxisAlignedBB boxToScan = entity.boundingBox.expand(playerBorder, playerBorder, playerBorder);
List<Entity> entitiesHit = world.getEntitiesWithinAABBExcludingEntity(entity, boxToScan);
double closestEntity = reachDistance;
if (entitiesHit == null || entitiesHit.isEmpty())
{
return null;
}
for (Entity entityHit : entitiesHit)
{
if (entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null)
{
float border = entityHit.getCollisionBorderSize();
AxisAlignedBB aabb = entityHit.boundingBox.expand(border, border, border);
MovingObjectPosition hitMOP = aabb.calculateIntercept(playerPosition, playerViewOffset);
if (hitMOP != null)
{
if (aabb.isVecInside(playerPosition))
{
if (0.0D < closestEntity || closestEntity == 0.0D)
{
pickedEntity = new MovingObjectPosition(entityHit);
if (pickedEntity != null)
{
pickedEntity.hitVec = hitMOP.hitVec;
closestEntity = 0.0D;
}
}
}
else
{
double distance = playerPosition.distanceTo(hitMOP.hitVec);
if (distance < closestEntity || closestEntity == 0.0D)
{
pickedEntity = new MovingObjectPosition(entityHit);
pickedEntity.hitVec = hitMOP.hitVec;
closestEntity = distance;
}
}
}
}
}
return pickedEntity;
}
@SuppressWarnings("unchecked")
public static MovingObjectPosition raytraceEntities(World world, Vec3 start, Vec3 end, double range, boolean collisionFlag, Entity exclude)
{
AxisAlignedBB boxToScan = AxisAlignedBB.getBoundingBox(start.xCoord, start.yCoord, start.zCoord, end.xCoord, end.yCoord, end.zCoord);
List<Entity> entitiesHit = null;
if (exclude != null)
{
entitiesHit = world.getEntitiesWithinAABBExcludingEntity(exclude, boxToScan);
}
else
{
entitiesHit = world.getEntitiesWithinAABB(Entity.class, boxToScan);
}
MovingObjectPosition pickedEntity = null;
double closestEntity = range;
if (entitiesHit == null || entitiesHit.isEmpty())
{
return null;
}
for (Entity entityHit : entitiesHit)
{
if (entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null)
{
float border = entityHit.getCollisionBorderSize();
AxisAlignedBB aabb = entityHit.boundingBox.expand(border, border, border);
MovingObjectPosition hitMOP = aabb.calculateIntercept(start, end);
if (hitMOP != null)
{
if (aabb.isVecInside(start))
{
if (0.0D < closestEntity || closestEntity == 0.0D)
{
pickedEntity = new MovingObjectPosition(entityHit);
if (pickedEntity != null)
{
pickedEntity.hitVec = hitMOP.hitVec;
closestEntity = 0.0D;
}
}
}
else
{
double distance = start.distanceTo(hitMOP.hitVec);
if (distance < closestEntity || closestEntity == 0.0D)
{
pickedEntity = new MovingObjectPosition(entityHit);
pickedEntity.hitVec = hitMOP.hitVec;
closestEntity = distance;
}
}
}
}
}
return pickedEntity;
}
public static MovingObjectPosition raytraceBlocks_fromAnEntity(World world, Entity entity, Vec3 error, double reachDistance, boolean collisionFlag)
{
Vec3 playerPosition = Vec3.createVectorHelper(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ);
Vec3 playerLook = entity.getLookVec();
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * reachDistance + error.xCoord, playerPosition.yCoord + playerLook.yCoord * reachDistance + error.yCoord, playerPosition.zCoord + playerLook.zCoord * reachDistance + error.zCoord);
return raytraceBlocks(world, playerPosition, playerViewOffset, collisionFlag);
}
public static MovingObjectPosition raytraceBlocks_fromAnEntity(World world, Entity entity, double reachDistance, boolean collisionFlag)
{
Vec3 playerPosition = Vec3.createVectorHelper(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ);
Vec3 playerLook = entity.getLookVec();
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * reachDistance, playerPosition.yCoord + playerLook.yCoord * reachDistance, playerPosition.zCoord + playerLook.zCoord * reachDistance);
return raytraceBlocks(world, playerPosition, playerViewOffset, collisionFlag);
}
public static MovingObjectPosition raytraceBlocks(World world, Vec3 start, Vec3 end, boolean collisionFlag)
{
return world.rayTraceBlocks_do_do(start, end, collisionFlag, !collisionFlag);
}
public static Vector3 getPosFromRotation(final Vector3 center, float reachDistance, float yaw, float pitch)
{
return center.clone().translate(getLook(yaw, pitch, 1.0F).scale(reachDistance));
}
/** Does a ray trace from start to end vector
*
* @param world - world to do the ray trace in
* @param start - starting point clear of any collisions from its caster
* @param end - end point
* @param collisionFlag
* @return */
public static MovingObjectPosition ray_trace_do(final World world, final Vec3 start, final Vec3 end, final float range, boolean collisionFlag)
{
MovingObjectPosition hitBlock = raytraceBlocks(world, new Vector3(start).toVec3(), new Vector3(end).toVec3(), collisionFlag);
MovingObjectPosition hitEntity = raytraceEntities(world, start, end, range, collisionFlag, null);
if (hitEntity == null)
{
return hitBlock;
}
else if (hitBlock == null)
{
return hitEntity;
}
else
{
if (hitEntity.hitVec.distanceTo(start) < hitBlock.hitVec.distanceTo(start))
{
return hitEntity;
}
else
{
return hitBlock;
}
}
}
/** Does a ray trace from an entities look angle out to a set distance from the entity
*
* @param entity - entity who's view angles will be used for finding the start and end points of
* the ray
* @param e - error(or adjustments) to add to it if this ray is being used for weapon
* calculations
* @param reachDistance - distance the ray will extend to
* @param collisionFlag
* @return */
public static MovingObjectPosition do_rayTraceFromEntity(Entity entity, Vec3 e, double reachDistance, boolean collisionFlag)
{
MovingObjectPosition hitBlock = raytraceBlocks_fromAnEntity(entity.worldObj, entity, e, reachDistance, collisionFlag);
MovingObjectPosition hitEntity = raytraceEntities_fromAnEntity(entity.worldObj, entity, e, reachDistance, collisionFlag);
if (hitEntity == null)
{
return hitBlock;
}
else if (hitBlock == null)
{
return hitEntity;
}
else
{
Vec3 playerPosition = Vec3.createVectorHelper(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ);
if (hitEntity.hitVec.distanceTo(playerPosition) < hitBlock.hitVec.distanceTo(playerPosition))
{
return hitEntity;
}
else
{
return hitBlock;
}
}
}
public static Vec3 getLook(Entity entity, float par1)
{
float f1;
float f2;
float f3;
float f4;
if (par1 == 1.0F)
{
f1 = MathHelper.cos(-entity.rotationYaw * 0.017453292F - (float) Math.PI);
f2 = MathHelper.sin(-entity.rotationYaw * 0.017453292F - (float) Math.PI);
f3 = -MathHelper.cos(-entity.rotationPitch * 0.017453292F);
f4 = MathHelper.sin(-entity.rotationPitch * 0.017453292F);
return entity.worldObj.getWorldVec3Pool().getVecFromPool((f2 * f3), f4, (f1 * f3));
}
else
{
f1 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par1;
f2 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par1;
f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
float f6 = MathHelper.sin(-f1 * 0.017453292F);
return entity.worldObj.getWorldVec3Pool().getVecFromPool((f4 * f5), f6, (f3 * f5));
}
}
public static Vector3 getLook(float yaw, float pitch, float distance)
{
float f1, f2, f3, f4;
if (distance == 1.0F)
{
f1 = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI);
f2 = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI);
f3 = -MathHelper.cos(-pitch * 0.017453292F);
f4 = MathHelper.sin(-pitch * 0.017453292F);
return new Vector3((f2 * f3), f4, (f1 * f3));
}
else
{
f1 = pitch * distance;
f2 = yaw * distance;
f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
float f6 = MathHelper.sin(-f1 * 0.017453292F);
return new Vector3((f4 * f5), f6, (f3 * f5));
}
}
}

View file

@ -0,0 +1,81 @@
package resonantinduction.electrical.laser.gun;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderMiningLaserGun implements IItemRenderer
{
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "MiningLaserGun.tcn");
private static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "LaserGun.png");
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
float scale = 5f;
if (Minecraft.getMinecraft().thePlayer.getItemInUse() != item)
{
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(0.2f, 0.2f, 0.67f);
GL11.glRotatef(-40, 0, 1, 0);
GL11.glRotatef(10, 1, 0, 0);
}
else
{
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(0.2f, 0.2f, 0.67f);
GL11.glRotatef(-40, 0, 1, 0);
GL11.glRotatef(20, 1, 0, 0);
}
}
else if (type == ItemRenderType.EQUIPPED)
{
float scale = 3f;
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(-80, 1, 0, 0);
GL11.glRotatef(60, 0, 1, 0);
GL11.glRotatef(20, 0, 0, 1);
GL11.glTranslatef(0f, 0f, 0.6f);
}
else if (type == ItemRenderType.INVENTORY)
{
float scale = 1.5f;
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(0.1f, 0.06f, 0.52f);
}
MODEL.renderAll();
GL11.glPopMatrix();
}
}

View file

@ -1,12 +1,16 @@
package resonantinduction.core;
import java.awt.Color;
import net.minecraft.block.Block;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import universalelectricity.api.vector.IVector3;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.render.fx.FxLaser;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -49,7 +53,7 @@ public class ClientProxy extends CommonProxy
@Override
public void renderBlockParticle(World world, Vector3 position, Vector3 velocity, int blockID, float scale)
{
this.renderBlockParticle(world, position.x, position.y, position.z, velocity, blockID, scale);
this.renderBlockParticle(world, position.x, position.y, position.z, velocity, blockID, scale);
}
@Override
@ -61,4 +65,16 @@ public class ClientProxy extends CommonProxy
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
}
@Override
public void renderBeam(World world, IVector3 position, IVector3 hit, Color color, int age)
{
renderBeam(world, position, hit, color.getRed(), color.getGreen(), color.getBlue(), age);
}
@Override
public void renderBeam(World world, IVector3 position, IVector3 target, float red, float green, float blue, int age)
{
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new FxLaser(world, position, target, red, green, blue, age));
}
}

View file

@ -3,34 +3,43 @@
*/
package resonantinduction.core;
import java.awt.Color;
import net.minecraft.world.World;
import universalelectricity.api.vector.IVector3;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.prefab.ProxyBase;
/**
* @author Calclavia
*
*/
/** @author Calclavia */
public class CommonProxy extends ProxyBase
{
public boolean isPaused()
{
return false;
}
public boolean isPaused()
{
return false;
}
public boolean isGraphicsFancy()
{
return false;
}
public boolean isGraphicsFancy()
{
return false;
}
public void renderBlockParticle(World world, double x, double y, double z, Vector3 velocity, int blockID, float scale)
public void renderBlockParticle(World world, double x, double y, double z, Vector3 velocity, int blockID, float scale)
{
}
public void renderBlockParticle(World world, Vector3 position, Vector3 velocity, int blockID, float scale)
{
}
public void renderBlockParticle(World world, Vector3 position, Vector3 velocity, int blockID, float scale)
{
}
public void renderBeam(World world, IVector3 position, IVector3 hit, Color color, int age)
{
}
public void renderBeam(World world, IVector3 position, IVector3 target, float red, float green, float blue, int age)
{
}
}