finished the base AMS

This commit is contained in:
HbmMods 2020-04-01 21:25:22 +02:00
parent 8973fb0ed1
commit 61790da788
16 changed files with 345 additions and 11 deletions

View File

@ -559,8 +559,11 @@ container.dfcEmitter=DFC-Emitter
tile.dfc_receiver.name=DFC-Receiver
container.dfcReceiver=DFC-Receiver
tile.dfc_injector.name=DFC-Brennstoffinjektor
container.dfcInjector=DFC-Brennstoffinjektor
tile.dfc_stabilizer.name=DFC-Stabilisator
container.dfcStabilizer=DFC-Stabilisator
tile.dfc_core.name=Dunkler Fusionskern
container.dfcCore.name=Dunkler Fusionskern
container.dfc_core=Dunkler Fusionskern
item.template_folder.name=Produktionsvorlagen-Zeichenmappe
item.fluid_identifier.name=Flüssigkeits-Kennzeichnung
@ -2249,6 +2252,8 @@ item.ams_focus_booster.name=Verstärkender Stabilisierungsfokus
item.ams_muzzle.name=Strahlenemissions-Mündung
item.ams_lens.name=Stabilisierer-Linse
item.ams_core_sing.name=Vibrierende Singularität (AMS-Kern)
item.ams_core_wormhole.name=Winziges Wurmloch (AMS-Kern)
item.ams_core_eyeofharmony.name=Auge der Harmonie (AMS-Kern)

View File

@ -559,8 +559,11 @@ container.dfcEmitter=DFC Emitter
tile.dfc_receiver.name=DFC Receiver
container.dfcReceiver=DFC Receiver
tile.dfc_injector.name=DFC Fuel Injector
container.dfcInjector=DFC Fuel Injector
tile.dfc_stabilizer.name=DFC Stabilizer
container.dfcStabilizer=DFC Stabilizer
tile.dfc_core.name=Dark Fusion Core
container.dfcCore.name=Dark Fusion Core
container.dfcCore=Dark Fusion Core
item.template_folder.name=Machine Template Folder
item.fluid_identifier.name=Fluid Identifier
@ -2249,6 +2252,8 @@ item.ams_focus_booster.name=Boosting Stabilizer Focus
item.ams_muzzle.name=Ray-Emission Muzzle
item.ams_lens.name=Stabilizer Lens
item.ams_core_sing.name=Vibrant Singularity (AMS Core)
item.ams_core_wormhole.name=Tiny Wormhole (AMS Core)
item.ams_core_eyeofharmony.name=Eye of Harmony (AMS Core)

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

View File

@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerCoreStabilizer extends Container {
@ -15,6 +16,8 @@ public class ContainerCoreStabilizer extends Container {
nukeBoy = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 80, 17));
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 9; j++)
@ -28,6 +31,38 @@ public class ContainerCoreStabilizer extends Container {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 == 0) {
if (!this.mergeItemStack(var5, 1, this.inventorySlots.size(), true)) {
return null;
}
} else if (!this.mergeItemStack(var5, 0, 1, true)) {
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
}
else
{
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {

View File

@ -33,7 +33,9 @@ public class GUICore extends GuiInfoContainer {
core.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 17, 16, 52);
String[] text = new String[] { "Restriction Field: " + core.field + "%" };
String[] text1 = new String[] { "Heat Saturation: " + core.heat + "%" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 52, mouseX, mouseY, text);
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 152, guiTop + 17, 16, 52, mouseX, mouseY, text1);
}
@Override

View File

@ -40,7 +40,8 @@ public class GUICoreReceiver extends GuiInfoContainer {
this.fontRendererObj.drawString("Input:", 40, 25, 0xFF7F7F);
this.fontRendererObj.drawString(Library.getShortNumber(receiver.joules) + "Spk", 50, 35, 0xFF7F7F);
this.fontRendererObj.drawString(Library.getShortNumber(receiver.joules * 5000) + "HE", 50, 45, 0xFF7F7F);
this.fontRendererObj.drawString("Output:", 40, 45, 0xFF7F7F);
this.fontRendererObj.drawString(Library.getShortNumber(receiver.joules * 5000) + "HE", 50, 55, 0xFF7F7F);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}

View File

@ -536,6 +536,8 @@ public class ModItems {
public static Item ams_muzzle;
public static Item ams_lens;
public static Item ams_core_sing;
public static Item ams_core_wormhole;
public static Item ams_core_eyeofharmony;
@ -3065,6 +3067,7 @@ public class ModItems {
ams_focus_limiter = new ItemCustomLore().setUnlocalizedName("ams_focus_limiter").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":ams_focus_limiter");
ams_focus_booster = new ItemCustomLore().setUnlocalizedName("ams_focus_booster").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":ams_focus_booster");
ams_muzzle = new ItemCustomLore().setUnlocalizedName("ams_muzzle").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":ams_muzzle");
ams_lens = new ItemLens().setUnlocalizedName("ams_lens").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":ams_lens");
ams_core_sing = new ItemAMSCore(1000000000L, 200, 10).setUnlocalizedName("ams_core_sing").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":ams_core_sing");
ams_core_wormhole = new ItemAMSCore(1500000000L, 200, 15).setUnlocalizedName("ams_core_wormhole").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":ams_core_wormhole");
ams_core_eyeofharmony = new ItemAMSCore(2500000000L, 300, 10).setUnlocalizedName("ams_core_eyeofharmony").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":ams_core_eyeofharmony");
@ -4226,6 +4229,7 @@ public class ModItems {
GameRegistry.registerItem(ams_focus_limiter, ams_focus_limiter.getUnlocalizedName());
GameRegistry.registerItem(ams_focus_booster, ams_focus_booster.getUnlocalizedName());
GameRegistry.registerItem(ams_muzzle, ams_muzzle.getUnlocalizedName());
GameRegistry.registerItem(ams_lens, ams_lens.getUnlocalizedName());
GameRegistry.registerItem(ams_core_sing, ams_core_sing.getUnlocalizedName());
GameRegistry.registerItem(ams_core_wormhole, ams_core_wormhole.getUnlocalizedName());
GameRegistry.registerItem(ams_core_eyeofharmony, ams_core_eyeofharmony.getUnlocalizedName());

View File

@ -37,10 +37,14 @@ public class ItemCatalyst extends Item {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
{
list.add("Absolute Energy Bonus: " + powerAbs + "HE");
/*list.add("Absolute Energy Bonus: " + powerAbs + "HE");
list.add("Energy Modifier: " + (powerMod >= 1 ? "+" : "") + (Math.round(powerMod * 1000) * .10 - 100) + "%");
list.add("Heat Modifier: " + (heatMod >= 1 ? "+" : "") + (Math.round(heatMod * 1000) * .10 - 100) + "%");
list.add("Fuel Modifier: " + (fuelMod >= 1 ? "+" : "") + (Math.round(fuelMod * 1000) * .10 - 100) + "%");
list.add("Fuel Modifier: " + (fuelMod >= 1 ? "+" : "") + (Math.round(fuelMod * 1000) * .10 - 100) + "%");*/
//TODO: do something useful with this
list.add("Adds spice to the core.");
list.add("Look at all those colors!");
}
public static long getPowerAbs(ItemStack stack) {

View File

@ -0,0 +1,53 @@
package com.hbm.items.special;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class ItemLens extends Item {
public static final long maxDamage = 60 * 60 * 60 * 20 * 100; //1 hour at 100%, 100 hours at 1%
public static long getLensDamage(ItemStack stack) {
if(!stack.hasTagCompound()) {
stack.stackTagCompound = new NBTTagCompound();
return 0;
}
return stack.stackTagCompound.getLong("damage");
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
long damage = getLensDamage(stack);
int percent = (int) ((maxDamage - damage) * 100 / maxDamage);
list.add("Durability: " + (maxDamage - damage) + "/" + maxDamage + " (" + percent + "%)");
}
public static void setLensDamage(ItemStack stack, long damage) {
if(!stack.hasTagCompound()) {
stack.stackTagCompound = new NBTTagCompound();
}
stack.stackTagCompound.setLong("damage", damage);
}
public double getDurabilityForDisplay(ItemStack stack)
{
return (double)getLensDamage(stack) / (double)maxDamage;
}
public boolean showDurabilityBar(ItemStack stack)
{
return true;
}
}

View File

@ -3,7 +3,7 @@ package com.hbm.lib;
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (3442)";
public static final String VERSION = "1.0.27 BETA (3461)";
//HBM's Beta Naming Convention:
//V T (X)
//V -> next release version

View File

@ -1679,6 +1679,38 @@ public class CraftingManager {
GameRegistry.addRecipe(new ItemStack(ModBlocks.struct_launcher_core_large, 1), new Object[] { "SIS", "ICI", "BEB", 'S', ModItems.circuit_red_copper, 'I', Blocks.iron_bars, 'C', ModItems.circuit_targeting_tier4, 'B', ModBlocks.struct_launcher, 'E', ModBlocks.machine_battery });
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.obj_tester, 1), new Object[] { "P", "I", "S", 'P', ModItems.polaroid, 'I', ModItems.flame_pony, 'S', "plateSteel" }));
GameRegistry.addRecipe(new ItemStack(ModBlocks.fence_metal, 6), new Object[] { "BIB", "BIB", 'B', Blocks.iron_bars, 'I', Items.iron_ingot });
GameRegistry.addRecipe(new ItemStack(ModItems.rune_blank, 1), new Object[] { "PSP", "SDS", "PSP", 'P', ModItems.powder_magic, 'S', ModItems.ingot_starmetal, 'D', ModItems.dynosphere_dineutronium_charged });
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.rune_isa, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.singularity_counter_resonant });
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.rune_dagaz, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.singularity });
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.rune_hagalaz, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.singularity_super_heated });
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.rune_jera, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.singularity_spark });
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.rune_thurisaz, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.black_hole });
GameRegistry.addRecipe(new ItemStack(ModItems.ams_lens, 1), new Object[] { "PDP", "GDG", "PDP", 'P', ModItems.plate_dineutronium, 'G', ModBlocks.reinforced_glass, 'D', Blocks.diamond_block });
GameRegistry.addRecipe(new ItemStack(ModItems.ams_catalyst_blank, 1), new Object[] { "TET", "ETE", "TET", 'T', ModItems.powder_tennessine, 'E', ModItems.ingot_euphemium});
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_lithium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_isa, ModItems.rune_isa, ModItems.rune_jera, ModItems.rune_jera, "dustLithium", "dustLithium", "dustLithium", "dustLithium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_beryllium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_isa, ModItems.rune_dagaz, ModItems.rune_jera, ModItems.rune_jera, "dustBeryllium", "dustBeryllium", "dustBeryllium", "dustBeryllium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_copper, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_dagaz, ModItems.rune_dagaz, ModItems.rune_jera, ModItems.rune_jera, "dustCopper", "dustCopper", "dustCopper", "dustCopper" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_cobalt, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_dagaz, ModItems.rune_hagalaz, ModItems.rune_jera, ModItems.rune_jera, "dustCobalt", "dustCobalt", "dustCobalt", "dustCobalt" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_tungsten, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_hagalaz, ModItems.rune_hagalaz, ModItems.rune_jera, ModItems.rune_jera, "dustTungsten", "dustTungsten", "dustTungsten", "dustTungsten" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_aluminium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_isa, ModItems.rune_isa, ModItems.rune_jera, ModItems.rune_thurisaz, "dustAluminum", "dustAluminum", "dustAluminum", "dustAluminum" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_iron, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_isa, ModItems.rune_dagaz, ModItems.rune_jera, ModItems.rune_thurisaz, "dustIron", "dustIron", "dustIron", "dustIron" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_strontium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_dagaz, ModItems.rune_dagaz, ModItems.rune_jera, ModItems.rune_thurisaz, "dustStrontium", "dustStrontium", "dustStrontium", "dustStrontium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_niobium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_dagaz, ModItems.rune_hagalaz, ModItems.rune_jera, ModItems.rune_thurisaz, "dustNiobium", "dustNiobium", "dustNiobium", "dustNiobium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_cerium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_hagalaz, ModItems.rune_hagalaz, ModItems.rune_jera, ModItems.rune_thurisaz, "dustCerium", "dustCerium", "dustCerium", "dustCerium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_caesium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_isa, ModItems.rune_isa, ModItems.rune_thurisaz, ModItems.rune_thurisaz, "dustCaesium", "dustCaesium", "dustCaesium", "dustCaesium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_thorium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_isa, ModItems.rune_dagaz, ModItems.rune_thurisaz, ModItems.rune_thurisaz, "dustThorium", "dustThorium", "dustThorium", "dustThorium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_euphemium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_dagaz, ModItems.rune_dagaz, ModItems.rune_thurisaz, ModItems.rune_thurisaz, "dustEuphemium", "dustEuphemium", "dustEuphemium", "dustEuphemium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_schrabidium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_dagaz, ModItems.rune_hagalaz, ModItems.rune_thurisaz, ModItems.rune_thurisaz, "dustSchrabidium", "dustSchrabidium", "dustSchrabidium", "dustSchrabidium" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ams_catalyst_dineutronium, 1), new Object[] { ModItems.ams_catalyst_blank, ModItems.rune_hagalaz, ModItems.rune_hagalaz, ModItems.rune_thurisaz, ModItems.rune_thurisaz, "dustDineutronium", "dustDineutronium", "dustDineutronium", "dustDineutronium" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.dfc_core, 1), new Object[] { "DLD", "LML", "DLD", 'D', ModItems.plate_dineutronium, 'L', "blockLead", 'M', ModBlocks.block_meteor }));
GameRegistry.addRecipe(new ItemStack(ModBlocks.dfc_emitter, 1), new Object[] { "SDS", "TXL", "SDS", 'S', ModItems.ingot_starmetal, 'D', ModItems.plate_desh, 'T', ModBlocks.machine_transformer_dnt, 'X', ModItems.crystal_xen, 'L', ModItems.sat_head_laser });
GameRegistry.addRecipe(new ItemStack(ModBlocks.dfc_receiver, 1), new Object[] { "SDS", "TXL", "SDS", 'S', ModItems.ingot_starmetal, 'D', ModItems.plate_desh, 'T', ModBlocks.machine_transformer_dnt, 'X', ModBlocks.sellafield_core, 'L', ModItems.hull_small_steel });
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.dfc_injector, 1), new Object[] { "SDS", "TXL", "SDS", 'S', ModItems.ingot_starmetal, 'D', ModItems.plate_combine_steel, 'T', ModBlocks.machine_fluidtank, 'X', ModItems.motor, 'L', ModItems.pipes_steel }));
GameRegistry.addRecipe(new ItemStack(ModBlocks.dfc_stabilizer, 1), new Object[] { "SDS", "TXL", "SDS", 'S', ModItems.ingot_starmetal, 'D', ModItems.plate_desh, 'T', ModItems.singularity_spark, 'X', ModItems.magnet_circular, 'L', ModItems.crystal_xen });
}
public static void AddSmeltingRec()

View File

@ -27,7 +27,11 @@ public class RenderCore extends TileEntitySpecialRenderer {
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
TileEntityCore core = (TileEntityCore)tileEntity;
renderStandby(x, y, z);
if(core.heat == 0)
renderStandby(x, y, z);
else
renderOrb(core, x, y, z);
}
public void renderStandby(double x, double y, double z) {
@ -62,6 +66,48 @@ public class RenderCore extends TileEntitySpecialRenderer {
GL11.glPopMatrix();
}
public void renderOrb(TileEntityCore tile, double x, double y, double z) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
int color = tile.color;
GL11.glColor3ub((byte)((color & 0xFF0000) >> 16), (byte)((color & 0x00FF00) >> 8), (byte)((color & 0x0000FF) >> 0));
int tot = tile.tanks[0].getMaxFill() + tile.tanks[1].getMaxFill();
int fill = tile.tanks[0].getFill() + tile.tanks[1].getFill();
float scale = 4.5F * fill / tot + 0.5F;
GL11.glScalef(scale, scale, scale);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glScalef(0.5F, 0.5F, 0.5F);
ResourceManager.sphere_ruv.renderAll();
GL11.glScalef(2F, 2F, 2F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
for(int i = 6; i <= 10; i++) {
GL11.glPushMatrix();
GL11.glScalef(i * 0.1F, i * 0.1F, i * 0.1F);
ResourceManager.sphere_ruv.renderAll();
GL11.glPopMatrix();
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
public void renderVoid(TileEntity tile, double x, double y, double z) {
World world = tile.getWorldObj();

View File

@ -1,7 +1,11 @@
package com.hbm.tileentity.machine;
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemCatalyst;
import com.hbm.tileentity.TileEntityMachineBase;
import net.minecraft.nbt.NBTTagCompound;
@ -22,7 +26,7 @@ public class TileEntityCore extends TileEntityMachineBase {
@Override
public String getName() {
return "container.dfc_core";
return "container.dfcCore";
}
@Override
@ -30,6 +34,44 @@ public class TileEntityCore extends TileEntityMachineBase {
if(!worldObj.isRemote) {
if(heat > 0 && heat >= field) {
int fill = tanks[0].getFill() + tanks[1].getFill();
int max = tanks[0].getMaxFill() + tanks[1].getMaxFill();
int mod = heat * 10;
int size = Math.max(Math.min(fill * mod / max, 1000), 50);
//System.out.println(fill + " * " + mod + " / " + max + " = " + size);
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.explode", 100000.0F, 1.0F);
EntityNukeExplosionMK3 exp = new EntityNukeExplosionMK3(worldObj);
exp.posX = xCoord;
exp.posY = yCoord;
exp.posZ = zCoord;
exp.destructionRange = size;
exp.speed = 25;
exp.coefficient = 1.0F;
exp.waste = false;
worldObj.spawnEntityInWorld(exp);
EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(worldObj, size);
cloud.posX = xCoord;
cloud.posY = yCoord;
cloud.posZ = zCoord;
worldObj.spawnEntityInWorld(cloud);
}
if(slots[0] != null && slots[2] != null && slots[0].getItem() instanceof ItemCatalyst && slots[2].getItem() instanceof ItemCatalyst)
color = calcAvgHex(
((ItemCatalyst)slots[0].getItem()).getColor(),
((ItemCatalyst)slots[2].getItem()).getColor()
);
else
color = 0;
NBTTagCompound data = new NBTTagCompound();
data.setInteger("tank0", tanks[0].getTankType().ordinal());
data.setInteger("tank1", tanks[1].getTankType().ordinal());
@ -37,7 +79,15 @@ public class TileEntityCore extends TileEntityMachineBase {
data.setInteger("fill1", tanks[1].getFill());
data.setInteger("field", field);
data.setInteger("heat", heat);
data.setInteger("color", color);
networkPack(data, 250);
heat = 0;
field = 0;
this.markDirty();
} else {
//TODO: sick particle effects
}
}
@ -50,6 +100,7 @@ public class TileEntityCore extends TileEntityMachineBase {
tanks[1].setFill(data.getInteger("fill1"));
field = data.getInteger("field");
heat = data.getInteger("heat");
color = data.getInteger("color");
}
public int getFieldScaled(int i) {
@ -60,9 +111,39 @@ public class TileEntityCore extends TileEntityMachineBase {
return (heat * i) / 100;
}
public boolean isReady() {
if(getCore() == 0)
return false;
if(color == 0)
return false;
if(getFuelEfficiency(tanks[0].getTankType()) <= 0 || getFuelEfficiency(tanks[1].getTankType()) <= 0)
return false;
return true;
}
//100 emitter watt = 10000 joules = 1 heat = 10mB burned
public long burn(long joules) {
return 0;
//check if a reaction can take place
if(!isReady())
return joules;
int demand = (int)Math.ceil((double)joules / 1000D);
//check if the reaction has enough valid fuel
if(tanks[0].getFill() < demand || tanks[1].getFill() < demand)
return joules;
heat += (int)Math.ceil((double)joules / 10000D);
tanks[0].setFill(tanks[0].getFill() - demand);
tanks[1].setFill(tanks[1].getFill() - demand);
return (long) (joules * getCore() * getFuelEfficiency(tanks[0].getTankType()) * getFuelEfficiency(tanks[1].getTankType()));
}
public float getFuelEfficiency(FluidType type) {
@ -93,5 +174,60 @@ public class TileEntityCore extends TileEntityMachineBase {
return 0;
}
}
//TODO: move stats to the AMSCORE class
public int getCore() {
if(slots[1] == null) {
return 0;
}
if(slots[1].getItem() == ModItems.ams_core_sing)
return 500;
if(slots[1].getItem() == ModItems.ams_core_wormhole)
return 650;
if(slots[1].getItem() == ModItems.ams_core_eyeofharmony)
return 800;
if(slots[1].getItem() == ModItems.ams_core_thingy)
return 2500;
return 0;
}
private int calcAvgHex(int h1, int h2) {
int r1 = ((h1 & 0xFF0000) >> 16);
int g1 = ((h1 & 0x00FF00) >> 8);
int b1 = ((h1 & 0x0000FF) >> 0);
int r2 = ((h2 & 0xFF0000) >> 16);
int g2 = ((h2 & 0x00FF00) >> 8);
int b2 = ((h2 & 0x0000FF) >> 0);
int r = (((r1 + r2) / 2) << 16);
int g = (((g1 + g2) / 2) << 8);
int b = (((b1 + b2) / 2) << 0);
return r | g | b;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
tanks[0].readFromNBT(nbt, "fuel1");
tanks[1].readFromNBT(nbt, "fuel2");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
tanks[0].writeToNBT(nbt, "fuel1");
tanks[1].writeToNBT(nbt, "fuel2");
}
}

View File

@ -101,7 +101,7 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements ICon
}
if(te instanceof TileEntityCore) {
((TileEntityCore)te).burn(out);
out = ((TileEntityCore)te).burn(out);
continue;
}

View File

@ -1,6 +1,8 @@
package com.hbm.tileentity.machine;
import com.hbm.interfaces.IConsumer;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemLens;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.relauncher.Side;
@ -40,7 +42,7 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
beam = 0;
if(power >= demand) {
if(power >= demand && slots[0] != null && slots[0].getItem() == ModItems.ams_lens && ItemLens.getLensDamage(slots[0]) < ItemLens.maxDamage) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
for(int i = 1; i <= range; i++) {
@ -57,6 +59,15 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
core.field = watts;
this.power -= demand;
beam = i;
long dmg = ItemLens.getLensDamage(slots[0]);
dmg += watts;
if(dmg >= ItemLens.maxDamage)
slots[0] = null;
else
ItemLens.setLensDamage(slots[0], dmg);
break;
}