mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge branch 'HbmMods:master' into master
This commit is contained in:
commit
99b19cd022
11
changelog
11
changelog
@ -1,2 +1,11 @@
|
||||
## Changed
|
||||
* Removed a ton of unused projectile entities
|
||||
* Removed the old ZOMG beams, negative energy type explosions now use DFC-like effects instead
|
||||
* Removed the old multitool (it sucked)
|
||||
|
||||
## Fixed
|
||||
* Fixed ore acidizer recipe config just straight up not working with ore dictionary keys
|
||||
* Fixed ore acidizer recipe config just straight up not working with ore dictionary keys
|
||||
* Fixed logistic network nodes disabled via redstone not re-enabling when redstone is cut
|
||||
* Added provisional emergency brake to drone pathfinding, pathfinding will simply fail if it goes on for too long
|
||||
* Fixed ore acidizer partitioner freezing the game
|
||||
* Fixed ore acidizer partitioner trash slots not being accessible via automation
|
||||
@ -1,6 +1,6 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=5523
|
||||
mod_build_number=5526
|
||||
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
|
||||
@ -201,8 +201,8 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
|
||||
if(access == null) {
|
||||
access = new int[SLOT_COUNT]; // writing this by hand is for chumps
|
||||
for(int i = 0; i < SLOT_COUNT; i++) access[i] = i;
|
||||
access = new int[SLOT_COUNT * 2]; // writing this by hand is for chumps
|
||||
for(int i = 0; i < SLOT_COUNT * 2; i++) access[i] = i;
|
||||
}
|
||||
|
||||
return access;
|
||||
|
||||
@ -110,12 +110,12 @@ public abstract class NEIGenericRecipeHandler extends TemplateRecipeHandler impl
|
||||
}
|
||||
|
||||
@Override public List<PositionedStack> getIngredients() { return getCycledIngredients(cycleticks / 20, Arrays.asList(this.input)); }
|
||||
@Override public PositionedStack getResult() { return this.output[0]; }
|
||||
@Override public PositionedStack getResult() { return null; }
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
List<PositionedStack> other = new ArrayList();
|
||||
for(int i = 1; i < this.output.length; i++) other.add(this.output[i]);
|
||||
for(int i = 0; i < this.output.length; i++) other.add(this.output[i]);
|
||||
other.add(this.machine);
|
||||
if(this.template != null) other.add(this.template);
|
||||
return getCycledIngredients(cycleticks / 20, other);
|
||||
|
||||
13
src/main/java/com/hbm/handler/nei/PrecAssRecipeHandler.java
Normal file
13
src/main/java/com/hbm/handler/nei/PrecAssRecipeHandler.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.recipes.PrecAssRecipes;
|
||||
|
||||
public class PrecAssRecipeHandler extends NEIGenericRecipeHandler {
|
||||
|
||||
public PrecAssRecipeHandler() {
|
||||
super(ModBlocks.machine_precass.getLocalizedName(), PrecAssRecipes.INSTANCE, ModBlocks.machine_precass);
|
||||
}
|
||||
|
||||
@Override public String getRecipeID() { return "ntmPrecAss"; }
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotCraftingOutput;
|
||||
import com.hbm.inventory.SlotNonRetarded;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachinePrecAss extends ContainerBase {
|
||||
|
||||
public ContainerMachinePrecAss(InventoryPlayer invPlayer, IInventory assembler) {
|
||||
super(invPlayer, assembler);
|
||||
|
||||
// Battery
|
||||
this.addSlotToContainer(new SlotNonRetarded(assembler, 0, 152, 81));
|
||||
// Schematic
|
||||
this.addSlotToContainer(new SlotNonRetarded(assembler, 1, 35, 126));
|
||||
// Upgrades
|
||||
this.addSlots(assembler, 2, 152, 108, 2, 1);
|
||||
// Input
|
||||
this.addSlots(assembler, 4, 8, 27, 3, 3);
|
||||
// Output
|
||||
this.addOutputSlots(invPlayer.player, assembler, 13, 80, 27, 3, 3);
|
||||
|
||||
this.playerInv(invPlayer, 8, 174);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack slotOriginal = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack slotStack = slot.getStack();
|
||||
slotOriginal = slotStack.copy();
|
||||
|
||||
if(index <= tile.getSizeInventory() - 1) {
|
||||
SlotCraftingOutput.checkAchievements(player, slotStack);
|
||||
if(!this.mergeItemStack(slotStack, tile.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(slotOriginal.getItem() instanceof IBatteryItem || slotOriginal.getItem() == ModItems.battery_creative) {
|
||||
if(!this.mergeItemStack(slotStack, 0, 1, false)) return null;
|
||||
} else if(slotOriginal.getItem() == ModItems.blueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 1, 2, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) {
|
||||
if(!this.mergeItemStack(slotStack, 2, 4, false)) return null;
|
||||
} else {
|
||||
if(!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 4, 22, false)) return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == 0) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return slotOriginal;
|
||||
}
|
||||
}
|
||||
123
src/main/java/com/hbm/inventory/gui/GUIMachinePrecAss.java
Normal file
123
src/main/java/com/hbm/inventory/gui/GUIMachinePrecAss.java
Normal file
@ -0,0 +1,123 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachinePrecAss;
|
||||
import com.hbm.inventory.recipes.PrecAssRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePrecAss;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachinePrecAss extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_precass.png");
|
||||
private TileEntityMachinePrecAss assembler;
|
||||
|
||||
public GUIMachinePrecAss(InventoryPlayer invPlayer, TileEntityMachinePrecAss tedf) {
|
||||
super(new ContainerMachinePrecAss(invPlayer, tedf));
|
||||
assembler = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 256;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
assembler.inputTank.renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 99, 52, 16);
|
||||
assembler.outputTank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 99, 52, 16);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower);
|
||||
|
||||
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
|
||||
if(this.assembler.assemblerModule.recipe != null && PrecAssRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PrecAssRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PrecAssRecipes.INSTANCE, assembler, assembler.assemblerModule.recipe, 0, ItemBlueprints.grabPool(assembler.slots[1]), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.assembler.hasCustomInventoryName() ? this.assembler.getInventoryName() : I18n.format(this.assembler.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int p = (int) (assembler.power * 61 / assembler.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 79 - p, 176, 61 - p, 16, p);
|
||||
|
||||
if(assembler.assemblerModule.progress > 0) {
|
||||
int j = (int) Math.ceil(70 * assembler.assemblerModule.progress);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
|
||||
}
|
||||
|
||||
GenericRecipe recipe = PrecAssRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe);
|
||||
|
||||
/// LEFT LED
|
||||
if(assembler.didProcess) {
|
||||
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6);
|
||||
} else if(recipe != null) {
|
||||
drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6);
|
||||
}
|
||||
|
||||
/// RIGHT LED
|
||||
if(assembler.didProcess) {
|
||||
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6);
|
||||
} else if(recipe != null && assembler.power >= recipe.power) {
|
||||
drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6);
|
||||
}
|
||||
|
||||
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126);
|
||||
|
||||
if(recipe != null && recipe.inputItem != null) {
|
||||
for(int i = 0; i < recipe.inputItem.length; i++) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(assembler.assemblerModule.inputSlots[i]);
|
||||
if(!slot.getHasStack()) this.renderItem(recipe.inputItem[i].extractForCyclingDisplay(20), slot.xDisplayPosition, slot.yDisplayPosition, 10F);
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.5F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
this.zLevel = 300F;
|
||||
for(int i = 0; i < recipe.inputItem.length; i++) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(assembler.assemblerModule.inputSlots[i]);
|
||||
if(!slot.getHasStack()) drawTexturedModalRect(guiLeft + slot.xDisplayPosition, guiTop + slot.yDisplayPosition, slot.xDisplayPosition, slot.yDisplayPosition, 16, 16);
|
||||
}
|
||||
this.zLevel = 0F;
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
assembler.inputTank.renderTank(guiLeft + 8, guiTop + 115, this.zLevel, 52, 16, 1);
|
||||
assembler.outputTank.renderTank(guiLeft + 80, guiTop + 115, this.zLevel, 52, 16, 1);
|
||||
}
|
||||
}
|
||||
80
src/main/java/com/hbm/inventory/recipes/PrecAssRecipes.java
Normal file
80
src/main/java/com/hbm/inventory/recipes/PrecAssRecipes.java
Normal file
@ -0,0 +1,80 @@
|
||||
package com.hbm.inventory.recipes;
|
||||
|
||||
import static com.hbm.inventory.OreDictManager.*;
|
||||
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.NBTStack;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipes;
|
||||
import com.hbm.items.BrokenItem;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemCircuit.EnumCircuitType;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PrecAssRecipes extends GenericRecipes<GenericRecipe> {
|
||||
|
||||
public static final PrecAssRecipes INSTANCE = new PrecAssRecipes();
|
||||
|
||||
@Override public int inputItemLimit() { return 9; }
|
||||
@Override public int inputFluidLimit() { return 1; }
|
||||
@Override public int outputItemLimit() { return 9; }
|
||||
@Override public int outputFluidLimit() { return 1; }
|
||||
|
||||
@Override public String getFileName() { return "hbmPrecisionAssembly.json"; }
|
||||
@Override public GenericRecipe instantiateRecipe(String name) { return new GenericRecipe(name); }
|
||||
|
||||
@Override
|
||||
public void registerDefaults() {
|
||||
|
||||
registerPair(new GenericRecipe("precass.controller").setup(400, 15_000L)
|
||||
.inputItems(new ComparableStack(ModItems.circuit, 32, EnumCircuitType.CHIP),
|
||||
new ComparableStack(ModItems.circuit, 32, EnumCircuitType.CAPACITOR),
|
||||
new ComparableStack(ModItems.circuit, 16, EnumCircuitType.CAPACITOR_TANTALIUM),
|
||||
new ComparableStack(ModItems.circuit, 1, EnumCircuitType.CONTROLLER_CHASSIS),
|
||||
new ComparableStack(ModItems.upgrade_speed_1),
|
||||
new OreDictStack(PB.wireFine(), 16))
|
||||
.inputFluids(new FluidStack(Fluids.PERFLUOROMETHYL, 1_000)),
|
||||
DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CONTROLLER), 10, 25);
|
||||
}
|
||||
|
||||
/** Registers a generic pair of faulty product and recycling of broken items. */
|
||||
public void registerPair(GenericRecipe recipe, ItemStack output, int chance, int reclaim) {
|
||||
recipe.outputItems(new ChanceOutputMulti(
|
||||
new ChanceOutput(output, chance),
|
||||
new ChanceOutput(BrokenItem.make(output), 100 - chance)
|
||||
));
|
||||
|
||||
this.register(recipe);
|
||||
|
||||
float fReclaim = reclaim / 100F;
|
||||
|
||||
IOutput[] recycle = new IOutput[recipe.inputItem.length];
|
||||
for(int i = 0; i < recycle.length; i++) {
|
||||
ItemStack stack = recipe.inputItem[i].extractForNEI().get(0).copy();
|
||||
int stackSize = (int) (recipe.inputItem[i].stacksize * fReclaim);
|
||||
// if the resulting stack size is >= 1, use that, otherwise use the original stack size but a chance output percentage
|
||||
if(stackSize > 0) {
|
||||
stack.stackSize = stackSize;
|
||||
recycle[i] = new ChanceOutput(stack);
|
||||
} else {
|
||||
recycle[i] = new ChanceOutput(stack, fReclaim);
|
||||
}
|
||||
}
|
||||
|
||||
FluidStack[] fluid = recipe.inputFluid != null ? new FluidStack[1] : null;
|
||||
if(fluid != null) {
|
||||
fluid[0] = new FluidStack(recipe.inputFluid[0].type, (int) Math.round(recipe.inputFluid[0].fill * fReclaim));
|
||||
}
|
||||
|
||||
this.register(new GenericRecipe(recipe.getInternalName() + ".recycle").setup(recipe.duration, recipe.power).setNameWrapper("precass.recycle")
|
||||
.setIcon(BrokenItem.make(output))
|
||||
.inputItems(new NBTStack(BrokenItem.make(output)))
|
||||
.outputItems(recycle)
|
||||
.outputFluids(fluid));
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@ -38,6 +39,8 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
|
||||
public static final String POOL_PREFIX_DISCOVER = "discover.";
|
||||
/** Secret recipes, self-explantory. Why even have this comment? */
|
||||
public static final String POOL_PREFIX_SECRET = "secret.";
|
||||
/** 528 greyprints */
|
||||
public static final String POOL_PREFIX_528 = "528.";
|
||||
|
||||
public List<T> recipeOrderedList = new ArrayList();
|
||||
public HashMap<String, T> recipeNameMap = new HashMap();
|
||||
@ -235,13 +238,14 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
|
||||
|
||||
@Override
|
||||
public ItemStack collapse() {
|
||||
if(this.chance >= 1F) return getSingle().copy();
|
||||
return RNG.nextFloat() <= chance ? getSingle().copy() : null;
|
||||
if(this.chance >= 1F) return getSingle();
|
||||
return RNG.nextFloat() <= chance ? getSingle() : null;
|
||||
}
|
||||
|
||||
@Override public ItemStack getSingle() { return this.stack; }
|
||||
@Override public ItemStack getSingle() { return this.stack.copy(); }
|
||||
@Override public boolean possibleMultiOutput() { return false; }
|
||||
@Override public ItemStack[] getAllPossibilities() { return new ItemStack[] {getSingle()}; }
|
||||
/** For NEI, includes tooltip labels */
|
||||
@Override public ItemStack[] getAllPossibilities() { return new ItemStack[] {this.chance >= 1F ? getSingle() : ItemStackUtil.addTooltipToStack(getSingle(), EnumChatFormatting.RED + "" + (int)(this.chance * 1000) / 10F + "%")}; }
|
||||
|
||||
@Override
|
||||
public void serialize(JsonWriter writer) throws IOException {
|
||||
@ -287,13 +291,23 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
|
||||
|
||||
public List<ChanceOutput> pool = new ArrayList();
|
||||
|
||||
public ChanceOutputMulti(ChanceOutput... out) {
|
||||
for(ChanceOutput output : out) pool.add(output);
|
||||
}
|
||||
|
||||
@Override public ItemStack collapse() { return ((ChanceOutput) WeightedRandom.getRandomItem(RNG, pool)).collapse(); }
|
||||
@Override public boolean possibleMultiOutput() { return pool.size() > 1; }
|
||||
@Override public ItemStack getSingle() { return possibleMultiOutput() ? null : pool.get(0).getSingle(); }
|
||||
|
||||
@Override public ItemStack[] getAllPossibilities() {
|
||||
ItemStack[] outputs = new ItemStack[pool.size()];
|
||||
for(int i = 0; i < outputs.length; i++) outputs[i] = pool.get(i).getAllPossibilities()[0];
|
||||
int totalWeight = WeightedRandom.getTotalWeight(pool);
|
||||
for(int i = 0; i < outputs.length; i++) {
|
||||
ChanceOutput out = pool.get(i);
|
||||
float chance = (float) out.itemWeight / (float) totalWeight;
|
||||
outputs[i] = chance >= 1 ? out.getAllPossibilities()[0] :
|
||||
ItemStackUtil.addTooltipToStack(out.getAllPossibilities()[0], EnumChatFormatting.RED + "" + (int)(chance * 1000) / 10F + "%");
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
|
||||
|
||||
@ -92,6 +92,7 @@ public abstract class SerializableRecipe {
|
||||
recipeHandlers.add(ChemicalPlantRecipes.INSTANCE);
|
||||
recipeHandlers.add(PUREXRecipes.INSTANCE);
|
||||
recipeHandlers.add(FusionRecipes.INSTANCE);
|
||||
recipeHandlers.add(PrecAssRecipes.INSTANCE);
|
||||
|
||||
recipeHandlers.add(new MatDistribution());
|
||||
recipeHandlers.add(new CustomMachineRecipes());
|
||||
|
||||
@ -24,6 +24,7 @@ public class ItemBlueprints extends Item {
|
||||
|
||||
@SideOnly(Side.CLIENT) protected IIcon iconDiscover;
|
||||
@SideOnly(Side.CLIENT) protected IIcon iconSecret;
|
||||
@SideOnly(Side.CLIENT) protected IIcon icon528;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -31,6 +32,7 @@ public class ItemBlueprints extends Item {
|
||||
super.registerIcons(reg);
|
||||
this.iconDiscover = reg.registerIcon(this.getIconString() + "_discover");
|
||||
this.iconSecret = reg.registerIcon(this.getIconString() + "_secret");
|
||||
this.icon528 = reg.registerIcon(this.getIconString() + "_528");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,11 +47,12 @@ public class ItemBlueprints extends Item {
|
||||
if(stack.hasTagCompound()) {
|
||||
String poolName = stack.stackTagCompound.getString("pool");
|
||||
if(poolName == null) return this.itemIcon;
|
||||
if(poolName.startsWith(GenericRecipes.POOL_PREFIX_DISCOVER)) return this.iconDiscover;
|
||||
if(poolName.startsWith(GenericRecipes.POOL_PREFIX_SECRET)) return this.iconSecret;
|
||||
if(poolName.startsWith(GenericRecipes.POOL_PREFIX_DISCOVER)) return this.iconDiscover; // beige
|
||||
if(poolName.startsWith(GenericRecipes.POOL_PREFIX_SECRET)) return this.iconSecret; // black
|
||||
if(poolName.startsWith(GenericRecipes.POOL_PREFIX_528)) return this.icon528; // grey
|
||||
}
|
||||
|
||||
return this.itemIcon;
|
||||
return this.itemIcon; // blue
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -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 (5523)";
|
||||
public static final String VERSION = "1.0.27 BETA (5526)";
|
||||
//HBM's Beta Naming Convention:
|
||||
//V T (X)
|
||||
//V -> next release version
|
||||
|
||||
@ -17,21 +17,25 @@ public class NEIRegistry {
|
||||
|
||||
handlers.add(new AnvilRecipeHandler());
|
||||
handlers.add(new SmithingRecipeHandler());
|
||||
handlers.add(new PressRecipeHandler());
|
||||
handlers.add(new AlloyFurnaceRecipeHandler());
|
||||
handlers.add(new ShredderRecipeHandler());
|
||||
handlers.add(new PressRecipeHandler());
|
||||
handlers.add(new CrucibleSmeltingHandler());
|
||||
handlers.add(new CrucibleAlloyingHandler());
|
||||
handlers.add(new CrucibleCastingHandler());
|
||||
handlers.add(new AssemblyMachineRecipeHandler());
|
||||
handlers.add(new PrecAssRecipeHandler());
|
||||
handlers.add(new ChemicalPlantRecipeHandler());
|
||||
handlers.add(new RefineryRecipeHandler());
|
||||
handlers.add(new CentrifugeRecipeHandler());
|
||||
handlers.add(new GasCentrifugeRecipeHandler());
|
||||
handlers.add(new BreederRecipeHandler());
|
||||
handlers.add(new CyclotronRecipeHandler());
|
||||
handlers.add(new AssemblyMachineRecipeHandler());
|
||||
handlers.add(new RefineryRecipeHandler());
|
||||
handlers.add(new VacuumRecipeHandler());
|
||||
handlers.add(new CrackingHandler());
|
||||
handlers.add(new RadiolysisRecipeHandler());
|
||||
handlers.add(new ReformingHandler());
|
||||
handlers.add(new HydrotreatingHandler());
|
||||
handlers.add(new ChemicalPlantRecipeHandler());
|
||||
handlers.add(new PUREXRecipeHandler());
|
||||
handlers.add(new OreSlopperHandler()); //before acidizing
|
||||
handlers.add(new CrystallizerRecipeHandler());
|
||||
@ -41,9 +45,6 @@ public class NEIRegistry {
|
||||
handlers.add(new FuelPoolHandler());
|
||||
handlers.add(new RBMKRodDisassemblyHandler());
|
||||
handlers.add(new RBMKWasteDecayHandler());
|
||||
handlers.add(new CrucibleSmeltingHandler());
|
||||
handlers.add(new CrucibleAlloyingHandler());
|
||||
handlers.add(new CrucibleCastingHandler());
|
||||
handlers.add(new ToolingHandler());
|
||||
handlers.add(new ConstructionHandler());
|
||||
handlers.add(new SatelliteHandler());
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.module.machine;
|
||||
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.PrecAssRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipes;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
@ -21,7 +21,7 @@ public class ModuleMachinePrecAss extends ModuleMachineBase {
|
||||
|
||||
@Override
|
||||
public GenericRecipes getRecipeSet() {
|
||||
return AssemblyMachineRecipes.INSTANCE;
|
||||
return PrecAssRecipes.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -54,8 +54,6 @@ public class RenderAssemblyMachine extends TileEntitySpecialRenderer implements
|
||||
double[] arm1 = assembler.arms[0].getPositions(interp);
|
||||
double[] arm2 = assembler.arms[1].getPositions(interp);
|
||||
|
||||
// arm1 = arm2 = new double[] {60, -15, 15, -0.25}; // heart
|
||||
|
||||
GL11.glRotated(spin, 0, 1, 0);
|
||||
ResourceManager.assembly_machine.renderPart("Ring");
|
||||
|
||||
|
||||
@ -4,13 +4,22 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.recipes.PrecAssRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePrecAss;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
@ -37,29 +46,32 @@ public class RenderPrecAss extends TileEntitySpecialRenderer implements IItemRen
|
||||
|
||||
bindTexture(ResourceManager.precass_tex);
|
||||
ResourceManager.assembly_machine.renderPart("Base");
|
||||
//if(assembler.frame) ResourceManager.assembly_machine.renderPart("Frame");
|
||||
if(assembler.frame) ResourceManager.assembly_machine.renderPart("Frame");
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
//double spin = BobMathUtil.interp(assembler.prevRing, assembler.ring, interp);
|
||||
double[] arm1 = new double[] {45, -15, -5, -0.75};
|
||||
double spin = BobMathUtil.interp(assembler.prevRing, assembler.ring, interp);
|
||||
|
||||
// arm1 = arm2 = new double[] {60, -15, 15, -0.25}; // heart
|
||||
double[] arm = new double[] {
|
||||
BobMathUtil.interp(assembler.prevArmAngles[0], assembler.armAngles[0], interp),
|
||||
BobMathUtil.interp(assembler.prevArmAngles[1], assembler.armAngles[1], interp),
|
||||
BobMathUtil.interp(assembler.prevArmAngles[2], assembler.armAngles[2], interp)
|
||||
};
|
||||
|
||||
//GL11.glRotated(spin, 0, 1, 0);
|
||||
GL11.glRotated(spin, 0, 1, 0);
|
||||
ResourceManager.assembly_machine.renderPart("Ring");
|
||||
ResourceManager.assembly_machine.renderPart("Ring2");
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
renderArm(arm1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
renderArm(arm, BobMathUtil.interp(assembler.prevStrikers[i], assembler.strikers[i], interp));
|
||||
GL11.glRotated(-90, 0, 1, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
/*GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe);
|
||||
GenericRecipe recipe = PrecAssRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe);
|
||||
if(recipe != null && MainRegistry.proxy.me().getDistanceSq(tileEntity.xCoord + 0.5, tileEntity.yCoord + 1, tileEntity.zCoord + 0.5) < 35 * 35) {
|
||||
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
@ -89,12 +101,12 @@ public class RenderPrecAss extends TileEntitySpecialRenderer implements IItemRen
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(dummy, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
}*/
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderArm(double[] arm) {
|
||||
public static void renderArm(double[] arm, double striker) {
|
||||
|
||||
GL11.glPushMatrix(); {
|
||||
GL11.glTranslated(0, 1.625, 0.9375);
|
||||
@ -111,7 +123,7 @@ public class RenderPrecAss extends TileEntitySpecialRenderer implements IItemRen
|
||||
GL11.glRotated(arm[2], 1, 0, 0);
|
||||
GL11.glTranslated(0, -2.375, -0.4375);
|
||||
ResourceManager.assembly_machine.renderPart("Head1");
|
||||
GL11.glTranslated(0, arm[3], 0);
|
||||
GL11.glTranslated(0, striker, 0);
|
||||
ResourceManager.assembly_machine.renderPart("Spike1");
|
||||
} GL11.glPopMatrix();
|
||||
}
|
||||
@ -139,9 +151,9 @@ public class RenderPrecAss extends TileEntitySpecialRenderer implements IItemRen
|
||||
ResourceManager.assembly_machine.renderPart("Frame");
|
||||
ResourceManager.assembly_machine.renderPart("Ring");
|
||||
ResourceManager.assembly_machine.renderPart("Ring2");
|
||||
double[] arm = new double[] {45, -15, -5, -0.75};
|
||||
double[] arm = new double[] {45, -30, 45};
|
||||
for(int i = 0; i < 4; i++) {
|
||||
renderArm(arm);
|
||||
renderArm(arm, 0);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
}
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
@ -169,18 +169,11 @@ public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase impl
|
||||
if(this.ringTarget > this.ring) this.ring += this.ringSpeed;
|
||||
if(this.ringTarget < this.ring) this.ring -= this.ringSpeed;
|
||||
if(this.ringTarget == this.ring) {
|
||||
if(ringTarget >= 360) {
|
||||
this.ringTarget -= 360D;
|
||||
this.ring -= 360D;
|
||||
this.prevRing -= 360D;
|
||||
}
|
||||
if(ringTarget <= -360) {
|
||||
this.ringTarget += 360D;
|
||||
this.ring += 360D;
|
||||
this.prevRing += 360D;
|
||||
}
|
||||
double sub = ringTarget >= 360 ? -360D : 360D;
|
||||
this.ringTarget += sub;
|
||||
this.ring += sub;
|
||||
this.prevRing += sub;
|
||||
this.ringDelay = 20 + worldObj.rand.nextInt(21);
|
||||
//MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerStop", this.getVolume(0.25F), 1.5F);
|
||||
}
|
||||
} else {
|
||||
if(this.ringDelay > 0) this.ringDelay--;
|
||||
|
||||
@ -6,9 +6,11 @@ import java.util.List;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.UpgradeManagerNT;
|
||||
import com.hbm.inventory.container.ContainerMachinePrecAss;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.gui.GUIMachinePrecAss;
|
||||
import com.hbm.inventory.recipes.PrecAssRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
@ -17,6 +19,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.module.machine.ModuleMachinePrecAss;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
@ -29,13 +32,16 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// horribly copy-pasted crap device
|
||||
public class TileEntityMachinePrecAss extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver/*, IGUIProvider*/ {
|
||||
public class TileEntityMachinePrecAss extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider {
|
||||
|
||||
public FluidTank inputTank;
|
||||
public FluidTank outputTank;
|
||||
@ -55,6 +61,14 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
|
||||
public double ringTarget;
|
||||
public int ringDelay;
|
||||
|
||||
public double[] armAngles = new double[] {45, -15, -5};
|
||||
public double[] prevArmAngles = new double[] {45, -15, -5};
|
||||
public double[] strikers = new double[4];
|
||||
public double[] prevStrikers = new double[4];
|
||||
public boolean[] strikerDir = new boolean[4];
|
||||
protected int strikerIndex;
|
||||
protected int strikerDelay;
|
||||
|
||||
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
|
||||
|
||||
public TileEntityMachinePrecAss() {
|
||||
@ -79,7 +93,7 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemblerModule.recipe);
|
||||
GenericRecipe recipe = PrecAssRecipes.INSTANCE.recipeNameMap.get(assemblerModule.recipe);
|
||||
if(recipe != null) {
|
||||
this.maxPower = recipe.power * 100;
|
||||
}
|
||||
@ -134,52 +148,100 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
|
||||
}
|
||||
}
|
||||
|
||||
/*for(AssemblerArm arm : arms) {
|
||||
arm.updateInterp();
|
||||
if(didProcess) {
|
||||
arm.updateArm();
|
||||
} else{
|
||||
arm.returnToNullPos();
|
||||
}
|
||||
|
||||
if(!this.muffled && arm.prevAngles[3] != arm.angles[3] && arm.angles[3] == -0.75) {
|
||||
MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerStrike", this.getVolume(0.5F), 1F);
|
||||
}
|
||||
}*/
|
||||
for(int i = 0; i < 3; i++) this.prevArmAngles[i] = this.armAngles[i];
|
||||
for(int i = 0; i < 4; i++) this.prevStrikers[i] = this.strikers[i];
|
||||
|
||||
this.prevRing = this.ring;
|
||||
|
||||
if(didProcess) {
|
||||
if(this.ring != this.ringTarget) {
|
||||
double ringDelta = Math.abs(this.ringTarget - this.ring);
|
||||
if(ringDelta <= this.ringSpeed) this.ring = this.ringTarget;
|
||||
if(this.ringTarget > this.ring) this.ring += this.ringSpeed;
|
||||
if(this.ringTarget < this.ring) this.ring -= this.ringSpeed;
|
||||
if(this.ringTarget == this.ring) {
|
||||
if(ringTarget >= 360) {
|
||||
this.ringTarget -= 360D;
|
||||
this.ring -= 360D;
|
||||
this.prevRing -= 360D;
|
||||
}
|
||||
if(ringTarget <= -360) {
|
||||
this.ringTarget += 360D;
|
||||
this.ring += 360D;
|
||||
this.prevRing += 360D;
|
||||
}
|
||||
this.ringDelay = 20 + worldObj.rand.nextInt(21);
|
||||
}
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if(this.strikerDir[i]) {
|
||||
this.strikers[i] = -0.75D;
|
||||
this.strikerDir[i] = false;
|
||||
if(!this.muffled) MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerStrike", this.getVolume(0.5F), 1.25F);
|
||||
} else {
|
||||
this.strikers[i] = MathHelper.clamp_double(this.strikers[i] + 0.5D, -0.75D, 0D);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.ring != this.ringTarget) {
|
||||
double ringDelta = Math.abs(this.ringTarget - this.ring);
|
||||
if(ringDelta <= this.ringSpeed) this.ring = this.ringTarget;
|
||||
if(this.ringTarget > this.ring) this.ring += this.ringSpeed;
|
||||
if(this.ringTarget < this.ring) this.ring -= this.ringSpeed;
|
||||
if(this.ringTarget == this.ring) {
|
||||
double sub = ringTarget >= 360 ? -360D : 360D;
|
||||
this.ringTarget += sub;
|
||||
this.ring += sub;
|
||||
this.prevRing += sub;
|
||||
this.ringDelay = 100 + worldObj.rand.nextInt(21);
|
||||
}
|
||||
}
|
||||
|
||||
if(didProcess) {
|
||||
if(this.ring == this.ringTarget) {
|
||||
if(this.ringDelay > 0) this.ringDelay--;
|
||||
if(this.ringDelay <= 0) {
|
||||
this.ringTarget += (worldObj.rand.nextDouble() * 2 - 1) * 135;
|
||||
this.ringTarget += 45 * (worldObj.rand.nextBoolean() ? -1 : 1);
|
||||
this.ringSpeed = 10D + worldObj.rand.nextDouble() * 5D;
|
||||
if(!this.muffled) MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerStart", this.getVolume(0.25F), 1.25F + worldObj.rand.nextFloat() * 0.25F);
|
||||
}
|
||||
}
|
||||
|
||||
if(!isInWorkingPosition(this.armAngles) && canArmsMove()) {
|
||||
move(WORKING_POSITION);
|
||||
}
|
||||
|
||||
if(isInWorkingPosition(this.armAngles)) {
|
||||
this.strikerDelay--;
|
||||
if(this.strikerDelay <= 0) {
|
||||
this.strikerDir[this.strikerIndex] = true;
|
||||
this.strikerIndex = (this.strikerIndex + 1) % this.strikers.length;
|
||||
this.strikerDelay = this.strikerIndex == 3 ? (10 + worldObj.rand.nextInt(3)) : 2;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for(int i = 0; i < 4; i++) this.strikerDir[i] = false; // set all strikers to retract
|
||||
if(canArmsMove()) move(NULL_POSITION);
|
||||
}
|
||||
|
||||
if(this.isInWorkingPosition(prevArmAngles) && !this.isInWorkingPosition(armAngles)) {
|
||||
if(!this.muffled) MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerStop", this.getVolume(0.25F), 1.25F + worldObj.rand.nextFloat() * 0.25F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double[] NULL_POSITION = new double[] {45, -30, 45};
|
||||
public double[] WORKING_POSITION = new double[] {45, -15, -5};
|
||||
|
||||
private boolean canArmsMove() {
|
||||
for(int i = 0; i < 4; i++) if(this.strikers[i] != 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isInWorkingPosition(double[] arms) {
|
||||
for(int i = 0; i < 3; i++) if(arms[i] != WORKING_POSITION[i]) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean move(double[] targetAngles) {
|
||||
boolean didMove = false;
|
||||
|
||||
for(int i = 0; i < armAngles.length; i++) {
|
||||
if(armAngles[i] == targetAngles[i]) continue;
|
||||
didMove = true;
|
||||
double angle = armAngles[i];
|
||||
double target = targetAngles[i];
|
||||
double turn = 15D;
|
||||
double delta = Math.abs(angle - target);
|
||||
|
||||
if(delta <= turn) { armAngles[i] = targetAngles[i]; continue; }
|
||||
if(angle < target) armAngles[i] += turn;
|
||||
else armAngles[i] -= turn;
|
||||
}
|
||||
return !didMove;
|
||||
}
|
||||
|
||||
@Override public AudioWrapper createAudioLoop() {
|
||||
return MainRegistry.proxy.getLoopedSound("hbm:block.motor", xCoord, yCoord, zCoord, 0.5F, 15F, 0.75F, 20);
|
||||
}
|
||||
@ -224,17 +286,12 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
boolean wasProcessing = this.didProcess;
|
||||
this.inputTank.deserialize(buf);
|
||||
this.outputTank.deserialize(buf);
|
||||
this.power = buf.readLong();
|
||||
this.maxPower = buf.readLong();
|
||||
this.didProcess = buf.readBoolean();
|
||||
this.assemblerModule.deserialize(buf);
|
||||
|
||||
if(wasProcessing && !didProcess) {
|
||||
MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.assemblerStop", this.getVolume(0.25F), 1.5F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -284,8 +341,8 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
|
||||
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {outputTank}; }
|
||||
@Override public FluidTank[] getAllTanks() { return new FluidTank[] {inputTank, outputTank}; }
|
||||
|
||||
//@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineAssemblyMachine(player.inventory, this); }
|
||||
//@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineAssemblyMachine(player.inventory, this); }
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachinePrecAss(player.inventory, this); }
|
||||
@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachinePrecAss(player.inventory, this); }
|
||||
|
||||
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
|
||||
|
||||
@ -322,7 +379,7 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
|
||||
|
||||
@Override
|
||||
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo) {
|
||||
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_assembly_machine));
|
||||
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_precass));
|
||||
if(type == UpgradeType.SPEED) {
|
||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_SPEED, "+" + (level * 100 / 3) + "%"));
|
||||
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 50) + "%"));
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.albion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.container.ContainerPADetector;
|
||||
import com.hbm.inventory.gui.GUIPADetector;
|
||||
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes;
|
||||
@ -15,8 +16,13 @@ import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -24,7 +30,8 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider, IParticleUser {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public static final long usage = 100_000;
|
||||
|
||||
@ -122,7 +129,7 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
|
||||
|
||||
for(ParticleAcceleratorRecipe recipe : ParticleAcceleratorRecipes.recipes) {
|
||||
if(!recipe.matchesRecipe(particle.input1, particle.input2)) continue; // another W for continue
|
||||
|
||||
|
||||
if(particle.momentum < recipe.momentum) {
|
||||
particle.crash(PAState.CRASH_UNDERSPEED);
|
||||
return;
|
||||
@ -146,12 +153,12 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if((recipe.output1 != null && recipe.output1.getItem() == ModItems.particle_digamma) || (recipe.output2 != null && recipe.output2.getItem() == ModItems.particle_digamma)) {
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(100, 50, 100));
|
||||
for(EntityPlayer player : players) player.triggerAchievement(MainRegistry.achOmega12);
|
||||
}
|
||||
|
||||
|
||||
particle.crash(PAState.SUCCESS);
|
||||
return;
|
||||
}
|
||||
@ -183,4 +190,85 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
|
||||
public BlockPos getExitPos(Particle particle) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_pa_detector";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoolant(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCrafting(Context context, Arguments args) {
|
||||
Object[] items = new Object[] {"", 0, "", 0, "", 0, "", 0};
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ItemStack slot = slots[i+1];
|
||||
if (slot != null) {
|
||||
items[i*2] = slot.getUnlocalizedName();
|
||||
items[(i*2)+1] = slot.stackSize;
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
Object[] items = new Object[] {"", 0, "", 0, "", 0, "", 0};
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ItemStack slot = slots[i+1];
|
||||
if (slot != null) {
|
||||
items[i*2] = slot.getUnlocalizedName();
|
||||
items[(i*2)+1] = slot.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return new Object[] {
|
||||
getPower(), getMaxPower(),
|
||||
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
|
||||
items[0], items[1], items[2], items[3],
|
||||
items[4], items[5], items[6], items[7]
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergyInfo",
|
||||
"getCoolant",
|
||||
"getCrafting",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||
case "getCoolant": return getCoolant(context, args);
|
||||
case "getCrafting": return getCrafting(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,6 +266,21 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
||||
return "ntm_pa_dipole";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoolant(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getDirLower(Context context, Arguments args) {
|
||||
@ -321,10 +336,25 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
getPower(), getMaxPower(),
|
||||
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
|
||||
dirToName(dirLower), dirToName(dirUpper), dirToName(dirRedstone), threshold
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergyInfo",
|
||||
"getCoolant",
|
||||
"getDirLower",
|
||||
"setDirLower",
|
||||
"getDirUpper",
|
||||
@ -333,6 +363,7 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
||||
"setDirRedstone",
|
||||
"getThreshold",
|
||||
"setThreshold",
|
||||
"getInfo",
|
||||
};
|
||||
}
|
||||
|
||||
@ -340,6 +371,9 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||
case "getCoolant": return getCoolant(context, args);
|
||||
|
||||
case "getDirLower": return getDirLower(context, args);
|
||||
case "setDirLower": return setDirLower(context, args);
|
||||
case "getDirUpper": return getDirUpper(context, args);
|
||||
@ -348,6 +382,8 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
||||
case "setDirRedstone": return setDirRedstone(context, args);
|
||||
case "getThreshold": return getThreshold(context, args);
|
||||
case "setThreshold": return setThreshold(context, args);
|
||||
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
@ -361,7 +397,7 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
|
||||
|
||||
if((PREFIX_FUNCTION + "setthreshold").equals(name) && params.length > 0) {
|
||||
this.threshold = IRORInteractive.parseInt(params[0], 0, 999_999_999);
|
||||
this.markChanged();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.tileentity.machine.albion;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.container.ContainerPAQuadrupole;
|
||||
import com.hbm.inventory.gui.GUIPAQuadrupole;
|
||||
import com.hbm.items.ModItems;
|
||||
@ -12,19 +13,25 @@ import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUIProvider, IParticleUser {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public static final long usage = 100_000;
|
||||
public static final int focusGain = 100;
|
||||
|
||||
|
||||
public TileEntityPAQuadrupole() {
|
||||
super(2);
|
||||
}
|
||||
@ -49,7 +56,7 @@ public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUI
|
||||
@Override
|
||||
public void onEnter(Particle particle, ForgeDirection dir) {
|
||||
EnumCoilType type = null;
|
||||
|
||||
|
||||
int mult = 1;
|
||||
if(slots[1] != null && slots[1].getItem() == ModItems.pa_coil) {
|
||||
type = EnumUtil.grabEnumSafely(EnumCoilType.class, slots[1].getItemDamage());
|
||||
@ -60,7 +67,7 @@ public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUI
|
||||
if(this.power < this.usage * mult) particle.crash(PAState.CRASH_NOPOWER);
|
||||
if(type == null) particle.crash(PAState.CRASH_NOCOIL);
|
||||
if(type != null && type.quadMax < particle.momentum) particle.crash(PAState.CRASH_OVERSPEED);
|
||||
|
||||
|
||||
if(particle.invalid) return;
|
||||
|
||||
particle.addDistance(3);
|
||||
@ -76,19 +83,19 @@ public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUI
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
this.power = Library.chargeTEFromItems(slots, 0, power, this.getMaxPower());
|
||||
}
|
||||
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 1,
|
||||
@ -99,10 +106,10 @@ public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUI
|
||||
zCoord + 2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
@ -129,4 +136,57 @@ public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUI
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIPAQuadrupole(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_pa_quad";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoolant(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
getPower(), getMaxPower(),
|
||||
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergyInfo",
|
||||
"getCoolant",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||
case "getCoolant": return getCoolant(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.tileentity.machine.albion;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.container.ContainerPARFC;
|
||||
import com.hbm.inventory.gui.GUIPARFC;
|
||||
import com.hbm.lib.Library;
|
||||
@ -9,20 +10,26 @@ import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvider, IParticleUser {
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public static final long usage = 250_000;
|
||||
public static final int momentumGain = 100;
|
||||
public static final int defocusGain = 100;
|
||||
|
||||
|
||||
public TileEntityPARFC() {
|
||||
super(1);
|
||||
}
|
||||
@ -49,7 +56,7 @@ public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvide
|
||||
|
||||
if(!isCool()) particle.crash(PAState.CRASH_NOCOOL);
|
||||
if(this.power < this.usage) particle.crash(PAState.CRASH_NOPOWER);
|
||||
|
||||
|
||||
if(particle.invalid) return;
|
||||
|
||||
particle.addDistance(9);
|
||||
@ -66,19 +73,19 @@ public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvide
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
this.power = Library.chargeTEFromItems(slots, 0, power, this.getMaxPower());
|
||||
}
|
||||
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 4,
|
||||
@ -89,10 +96,10 @@ public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvide
|
||||
zCoord + 5
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
@ -121,4 +128,57 @@ public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvide
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIPARFC(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_pa_rfc";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoolant(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
getPower(), getMaxPower(),
|
||||
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergyInfo",
|
||||
"getCoolant",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||
case "getCoolant": return getCoolant(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.tileentity.machine.albion;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerPASource;
|
||||
import com.hbm.inventory.gui.GUIPASource;
|
||||
@ -11,9 +12,14 @@ import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -24,7 +30,8 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityPASource extends TileEntityCooledBase implements IGUIProvider, IConditionalInvAccess, IControlReceiver {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityPASource extends TileEntityCooledBase implements IGUIProvider, IConditionalInvAccess, IControlReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public static final long usage = 100_000;
|
||||
public Particle particle;
|
||||
@ -237,7 +244,7 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
|
||||
if(particle != null) {
|
||||
NBTTagCompound particleTag = new NBTTagCompound();
|
||||
particleTag.setInteger("x", particle.x);
|
||||
@ -247,12 +254,12 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
|
||||
particleTag.setInteger("momentum", particle.momentum);
|
||||
particleTag.setInteger("defocus", particle.defocus);
|
||||
particleTag.setInteger("dist", particle.distanceTraveled);
|
||||
|
||||
|
||||
NBTTagCompound inputTag1 = new NBTTagCompound();
|
||||
NBTTagCompound inputTag2 = new NBTTagCompound();
|
||||
particle.input1.writeToNBT(inputTag1);
|
||||
particle.input2.writeToNBT(inputTag2);
|
||||
|
||||
|
||||
particleTag.setTag("input1", inputTag1);
|
||||
particleTag.setTag("input2", inputTag2);
|
||||
nbt.setTag("particle", particleTag);
|
||||
@ -278,6 +285,114 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
|
||||
this.particle.distanceTraveled = particleTag.getInteger("dist");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_pa_source";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoolant(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMomentum(Context context, Arguments args) {
|
||||
return new Object[] {lastSpeed};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getState(Context context, Arguments args) {
|
||||
return new Object[] {state.name()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCrafting(Context context, Arguments args) {
|
||||
Object[] items = new Object[] {"", 0, "", 0, "", 0, "", 0};
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ItemStack slot = slots[i+1];
|
||||
if (slot != null) {
|
||||
items[i*2] = slot.getUnlocalizedName();
|
||||
items[(i*2)+1] = slot.stackSize;
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] cancelOperation(Context context, Arguments args) {
|
||||
particle = null;
|
||||
state = PAState.IDLE;
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
Object[] items = new Object[] {"", 0, "", 0, "", 0, "", 0};
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ItemStack slot = slots[i+1];
|
||||
if (slot != null) {
|
||||
items[i*2] = slot.getUnlocalizedName();
|
||||
items[(i*2)+1] = slot.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return new Object[] {
|
||||
getPower(), getMaxPower(),
|
||||
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
|
||||
items[0], items[1], items[2], items[3],
|
||||
items[4], items[5], items[6], items[7],
|
||||
lastSpeed, state.name()
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergyInfo",
|
||||
"getCoolant",
|
||||
"getMomentum",
|
||||
"getState",
|
||||
"getCrafting",
|
||||
"cancelOperation",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||
case "getCoolant": return getCoolant(context, args);
|
||||
case "getMomentum": return getMomentum(context, args);
|
||||
case "getState": return getState(context, args);
|
||||
case "getCrafting": return getCrafting(context, args);
|
||||
case "cancelOperation": return cancelOperation(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
|
||||
public static class Particle {
|
||||
|
||||
private TileEntityPASource source;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.tileentity.machine.fusion;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Heatable;
|
||||
@ -11,35 +12,41 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFluidStandardTransceiverMK2, IFusionPowerReceiver {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFluidStandardTransceiverMK2, IFusionPowerReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
protected GenNode plasmaNode;
|
||||
|
||||
|
||||
public long plasmaEnergy;
|
||||
public long plasmaEnergySync;
|
||||
public FluidTank[] tanks;
|
||||
|
||||
|
||||
public TileEntityFusionBoiler() {
|
||||
this.tanks = new FluidTank[2];
|
||||
this.tanks[0] = new FluidTank(Fluids.WATER, 32_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.SUPERHOTSTEAM, 32_000);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
this.plasmaEnergySync = this.plasmaEnergy;
|
||||
this.plasmaEnergy = 0;
|
||||
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(tanks[0].getTankType() != Fluids.NONE) this.trySubscribe(tanks[0].getTankType(), worldObj, pos);
|
||||
if(tanks[1].getFill() > 0) this.tryProvide(tanks[1], worldObj, pos);
|
||||
@ -48,26 +55,26 @@ public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFlu
|
||||
if(plasmaNode == null || plasmaNode.expired) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getOpposite();
|
||||
plasmaNode = UniNodespace.getNode(worldObj, xCoord + dir.offsetX * 4, yCoord + 2, zCoord + dir.offsetZ * 4, PlasmaNetworkProvider.THE_PROVIDER);
|
||||
|
||||
|
||||
if(plasmaNode == null) {
|
||||
plasmaNode = new GenNode(PlasmaNetworkProvider.THE_PROVIDER,
|
||||
new BlockPos(xCoord + dir.offsetX * 4, yCoord + 2, zCoord + dir.offsetZ * 4))
|
||||
.setConnections(new DirPos(xCoord + dir.offsetX * 5, yCoord + 2, zCoord + dir.offsetZ * 5, dir));
|
||||
|
||||
|
||||
UniNodespace.createNode(worldObj, plasmaNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(plasmaNode != null && plasmaNode.hasValidNet()) plasmaNode.net.addReceiver(this);
|
||||
|
||||
|
||||
this.networkPackNT(50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
|
||||
return new DirPos[] {
|
||||
//new DirPos(xCoord + dir.offsetX * 5, yCoord + 2, zCoord + dir.offsetZ * 5, dir),
|
||||
new DirPos(xCoord - dir.offsetX * 1 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 1 + rot.offsetZ * 2, rot),
|
||||
@ -82,17 +89,17 @@ public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFlu
|
||||
@Override
|
||||
public void receiveFusionPower(long fusionPower, double neutronPower) {
|
||||
this.plasmaEnergy = fusionPower;
|
||||
|
||||
|
||||
int waterCycles = Math.min(tanks[0].getFill(), tanks[1].getMaxFill() - tanks[1].getFill());
|
||||
int steamCycles = (int) (Math.min(fusionPower / tanks[0].getTankType().getTrait(FT_Heatable.class).getFirstStep().heatReq, waterCycles));
|
||||
// the Math.min call was mushed into the steam cycles call instead of doing it afterwards as usual
|
||||
// in order to prevent issues when casting, should the fusion reactor output truly absurd amounts of power
|
||||
// due to the water cycles being effectively capped via the buffer size
|
||||
|
||||
|
||||
if(steamCycles > 0) {
|
||||
tanks[0].setFill(tanks[0].getFill() - steamCycles);
|
||||
tanks[1].setFill(tanks[1].getFill() + steamCycles);
|
||||
|
||||
|
||||
if(worldObj.rand.nextInt(200) == 0) {
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 2, zCoord + 0.5, "hbm:block.boilerGroan", 2.5F, 1.0F);
|
||||
}
|
||||
@ -103,7 +110,7 @@ public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFlu
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(plasmaEnergySync);
|
||||
|
||||
|
||||
this.tanks[0].serialize(buf);
|
||||
this.tanks[1].serialize(buf);
|
||||
}
|
||||
@ -112,7 +119,7 @@ public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFlu
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.plasmaEnergy = buf.readLong();
|
||||
|
||||
|
||||
this.tanks[0].deserialize(buf);
|
||||
this.tanks[1].deserialize(buf);
|
||||
}
|
||||
@ -170,4 +177,57 @@ public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFlu
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_fusion_boiler";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPlasmaEnergy(Context context, Arguments args) {
|
||||
return new Object[] {plasmaEnergySync};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFluid(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tanks[0].getFill(), tanks[0].getMaxFill(),
|
||||
tanks[1].getFill(), tanks[1].getMaxFill()
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
plasmaEnergySync,
|
||||
|
||||
tanks[0].getFill(), tanks[0].getMaxFill(),
|
||||
tanks[1].getFill(), tanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getPlasmaEnergy",
|
||||
"getFluid",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getPlasmaEnergy": return getPlasmaEnergy(context, args);
|
||||
case "getFluid": return getFluid(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.tileentity.machine.fusion;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.container.ContainerFusionBreeder;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
@ -18,9 +19,14 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -29,10 +35,11 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFusionBreeder extends TileEntityMachineBase implements IFluidStandardTransceiverMK2, IFusionPowerReceiver, IGUIProvider {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityFusionBreeder extends TileEntityMachineBase implements IFluidStandardTransceiverMK2, IFusionPowerReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
protected GenNode plasmaNode;
|
||||
|
||||
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public double neutronEnergy;
|
||||
@ -42,7 +49,7 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
||||
|
||||
public TileEntityFusionBreeder() {
|
||||
super(3);
|
||||
|
||||
|
||||
tanks = new FluidTank[2];
|
||||
tanks[0] = new FluidTank(Fluids.NONE, 16_000);
|
||||
tanks[1] = new FluidTank(Fluids.NONE, 16_000);
|
||||
@ -52,44 +59,44 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
||||
public String getName() {
|
||||
return "container.fusionBreeder";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
tanks[0].setType(0, slots);
|
||||
|
||||
if(!canProcessSolid() && !canProcessLiquid()) {
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
|
||||
// because tile updates may happen in any order and the value that needs
|
||||
// to be synced needs to persist until the next tick due to the batched packets
|
||||
this.neutronEnergySync = this.neutronEnergy;
|
||||
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(tanks[0].getTankType() != Fluids.NONE) this.trySubscribe(tanks[0].getTankType(), worldObj, pos);
|
||||
if(tanks[1].getFill() > 0) this.tryProvide(tanks[1], worldObj, pos);
|
||||
}
|
||||
|
||||
|
||||
if(plasmaNode == null || plasmaNode.expired) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getOpposite();
|
||||
plasmaNode = UniNodespace.getNode(worldObj, xCoord + dir.offsetX * 2, yCoord + 2, zCoord + dir.offsetZ * 2, PlasmaNetworkProvider.THE_PROVIDER);
|
||||
|
||||
|
||||
if(plasmaNode == null) {
|
||||
plasmaNode = new GenNode(PlasmaNetworkProvider.THE_PROVIDER,
|
||||
new BlockPos(xCoord + dir.offsetX * 2, yCoord + 2, zCoord + dir.offsetZ * 2))
|
||||
.setConnections(new DirPos(xCoord + dir.offsetX * 3, yCoord + 2, zCoord + dir.offsetZ * 3, dir));
|
||||
|
||||
|
||||
UniNodespace.createNode(worldObj, plasmaNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(plasmaNode != null && plasmaNode.hasValidNet()) plasmaNode.net.addReceiver(this);
|
||||
|
||||
|
||||
this.networkPackNT(25);
|
||||
|
||||
|
||||
this.neutronEnergy = 0;
|
||||
}
|
||||
}
|
||||
@ -115,17 +122,17 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
||||
}
|
||||
|
||||
public boolean canProcessLiquid() {
|
||||
|
||||
|
||||
Pair<Integer, FluidStack> output = FluidBreederRecipes.getOutput(tanks[0].getTankType());
|
||||
if(output == null) return false;
|
||||
if(tanks[0].getFill() < output.getKey()) return false;
|
||||
|
||||
|
||||
FluidStack fluid = output.getValue();
|
||||
|
||||
if(tanks[1].getTankType() != fluid.type && tanks[1].getFill() > 0) return false;
|
||||
tanks[1].setTankType(fluid.type);
|
||||
if(tanks[1].getFill() + fluid.fill > tanks[1].getMaxFill()) return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -156,7 +163,7 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
||||
tanks[0].setFill(tanks[0].getFill() - output.getKey());
|
||||
tanks[1].setFill(tanks[1].getFill() + output.getValue().fill);
|
||||
}
|
||||
|
||||
|
||||
public void doProgress() {
|
||||
|
||||
if(canProcessSolid()) {
|
||||
@ -187,11 +194,11 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
||||
|
||||
@Override public boolean canExtractItem(int slot, ItemStack itemStack, int side) { return slot == 2; }
|
||||
@Override public int[] getAccessibleSlotsFromSide(int side) { return new int[] {1, 2}; }
|
||||
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + dir.offsetX * 3, yCoord + 2, zCoord + dir.offsetZ * 3, dir),
|
||||
new DirPos(xCoord + rot.offsetX * 2, yCoord, zCoord + rot.offsetZ * 2, rot),
|
||||
@ -215,7 +222,7 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
||||
super.serialize(buf);
|
||||
buf.writeDouble(neutronEnergySync);
|
||||
buf.writeDouble(progress);
|
||||
|
||||
|
||||
this.tanks[0].serialize(buf);
|
||||
this.tanks[1].serialize(buf);
|
||||
}
|
||||
@ -225,7 +232,7 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
||||
super.deserialize(buf);
|
||||
this.neutronEnergy = buf.readDouble();
|
||||
this.progress = buf.readDouble();
|
||||
|
||||
|
||||
this.tanks[0].deserialize(buf);
|
||||
this.tanks[1].deserialize(buf);
|
||||
}
|
||||
@ -289,4 +296,111 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_fusion_breeder";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getNeutronEnergy(Context context, Arguments args) {
|
||||
return new Object[] {neutronEnergySync};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getProgress(Context context, Arguments args) {
|
||||
return new Object[] {progress / capacity};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFluid(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getUnlocalizedName(),
|
||||
tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getUnlocalizedName()
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCrafting(Context context, Arguments args) {
|
||||
ItemStack input = slots[1];
|
||||
String inputName = "";
|
||||
int inputSize = 0;
|
||||
if (input != null) {
|
||||
inputName = input.getUnlocalizedName();
|
||||
inputSize = input.stackSize;
|
||||
}
|
||||
|
||||
ItemStack output = slots[2];
|
||||
String outputName = "";
|
||||
int outputSize = 0;
|
||||
if (output != null) {
|
||||
outputName = output.getUnlocalizedName();
|
||||
outputSize = output.stackSize;
|
||||
}
|
||||
|
||||
return new Object[] {
|
||||
inputName, inputSize,
|
||||
outputName, outputSize
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
ItemStack input = slots[1];
|
||||
String inputName = "";
|
||||
int inputSize = 0;
|
||||
if (input != null) {
|
||||
inputName = input.getUnlocalizedName();
|
||||
inputSize = input.stackSize;
|
||||
}
|
||||
|
||||
ItemStack output = slots[2];
|
||||
String outputName = "";
|
||||
int outputSize = 0;
|
||||
if (output != null) {
|
||||
outputName = output.getUnlocalizedName();
|
||||
outputSize = output.stackSize;
|
||||
}
|
||||
|
||||
return new Object[] {
|
||||
neutronEnergySync, progress / capacity,
|
||||
|
||||
tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getUnlocalizedName(),
|
||||
tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getUnlocalizedName(),
|
||||
|
||||
inputName, inputSize,
|
||||
outputName, outputSize
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getNeutronEnergy",
|
||||
"getProgress",
|
||||
"getFluid",
|
||||
"getCrafting",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getNeutronEnergy": return getNeutronEnergy(context, args);
|
||||
case "getProgress": return getProgress(context, args);
|
||||
case "getFluid": return getFluid(context, args);
|
||||
case "getCrafting": return getCrafting(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.fusion;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerFusionKlystron;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
@ -21,9 +22,14 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -33,7 +39,8 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFusionKlystron extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiverMK2, IControlReceiver, IGUIProvider {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityFusionKlystron extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiverMK2, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
protected GenNode klystronNode;
|
||||
public static final long MAX_OUTPUT = 1_000_000;
|
||||
@ -42,19 +49,19 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
||||
public long output;
|
||||
public long power;
|
||||
public long maxPower;
|
||||
|
||||
|
||||
public float fan;
|
||||
public float prevFan;
|
||||
public float fanSpeed;
|
||||
public static final float FAN_ACCELERATION = 0.125F;
|
||||
|
||||
|
||||
public FluidTank compair;
|
||||
|
||||
private AudioWrapper audio;
|
||||
|
||||
public TileEntityFusionKlystron() {
|
||||
super(1);
|
||||
|
||||
|
||||
compair = new FluidTank(Fluids.AIR, AIR_CONSUMPTION * 60);
|
||||
}
|
||||
|
||||
@ -62,62 +69,62 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
||||
public String getName() {
|
||||
return "container.fusionKlystron";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
this.maxPower = Math.max(1_000_000L, this.outputTarget * 100L);
|
||||
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos);
|
||||
this.trySubscribe(compair.getTankType(), worldObj, pos);
|
||||
}
|
||||
|
||||
|
||||
this.output = 0;
|
||||
|
||||
|
||||
double powerFactor = TileEntityFusionTorus.getSpeedScaled(maxPower, power);
|
||||
double airFactor = TileEntityFusionTorus.getSpeedScaled(compair.getMaxFill(), compair.getFill());
|
||||
double factor = Math.min(powerFactor, airFactor);
|
||||
|
||||
long powerReq = (long) Math.ceil(outputTarget * factor);
|
||||
int airReq = (int) Math.ceil(AIR_CONSUMPTION * factor);
|
||||
|
||||
|
||||
if(outputTarget > 0 && power >= powerReq && compair.getFill() >= airReq) {
|
||||
this.output = powerReq;
|
||||
|
||||
|
||||
this.power -= powerReq;
|
||||
this.compair.setFill(this.compair.getFill() - airReq);
|
||||
}
|
||||
|
||||
|
||||
if(output < outputTarget / 50) output = 0;
|
||||
|
||||
|
||||
if(klystronNode == null || klystronNode.expired) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getOpposite();
|
||||
klystronNode = UniNodespace.getNode(worldObj, xCoord + dir.offsetX * 4, yCoord + 2, zCoord + dir.offsetZ * 4, KlystronNetworkProvider.THE_PROVIDER);
|
||||
|
||||
|
||||
if(klystronNode == null) {
|
||||
klystronNode = new GenNode(KlystronNetworkProvider.THE_PROVIDER,
|
||||
new BlockPos(xCoord + dir.offsetX * 4, yCoord + 2, zCoord + dir.offsetZ * 4))
|
||||
.setConnections(new DirPos(xCoord + dir.offsetX * 5, yCoord + 2, zCoord + dir.offsetZ * 5, dir));
|
||||
|
||||
|
||||
UniNodespace.createNode(worldObj, klystronNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(klystronNode.net != null) klystronNode.net.addProvider(this);
|
||||
|
||||
|
||||
if(klystronNode != null && klystronNode.net != null) {
|
||||
KlystronNetwork net = (KlystronNetwork) klystronNode.net;
|
||||
|
||||
|
||||
for(Object o : net.receiverEntries.entrySet()) {
|
||||
Entry e = (Entry) o;
|
||||
if(e.getKey() instanceof TileEntityFusionTorus) { // replace this with an interface should we ever get more acceptors
|
||||
TileEntityFusionTorus torus = (TileEntityFusionTorus) e.getKey();
|
||||
|
||||
|
||||
if(torus.isLoaded() && !torus.isInvalid()) { // check against zombie network members
|
||||
torus.klystronEnergy += this.output;
|
||||
break; // we only do one anyway
|
||||
@ -125,29 +132,29 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.networkPackNT(100);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
double mult = TileEntityFusionTorus.getSpeedScaled(outputTarget, output);
|
||||
if(this.output > 0) this.fanSpeed += FAN_ACCELERATION * mult;
|
||||
else this.fanSpeed -= FAN_ACCELERATION;
|
||||
|
||||
|
||||
this.fanSpeed = MathHelper.clamp_float(this.fanSpeed, 0F, 5F * (float) mult);
|
||||
|
||||
|
||||
this.prevFan = this.fan;
|
||||
this.fan += this.fanSpeed;
|
||||
|
||||
|
||||
if(this.fan >= 360F) {
|
||||
this.fan -= 360F;
|
||||
this.prevFan -= 360F;
|
||||
}
|
||||
|
||||
|
||||
if(this.fanSpeed > 0 && MainRegistry.proxy.me().getDistanceSq(xCoord + 0.5, yCoord + 2.5, zCoord + 0.5) < 30 * 30) {
|
||||
|
||||
|
||||
float speed = this.fanSpeed / 5F;
|
||||
|
||||
|
||||
if(audio == null) {
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.fel", xCoord + 0.5F, yCoord + 2.5F, zCoord + 0.5F, getVolume(speed), 15F, speed, 20);
|
||||
audio.startSound();
|
||||
@ -156,9 +163,9 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
||||
audio.updatePitch(speed);
|
||||
audio.keepAlive();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if(audio != null) {
|
||||
if(audio.isPlaying()) audio.stopSound();
|
||||
audio = null;
|
||||
@ -166,11 +173,11 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + dir.offsetX * 4, yCoord + 2, zCoord + dir.offsetZ * 4, dir),
|
||||
new DirPos(xCoord + rot.offsetX * 3, yCoord, zCoord + rot.offsetZ * 3, rot),
|
||||
@ -221,7 +228,7 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
||||
this.output = buf.readLong();
|
||||
this.compair.deserialize(buf);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
@ -229,18 +236,18 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
||||
this.power = nbt.getLong("power");
|
||||
this.maxPower = nbt.getLong("maxPower");
|
||||
this.outputTarget = nbt.getLong("outputTarget");
|
||||
|
||||
|
||||
this.compair.readFromNBT(nbt, "t");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setLong("maxPower", maxPower);
|
||||
nbt.setLong("outputTarget", outputTarget);
|
||||
|
||||
|
||||
this.compair.writeToNBT(nbt, "t");
|
||||
}
|
||||
|
||||
@ -299,11 +306,77 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
|
||||
|
||||
if(data.hasKey("amount")) {
|
||||
this.outputTarget = data.getLong("amount");
|
||||
if(this.outputTarget < 0) this.outputTarget = 0;
|
||||
if(this.outputTarget > MAX_OUTPUT) this.outputTarget = MAX_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_fusion_klystron";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAir(Context context, Arguments args) {
|
||||
return new Object[] {compair.getFill(), compair.getMaxFill()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getOutput(Context context, Arguments args) {
|
||||
return new Object[] {output, outputTarget};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setOutput(Context context, Arguments args) {
|
||||
outputTarget = (long) MathHelper.clamp_double(args.checkDouble(0), 0.0, MAX_OUTPUT);
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
getPower(), getMaxPower(),
|
||||
compair.getFill(), compair.getMaxFill(),
|
||||
output, outputTarget
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergyInfo",
|
||||
"getAir",
|
||||
"getOutput",
|
||||
"setOutput",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||
case "getAir": return getAir(context, args);
|
||||
case "getOutput": return getOutput(context, args);
|
||||
case "setOutput": return setOutput(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.main.MainRegistry;
|
||||
@ -18,105 +19,111 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiverMK2, IFusionPowerReceiver, IConfigurableMachine {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiverMK2, IFusionPowerReceiver, IConfigurableMachine, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
protected GenNode plasmaNode;
|
||||
|
||||
public long plasmaEnergy;
|
||||
public long plasmaEnergySync;
|
||||
public long power;
|
||||
|
||||
|
||||
public float rotor;
|
||||
public float prevRotor;
|
||||
public float rotorSpeed;
|
||||
public static final float ROTOR_ACCELERATION = 0.125F;
|
||||
|
||||
|
||||
public static final double PLASMA_EFFICIENCY = 1.35D;
|
||||
public static final int COOLANT_USE = 50;
|
||||
public static long MINIMUM_PLASMA = 5_000_000L;
|
||||
|
||||
|
||||
public FluidTank[] tanks;
|
||||
private AudioWrapper audio;
|
||||
|
||||
@Override public String getConfigName() { return "mhd-turbine"; }
|
||||
@Override public void readIfPresent(JsonObject obj) { MINIMUM_PLASMA = IConfigurableMachine.grab(obj, "L:minimumPlasma", MINIMUM_PLASMA); }
|
||||
@Override public void writeConfig(JsonWriter writer) throws IOException { writer.name("L:minimumPlasma").value(MINIMUM_PLASMA); }
|
||||
|
||||
|
||||
public TileEntityFusionMHDT() {
|
||||
this.tanks = new FluidTank[2];
|
||||
this.tanks[0] = new FluidTank(Fluids.PERFLUOROMETHYL_COLD, 4_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.PERFLUOROMETHYL, 4_000);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasMinimumPlasma() {
|
||||
return this.plasmaEnergy >= MINIMUM_PLASMA;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
this.plasmaEnergySync = this.plasmaEnergy;
|
||||
|
||||
|
||||
if(isCool()) {
|
||||
this.power = (long) Math.floor(this.plasmaEnergy * PLASMA_EFFICIENCY);
|
||||
if(!this.hasMinimumPlasma()) this.power /= 2;
|
||||
tanks[0].setFill(tanks[0].getFill() - COOLANT_USE);
|
||||
tanks[1].setFill(tanks[1].getFill() + COOLANT_USE);
|
||||
}
|
||||
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
if(tanks[0].getTankType() != Fluids.NONE) this.trySubscribe(tanks[0].getTankType(), worldObj, pos);
|
||||
if(tanks[1].getFill() > 0) this.tryProvide(tanks[1], worldObj, pos);
|
||||
}
|
||||
|
||||
|
||||
if(plasmaNode == null || plasmaNode.expired) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getOpposite();
|
||||
plasmaNode = UniNodespace.getNode(worldObj, xCoord + dir.offsetX * 6, yCoord + 2, zCoord + dir.offsetZ * 6, PlasmaNetworkProvider.THE_PROVIDER);
|
||||
|
||||
|
||||
if(plasmaNode == null) {
|
||||
plasmaNode = new GenNode(PlasmaNetworkProvider.THE_PROVIDER,
|
||||
new BlockPos(xCoord + dir.offsetX * 6, yCoord + 2, zCoord + dir.offsetZ * 6))
|
||||
.setConnections(new DirPos(xCoord + dir.offsetX * 7, yCoord + 2, zCoord + dir.offsetZ * 7, dir));
|
||||
|
||||
|
||||
UniNodespace.createNode(worldObj, plasmaNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(plasmaNode != null && plasmaNode.hasValidNet()) plasmaNode.net.addReceiver(this);
|
||||
|
||||
|
||||
this.networkPackNT(150);
|
||||
this.plasmaEnergy = 0;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if(this.plasmaEnergy > 0 && isCool()) this.rotorSpeed += ROTOR_ACCELERATION;
|
||||
else this.rotorSpeed -= ROTOR_ACCELERATION;
|
||||
|
||||
|
||||
this.rotorSpeed = MathHelper.clamp_float(this.rotorSpeed, 0F, hasMinimumPlasma() ? 15F : 10F);
|
||||
|
||||
|
||||
this.prevRotor = this.rotor;
|
||||
this.rotor += this.rotorSpeed;
|
||||
|
||||
|
||||
if(this.rotor >= 360F) {
|
||||
this.rotor -= 360F;
|
||||
this.prevRotor -= 360F;
|
||||
}
|
||||
|
||||
|
||||
if(this.rotorSpeed > 0 && MainRegistry.proxy.me().getDistanceSq(xCoord + 0.5, yCoord + 2.5, zCoord + 0.5) < 30 * 30) {
|
||||
|
||||
|
||||
float speed = this.rotorSpeed / 15F;
|
||||
|
||||
|
||||
if(audio == null) {
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.largeTurbineRunning", xCoord + 0.5F, yCoord + 1.5F, zCoord + 0.5F, getVolume(speed), 20F, speed, 20);
|
||||
audio.startSound();
|
||||
@ -125,9 +132,9 @@ public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnerg
|
||||
audio.updatePitch(speed);
|
||||
audio.keepAlive();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if(audio != null) {
|
||||
if(audio.isPlaying()) audio.stopSound();
|
||||
audio = null;
|
||||
@ -135,15 +142,15 @@ public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnerg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isCool() {
|
||||
return tanks[0].getFill() >= COOLANT_USE && tanks[1].getFill() + COOLANT_USE <= tanks[1].getMaxFill();
|
||||
}
|
||||
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + dir.offsetX * 4 + rot.offsetX * 4, yCoord, zCoord + dir.offsetZ * 4 + rot.offsetZ * 4, rot),
|
||||
new DirPos(xCoord + dir.offsetX * 4 - rot.offsetX * 4, yCoord, zCoord + dir.offsetZ * 4 - rot.offsetZ * 4, rot.getOpposite()),
|
||||
@ -158,7 +165,7 @@ public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnerg
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(plasmaEnergySync);
|
||||
|
||||
|
||||
this.tanks[0].serialize(buf);
|
||||
this.tanks[1].serialize(buf);
|
||||
}
|
||||
@ -167,7 +174,7 @@ public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnerg
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.plasmaEnergy = buf.readLong();
|
||||
|
||||
|
||||
this.tanks[0].deserialize(buf);
|
||||
this.tanks[1].deserialize(buf);
|
||||
}
|
||||
@ -244,4 +251,65 @@ public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnerg
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_fusion_mhdt";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {power};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPlasmaEnergy(Context context, Arguments args) {
|
||||
return new Object[] {plasmaEnergySync};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoolant(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tanks[0].getFill(), tanks[0].getMaxFill(),
|
||||
tanks[1].getFill(), tanks[1].getMaxFill()
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
power, plasmaEnergySync,
|
||||
|
||||
tanks[0].getFill(), tanks[0].getMaxFill(),
|
||||
tanks[1].getFill(), tanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergyInfo",
|
||||
"getPlasmaEnergy",
|
||||
"getCoolant",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||
case "getPlasmaEnergy": return getPlasmaEnergy(context, args);
|
||||
case "getCoolant": return getCoolant(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.fusion;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerFusionTorus;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
@ -25,9 +26,14 @@ import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -37,10 +43,11 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIProvider, IControlReceiver {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIProvider, IControlReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public boolean didProcess = false;
|
||||
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public ModuleMachineFusion fusionModule;
|
||||
|
||||
@ -51,7 +58,7 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
public long klystronEnergy;
|
||||
public long plasmaEnergy;
|
||||
public double fuelConsumption;
|
||||
|
||||
|
||||
public float magnet;
|
||||
public float prevMagnet;
|
||||
public float magnetSpeed;
|
||||
@ -59,21 +66,21 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
|
||||
private AudioWrapper audio;
|
||||
public int timeOffset = -1;
|
||||
|
||||
|
||||
public TileEntityFusionTorus() {
|
||||
super(3);
|
||||
|
||||
klystronNodes = new GenNode[4];
|
||||
plasmaNodes = new GenNode[4];
|
||||
connections = new boolean[4];
|
||||
|
||||
|
||||
this.tanks = new FluidTank[4];
|
||||
|
||||
this.tanks[0] = new FluidTank(Fluids.NONE, 4_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.NONE, 4_000);
|
||||
this.tanks[2] = new FluidTank(Fluids.NONE, 4_000);
|
||||
this.tanks[3] = new FluidTank(Fluids.NONE, 4_000);
|
||||
|
||||
|
||||
this.fusionModule = new ModuleMachineFusion(0, this, slots)
|
||||
.fluidInput(tanks[0], tanks[1], tanks[2])
|
||||
.fluidOutput(tanks[3])
|
||||
@ -87,7 +94,7 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
@ -97,10 +104,10 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
if(klystronNodes[i].net != null) klystronNodes[i].net.addReceiver(this);
|
||||
if(plasmaNodes[i].net != null) plasmaNodes[i].net.addProvider(this);
|
||||
}
|
||||
|
||||
|
||||
this.temperature += this.temp_passive_heating;
|
||||
if(this.temperature > KELVIN + 20) this.temperature = KELVIN + 20;
|
||||
|
||||
|
||||
if(this.temperature > this.temperature_target) {
|
||||
int cyclesTemp = (int) Math.ceil((Math.min(this.temperature - temperature_target, temp_change_max)) / temp_change_per_mb);
|
||||
int cyclesCool = coolantTanks[0].getFill();
|
||||
@ -111,9 +118,9 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
coolantTanks[1].setFill(coolantTanks[1].getFill() + cycles);
|
||||
this.temperature -= this.temp_change_per_mb * cycles;
|
||||
}
|
||||
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
this.trySubscribe(worldObj, pos);
|
||||
this.trySubscribe(coolantTanks[0].getTankType(), worldObj, pos);
|
||||
@ -127,19 +134,19 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
}
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 0, power, this.getMaxPower());
|
||||
|
||||
|
||||
// keeping track of PLASMA receivers because those need to share the combined output
|
||||
int receiverCount = 0;
|
||||
// collectors for determining the speed of the bonus bar
|
||||
int collectors = 0;
|
||||
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
connections[i] = false;
|
||||
if(klystronNodes[i] != null && klystronNodes[i].hasValidNet() && !klystronNodes[i].net.providerEntries.isEmpty()) connections[i] = true;
|
||||
if(!connections[i] && plasmaNodes[i] != null && plasmaNodes[i].hasValidNet() && !plasmaNodes[i].net.receiverEntries.isEmpty()) connections[i] = true;
|
||||
|
||||
|
||||
if(plasmaNodes[i] != null && plasmaNodes[i].hasValidNet() && !plasmaNodes[i].net.receiverEntries.isEmpty()) {
|
||||
|
||||
|
||||
for(Object o : plasmaNodes[i].net.receiverEntries.entrySet()) {
|
||||
Entry<Object, Long> entry = (Entry<Object, Long>) o;
|
||||
Object thing = entry.getKey();
|
||||
@ -150,18 +157,18 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FusionRecipe recipe = (FusionRecipe) this.fusionModule.getRecipe();
|
||||
|
||||
double powerFactor = TileEntityFusionTorus.getSpeedScaled(this.getMaxPower(), power);
|
||||
double fuel0Factor = recipe != null && recipe.inputFluid.length > 0 ? getSpeedScaled(tanks[0].getMaxFill(), tanks[0].getFill()) : 1D;
|
||||
double fuel1Factor = recipe != null && recipe.inputFluid.length > 1 ? getSpeedScaled(tanks[1].getMaxFill(), tanks[1].getFill()) : 1D;
|
||||
double fuel2Factor = recipe != null && recipe.inputFluid.length > 2 ? getSpeedScaled(tanks[2].getMaxFill(), tanks[2].getFill()) : 1D;
|
||||
|
||||
|
||||
double factor = BobMathUtil.min(powerFactor, fuel0Factor, fuel1Factor, fuel2Factor);
|
||||
|
||||
|
||||
boolean ignition = recipe != null ? recipe.ignitionTemp <= this.klystronEnergy : true;
|
||||
|
||||
|
||||
this.plasmaEnergy = 0;
|
||||
this.fuelConsumption = 0;
|
||||
this.fusionModule.preUpdate(factor, collectors * 0.5D);
|
||||
@ -172,17 +179,17 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
this.plasmaEnergy = (long) Math.ceil(recipe.outputTemp * factor);
|
||||
this.fuelConsumption = factor;
|
||||
}
|
||||
|
||||
|
||||
double outputIntensity = this.getOuputIntensity(receiverCount);
|
||||
double outputFlux = recipe != null ? recipe.neutronFlux * factor : 0D;
|
||||
|
||||
|
||||
if(this.plasmaEnergy > 0) for(int i = 0; i < 4; i++) {
|
||||
|
||||
|
||||
if(plasmaNodes[i] != null && plasmaNodes[i].hasValidNet() && !plasmaNodes[i].net.receiverEntries.isEmpty()) {
|
||||
|
||||
|
||||
for(Object o : plasmaNodes[i].net.receiverEntries.entrySet()) {
|
||||
Entry<Object, Long> entry = (Entry<Object, Long>) o;
|
||||
|
||||
|
||||
if(entry.getKey() instanceof IFusionPowerReceiver) {
|
||||
long powerReceived = (long) Math.ceil(this.plasmaEnergy * outputIntensity);
|
||||
((IFusionPowerReceiver) entry.getKey()).receiveFusionPower(powerReceived, outputFlux);
|
||||
@ -190,33 +197,33 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.networkPackNT(150);
|
||||
|
||||
|
||||
this.klystronEnergy = 0;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if(timeOffset == -1) this.timeOffset = worldObj.rand.nextInt(30_000);
|
||||
|
||||
double powerFactor = TileEntityFusionTorus.getSpeedScaled(this.getMaxPower(), power);
|
||||
if(this.didProcess) this.magnetSpeed += MAGNET_ACCELERATION;
|
||||
else this.magnetSpeed -= MAGNET_ACCELERATION;
|
||||
|
||||
|
||||
this.magnetSpeed = MathHelper.clamp_float(this.magnetSpeed, 0F, 30F * (float) powerFactor);
|
||||
|
||||
|
||||
this.prevMagnet = this.magnet;
|
||||
this.magnet += this.magnetSpeed;
|
||||
|
||||
|
||||
if(this.magnet >= 360F) {
|
||||
this.magnet -= 360F;
|
||||
this.prevMagnet -= 360F;
|
||||
}
|
||||
|
||||
|
||||
if(this.magnetSpeed > 0 && MainRegistry.proxy.me().getDistanceSq(xCoord + 0.5, yCoord + 2.5, zCoord + 0.5) < 50 * 50) {
|
||||
|
||||
|
||||
float speed = this.magnetSpeed / 30F;
|
||||
|
||||
|
||||
if(audio == null) {
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.fusionReactorRunning", xCoord + 0.5F, yCoord + 2.5F, zCoord + 0.5F, getVolume(speed), 30F, speed, 20);
|
||||
audio.startSound();
|
||||
@ -225,9 +232,9 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
audio.updatePitch(speed);
|
||||
audio.keepAlive();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if(audio != null) {
|
||||
if(audio.isPlaying()) audio.stopSound();
|
||||
audio = null;
|
||||
@ -235,24 +242,24 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static double getOuputIntensity(int receiverCount) {
|
||||
if(receiverCount == 1) return 1D; // 100%
|
||||
if(receiverCount == 2) return 0.625D; // 125%
|
||||
if(receiverCount == 3) return 0.5D; // 150%
|
||||
return 0.4375D; // 175%
|
||||
}
|
||||
|
||||
|
||||
public GenNode createNode(INetworkProvider provider, ForgeDirection dir) {
|
||||
GenNode node = UniNodespace.getNode(worldObj, xCoord + dir.offsetX * 7, yCoord + 2, zCoord + dir.offsetZ * 7, provider);
|
||||
if(node != null) return node;
|
||||
|
||||
|
||||
node = new GenNode(provider,
|
||||
new BlockPos(xCoord + dir.offsetX * 7, yCoord + 2, zCoord + dir.offsetZ * 7))
|
||||
.setConnections(new DirPos(xCoord + dir.offsetX * 8, yCoord + 2, zCoord + dir.offsetZ * 8, dir));
|
||||
|
||||
|
||||
UniNodespace.createNode(worldObj, node);
|
||||
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
@ -288,7 +295,7 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
buf.writeLong(this.klystronEnergy);
|
||||
buf.writeLong(this.plasmaEnergy);
|
||||
buf.writeDouble(this.fuelConsumption);
|
||||
|
||||
|
||||
this.fusionModule.serialize(buf);
|
||||
for(int i = 0; i < 4; i++) this.tanks[i].serialize(buf);
|
||||
for(int i = 0; i < 4; i++) buf.writeBoolean(connections[i]);
|
||||
@ -301,26 +308,26 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
this.klystronEnergy = buf.readLong();
|
||||
this.plasmaEnergy = buf.readLong();
|
||||
this.fuelConsumption = buf.readDouble();
|
||||
|
||||
|
||||
this.fusionModule.deserialize(buf);
|
||||
for(int i = 0; i < 4; i++) this.tanks[i].deserialize(buf);
|
||||
for(int i = 0; i < 4; i++) connections[i] = buf.readBoolean();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
|
||||
for(int i = 0; i < 4; i++) this.tanks[i].readFromNBT(nbt, "ft" + i);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.fusionModule.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
|
||||
for(int i = 0; i < 4; i++) this.tanks[i].writeToNBT(nbt, "ft" + i);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
@ -335,7 +342,7 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {coolantTanks[1], tanks[3]}; }
|
||||
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {coolantTanks[0], tanks[0], tanks[1], tanks[2]}; }
|
||||
@Override public FluidTank[] getAllTanks() { return new FluidTank[] {coolantTanks[0], coolantTanks[1], tanks[0], tanks[1], tanks[2], tanks[3]}; }
|
||||
|
||||
|
||||
/** Linearly scales up from 0% to 100% from 0 to 0.5, then stays at 100% */
|
||||
public static double getSpeedScaled(double max, double level) {
|
||||
if(max == 0) return 0D;
|
||||
@ -453,4 +460,110 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_fusion_torus";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFluid(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getUnlocalizedName(),
|
||||
tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getUnlocalizedName(),
|
||||
tanks[2].getFill(), tanks[2].getMaxFill(), tanks[2].getTankType().getUnlocalizedName(),
|
||||
tanks[3].getFill(), tanks[3].getMaxFill(), tanks[3].getTankType().getUnlocalizedName(),
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoolant(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getKlystronEnergy(Context context, Arguments args) {
|
||||
return new Object[] {klystronEnergy};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPlasmaEnergy(Context context, Arguments args) {
|
||||
return new Object[] {plasmaEnergy};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFuelConsumption(Context context, Arguments args) {
|
||||
return new Object[] {fuelConsumption};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getRecipeProgress(Context context, Arguments args) {
|
||||
return new Object[] {fusionModule.progress, fusionModule.bonus};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
getPower(), getMaxPower(),
|
||||
|
||||
tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getUnlocalizedName(),
|
||||
tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getUnlocalizedName(),
|
||||
tanks[2].getFill(), tanks[2].getMaxFill(), tanks[2].getTankType().getUnlocalizedName(),
|
||||
tanks[3].getFill(), tanks[3].getMaxFill(), tanks[3].getTankType().getUnlocalizedName(),
|
||||
|
||||
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||
|
||||
klystronEnergy, plasmaEnergy, fuelConsumption,
|
||||
fusionModule.progress, fusionModule.bonus
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getEnergyInfo",
|
||||
"getFluid",
|
||||
"getCoolant",
|
||||
"getKlystronEnergy",
|
||||
"getPlasmaEnergy",
|
||||
"getFuelConsumption",
|
||||
"getRecipeProgress",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch (method) {
|
||||
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||
case "getFluid": return getFluid(context, args);
|
||||
case "getCoolant": return getCoolant(context, args);
|
||||
case "getKlystronEnergy": return getKlystronEnergy(context, args);
|
||||
case "getPlasmaEnergy": return getPlasmaEnergy(context, args);
|
||||
case "getFuelConsumption": return getFuelConsumption(context, args);
|
||||
case "getRecipeProgress": return getRecipeProgress(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
}
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,9 @@ public class TileEntityDroneDock extends TileEntityRequestNetworkContainer imple
|
||||
paths.add(init);
|
||||
|
||||
// breadth-first search
|
||||
for(int i = 0; i < pathingDepth; i++) {
|
||||
outer: for(int i = 0; i < pathingDepth; i++) {
|
||||
|
||||
int iterationBrake = 1000;
|
||||
|
||||
List<List<PathNode>> newPaths = new ArrayList();
|
||||
|
||||
@ -155,6 +157,11 @@ public class TileEntityDroneDock extends TileEntityRequestNetworkContainer imple
|
||||
newPath.add(connectedSafe);
|
||||
newPaths.add(newPath);
|
||||
}
|
||||
|
||||
// emergency halt after 1000 iterations, forces pathing depth to proceed
|
||||
// theoretical maximum is therefore 10k iterations
|
||||
iterationBrake--;
|
||||
if(iterationBrake <= 0) continue outer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ public abstract class TileEntityRequestNetwork extends TileEntityLoadedBase {
|
||||
|
||||
PathNode newNode = createNode(pos);
|
||||
if(this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) newNode.active = false;
|
||||
else newNode.active = true;
|
||||
// push new node
|
||||
push(worldObj, newNode);
|
||||
|
||||
|
||||
@ -411,6 +411,7 @@ container.machineLargeTurbine=Industrielle Dampfturbine
|
||||
container.machineLiquefactor=Verflüssiger
|
||||
container.machineMixer=Industrieller Mixer
|
||||
container.machineOreSlopper=B.E.M.
|
||||
container.machinePrecAss=Präzisions-Montagemaschine
|
||||
container.machinePUREX=PUREX
|
||||
container.machinePyroOven=Pyrolyseofen
|
||||
container.machineRefinery=Ölraffinerie
|
||||
@ -3767,6 +3768,8 @@ potion.hbm_stability=Stabilität
|
||||
potion.hbm_taint=Verdorben
|
||||
potion.hbm_telekinesis=! ! !
|
||||
|
||||
precass.recycle=Recyclen von %s
|
||||
|
||||
purex.recycle=Wiederanreicherung von %s
|
||||
purex.schrab=Schrabidium extrahieren aus %s
|
||||
|
||||
@ -4537,6 +4540,7 @@ tile.machine_nuke_furnace_on.name=Atombetriebener Ofen
|
||||
tile.machine_orbus.name=Schwerer Magnetischer Lagerbehälter
|
||||
tile.machine_ore_slopper.name=Bedrockerzmaschine
|
||||
tile.machine_powerrtg.name=PT-Isotopenzelle
|
||||
tile.machine_precass.name=Präzisions-Montagemaschine
|
||||
tile.machine_press.name=Befeuerte Presse
|
||||
tile.machine_puf6_tank.name=Plutoniumhexafluorid-Tank
|
||||
tile.machine_pumpjack.name=Pferdekopfpumpe
|
||||
|
||||
@ -816,6 +816,7 @@ container.machineLargeTurbine=Industrial Steam Turbine
|
||||
container.machineLiquefactor=Liquefactor
|
||||
container.machineMixer=Industrial Mixer
|
||||
container.machineOreSlopper=B.O.P.
|
||||
container.machinePrecAss=Precision Assembly Machine
|
||||
container.machinePUREX=PUREX
|
||||
container.machinePyroOven=Pyrolysis Oven
|
||||
container.machineRefinery=Oil Refinery
|
||||
@ -4943,6 +4944,8 @@ potion.hbm_stability=Stability
|
||||
potion.hbm_taint=Tainted
|
||||
potion.hbm_telekinesis=! ! !
|
||||
|
||||
precass.recycle=Recycling of %s
|
||||
|
||||
purex.recycle=Reprocessing of %s
|
||||
purex.schrab=Schrabidium extraction from %s
|
||||
|
||||
@ -5804,6 +5807,7 @@ tile.machine_nuke_furnace_on.name=Nuclear Furnace
|
||||
tile.machine_orbus.name=Heavy Magnetic Storage Tank
|
||||
tile.machine_ore_slopper.name=Bedrock Ore Processor
|
||||
tile.machine_powerrtg.name=PT Isotope Cell
|
||||
tile.machine_precass.name=Precision Assembly Machine
|
||||
tile.machine_press.name=Burner Press
|
||||
tile.machine_puf6_tank.name=Plutonium Hexafluoride Tank
|
||||
tile.machine_pumpjack.name=Pumpjack
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/items/blueprints_528.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/blueprints_528.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
Loading…
x
Reference in New Issue
Block a user