mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
more material stuff, artillery turret basecode for greg & HIM
This commit is contained in:
parent
b0647c3950
commit
48fc913ac2
@ -95,17 +95,17 @@ public class MineralRecipes {
|
||||
|
||||
addBillet(ModItems.billet_cobalt, ModItems.ingot_cobalt, ModItems.nugget_cobalt);
|
||||
addBillet(ModItems.billet_co60, ModItems.ingot_co60, ModItems.nugget_co60);
|
||||
addBillet(ModItems.billet_sr90, ModItems.ingot_sr90, ModItems.nugget_sr90, "nuggetStrontium90", "tinySr90");
|
||||
addBillet(ModItems.billet_uranium, ModItems.ingot_uranium, ModItems.nugget_uranium, "nuggetUranium");
|
||||
addBillet(ModItems.billet_u233, ModItems.ingot_u233, ModItems.nugget_u233, "nuggetUranium233", "tinyU233");
|
||||
addBillet(ModItems.billet_u235, ModItems.ingot_u235, ModItems.nugget_u235, "nuggetUranium235", "tinyU235");
|
||||
addBillet(ModItems.billet_u238, ModItems.ingot_u238, ModItems.nugget_u238, "nuggetUranium238", "tinyU238");
|
||||
addBillet(ModItems.billet_th232, ModItems.ingot_th232, ModItems.nugget_th232, "nuggetThorium232", "tinyTh232");
|
||||
addBillet(ModItems.billet_plutonium, ModItems.ingot_plutonium, ModItems.nugget_plutonium, "nuggetPlutonium");
|
||||
addBillet(ModItems.billet_pu238, ModItems.ingot_pu238, ModItems.nugget_pu238, "nuggetPlutonium238", "tinyPu238");
|
||||
addBillet(ModItems.billet_pu239, ModItems.ingot_pu239, ModItems.nugget_pu239, "nuggetPlutonium239", "tinyPu239");
|
||||
addBillet(ModItems.billet_pu240, ModItems.ingot_pu240, ModItems.nugget_pu240, "nuggetPlutonium240", "tinyPu240");
|
||||
addBillet(ModItems.billet_pu241, ModItems.ingot_pu241, ModItems.nugget_pu241, "nuggetPlutonium241", "tinyPu241");
|
||||
addBillet(ModItems.billet_sr90, ModItems.ingot_sr90, ModItems.nugget_sr90, SR90.allNuggets());
|
||||
addBillet(ModItems.billet_uranium, ModItems.ingot_uranium, ModItems.nugget_uranium, U.allNuggets());
|
||||
addBillet(ModItems.billet_u233, ModItems.ingot_u233, ModItems.nugget_u233, U233.allNuggets());
|
||||
addBillet(ModItems.billet_u235, ModItems.ingot_u235, ModItems.nugget_u235, U235.allNuggets());
|
||||
addBillet(ModItems.billet_u238, ModItems.ingot_u238, ModItems.nugget_u238, U238.allNuggets());
|
||||
addBillet(ModItems.billet_th232, ModItems.ingot_th232, ModItems.nugget_th232, TH232.allNuggets());
|
||||
addBillet(ModItems.billet_plutonium, ModItems.ingot_plutonium, ModItems.nugget_plutonium, PU.allNuggets());
|
||||
addBillet(ModItems.billet_pu238, ModItems.ingot_pu238, ModItems.nugget_pu238, PU238.allNuggets());
|
||||
addBillet(ModItems.billet_pu239, ModItems.ingot_pu239, ModItems.nugget_pu239, PU239.allNuggets());
|
||||
addBillet(ModItems.billet_pu240, ModItems.ingot_pu240, ModItems.nugget_pu240, PU240.allNuggets());
|
||||
addBillet(ModItems.billet_pu241, ModItems.ingot_pu241, ModItems.nugget_pu241, PU241.allNuggets());
|
||||
addBillet(ModItems.billet_pu_mix, ModItems.ingot_pu_mix, ModItems.nugget_pu_mix);
|
||||
addBillet(ModItems.billet_am241, ModItems.ingot_am241, ModItems.nugget_am241, AM241.allNuggets());
|
||||
addBillet(ModItems.billet_am242, ModItems.ingot_am242, ModItems.nugget_am242, AM242.allNuggets());
|
||||
@ -115,8 +115,8 @@ public class MineralRecipes {
|
||||
addBillet(ModItems.billet_technetium, ModItems.ingot_technetium, ModItems.nugget_technetium, TC99.allNuggets());
|
||||
addBillet(ModItems.billet_au198, ModItems.ingot_au198, ModItems.nugget_au198, AU198.allNuggets());
|
||||
addBillet(ModItems.billet_pb209, ModItems.ingot_pb209, ModItems.nugget_pb209, PB209.allNuggets()); //and so forth
|
||||
addBillet(ModItems.billet_ra226, ModItems.ingot_ra226, ModItems.nugget_ra226, "nuggetRa226");
|
||||
addBillet(ModItems.billet_actinium, ModItems.ingot_actinium, ModItems.nugget_actinium, "nuggetActinium227", "tinyAc227");
|
||||
addBillet(ModItems.billet_ra226, ModItems.ingot_ra226, ModItems.nugget_ra226, RA226.allNuggets());
|
||||
addBillet(ModItems.billet_actinium, ModItems.ingot_actinium, ModItems.nugget_actinium, AC227.allNuggets());
|
||||
addBillet(ModItems.billet_schrabidium, ModItems.ingot_schrabidium, ModItems.nugget_schrabidium, "nuggetSchrabidium");
|
||||
addBillet(ModItems.billet_solinium, ModItems.ingot_solinium, ModItems.nugget_solinium, "nuggetSolinium");
|
||||
addBillet(ModItems.billet_gh336, ModItems.ingot_gh336, ModItems.nugget_gh336, GH336.allNuggets());
|
||||
|
||||
@ -19,8 +19,8 @@ public class MatDistribution {
|
||||
|
||||
public static void register() {
|
||||
registerEntry(Blocks.rail, MAT_IRON, INGOT.q(6, 16));
|
||||
registerEntry(Blocks.golden_rail, MAT_GOLD, INGOT.q(6));
|
||||
registerEntry(Blocks.detector_rail, MAT_IRON, INGOT.q(6));
|
||||
registerEntry(Blocks.golden_rail, MAT_GOLD, INGOT.q(6), MAT_REDSTONE, DUST.q(1));
|
||||
registerEntry(Blocks.detector_rail, MAT_IRON, INGOT.q(6), MAT_REDSTONE, DUST.q(1));
|
||||
registerEntry(Items.minecart, MAT_IRON, INGOT.q(5));
|
||||
|
||||
registerOre(OreDictManager.COAL.ore(), MAT_IRON, INGOT.q(4), MAT_STONE, QUART.q(1));
|
||||
|
||||
@ -13,7 +13,7 @@ public enum MaterialShapes {
|
||||
QUART(162),
|
||||
BLOCK(INGOT.quantity * 9, "block");
|
||||
|
||||
int quantity;
|
||||
private int quantity;
|
||||
String[] prefixes;
|
||||
|
||||
private MaterialShapes(int quantity, String... prefixes) {
|
||||
|
||||
@ -16,6 +16,7 @@ import com.hbm.util.ItemStackUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/* with every new rewrite, optimization and improvement, the code becomes more gregian */
|
||||
|
||||
/**
|
||||
* Defines materials that wrap around DictFrames to more accurately describe that material.
|
||||
* Direct uses are the crucible and possibly item auto-gen, depending on what traits are set.
|
||||
@ -28,19 +29,40 @@ public class Mats {
|
||||
public static HashMap<ComparableStack, List<MaterialStack>> materialEntries = new HashMap();
|
||||
public static HashMap<String, List<MaterialStack>> materialOreEntries = new HashMap();
|
||||
|
||||
public static final NTMMaterial
|
||||
MAT_STONE = makeSmeltable(new DictFrame("Stone"), 0),
|
||||
MAT_COAL = make(COAL).smeltable(SmeltingBehavior.ADDITIVE),
|
||||
MAT_IRON = makeSmeltable(IRON, 0).omitAutoGen(),
|
||||
MAT_GOLD = makeSmeltable(GOLD, 0).omitAutoGen(),
|
||||
MAT_STEEL = makeSmeltable(STEEL, 0).setShapes(DUSTTINY, INGOT, DUST, PLATE, BLOCK),
|
||||
MAT_TUNGSTEN = makeSmeltable(W, 0).setShapes(WIRE, INGOT, DUST, BLOCK),
|
||||
MAT_COPPER = makeSmeltable(CU, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK),
|
||||
MAT_ALUMINIUM = makeSmeltable(AL, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK),
|
||||
MAT_MINGRADE = makeSmeltable(MINGRADE, 0).setShapes(WIRE, INGOT, DUST, BLOCK),
|
||||
MAT_ALLOY = makeSmeltable(ALLOY, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK),
|
||||
MAT_TITANIUM = makeSmeltable(TI, 0).setShapes(INGOT, DUST, PLATE, BLOCK),
|
||||
MAT_LEAD = makeSmeltable(PB, 0).setShapes(NUGGET, INGOT, DUST, PLATE, BLOCK);
|
||||
//Vanilla
|
||||
public static final NTMMaterial MAT_STONE = makeSmeltable(df("Stone"), 0);
|
||||
public static final NTMMaterial MAT_COAL = make(COAL).smeltable(SmeltingBehavior.ADDITIVE);
|
||||
public static final NTMMaterial MAT_IRON = makeSmeltable(IRON, 0).omitAutoGen();
|
||||
public static final NTMMaterial MAT_GOLD = makeSmeltable(GOLD, 0).omitAutoGen();
|
||||
public static final NTMMaterial MAT_REDSTONE = makeSmeltable(REDSTONE, 0).omitAutoGen();
|
||||
|
||||
//Radioactive
|
||||
public static final NTMMaterial MAT_URANIUM = makeSmeltable(U, 0).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_THORIUM = makeSmeltable(TH232, 0).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_PLUTONIUM = makeSmeltable(PU, 0).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_RADIUM = makeSmeltable(RA226, 0).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK);
|
||||
|
||||
//Base metals
|
||||
public static final NTMMaterial MAT_TITANIUM = makeSmeltable(TI, 0).setShapes(INGOT, DUST, PLATE, BLOCK);
|
||||
public static final NTMMaterial MAT_COPPER = makeSmeltable(CU, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK);
|
||||
public static final NTMMaterial MAT_TUNGSTEN = makeSmeltable(W, 0).setShapes(WIRE, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_ALUMINIUM = makeSmeltable(AL, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK);
|
||||
public static final NTMMaterial MAT_LEAD = makeSmeltable(PB, 0).setShapes(NUGGET, INGOT, DUST, PLATE, BLOCK);
|
||||
public static final NTMMaterial MAT_BISMUTH = makeSmeltable(df("Bismuth"), 0).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_ARSENIC = makeSmeltable(AS, 0).setShapes(NUGGET, INGOT);
|
||||
public static final NTMMaterial MAT_TANTALIUM = makeSmeltable(TA, 0).setShapes(NUGGET, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_NIOBIUM = makeSmeltable(NB, 0).setShapes(NUGGET, DUSTTINY, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_BERYLLIUM = makeSmeltable(BE, 0).setShapes(NUGGET, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_COBALT = makeSmeltable(CO, 0).setShapes(NUGGET, DUSTTINY, BILLET, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_BORON = makeSmeltable(B, 0).setShapes(DUSTTINY, INGOT, DUST, BLOCK);
|
||||
|
||||
//Alloys
|
||||
public static final NTMMaterial MAT_STEEL = makeSmeltable(STEEL, 0).setShapes(DUSTTINY, INGOT, DUST, PLATE, BLOCK);
|
||||
public static final NTMMaterial MAT_MINGRADE = makeSmeltable(MINGRADE, 0).setShapes(WIRE, INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_ALLOY = makeSmeltable(ALLOY, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK);
|
||||
public static final NTMMaterial MAT_TCALLOY = makeSmeltable(TCALLOY, 0).setShapes(INGOT, DUST);
|
||||
public static final NTMMaterial MAT_DURA = makeSmeltable(DURA, 0).setShapes(INGOT, DUST, BLOCK);
|
||||
public static final NTMMaterial MAT_MAGTUNG = makeSmeltable(MAGTUNG, 0).setShapes(INGOT, DUST, BLOCK);
|
||||
|
||||
public static NTMMaterial make(DictFrame dict) {
|
||||
return new NTMMaterial(dict);
|
||||
@ -50,6 +72,10 @@ public class Mats {
|
||||
return new NTMMaterial(dict).smeltable(SmeltingBehavior.SMELTABLE).setMoltenColor(color);
|
||||
}
|
||||
|
||||
public static DictFrame df(String string) {
|
||||
return new DictFrame(string);
|
||||
}
|
||||
|
||||
public static List<MaterialStack> getMaterialsFromItem(ItemStack stack) {
|
||||
List<MaterialStack> list = new ArrayList();
|
||||
List<String> names = ItemStackUtil.getOreDictNames(stack);
|
||||
@ -73,7 +99,7 @@ public class Mats {
|
||||
NTMMaterial material = matByName.get(materialName);
|
||||
|
||||
if(material != null) {
|
||||
list.add(new MaterialStack(material, prefixEntry.getValue().quantity));
|
||||
list.add(new MaterialStack(material, prefixEntry.getValue().q(1)));
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
@ -104,11 +130,11 @@ public class Mats {
|
||||
public static String formatAmount(int amount) {
|
||||
String format = "";
|
||||
|
||||
int blocks = amount / BLOCK.quantity;
|
||||
int blocks = amount / BLOCK.q(1);
|
||||
amount -= BLOCK.q(blocks);
|
||||
int ingots = amount / INGOT.quantity;
|
||||
int ingots = amount / INGOT.q(1);
|
||||
amount -= INGOT.q(ingots);
|
||||
int nuggets = amount / NUGGET.quantity;
|
||||
int nuggets = amount / NUGGET.q(1);
|
||||
amount -= NUGGET.q(nuggets);
|
||||
int quanta = amount;
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
@ -28,7 +27,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUIProvider {
|
||||
public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implements IGUIProvider {
|
||||
|
||||
public short mode = 0;
|
||||
public static final short MODE_ARTILLERY = 0;
|
||||
@ -39,8 +38,6 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
||||
public double barrelPos = 0;
|
||||
public double lastBarrelPos = 0;
|
||||
|
||||
private List<Vec3> targetQueue = new ArrayList();
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<ItemStack> getAmmoTypesForDisplay() {
|
||||
@ -57,15 +54,6 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
||||
return ammoStacks;
|
||||
}
|
||||
|
||||
public void enqueueTarget(double x, double y, double z) {
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 delta = Vec3.createVectorHelper(x - pos.xCoord, y - pos.yCoord, z - pos.zCoord);
|
||||
if(delta.lengthVector() <= this.getDecetorRange()) {
|
||||
this.targetQueue.add(Vec3.createVectorHelper(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Integer> getAmmoList() {
|
||||
return new ArrayList();
|
||||
@ -132,28 +120,8 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void seekNewTarget() {
|
||||
super.seekNewTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean entityInLOS(Entity e) {
|
||||
|
||||
if(this.mode == this.MODE_CANNON) {
|
||||
return super.entityInLOS(e);
|
||||
} else {
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 ent = this.getEntityPos(e);
|
||||
Vec3 delta = Vec3.createVectorHelper(ent.xCoord - pos.xCoord, ent.yCoord - pos.yCoord, ent.zCoord - pos.zCoord);
|
||||
double length = delta.lengthVector();
|
||||
|
||||
if(length < this.getDecetorGrace() || length > this.getDecetorRange() * 1.1) //the latter statement is only relevant for entities that have already been detected
|
||||
return false;
|
||||
|
||||
int height = worldObj.getHeightValue((int) Math.floor(e.posX), (int) Math.floor(e.posZ));
|
||||
return height < (e.posY + e.height);
|
||||
}
|
||||
public boolean doLOSCheck() {
|
||||
return this.mode == this.MODE_CANNON;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package com.hbm.tileentity.turret;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public abstract class TileEntityTurretBaseArtillery extends TileEntityTurretBaseNT {
|
||||
|
||||
protected List<Vec3> targetQueue = new ArrayList();
|
||||
|
||||
public void enqueueTarget(double x, double y, double z) {
|
||||
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 delta = Vec3.createVectorHelper(x - pos.xCoord, y - pos.yCoord, z - pos.zCoord);
|
||||
if(delta.lengthVector() <= this.getDecetorRange()) {
|
||||
this.targetQueue.add(Vec3.createVectorHelper(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean doLOSCheck();
|
||||
|
||||
@Override
|
||||
public boolean entityInLOS(Entity e) {
|
||||
|
||||
if(doLOSCheck()) {
|
||||
return super.entityInLOS(e);
|
||||
|
||||
} else {
|
||||
Vec3 pos = this.getTurretPos();
|
||||
Vec3 ent = this.getEntityPos(e);
|
||||
Vec3 delta = Vec3.createVectorHelper(ent.xCoord - pos.xCoord, ent.yCoord - pos.yCoord, ent.zCoord - pos.zCoord);
|
||||
double length = delta.lengthVector();
|
||||
|
||||
if(length < this.getDecetorGrace() || length > this.getDecetorRange() * 1.1) //the latter statement is only relevant for entities that have already been detected
|
||||
return false;
|
||||
|
||||
int height = worldObj.getHeightValue((int) Math.floor(e.posX), (int) Math.floor(e.posZ));
|
||||
return height < (e.posY + e.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,8 +17,8 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityTurretHIMARS extends TileEntityTurretBaseNT implements IGUIProvider {
|
||||
|
||||
public class TileEntityTurretHIMARS extends TileEntityTurretBaseArtillery implements IGUIProvider {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<ItemStack> getAmmoTypesForDisplay() {
|
||||
@ -50,6 +50,11 @@ public class TileEntityTurretHIMARS extends TileEntityTurretBaseNT implements IG
|
||||
return 1_000_000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doLOSCheck() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFiringTick() {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user