diff --git a/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java b/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java index 5f9b7f43d..6d6f0da52 100644 --- a/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java +++ b/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java @@ -89,7 +89,7 @@ public abstract class GuiInfoContainer extends GuiContainer { } //TODO: do the funny - protected void drawHoveringText2(List lines, int x, int y, FontRenderer font) { + protected void drawHoveringText2(List lines, int x, int y, FontRenderer font) { if(!lines.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java index ddc5f9124..03d878c53 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java @@ -6,6 +6,7 @@ import java.util.List; import com.hbm.blocks.BlockDummyable; import com.hbm.entity.projectile.EntityArtilleryShell; import com.hbm.handler.BulletConfigSyncingUtil; +import com.hbm.handler.BulletConfiguration; import com.hbm.inventory.container.ContainerTurretBase; import com.hbm.inventory.gui.GUITurretArty; import com.hbm.items.ModItems; @@ -22,6 +23,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -49,6 +51,24 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI configs.add(BulletConfigSyncingUtil.SHELL_DU); configs.add(BulletConfigSyncingUtil.SHELL_W9); } + + @Override + @SideOnly(Side.CLIENT) + public List getAmmoTypesForDisplay() { + + if(ammoStacks != null) + return ammoStacks; + + for(Integer i : getAmmoList()) { + BulletConfiguration config = BulletConfigSyncingUtil.pullConfig(i); + + if(config != null && config.ammo != null) { + ammoStacks.add(new ItemStack(config.ammo)); + } + } + + return ammoStacks; + } public void enqueueTarget(double x, double y, double z) { diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java index 518c2716d..52c018b75 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java @@ -461,10 +461,6 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple * Turns the turret towards the specified position */ public void turnTowards(Vec3 ent) { - - /*double turnYaw = Math.toRadians(this.getTurretYawSpeed()); - double turnPitch = Math.toRadians(this.getTurretPitchSpeed()); - double pi2 = Math.PI * 2;*/ Vec3 pos = this.getTurretPos(); Vec3 delta = Vec3.createVectorHelper(ent.xCoord - pos.xCoord, ent.yCoord - pos.yCoord, ent.zCoord - pos.zCoord); @@ -473,51 +469,6 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple double targetYaw = -Math.atan2(delta.xCoord, delta.zCoord); this.turnTowardsAngle(targetPitch, targetYaw); - - /*//if we are about to overshoot the target by turning, just snap to the correct rotation - if(Math.abs(this.rotationPitch - targetPitch) < turnPitch || Math.abs(this.rotationPitch - targetPitch) > pi2 - turnPitch) { - this.rotationPitch = targetPitch; - } else { - - if(targetPitch > this.rotationPitch) - this.rotationPitch += turnPitch; - else - this.rotationPitch -= turnPitch; - } - - double deltaYaw = (targetYaw - this.rotationYaw) % pi2; - - //determines what direction the turret should turn - //used to prevent situations where the turret would do almost a full turn when - //the target is only a couple degrees off while being on the other side of the 360° line - int dir = 0; - - if(deltaYaw < -Math.PI) - dir = 1; - else if(deltaYaw < 0) - dir = -1; - else if(deltaYaw > Math.PI) - dir = -1; - else if(deltaYaw > 0) - dir = 1; - - if(Math.abs(this.rotationYaw - targetYaw) < turnYaw || Math.abs(this.rotationYaw - targetYaw) > pi2 - turnYaw) { - this.rotationYaw = targetYaw; - } else { - this.rotationYaw += turnYaw * dir; - } - - double deltaPitch = targetPitch - this.rotationPitch; - deltaYaw = targetYaw - this.rotationYaw; - - double deltaAngle = Math.sqrt(deltaYaw * deltaYaw + deltaPitch * deltaPitch); - - this.rotationYaw = this.rotationYaw % pi2; - this.rotationPitch = this.rotationPitch % pi2; - - if(deltaAngle <= Math.toRadians(this.getAcceptableInaccuracy())) { - this.aligned = true; - }*/ } public void turnTowardsAngle(double targetPitch, double targetYaw) { @@ -789,6 +740,26 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple * @return */ protected abstract List getAmmoList(); + + @SideOnly(Side.CLIENT) + protected List ammoStacks; + + @SideOnly(Side.CLIENT) + public List getAmmoTypesForDisplay() { + + if(ammoStacks != null) + return ammoStacks; + + for(Integer i : getAmmoList()) { + BulletConfiguration config = BulletConfigSyncingUtil.pullConfig(i); + + if(config != null && config.ammo != null) { + ammoStacks.add(new ItemStack(config.ammo)); + } + } + + return ammoStacks; + } @Override public int[] getAccessibleSlotsFromSide(int side) {