mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Auto stash before merge of "master" and "origin/master"
This commit is contained in:
parent
39c3596cc1
commit
0bb05783ce
@ -89,7 +89,7 @@ public abstract class GuiInfoContainer extends GuiContainer {
|
||||
}
|
||||
|
||||
//TODO: do the funny
|
||||
protected void drawHoveringText2(List<Object[]> 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);
|
||||
|
||||
@ -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<ItemStack> 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) {
|
||||
|
||||
|
||||
@ -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<Integer> getAmmoList();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected List<ItemStack> ammoStacks;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<ItemStack> 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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user