mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-13 17:04:02 +00:00
fixes
This commit is contained in:
1 parent
8a0861589b
commit
3dcd5c43b6
5 files changed
+49
-47
No files matched your search
@@ -3,6 +3,7 @@ package tombenpotter.emt.client.renderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
@@ -11,6 +12,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import tombenpotter.emt.ModInformation;
|
||||
import tombenpotter.emt.common.entity.EntityLaser;
|
||||
import tombenpotter.emt.common.entity.EntityShield;
|
||||
|
||||
public class RenderShield extends Render {
|
||||
private static final ResourceLocation shieldTexture = new ResourceLocation(ModInformation.texturePath, "textures/models/shield.png");
|
||||
@@ -43,21 +45,21 @@ public class RenderShield extends Render {
|
||||
sin2 = MathHelper.sin((float) Math.toRadians(angle + 15));
|
||||
cos2 = MathHelper.cos((float) Math.toRadians(angle + 15));
|
||||
|
||||
values[i] = sin1 * hcos1;
|
||||
values[i + 1] = hsin1;
|
||||
values[i + 2] = cos1 * hcos1;
|
||||
values[i] = sin1 * hcos1 * 2;
|
||||
values[i + 1] = hsin1 * 2;
|
||||
values[i + 2] = cos1 * hcos1 * 2;
|
||||
|
||||
values[i + 3] = sin1 * hcos2;
|
||||
values[i + 4] = hsin2;
|
||||
values[i + 5] = cos1 * hcos2;
|
||||
values[i + 3] = sin1 * hcos2 * 2;
|
||||
values[i + 4] = hsin2 * 2;
|
||||
values[i + 5] = cos1 * hcos2 * 2;
|
||||
|
||||
values[i + 6] = sin2 * hcos2;
|
||||
values[i + 7] = hsin2;
|
||||
values[i + 8] = cos2 * hcos2;
|
||||
values[i + 6] = sin2 * hcos2 * 2;
|
||||
values[i + 7] = hsin2 * 2;
|
||||
values[i + 8] = cos2 * hcos2 * 2;
|
||||
|
||||
values[i + 9] = sin2 * hcos1;
|
||||
values[i + 10] = hsin1;
|
||||
values[i + 11] = cos2 * hcos1;
|
||||
values[i + 9] = sin2 * hcos1 * 2;
|
||||
values[i + 10] = hsin1 * 2;
|
||||
values[i + 11] = cos2 * hcos1 * 2;
|
||||
|
||||
i += 12;
|
||||
|
||||
@@ -70,23 +72,24 @@ public class RenderShield extends Render {
|
||||
}
|
||||
}
|
||||
|
||||
public void doRender(Entity entityLaser, double x, double y, double z, float par8, float par9) {
|
||||
this.bindEntityTexture(entityLaser);
|
||||
public void doRender(Entity entityShield, double x, double y, double z, float par8, float par9) {
|
||||
this.bindEntityTexture(entityShield);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
if(!Minecraft.getMinecraft().thePlayer.getDisplayName().equals( ((EntityShield)entityShield).owner.getDisplayName() ))
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
for (int v = 0; v < values.length; v += 12) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(values[v] , values[v + 1] , values[v + 2] , 1, 1);
|
||||
tessellator.addVertexWithUV(values[v + 3] , values[v + 4] , values[v + 5] , 1, 0);
|
||||
tessellator.addVertexWithUV(values[v + 6] , values[v + 7] , values[v + 8] , 0, 0);
|
||||
tessellator.addVertexWithUV(values[v + 9] , values[v + 10], values[v + 11], 0, 1);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(values[v] , values[v + 1] , values[v + 2] , 1, 1);
|
||||
tessellator.addVertexWithUV(values[v + 3] , values[v + 4] , values[v + 5] , 1, 0);
|
||||
tessellator.addVertexWithUV(values[v + 6] , values[v + 7] , values[v + 8] , 0, 0);
|
||||
tessellator.addVertexWithUV(values[v + 9] , values[v + 10], values[v + 11], 0, 1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
|
||||
@@ -19,14 +19,10 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityShield extends Entity implements IProjectile {
|
||||
EntityPlayer owner;
|
||||
public EntityPlayer owner;
|
||||
|
||||
public EntityShield(World world) {
|
||||
super(world);
|
||||
this.setSize(4, 4);
|
||||
this.ignoreFrustumCheck = true;
|
||||
owner = Minecraft.getMinecraft().thePlayer;
|
||||
this.setPosition(owner.posX, owner.posY, owner.posZ);
|
||||
this(world, Minecraft.getMinecraft().thePlayer);
|
||||
}
|
||||
|
||||
public EntityShield(World world, EntityPlayer player) {
|
||||
@@ -76,7 +72,7 @@ public class EntityShield extends Entity implements IProjectile {
|
||||
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (!owner.worldObj.isRemote) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
this.setPosition(owner.posX, owner.posY, owner.posZ);
|
||||
if (!owner.isUsingItem()) {
|
||||
this.setDead();
|
||||
|
||||
@@ -33,8 +33,10 @@ public class EntityRegistry {
|
||||
public static void registerEMTEntities() {
|
||||
|
||||
cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityLaser.class, "laser", entityIDs++, ElectroMagicTools.instance, 80, 3, true);
|
||||
|
||||
cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityArcher.class, "archer", entityIDs++, ElectroMagicTools.instance, 80, 3, true);
|
||||
cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityShield.class, "shield", entityIDs++, ElectroMagicTools.instance, 80, 3, true);
|
||||
registerEntityEgg(EntityArcher.class, 0x99111F, 0xE5685);
|
||||
|
||||
cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityShield.class, "shield", entityIDs++, ElectroMagicTools.instance, 80, 3, true);
|
||||
}
|
||||
}
|
||||
@@ -152,21 +152,23 @@ public class ItemMaterials extends Item {
|
||||
float d3 = 5000;
|
||||
Vec3 vec3d1 = playerLoc.addVector(f7 * d3, f8 * d3, f9 * d3);
|
||||
MovingObjectPosition movingobjectposition = player.worldObj.rayTraceBlocks(playerLoc, vec3d1, true);
|
||||
if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) {
|
||||
int x2 = movingobjectposition.blockX;
|
||||
int y2 = movingobjectposition.blockY;
|
||||
int z2 = movingobjectposition.blockZ;
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x2, y2, z2));
|
||||
}
|
||||
else if (movingobjectposition.typeOfHit == MovingObjectType.ENTITY) {
|
||||
Entity entityhit = movingobjectposition.entityHit;
|
||||
double x = entityhit.posX;
|
||||
double y = entityhit.posY;
|
||||
double z = entityhit.posZ;
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z));
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.inventory.consumeInventoryItem(this);
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) {
|
||||
int x2 = movingobjectposition.blockX;
|
||||
int y2 = movingobjectposition.blockY;
|
||||
int z2 = movingobjectposition.blockZ;
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x2, y2, z2));
|
||||
}
|
||||
else if (movingobjectposition.typeOfHit == MovingObjectType.ENTITY) {
|
||||
Entity entityhit = movingobjectposition.entityHit;
|
||||
double x = entityhit.posX;
|
||||
double y = entityhit.posY;
|
||||
double z = entityhit.posZ;
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z));
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.inventory.consumeInventoryItem(this);
|
||||
}
|
||||
}
|
||||
player.stopUsingItem();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import ic2.core.IC2;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -52,9 +53,7 @@ public class ItemShieldFocus extends ItemBaseFocus {
|
||||
for (PotionEffect effect : new LinkedList<PotionEffect>(player.getActivePotionEffects())) {
|
||||
IC2.platform.removePotion(player, effect.getPotionID());
|
||||
}
|
||||
if (player.capabilities.isCreativeMode)
|
||||
return;
|
||||
if (!wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) {
|
||||
if (!player.capabilities.isCreativeMode && !wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) {
|
||||
player.stopUsingItem();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user