mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
tragic yuri
This commit is contained in:
parent
966206dbf5
commit
07a2e4eea3
@ -7,4 +7,6 @@
|
||||
|
||||
## Fixed
|
||||
* Fixed fusion reactor item IO being broken
|
||||
* Fixed issue with the chemical factory where the declogging feature would be triggered by a recipe processor that doesn't even own the reported slot
|
||||
* Fixed issue with the chemical factory where the declogging feature would be triggered by a recipe processor that doesn't even own the reported slot
|
||||
* Fixed the new PA not triggering the omega-12 achievement
|
||||
* In addition to granting the achievement to nearby players on recipe completion, it is also granted when taking it out of the output slot
|
||||
@ -1007,6 +1007,7 @@ public class ModBlocks {
|
||||
@Deprecated public static Block machine_assembler;
|
||||
public static Block machine_assembly_machine;
|
||||
@Deprecated public static Block machine_assemfac;
|
||||
public static Block machine_assembly_factory;
|
||||
public static Block machine_arc_welder;
|
||||
public static Block machine_soldering_station;
|
||||
public static Block machine_arc_furnace;
|
||||
@ -2240,6 +2241,7 @@ public class ModBlocks {
|
||||
machine_assembler = new MachineAssembler(Material.iron).setBlockName("machine_assembler").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_assembler");
|
||||
machine_assembly_machine = new MachineAssemblyMachine(Material.iron).setBlockName("machine_assembly_machine").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_assemfac = new MachineAssemfac(Material.iron).setBlockName("machine_assemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_assembly_factory = new MachineAssemblyFactory(Material.iron).setBlockName("machine_assembly_factory").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_arc_welder = new MachineArcWelder(Material.iron).setBlockName("machine_arc_welder").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_soldering_station = new MachineSolderingStation(Material.iron).setBlockName("machine_soldering_station").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
@ -3298,6 +3300,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_assembler, machine_assembler.getUnlocalizedName());
|
||||
register(machine_assembly_machine);
|
||||
GameRegistry.registerBlock(machine_assemfac, machine_assemfac.getUnlocalizedName());
|
||||
register(machine_assembly_factory);
|
||||
GameRegistry.registerBlock(machine_chemplant, machine_chemplant.getUnlocalizedName());
|
||||
register(machine_chemical_plant);
|
||||
register(machine_chemfac);
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityProxyDyn;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAssemblyFactory;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineAssemblyFactory extends BlockDummyable implements ITooltipProvider, ILookOverlay {
|
||||
|
||||
public MachineAssemblyFactory(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineAssemblyFactory();
|
||||
if(meta >= 6) return new TileEntityProxyDyn().inventory().power().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {2, 0, 2, 2, 2, 2}; }
|
||||
@Override public int getOffset() { return 2; }
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
x -= dir.offsetX * 2;
|
||||
z -= dir.offsetZ * 2;
|
||||
|
||||
for(int i = -2; i <= 2; i++) for(int j = -2; j <= 2; j++) {
|
||||
if(Math.abs(i) == 2 || Math.abs(j) == 2) this.makeExtra(world, x + i, y, z + j);
|
||||
}
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
for(int i = -2; i <= 2; i++) {
|
||||
this.makeExtra(world, x + dir.offsetX * i + rot.offsetX * 2, y + 2, z + dir.offsetZ * i + rot.offsetZ * 2);
|
||||
this.makeExtra(world, x + dir.offsetX * i - rot.offsetX * 2, y + 2, z + dir.offsetZ * i - rot.offsetZ * 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(!(te instanceof TileEntityMachineAssemblyFactory)) return;
|
||||
TileEntityMachineAssemblyFactory assemfac = (TileEntityMachineAssemblyFactory) te;
|
||||
|
||||
DirPos[] cool = assemfac.getCoolPos();
|
||||
|
||||
for(DirPos dirPos : cool) if(dirPos.compare(x + dirPos.getDir().offsetX, y, z + dirPos.getDir().offsetZ)) {
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + assemfac.water.getTankType().getLocalizedName());
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + assemfac.lps.getTankType().getLocalizedName());
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
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.ItemBlueprints;
|
||||
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 ContainerMachineAssemblyFactory extends ContainerBase {
|
||||
|
||||
public ContainerMachineAssemblyFactory(InventoryPlayer invPlayer, IInventory assemFac) {
|
||||
super(invPlayer, assemFac);
|
||||
|
||||
// Battery
|
||||
this.addSlotToContainer(new SlotNonRetarded(assemFac, 0, 234, 112));
|
||||
// Upgrades
|
||||
this.addSlots(assemFac, 1, 214, 149, 3, 1);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
// Template
|
||||
this.addSlots(assemFac, 4 + i * 14, 25 + (i % 2) * 109, 54 + (i / 2) * 56, 1, 1);
|
||||
// Solid Input
|
||||
this.addSlots(assemFac, 5 + i * 14, 7 + (i % 2) * 109, 20 + (i / 2) * 56, 2, 6, 16);
|
||||
// Solid Output
|
||||
this.addOutputSlots(invPlayer.player, assemFac, 17 + i * 14, 87 + (i % 2) * 109, 54 + (i / 2) * 56, 1, 1);
|
||||
}
|
||||
|
||||
this.playerInv(invPlayer, 33, 158);
|
||||
}
|
||||
|
||||
@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() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 4, 5, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 18, 19, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 32, 33, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
|
||||
if(!this.mergeItemStack(slotStack, 44, 45, false)) return null;
|
||||
} else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) {
|
||||
if(!this.mergeItemStack(slotStack, 1, 4, false)) return null;
|
||||
} else {
|
||||
if(!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 5, 17, false) &&
|
||||
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 19, 31, false) &&
|
||||
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 33, 46, false) &&
|
||||
!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 47, 59, false)) return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == 0) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return slotOriginal;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.inventory.SlotCraftingOutput;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.machine.albion.TileEntityPADetector;
|
||||
|
||||
@ -24,8 +24,8 @@ public class ContainerPADetector extends Container {
|
||||
this.addSlotToContainer(new Slot(tile, 1, 62, 18));
|
||||
this.addSlotToContainer(new Slot(tile, 2, 80, 18));
|
||||
//Outputs
|
||||
this.addSlotToContainer(new SlotTakeOnly(tile, 3, 62, 45));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tile, 4, 80, 45));
|
||||
this.addSlotToContainer(new SlotCraftingOutput(playerInv.player, tile, 3, 62, 45));
|
||||
this.addSlotToContainer(new SlotCraftingOutput(playerInv.player, tile, 4, 80, 45));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
|
||||
@ -0,0 +1,140 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineAssemblyFactory;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAssemblyFactory;
|
||||
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 GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_assembly_factory.png");
|
||||
private TileEntityMachineAssemblyFactory assembler;
|
||||
|
||||
public GUIMachineAssemblyFactory(InventoryPlayer invPlayer, TileEntityMachineAssemblyFactory tedf) {
|
||||
super(new ContainerMachineAssemblyFactory(invPlayer, tedf));
|
||||
assembler = tedf;
|
||||
|
||||
this.xSize = 256;
|
||||
this.ySize = 240;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
for(int j = 0; j < 4; j++) {
|
||||
assembler.inputTanks[j].renderTankInfo(this, mouseX, mouseY, guiLeft + 105 + (j % 2) * 109, guiTop + 20 + (j / 2) * 56, 3, 16);
|
||||
assembler.outputTanks[j].renderTankInfo(this, mouseX, mouseY, guiLeft + 105 + (j % 2) * 109, guiTop + 54 + (j / 2) * 56, 3, 16);
|
||||
}
|
||||
|
||||
assembler.water.renderTankInfo(this, mouseX, mouseY, guiLeft + 232, guiTop + 149, 7, 52);
|
||||
assembler.lps.renderTankInfo(this, mouseX, mouseY, guiLeft + 241, guiTop + 149, 7, 52);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 234, guiTop + 18, 16, 92, assembler.power, assembler.maxPower);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(guiLeft + 6 + (i % 2) * 109 <= mouseX && guiLeft + 6 + (i % 2) * 109 + 18 > mouseX && guiTop + 53 + (i / 2) * 56 < mouseY && guiTop + 53 + (i / 2) * 56 + 18 >= mouseY) {
|
||||
if(this.assembler.assemblerModule[i].recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule[i].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);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 6 + (i % 2) * 109, 53 + (i / 2) * 56, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule[i].recipe, i, ItemBlueprints.grabPool(assembler.slots[4 + i * 14]), 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, 113 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 33, 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, 256, 140);
|
||||
drawTexturedModalRect(guiLeft + 25, guiTop + 140, 25, 140, 231, 100);
|
||||
|
||||
int p = (int) (assembler.power * 92 / assembler.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 234, guiTop + 110 - p, 0, 232 - p, 16, p);
|
||||
|
||||
for(int i = 0; i < 4; i++) if(assembler.assemblerModule[i].progress > 0) {
|
||||
int j = (int) Math.ceil(37 * assembler.assemblerModule[i].progress);
|
||||
drawTexturedModalRect(guiLeft + 45 + (i % 2) * 109, guiTop + 63 + (i / 2) * 56, 0, 240, j, 6);
|
||||
}
|
||||
|
||||
for(int g = 0; g < 4; g++) {
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule[g].recipe);
|
||||
|
||||
/// LEFT LED
|
||||
if(assembler.didProcess[g]) {
|
||||
drawTexturedModalRect(guiLeft + 45 + (g % 2) * 109, guiTop + 55 + (g / 2) * 56, 4, 236, 4, 4);
|
||||
} else if(recipe != null) {
|
||||
drawTexturedModalRect(guiLeft + 45 + (g % 2) * 109, guiTop + 55 + (g / 2) * 56, 0, 236, 4, 4);
|
||||
}
|
||||
|
||||
/// RIGHT LED
|
||||
if(assembler.didProcess[g]) {
|
||||
drawTexturedModalRect(guiLeft + 53 + (g % 2) * 109, guiTop + 55 + (g / 2) * 56, 4, 236, 4, 4);
|
||||
} else if(recipe != null && assembler.power >= recipe.power && assembler.canCool()) {
|
||||
drawTexturedModalRect(guiLeft + 53 + (g % 2) * 109, guiTop + 55 + (g / 2) * 56, 0, 236, 4, 4);
|
||||
}
|
||||
}
|
||||
|
||||
for(int g = 0; g < 4; g++) {
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule[g].recipe);
|
||||
|
||||
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 7 + (g % 2) * 109, 54 + (g / 2) * 56);
|
||||
|
||||
if(recipe != null && recipe.inputItem != null) {
|
||||
for(int i = 0; i < recipe.inputItem.length; i++) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(assembler.assemblerModule[g].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[g].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);
|
||||
}
|
||||
}
|
||||
|
||||
for(int j = 0; j < 4; j++) {
|
||||
assembler.inputTanks[j].renderTank(guiLeft + 105 + (j % 2) * 109, guiTop + 52 + (j / 2) * 56, this.zLevel, 5, 32);
|
||||
assembler.outputTanks[j].renderTank(guiLeft + 105 + (j % 2) * 109, guiTop + 70 + (j / 2) * 56, this.zLevel, 5, 16);
|
||||
}
|
||||
|
||||
assembler.water.renderTank(guiLeft + 232, guiTop + 201, this.zLevel, 7, 52);
|
||||
assembler.lps.renderTank(guiLeft + 241, guiTop + 201, this.zLevel, 7, 52);
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.machine.ItemBlueprints;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
@ -49,7 +50,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule[i].recipe);
|
||||
this.func_146283_a(recipe.print(), mouseX, mouseY);
|
||||
} else {
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + "Click to set recipe", mouseX, mouseY);
|
||||
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,6 +271,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssembler.class, new RenderAssembler());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemblyMachine.class, new RenderAssemblyMachine());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemfac.class, new RenderAssemfac());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemblyFactory.class, new RenderAssemblyFactory());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemplant.class, new RenderChemplant());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemicalPlant.class, new RenderChemicalPlant());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemfac.class, new RenderChemfac());
|
||||
|
||||
@ -142,6 +142,7 @@ public class ResourceManager {
|
||||
public static final IModelCustom assembler_arm = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/assembler_new_arm.obj"));
|
||||
public static final IModelCustom assembly_machine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assembly_machine.obj")).asVBO();
|
||||
public static final IModelCustom assemfac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assemfac.obj")).asVBO();
|
||||
public static final IModelCustom assembly_factory = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assembly_factory.obj")).asVBO();
|
||||
|
||||
//Chemplant
|
||||
public static final IModelCustom chemplant_body = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_body.obj")).asVBO();
|
||||
@ -578,6 +579,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation assembler_arm_tex = new ResourceLocation(RefStrings.MODID, "textures/models/assembler_arm_new.png");
|
||||
public static final ResourceLocation assembly_machine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assembly_machine.png");
|
||||
public static final ResourceLocation assemfac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assemfac.png");
|
||||
public static final ResourceLocation assembly_factory_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assembly_factory.png");
|
||||
|
||||
//Chemplant
|
||||
public static final ResourceLocation chemplant_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_base_new.png");
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class RenderAssemblyFactory extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
switch(tileEntity.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
bindTexture(ResourceManager.assembly_factory_tex);
|
||||
ResourceManager.assembly_factory.renderAll();
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_assembly_factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
|
||||
return new ItemRenderBase() {
|
||||
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -1.5, 0);
|
||||
GL11.glScaled(3, 3, 3);
|
||||
}
|
||||
public void renderCommonWithStack(ItemStack item) {
|
||||
GL11.glScaled(0.75, 0.75, 0.75);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.assembly_factory_tex);
|
||||
ResourceManager.assembly_factory.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}};
|
||||
}
|
||||
}
|
||||
@ -352,6 +352,7 @@ public class TileMappings {
|
||||
put(TileEntityMachineAssembler.class, "tileentity_assembly_machine");
|
||||
put(TileEntityMachineAssemblyMachine.class, "tileentity_assemblymachine");
|
||||
put(TileEntityMachineAssemfac.class, "tileentity_assemfac");
|
||||
put(TileEntityMachineAssemblyFactory.class, "tileentity_assemblyfactory");
|
||||
put(TileEntityMachineChemplant.class, "tileentity_chemical_plant");
|
||||
put(TileEntityMachineChemicalPlant.class, "tileentity_chemicalplant");
|
||||
put(TileEntityMachineChemfac.class, "tileentity_chemfac");
|
||||
|
||||
@ -0,0 +1,407 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.interfaces.NotableComments;
|
||||
import com.hbm.inventory.UpgradeManagerNT;
|
||||
import com.hbm.inventory.container.ContainerMachineAssemblyFactory;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineAssemblyFactory;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.module.machine.ModuleMachineAssembler;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.TileEntityProxyDyn.IProxyDelegateProvider;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
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.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
// TODO: make a base class because 90% of this is just copy pasted from the chemfac
|
||||
@NotableComments
|
||||
public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider {
|
||||
|
||||
public FluidTank[] allTanks;
|
||||
public FluidTank[] inputTanks;
|
||||
public FluidTank[] outputTanks;
|
||||
|
||||
public FluidTank water;
|
||||
public FluidTank lps;
|
||||
|
||||
public long power;
|
||||
public long maxPower = 1_000_000;
|
||||
public boolean[] didProcess = new boolean[4];
|
||||
|
||||
public boolean frame = false;
|
||||
private AudioWrapper audio;
|
||||
|
||||
public ModuleMachineAssembler[] assemblerModule;
|
||||
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
|
||||
|
||||
protected DelegateAssemblyFactoy delegate = new DelegateAssemblyFactoy();
|
||||
|
||||
public TileEntityMachineAssemblyFactory() {
|
||||
super(60);
|
||||
|
||||
this.inputTanks = new FluidTank[4];
|
||||
this.outputTanks = new FluidTank[4];
|
||||
for(int i = 0; i < 4; i++) {
|
||||
this.inputTanks[i] = new FluidTank(Fluids.NONE, 4_000);
|
||||
this.outputTanks[i] = new FluidTank(Fluids.NONE, 4_000);
|
||||
}
|
||||
|
||||
this.water = new FluidTank(Fluids.WATER, 4_000);
|
||||
this.lps = new FluidTank(Fluids.SPENTSTEAM, 4_000);
|
||||
|
||||
this.allTanks = new FluidTank[this.inputTanks.length + this.outputTanks.length + 2];
|
||||
for(int i = 0; i < inputTanks.length; i++) this.allTanks[i] = this.inputTanks[i];
|
||||
for(int i = 0; i < outputTanks.length; i++) this.allTanks[i + this.inputTanks.length] = this.outputTanks[i];
|
||||
|
||||
this.allTanks[this.allTanks.length - 2] = this.water;
|
||||
this.allTanks[this.allTanks.length - 1] = this.lps;
|
||||
|
||||
this.assemblerModule = new ModuleMachineAssembler[4];
|
||||
for(int i = 0; i < 4; i++) this.assemblerModule[i] = new ModuleMachineAssembler(i, this, slots)
|
||||
.itemInput(5 + i * 14).itemOutput(17 + i * 14)
|
||||
.fluidInput(inputTanks[i]).fluidOutput(outputTanks[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
for(int k = 0; k < 4; k++) if(i == 17 + k * 14) return true;
|
||||
for(int k = 0; k < 4; k++) if(this.assemblerModule[k].isSlotClogged(i)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
if(slot == 0) return true; // battery
|
||||
for(int i = 0; i < 4; i++) if(slot == 4 + i * 14 && stack.getItem() == ModItems.blueprints) return true;
|
||||
if(slot >= 1 && slot <= 3 && stack.getItem() instanceof ItemMachineUpgrade) return true; // upgrades
|
||||
for(int i = 0; i < 4; i++) if(this.assemblerModule[i].isItemValid(slot, stack)) return true; // recipe input crap
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] {
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
|
||||
47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
|
||||
}; // ho boy, a big fucking array of hand-written values, surely this isn't gonna bite me in the ass some day
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineAssemblyFactory";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(maxPower <= 0) this.maxPower = 10_000_000;
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
long nextMaxPower = 0;
|
||||
for(int i = 0; i < 4; i++) {
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemblerModule[i].recipe);
|
||||
if(recipe != null) {
|
||||
nextMaxPower += recipe.power * 100;
|
||||
}
|
||||
}
|
||||
this.maxPower = nextMaxPower;
|
||||
this.maxPower = BobMathUtil.max(this.power, this.maxPower, 1_000_000);
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
upgradeManager.checkSlots(slots, 1, 3);
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos);
|
||||
for(FluidTank tank : inputTanks) if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos);
|
||||
for(FluidTank tank : outputTanks) if(tank.getFill() > 0) this.tryProvide(tank, worldObj, pos);
|
||||
}
|
||||
|
||||
for(DirPos pos : getCoolPos()) {
|
||||
delegate.trySubscribe(worldObj, pos);
|
||||
delegate.trySubscribe(water.getTankType(), worldObj, pos);
|
||||
delegate.tryProvide(lps, worldObj, pos);
|
||||
}
|
||||
|
||||
double speed = 1D;
|
||||
double pow = 1D;
|
||||
|
||||
speed += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) / 3D;
|
||||
speed += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3);
|
||||
|
||||
pow -= Math.min(upgradeManager.getLevel(UpgradeType.POWER), 3) * 0.25D;
|
||||
pow += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) * 1D;
|
||||
pow += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * 10D / 3D;
|
||||
boolean markDirty = false;
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
this.assemblerModule[i].update(speed * 2D, pow * 2D, canCool(), slots[4 + i * 7]);
|
||||
this.didProcess[i] = this.assemblerModule[i].didProcess;
|
||||
markDirty |= this.assemblerModule[i].markDirty;
|
||||
|
||||
if(this.assemblerModule[i].didProcess) {
|
||||
this.water.setFill(this.water.getFill() - 100);
|
||||
this.lps.setFill(this.lps.getFill() + 100);
|
||||
}
|
||||
}
|
||||
|
||||
if(markDirty) this.markDirty();
|
||||
|
||||
this.networkPackNT(100);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override public AudioWrapper createAudioLoop() {
|
||||
return MainRegistry.proxy.getLoopedSound("hbm:block.motor", xCoord, yCoord, zCoord, 0.5F, 15F, 0.75F, 20);
|
||||
}
|
||||
|
||||
@Override public void onChunkUnload() {
|
||||
if(audio != null) { audio.stopSound(); audio = null; }
|
||||
}
|
||||
|
||||
@Override public void invalidate() {
|
||||
super.invalidate();
|
||||
if(audio != null) { audio.stopSound(); audio = null; }
|
||||
}
|
||||
|
||||
public boolean canCool() {
|
||||
return water.getFill() >= 100 && lps.getFill() <= lps.getMaxFill() - 100;
|
||||
}
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + 3, yCoord, zCoord - 2, Library.POS_X),
|
||||
new DirPos(xCoord + 3, yCoord, zCoord + 0, Library.POS_X),
|
||||
new DirPos(xCoord + 3, yCoord, zCoord + 2, Library.POS_X),
|
||||
new DirPos(xCoord - 3, yCoord, zCoord - 2, Library.NEG_X),
|
||||
new DirPos(xCoord - 3, yCoord, zCoord + 0, Library.NEG_X),
|
||||
new DirPos(xCoord - 3, yCoord, zCoord + 2, Library.NEG_X),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord + 3, Library.POS_Z),
|
||||
new DirPos(xCoord + 0, yCoord, zCoord + 3, Library.POS_Z),
|
||||
new DirPos(xCoord + 2, yCoord, zCoord + 3, Library.POS_Z),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord - 3, Library.NEG_Z),
|
||||
new DirPos(xCoord + 0, yCoord, zCoord - 3, Library.NEG_Z),
|
||||
new DirPos(xCoord + 2, yCoord, zCoord - 3, Library.NEG_Z),
|
||||
|
||||
new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 2 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 1 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 1 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 0 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 0 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord - dir.offsetX * 1 + rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 1 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 2 + rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 2 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 2 - rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 1 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 1 - rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord + dir.offsetX * 0 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 0 - rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord - dir.offsetX * 1 - rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 1 - rot.offsetZ * 2, Library.POS_Y),
|
||||
new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2, Library.POS_Y),
|
||||
|
||||
new DirPos(xCoord + dir.offsetX + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ + rot.offsetZ * 3, rot),
|
||||
new DirPos(xCoord - dir.offsetX + rot.offsetX * 3, yCoord, zCoord - dir.offsetZ + rot.offsetZ * 3, rot),
|
||||
new DirPos(xCoord + dir.offsetX - rot.offsetX * 3, yCoord, zCoord + dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()),
|
||||
new DirPos(xCoord - dir.offsetX - rot.offsetX * 3, yCoord, zCoord - dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public DirPos[] getCoolPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + rot.offsetX + dir.offsetX * 3, yCoord, zCoord + rot.offsetZ + dir.offsetZ * 3, dir),
|
||||
new DirPos(xCoord - rot.offsetX + dir.offsetX * 3, yCoord, zCoord - rot.offsetZ + dir.offsetZ * 3, dir),
|
||||
new DirPos(xCoord + rot.offsetX - dir.offsetX * 3, yCoord, zCoord + rot.offsetZ - dir.offsetZ * 3, dir.getOpposite()),
|
||||
new DirPos(xCoord - rot.offsetX - dir.offsetX * 3, yCoord, zCoord - rot.offsetZ - dir.offsetZ * 3, dir.getOpposite()),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
for(FluidTank tank : inputTanks) tank.serialize(buf);
|
||||
for(FluidTank tank : outputTanks) tank.serialize(buf);
|
||||
water.serialize(buf);
|
||||
lps.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeLong(maxPower);
|
||||
for(boolean b : didProcess) buf.writeBoolean(b);
|
||||
for(int i = 0; i < 4; i++) this.assemblerModule[i].serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
for(FluidTank tank : inputTanks) tank.deserialize(buf);
|
||||
for(FluidTank tank : outputTanks) tank.deserialize(buf);
|
||||
water.deserialize(buf);
|
||||
lps.deserialize(buf);
|
||||
this.power = buf.readLong();
|
||||
this.maxPower = buf.readLong();
|
||||
for(int i = 0; i < 4; i++) this.didProcess[i] = buf.readBoolean();
|
||||
for(int i = 0; i < 4; i++) this.assemblerModule[i].deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
for(int i = 0; i < inputTanks.length; i++) this.inputTanks[i].readFromNBT(nbt, "i" + i);
|
||||
for(int i = 0; i < outputTanks.length; i++) this.outputTanks[i].readFromNBT(nbt, "i" + i);
|
||||
|
||||
this.water.readFromNBT(nbt, "w");
|
||||
this.lps.readFromNBT(nbt, "s");
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.maxPower = nbt.getLong("maxPower");
|
||||
for(int i = 0; i < 4; i++) this.assemblerModule[i].readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
for(int i = 0; i < inputTanks.length; i++) this.inputTanks[i].writeToNBT(nbt, "i" + i);
|
||||
for(int i = 0; i < outputTanks.length; i++) this.outputTanks[i].writeToNBT(nbt, "i" + i);
|
||||
|
||||
this.water.writeToNBT(nbt, "w");
|
||||
this.lps.writeToNBT(nbt, "s");
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setLong("maxPower", maxPower);
|
||||
for(int i = 0; i < 4; i++) this.assemblerModule[i].writeToNBT(nbt);
|
||||
}
|
||||
|
||||
@Override public long getPower() { return power; }
|
||||
@Override public void setPower(long power) { this.power = power; }
|
||||
@Override public long getMaxPower() { return maxPower; }
|
||||
|
||||
@Override public FluidTank[] getReceivingTanks() { return inputTanks; }
|
||||
@Override public FluidTank[] getSendingTanks() { return outputTanks; }
|
||||
@Override public FluidTank[] getAllTanks() { return allTanks; }
|
||||
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineAssemblyFactory(player.inventory, this); }
|
||||
@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineAssemblyFactory(player.inventory, this); }
|
||||
|
||||
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
if(data.hasKey("index") && data.hasKey("selection")) {
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index >= 0 && index < 4) {
|
||||
this.assemblerModule[index].recipe = selection;
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
if(bb == null) bb = AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 3, zCoord + 3);
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
|
||||
return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo) {
|
||||
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_chemical_factory));
|
||||
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) + "%"));
|
||||
}
|
||||
if(type == UpgradeType.POWER) {
|
||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 25) + "%"));
|
||||
}
|
||||
if(type == UpgradeType.OVERDRIVE) {
|
||||
info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||
upgrades.put(UpgradeType.SPEED, 3);
|
||||
upgrades.put(UpgradeType.POWER, 3);
|
||||
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
public DirPos[] coolantLine;
|
||||
|
||||
@Override // carelessly copy pasted from TileEntityMachineChemicalFactory
|
||||
public Object getDelegateForPosition(int x, int y, int z) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
if(coolantLine == null) coolantLine = new DirPos[] {
|
||||
new DirPos(xCoord + rot.offsetX + dir.offsetX * 2, yCoord, zCoord + rot.offsetZ + dir.offsetZ * 2, dir),
|
||||
new DirPos(xCoord - rot.offsetX + dir.offsetX * 2, yCoord, zCoord - rot.offsetZ + dir.offsetZ * 2, dir),
|
||||
new DirPos(xCoord + rot.offsetX - dir.offsetX * 2, yCoord, zCoord + rot.offsetZ - dir.offsetZ * 2, dir.getOpposite()),
|
||||
new DirPos(xCoord - rot.offsetX - dir.offsetX * 2, yCoord, zCoord - rot.offsetZ - dir.offsetZ * 2, dir.getOpposite()),
|
||||
};
|
||||
|
||||
for(DirPos pos : coolantLine) if(pos.compare(x, y, z)) return this.delegate; // this actually fucking works
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public class DelegateAssemblyFactoy implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2 { // scumware
|
||||
|
||||
@Override public long getPower() { return TileEntityMachineAssemblyFactory.this.getPower(); }
|
||||
@Override public void setPower(long power) { TileEntityMachineAssemblyFactory.this.setPower(power); }
|
||||
@Override public long getMaxPower() { return TileEntityMachineAssemblyFactory.this.getMaxPower(); }
|
||||
@Override public boolean isLoaded() { return TileEntityMachineAssemblyFactory.this.isLoaded(); }
|
||||
|
||||
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {TileEntityMachineAssemblyFactory.this.water}; }
|
||||
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {TileEntityMachineAssemblyFactory.this.lps}; }
|
||||
|
||||
@Override public FluidTank[] getAllTanks() { return TileEntityMachineAssemblyFactory.this.getAllTanks(); }
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase implements IFluidStandardTransceiver, IUpgradeInfoProvider, IFluidCopiable {
|
||||
|
||||
public AssemblerArm[] arms;
|
||||
|
||||
@ -145,14 +145,6 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
upgradeManager.checkSlots(slots, 1, 3);
|
||||
|
||||
inputTanks[0].loadTank(10, 13, slots);
|
||||
inputTanks[1].loadTank(11, 14, slots);
|
||||
inputTanks[2].loadTank(12, 15, slots);
|
||||
|
||||
outputTanks[0].unloadTank(16, 19, slots);
|
||||
outputTanks[1].unloadTank(17, 20, slots);
|
||||
outputTanks[2].unloadTank(18, 21, slots);
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos);
|
||||
@ -188,6 +180,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
|
||||
}
|
||||
}
|
||||
|
||||
// internal fluid sharing logic
|
||||
for(FluidTank in : inputTanks) if(in.getTankType() != Fluids.NONE) for(FluidTank out : outputTanks) { // up to 144 iterations, but most of them are NOP anyway
|
||||
if(out.getTankType() == Fluids.NONE) continue;
|
||||
if(out.getTankType() != in.getTankType()) continue;
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
package com.hbm.tileentity.machine.albion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPADetector;
|
||||
import com.hbm.inventory.gui.GUIPADetector;
|
||||
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes;
|
||||
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes.ParticleAcceleratorRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.machine.albion.TileEntityPASource.PAState;
|
||||
import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
|
||||
@ -142,6 +146,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;
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ public class AchievementHandler {
|
||||
craftingAchievements.put(new ComparableStack(ModBlocks.machine_difurnace_off), MainRegistry.achBlastFurnace);
|
||||
craftingAchievements.put(new ComparableStack(ModBlocks.machine_assembly_machine), MainRegistry.achAssembly);
|
||||
craftingAchievements.put(new ComparableStack(ModItems.billet_pu_mix), MainRegistry.achChicagoPile);
|
||||
craftingAchievements.put(new ComparableStack(ModItems.particle_digamma), MainRegistry.achOmega12);
|
||||
}
|
||||
|
||||
public static void fire(EntityPlayer player, ItemStack stack) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 4.8 KiB |
Loading…
x
Reference in New Issue
Block a user