Clean up on laser code, and texture fix for laser gun
This commit is contained in:
parent
23a910a050
commit
429cb6b8cd
2 changed files with 19 additions and 16 deletions
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -144,14 +145,15 @@ public class ItemMiningLaser extends ItemElectric
|
|||
{
|
||||
Pair<Vector3, Integer> lastHit = miningMap.get(player);
|
||||
if (lastHit != null && lastHit.left() != null && lastHit.left().equals(new Vector3(hit)))
|
||||
{
|
||||
Block b = Block.blocksList[player.worldObj.getBlockId(hit.blockX, hit.blockY, hit.blockZ)];
|
||||
if (b != null && b.getBlockHardness(player.worldObj, hit.blockX, hit.blockY, hit.blockZ) > -1)
|
||||
{
|
||||
time = lastHit.right() + 1;
|
||||
if (time >= breakTime)
|
||||
{
|
||||
|
||||
LaserEvent.onBlockMinedByLaser(player.worldObj, player, new Vector3(hit));
|
||||
mined = true;
|
||||
player.worldObj.destroyBlockInWorldPartially(0, hit.blockX, hit.blockY, hit.blockZ, -1);
|
||||
miningMap.remove(player);
|
||||
}
|
||||
else
|
||||
|
@ -162,6 +164,7 @@ public class ItemMiningLaser extends ItemElectric
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!mined)
|
||||
{
|
||||
miningMap.put(player, new Pair<Vector3, Integer>(new Vector3(hit), time));
|
||||
|
@ -175,8 +178,8 @@ public class ItemMiningLaser extends ItemElectric
|
|||
//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);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
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");
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "LaserGun.png");
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
|
|
Loading…
Reference in a new issue