feat: add multiblock assembler
|
@ -0,0 +1,3 @@
|
|||
package appeng.api.networking;
|
||||
|
||||
public interface IAssemblerCache extends IGridCache {}
|
|
@ -0,0 +1,42 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockAssembler extends BlockAssemblerBase {
|
||||
public BlockAssembler() {
|
||||
super(TileAssembler.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World w,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer p,
|
||||
int side,
|
||||
// useless parameters
|
||||
float alec1,
|
||||
float alec2,
|
||||
float alec3
|
||||
) {
|
||||
TileEntity tileEntity = w.getTileEntity(x, y, z);
|
||||
if (tileEntity != null) {
|
||||
Platform.openGUI(
|
||||
p,
|
||||
tileEntity,
|
||||
ForgeDirection.getOrientation(side),
|
||||
GuiBridge.GUI_ASSEMBLER
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.me.cluster.IAssemblerMB;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public abstract class BlockAssemblerBase extends AEBaseTileBlock {
|
||||
public BlockAssemblerBase(Class<? extends TileEntity> tile) {
|
||||
super(Material.iron);
|
||||
this.setTileEntity(tile);
|
||||
this.setFeature(EnumSet.of(AEFeature.Legacy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(
|
||||
IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ
|
||||
) {
|
||||
super.onNeighborChange(world, x, y, z, tileX, tileY, tileZ);
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (!(te instanceof IAssemblerMB))
|
||||
return;
|
||||
|
||||
((IAssemblerMB) te).calculateMultiblock();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import appeng.tile.legacy.TileAssemblerCraftingAccelerator;
|
||||
|
||||
public class BlockAssemblerCraftingAccelerator extends BlockAssemblerMB {
|
||||
public BlockAssemblerCraftingAccelerator() {
|
||||
super(TileAssemblerCraftingAccelerator.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockAssemblerHeatVent;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
public class BlockAssemblerHeatVent extends BlockAssemblerMB {
|
||||
@Override
|
||||
protected BaseBlockRender<? extends AEBaseBlock, ? extends AEBaseTile> getRenderer() {
|
||||
return new RenderBlockAssemblerHeatVent();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.legacy.TileAssemblerMB;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* A base class that all assembler wall blocks inherit from
|
||||
*/
|
||||
public abstract class BlockAssemblerMB extends BlockAssemblerBase {
|
||||
public BlockAssemblerMB() {
|
||||
this(TileAssemblerMB.class);
|
||||
}
|
||||
|
||||
public BlockAssemblerMB(Class<? extends TileEntity> te) {
|
||||
super(te);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World w,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer p,
|
||||
int side,
|
||||
// useless parameters
|
||||
float alec1,
|
||||
float alec2,
|
||||
float alec3
|
||||
) {
|
||||
TileEntity tileEntity = w.getTileEntity(x, y, z);
|
||||
if (tileEntity != null) {
|
||||
TileAssemblerMB tamb = (TileAssemblerMB) tileEntity;
|
||||
if (tamb.isComplete()) {
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(
|
||||
p,
|
||||
tamb.ac.assemblers.get(0),
|
||||
ForgeDirection.getOrientation(side),
|
||||
GuiBridge.GUI_ASSEMBLER_MB
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package appeng.block.legacy;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockAssemblerWall;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
public class BlockAssemblerWall extends BlockAssemblerMB {
|
||||
@Override
|
||||
protected BaseBlockRender<? extends AEBaseBlock, ? extends AEBaseTile> getRenderer() {
|
||||
return new RenderBlockAssemblerWall();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerAssembler;
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiAssembler extends AEBaseGui {
|
||||
public GuiAssembler(InventoryPlayer inventoryPlayer, TileAssembler tileEntity) {
|
||||
super(new ContainerAssembler(inventoryPlayer, tileEntity));
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("gui.appliedenergistics2.Assembler"),
|
||||
8,
|
||||
6,
|
||||
4210752
|
||||
);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
8,
|
||||
this.ySize - 96 + 3,
|
||||
4210752
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.bindTexture("guis/assembler.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerAssemblerMB;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketChangeAssemblerGuiPage;
|
||||
import appeng.core.sync.packets.PacketUpdateAssemblerGuiPageNum;
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiAssemblerMB extends AEBaseGui {
|
||||
public int pageNumber = 0;
|
||||
public int maxPages = 0;
|
||||
public GuiButton next;
|
||||
public GuiButton prev;
|
||||
|
||||
public GuiAssemblerMB(InventoryPlayer inventoryPlayer, TileAssembler tileEntity) {
|
||||
super(new ContainerAssemblerMB(inventoryPlayer, tileEntity));
|
||||
this.ySize = 222;
|
||||
this.xSize = 223;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("gui.appliedenergistics2.MAC"), 8, 6, 4210752
|
||||
);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
8,
|
||||
this.ySize - 96 + 3,
|
||||
4210752
|
||||
);
|
||||
if (this.maxPages == 0) {
|
||||
this.fontRendererObj.drawString("WTF", 178, 56, 4210752);
|
||||
} else {
|
||||
this.fontRendererObj.drawString(
|
||||
1 + this.pageNumber + " / " + this.maxPages, 178, 56, 4210752
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.bindTexture("guis/mulitiassembler.png");
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
this.next.xPosition = x + this.xSize - 48;
|
||||
this.next.yPosition = y + 6;
|
||||
this.prev.xPosition = x + this.xSize - 48;
|
||||
this.prev.yPosition = y + 29;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.buttonList.add(
|
||||
this.next = new GuiButton(
|
||||
1,
|
||||
238,
|
||||
94,
|
||||
42,
|
||||
20,
|
||||
StatCollector.translateToLocal("gui.appliedenergistics2.Next")
|
||||
)
|
||||
);
|
||||
this.buttonList.add(
|
||||
this.prev = new GuiButton(
|
||||
1,
|
||||
238,
|
||||
94,
|
||||
42,
|
||||
20,
|
||||
StatCollector.translateToLocal("gui.appliedenergistics2.Prev")
|
||||
)
|
||||
);
|
||||
NetworkHandler.instance.sendToServer(new PacketUpdateAssemblerGuiPageNum(0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if (button == this.next) {
|
||||
NetworkHandler.instance.sendToServer(new PacketChangeAssemblerGuiPage(1));
|
||||
} else if (button == this.prev) {
|
||||
NetworkHandler.instance.sendToServer(new PacketChangeAssemblerGuiPage(-1));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import appeng.block.legacy.BlockAssemblerHeatVent;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.legacy.TileAssemblerMB;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderBlockAssemblerHeatVent
|
||||
extends BaseBlockRender<BlockAssemblerHeatVent, TileAssemblerMB> {
|
||||
@Override
|
||||
public boolean renderInWorld(
|
||||
BlockAssemblerHeatVent block,
|
||||
IBlockAccess world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
RenderBlocks renderer
|
||||
) {
|
||||
TileAssemblerMB tile = (TileAssemblerMB) world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile.complete) {
|
||||
block.getRendererInstance().setTemporaryRenderIcon(
|
||||
ExtraBlockTextures.BlockAssemblerHeatVentMerged.getIcon()
|
||||
);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
block.getRendererInstance().setTemporaryRenderIcon(null);
|
||||
return true;
|
||||
}
|
||||
return super.renderInWorld(block, world, x, y, z, renderer);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import appeng.block.legacy.BlockAssemblerWall;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.legacy.TileAssemblerMB;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderBlockAssemblerWall
|
||||
extends BaseBlockRender<BlockAssemblerWall, TileAssemblerMB> {
|
||||
@Override
|
||||
public boolean renderInWorld(
|
||||
BlockAssemblerWall block,
|
||||
IBlockAccess world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
RenderBlocks renderer
|
||||
) {
|
||||
TileAssemblerMB tile = (TileAssemblerMB) world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile.complete) {
|
||||
boolean XAxis = world.getTileEntity(x + 1, y, z) instanceof TileAssemblerMB
|
||||
&& world.getTileEntity(x - 1, y, z) instanceof TileAssemblerMB;
|
||||
boolean YAxis = world.getTileEntity(x, y + 1, z) instanceof TileAssemblerMB
|
||||
&& world.getTileEntity(x, y - 1, z) instanceof TileAssemblerMB;
|
||||
boolean ZAxis = world.getTileEntity(x, y, z + 1) instanceof TileAssemblerMB
|
||||
&& world.getTileEntity(x, y, z - 1) instanceof TileAssemblerMB;
|
||||
if (XAxis) {
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
block.getRendererInstance().setTemporaryRenderIcon(
|
||||
ExtraBlockTextures.BlockAssemblerWallMerged.getIcon()
|
||||
);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
block.getRendererInstance().setTemporaryRenderIcon(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (YAxis) {
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 1;
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
block.getRendererInstance().setTemporaryRenderIcon(
|
||||
ExtraBlockTextures.BlockAssemblerWallMerged.getIcon()
|
||||
);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
block.getRendererInstance().setTemporaryRenderIcon(null);
|
||||
renderer.uvRotateWest = 0;
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateSouth = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ZAxis) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
block.getRendererInstance().setTemporaryRenderIcon(
|
||||
ExtraBlockTextures.BlockAssemblerWallMerged.getIcon()
|
||||
);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
block.getRendererInstance().setTemporaryRenderIcon(null);
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.renderInWorld(block, world, x, y, z, renderer);
|
||||
}
|
||||
}
|
|
@ -127,7 +127,10 @@ public enum ExtraBlockTextures {
|
|||
Controller5("BlockLegacyControllerFront"),
|
||||
ControllerLinked("ControllerLinked"),
|
||||
|
||||
BlockStorageMonitorFrontMatrix("BlockStorageMonitorFront_Matrix");
|
||||
BlockStorageMonitorFrontMatrix("BlockStorageMonitorFront_Matrix"),
|
||||
|
||||
BlockAssemblerWallMerged("BlockAssemblerWallMerged"),
|
||||
BlockAssemblerHeatVentMerged("BlockAssemblerHeatVentMerged");
|
||||
|
||||
private final String name;
|
||||
private IIcon IIcon;
|
||||
|
|
|
@ -72,7 +72,7 @@ public abstract class AEBaseContainer extends Container {
|
|||
private final InventoryPlayer invPlayer;
|
||||
private final BaseActionSource mySrc;
|
||||
private final HashSet<Integer> locked = new HashSet<Integer>();
|
||||
private final TileEntity tileEntity;
|
||||
private TileEntity tileEntity;
|
||||
private final IPart part;
|
||||
private final IGuiItemObject obj;
|
||||
private final List<PacketPartialItem> dataChunks
|
||||
|
@ -325,6 +325,10 @@ public abstract class AEBaseContainer extends Container {
|
|||
return this.tileEntity;
|
||||
}
|
||||
|
||||
public void setTileEntity(TileEntity te) {
|
||||
this.tileEntity = te;
|
||||
}
|
||||
|
||||
public final void updateFullProgressBar(final int idx, final long value) {
|
||||
if (this.syncData.containsKey(idx)) {
|
||||
this.syncData.get(idx).update(value);
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package appeng.container.implementations;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlacableItemType;
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import appeng.util.inv.WrapperChainedInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class ContainerAssembler extends AEBaseContainer {
|
||||
public WrapperChainedInventory myinv;
|
||||
|
||||
public ContainerAssembler(InventoryPlayer ip, TileAssembler te) {
|
||||
this(ip, te.xCoord, te.yCoord, te.zCoord, te, te);
|
||||
}
|
||||
|
||||
public ContainerAssembler(
|
||||
InventoryPlayer pi, int x, int y, int z, TileEntity te, IInventory inv
|
||||
) {
|
||||
super(pi, te, null);
|
||||
int off = 0;
|
||||
this.myinv = new WrapperChainedInventory(inv);
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new SlotRestrictedInput(
|
||||
PlacableItemType.ENCODED_CRAFTING_PATTERN,
|
||||
this.myinv,
|
||||
off++,
|
||||
8 + j * 18,
|
||||
i * 18 + 18,
|
||||
pi
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
this.bindPlayerInventory(pi);
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
|
||||
int i;
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new SlotPlayerInv(
|
||||
inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 140 + i * 18
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(
|
||||
new SlotPlayerHotBar(inventoryPlayer, i, 8 + i * 18, 198)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer p) {
|
||||
return p.getDistanceSq(
|
||||
(double) this.getTileEntity().xCoord + 0.5,
|
||||
(double) this.getTileEntity().yCoord + 0.5,
|
||||
(double) this.getTileEntity().zCoord + 0.5
|
||||
)
|
||||
<= 32.0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package appeng.container.implementations;
|
||||
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerAssemblerMB extends ContainerAssembler {
|
||||
public ContainerAssemblerMB(InventoryPlayer ip, TileAssembler te) {
|
||||
super(ip, te);
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ import appeng.api.features.IRegistryContainer;
|
|||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.features.IWorldGen.WorldGenType;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.networking.IAssemblerCache;
|
||||
import appeng.api.networking.IControllerCache;
|
||||
import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.api.networking.IWirelessCache;
|
||||
|
@ -532,6 +533,7 @@ public final class Registration {
|
|||
gcr.registerGridCache(ICraftingGrid.class, CraftingGridCache.class);
|
||||
gcr.registerGridCache(IWirelessCache.class, WirelessGridCache.class);
|
||||
gcr.registerGridCache(IControllerCache.class, ControllerGridCache.class);
|
||||
gcr.registerGridCache(IAssemblerCache.class, AssemblerGridCache.class);
|
||||
|
||||
registries.externalStorage().addExternalStorageInterface(new AEExternalHandler());
|
||||
|
||||
|
|
|
@ -29,6 +29,10 @@ import appeng.block.AEBaseSlabBlock;
|
|||
import appeng.block.crafting.*;
|
||||
import appeng.block.grindstone.BlockCrank;
|
||||
import appeng.block.grindstone.BlockGrinder;
|
||||
import appeng.block.legacy.BlockAssembler;
|
||||
import appeng.block.legacy.BlockAssemblerCraftingAccelerator;
|
||||
import appeng.block.legacy.BlockAssemblerHeatVent;
|
||||
import appeng.block.legacy.BlockAssemblerWall;
|
||||
import appeng.block.legacy.BlockCraftMonitor;
|
||||
import appeng.block.legacy.BlockCraftTerminal;
|
||||
import appeng.block.legacy.BlockLegacyController;
|
||||
|
@ -143,6 +147,10 @@ public final class ApiBlocks implements IBlocks {
|
|||
private final ITileDefinition transitionPlane;
|
||||
private final ITileDefinition storageMonitor;
|
||||
private final ITileDefinition patternEncoder;
|
||||
private final ITileDefinition assembler;
|
||||
private final ITileDefinition assemblerWall;
|
||||
private final ITileDefinition assemblerHeatVent;
|
||||
private final ITileDefinition assemblerCraftingAccelerator;
|
||||
|
||||
public ApiBlocks(final DefinitionConstructor constructor) {
|
||||
final BlockLightDetector lightDetector = new BlockLightDetector();
|
||||
|
@ -324,6 +332,12 @@ public final class ApiBlocks implements IBlocks {
|
|||
= constructor.registerTileDefinition(new BlockStorageMonitor());
|
||||
this.patternEncoder
|
||||
= constructor.registerTileDefinition(new BlockPatternEncoder());
|
||||
this.assembler = constructor.registerTileDefinition(new BlockAssembler());
|
||||
this.assemblerWall = constructor.registerTileDefinition(new BlockAssemblerWall());
|
||||
this.assemblerHeatVent
|
||||
= constructor.registerTileDefinition(new BlockAssemblerHeatVent());
|
||||
this.assemblerCraftingAccelerator
|
||||
= constructor.registerTileDefinition(new BlockAssemblerCraftingAccelerator());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -78,7 +78,11 @@ public class AppEngPacketHandlerBase {
|
|||
|
||||
PACKET_COMPRESSED_NBT(PacketCompressedNBT.class),
|
||||
|
||||
PACKET_PAINTED_ENTITY(PacketPaintedEntity.class);
|
||||
PACKET_PAINTED_ENTITY(PacketPaintedEntity.class),
|
||||
|
||||
PACKET_CHANGE_ASSEMBLER_GUI_PAGE(PacketChangeAssemblerGuiPage.class),
|
||||
|
||||
PACKET_UPDATE_ASSEMBLER_GUI_PAGE_NUM(PacketUpdateAssemblerGuiPageNum.class);
|
||||
|
||||
private final Class<? extends AppEngPacket> packetClass;
|
||||
private final Constructor<? extends AppEngPacket> packetConstructor;
|
||||
|
|
|
@ -59,6 +59,7 @@ import appeng.parts.reporting.PartPatternTerminal;
|
|||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import appeng.tile.legacy.TileLegacyController;
|
||||
import appeng.tile.legacy.TilePatternEncoder;
|
||||
import appeng.tile.misc.*;
|
||||
|
@ -75,6 +76,7 @@ import cpw.mods.fml.common.network.IGuiHandler;
|
|||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
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;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -280,6 +282,20 @@ public enum GuiBridge implements IGuiHandler {
|
|||
TilePatternEncoder.class,
|
||||
GuiHostType.WORLD,
|
||||
SecurityPermissions.CRAFT
|
||||
),
|
||||
|
||||
GUI_ASSEMBLER(
|
||||
ContainerAssembler.class,
|
||||
TileAssembler.class,
|
||||
GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD
|
||||
),
|
||||
|
||||
GUI_ASSEMBLER_MB(
|
||||
ContainerAssemblerMB.class,
|
||||
TileAssembler.class,
|
||||
GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD
|
||||
);
|
||||
|
||||
private final Class tileClass;
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
package appeng.core.sync.packets;
|
||||
|
||||
import appeng.container.implementations.ContainerAssembler;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.me.cluster.implementations.AssemblerCluster;
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
public class PacketChangeAssemblerGuiPage extends AppEngPacket {
|
||||
int direction;
|
||||
|
||||
// automatic.
|
||||
public PacketChangeAssemblerGuiPage(ByteBuf buf) {
|
||||
this.direction = buf.readInt();
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketChangeAssemblerGuiPage(int direction) {
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
|
||||
buf.writeInt(this.getPacketID());
|
||||
buf.writeInt(this.direction = direction);
|
||||
|
||||
this.configureWrite(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) {
|
||||
EntityPlayerMP pmp = (EntityPlayerMP) player;
|
||||
Container c = pmp.openContainer;
|
||||
int offset;
|
||||
if (c != null && c instanceof ContainerAssembler) {
|
||||
ContainerAssembler ca = (ContainerAssembler) c;
|
||||
TileAssembler ta = (TileAssembler) ca.getTileEntity();
|
||||
if (ta != null) {
|
||||
AssemblerCluster ac = (AssemblerCluster) ta.getCluster();
|
||||
if (ac == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ac.assemblers == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
offset = -1;
|
||||
|
||||
for (int i = 0; i < ac.assemblers.size(); i++) {
|
||||
if (ac.assemblers.get(i) == ta) {
|
||||
offset = i;
|
||||
}
|
||||
}
|
||||
|
||||
offset += this.direction;
|
||||
if (offset < 0) {
|
||||
offset = ac.assemblers.size() - 1;
|
||||
}
|
||||
|
||||
if (offset >= ac.assemblers.size()) {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
ac.setLastOffset(offset);
|
||||
TileAssembler nta = ac.getAssembler(offset);
|
||||
ca.myinv.setInventory(nta);
|
||||
ca.setTileEntity(nta);
|
||||
|
||||
NetworkHandler.instance.sendTo(
|
||||
new PacketUpdateAssemblerGuiPageNum(offset, ac.assemblers.size()),
|
||||
(EntityPlayerMP) player
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package appeng.core.sync.packets;
|
||||
|
||||
import appeng.client.gui.implementations.GuiAssemblerMB;
|
||||
import appeng.container.implementations.ContainerAssembler;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.me.cluster.implementations.AssemblerCluster;
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
public class PacketUpdateAssemblerGuiPageNum extends AppEngPacket {
|
||||
int offset;
|
||||
int size;
|
||||
|
||||
// automatic.
|
||||
public PacketUpdateAssemblerGuiPageNum(ByteBuf buf) {
|
||||
this.offset = buf.readInt();
|
||||
this.size = buf.readInt();
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketUpdateAssemblerGuiPageNum(int offset, int size) {
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
|
||||
buf.writeInt(this.getPacketID());
|
||||
buf.writeInt(this.offset = offset);
|
||||
buf.writeInt(this.size = size);
|
||||
|
||||
this.configureWrite(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void
|
||||
clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player) {
|
||||
GuiScreen cs = FMLClientHandler.instance().getClient().currentScreen;
|
||||
|
||||
if (cs instanceof GuiAssemblerMB) {
|
||||
GuiAssemblerMB ga = (GuiAssemblerMB) cs;
|
||||
|
||||
ga.pageNumber = this.offset;
|
||||
ga.maxPages = this.size;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) {
|
||||
if (player.openContainer instanceof ContainerAssembler) {
|
||||
ContainerAssembler ca = (ContainerAssembler) player.openContainer;
|
||||
TileAssembler ta = (TileAssembler) ca.getTileEntity();
|
||||
AssemblerCluster ac = (AssemblerCluster) ta.getCluster();
|
||||
|
||||
int offset = -1;
|
||||
for (int i = 0; i < ac.assemblers.size(); i++) {
|
||||
if (ac.assemblers.get(i) == ta) {
|
||||
offset = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NetworkHandler.instance.sendTo(
|
||||
new PacketUpdateAssemblerGuiPageNum(offset, ac.assemblers.size()),
|
||||
(EntityPlayerMP) player
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package appeng.me.cache;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.api.networking.IAssemblerCache;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IGridStorage;
|
||||
import appeng.me.cluster.implementations.AssemblerCluster;
|
||||
|
||||
public class AssemblerGridCache implements IAssemblerCache {
|
||||
Set<AssemblerCluster> assemblers = new HashSet<>();
|
||||
int cooldown = 0;
|
||||
|
||||
public AssemblerGridCache(IGrid grid) {}
|
||||
|
||||
@Override
|
||||
public void onUpdateTick() {
|
||||
if (--this.cooldown > 0)
|
||||
return;
|
||||
this.cooldown = 20;
|
||||
|
||||
|
||||
Iterator<AssemblerCluster> it = this.assemblers.iterator();
|
||||
while (it.hasNext()) {
|
||||
AssemblerCluster ac = it.next();
|
||||
if (ac.isDestroyed) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
ac.onOperation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNode(IGridNode gridNode, IGridHost machine) {}
|
||||
|
||||
@Override
|
||||
public void addNode(IGridNode gridNode, IGridHost machine) {}
|
||||
|
||||
@Override
|
||||
public void onSplit(IGridStorage destinationStorage) {}
|
||||
|
||||
@Override
|
||||
public void onJoin(IGridStorage sourceStorage) {}
|
||||
|
||||
@Override
|
||||
public void populateGridStorage(IGridStorage destinationStorage) {}
|
||||
|
||||
public void addCluster(AssemblerCluster cluster) {
|
||||
this.assemblers.add(cluster);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package appeng.me.cluster;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IAssemblerCluster extends IAECluster {
|
||||
boolean canCraft();
|
||||
|
||||
TileEntity getAssembler(int var1);
|
||||
|
||||
int getLastOffset();
|
||||
|
||||
void setLastOffset(int var1);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package appeng.me.cluster;
|
||||
|
||||
import appeng.api.util.WorldCoord;
|
||||
|
||||
public interface IAssemblerMB {
|
||||
WorldCoord getLocation();
|
||||
|
||||
IAssemblerCluster getCluster();
|
||||
|
||||
void updateStatus(IAssemblerCluster var1);
|
||||
|
||||
boolean isComplete();
|
||||
|
||||
void calculateMultiblock();
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
package appeng.me.cluster.implementations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cluster.IAssemblerCluster;
|
||||
import appeng.tile.legacy.TileAssembler;
|
||||
import appeng.tile.legacy.TileAssemblerMB;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.google.common.collect.Iterators;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AssemblerCluster implements IAssemblerCluster {
|
||||
public WorldCoord min;
|
||||
public WorldCoord max;
|
||||
public boolean isDestroyed = false;
|
||||
public int lastPage;
|
||||
public int accelerators;
|
||||
public IInventory inv;
|
||||
public List<TileAssemblerMB> mb = new ArrayList<>();
|
||||
public List<TileAssembler> assemblers = new ArrayList<>();
|
||||
public long inst;
|
||||
public Job[] jobs;
|
||||
|
||||
public AssemblerCluster(WorldCoord _min, WorldCoord _max) {
|
||||
this.min = _min;
|
||||
this.max = _max;
|
||||
}
|
||||
|
||||
public void onOperation() {
|
||||
for (int i = 0; i < this.jobs.length; i++) {
|
||||
if (this.jobs[i] == null)
|
||||
continue;
|
||||
|
||||
ItemStack out = this.jobs[i].det.getOutput(
|
||||
this.jobs[i].inv, this.assemblers.get(0).getWorldObj()
|
||||
);
|
||||
|
||||
if (out != null) {
|
||||
try {
|
||||
IMEMonitor<IAEItemStack> inv
|
||||
= this.assemblers.get(0).getProxy().getStorage().getItemInventory(
|
||||
);
|
||||
|
||||
inv.injectItems(
|
||||
AEItemStack.create(out),
|
||||
Actionable.MODULATE,
|
||||
new MachineSource(this.assemblers.get(0))
|
||||
);
|
||||
|
||||
} catch (GridAccessException kek) {}
|
||||
}
|
||||
|
||||
this.jobs[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public TileAssembler getAssembler(int i) {
|
||||
return this.assemblers.get(i);
|
||||
}
|
||||
|
||||
public boolean addCraft(Job job) {
|
||||
for (int i = 0; i < this.jobs.length; i++) {
|
||||
if (this.jobs[i] == null) {
|
||||
this.jobs[i] = job;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canCraft() {
|
||||
for (Job j : this.jobs)
|
||||
if (j == null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if (!this.isDestroyed) {
|
||||
this.isDestroyed = true;
|
||||
if (!this.mb.isEmpty()) {
|
||||
// TODO: WTF
|
||||
//TileAssemblerMB mb = this.mb.get(0);
|
||||
//mb.sendUpdate(false, (Player) null);
|
||||
}
|
||||
|
||||
for (TileAssembler as : this.assemblers) {
|
||||
as.updateStatus(null);
|
||||
}
|
||||
|
||||
for (TileAssemblerMB r : this.mb) {
|
||||
r.updateStatus(null);
|
||||
// TODO: WTF
|
||||
//MinecraftForge.EVENT_BUS.post(new GridTileConnectivityEvent(
|
||||
// (IGridTileEntity) r.getTile(),
|
||||
// ((TileAssemblerMB) r.getTile()).getWorld(),
|
||||
// ((TileAssemblerMB) r.getTile()).getLocation()
|
||||
//));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getLastOffset() {
|
||||
return this.lastPage <= 0
|
||||
? 0
|
||||
: (this.lastPage >= this.assemblers.size() ? 0 : this.lastPage);
|
||||
}
|
||||
|
||||
public void setLastOffset(int x) {
|
||||
this.lastPage = x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(boolean updateGrid) {
|
||||
// TODO: WTF
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IGridHost> getTiles() {
|
||||
return Iterators.<IGridHost>concat(
|
||||
this.mb.iterator(), this.assemblers.iterator()
|
||||
);
|
||||
}
|
||||
|
||||
public static class Job {
|
||||
public ICraftingPatternDetails det;
|
||||
public InventoryCrafting inv;
|
||||
|
||||
public Job(ICraftingPatternDetails det, InventoryCrafting inv) {
|
||||
this.det = det;
|
||||
this.inv = inv;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,530 @@
|
|||
package appeng.tile.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.networking.IAssemblerCache;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.crafting.ICraftingProvider;
|
||||
import appeng.api.networking.crafting.ICraftingProviderHelper;
|
||||
import appeng.api.networking.events.MENetworkCraftingPatternChange;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.block.legacy.BlockAssemblerHeatVent;
|
||||
import appeng.block.legacy.BlockAssemblerWall;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.AssemblerGridCache;
|
||||
import appeng.me.cluster.IAssemblerCluster;
|
||||
import appeng.me.cluster.IAssemblerMB;
|
||||
import appeng.me.cluster.implementations.AssemblerCluster;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorIInventory;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileAssembler extends AENetworkTile
|
||||
implements IAssemblerMB, IAEAppEngInventory, IInventory, ICraftingProvider {
|
||||
AssemblerCluster ac = null;
|
||||
AppEngInternalInventory inv = new AppEngInternalInventory(this, 54);
|
||||
|
||||
public TileAssembler() {
|
||||
super();
|
||||
// TODO: WTF
|
||||
//super.updatesOnPower = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//protected void terminate() {
|
||||
// super.terminate();
|
||||
// if (this.ac != null) {
|
||||
// this.ac.destroy();
|
||||
// }
|
||||
|
||||
// this.ac = null;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int var1, ItemStack var2) {
|
||||
this.inv.setInventorySlotContents(var1, var2);
|
||||
try {
|
||||
this.getProxy().getGrid().postEvent(
|
||||
new MENetworkCraftingPatternChange(this, this.getProxy().getNode())
|
||||
);
|
||||
} catch (GridAccessException kek) {}
|
||||
}
|
||||
|
||||
public ItemStack decrStackSize(int var1, int var2) {
|
||||
ItemStack is = this.inv.decrStackSize(var1, var2);
|
||||
try {
|
||||
this.getProxy().getGrid().postEvent(
|
||||
new MENetworkCraftingPatternChange(this, this.getProxy().getNode())
|
||||
);
|
||||
} catch (GridAccessException kek) {}
|
||||
return is;
|
||||
}
|
||||
|
||||
public IAssemblerCluster getCluster() {
|
||||
return this.ac;
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//@Override
|
||||
public boolean isComplete() {
|
||||
return this.ac != null;
|
||||
}
|
||||
|
||||
public static void
|
||||
completeRegion(IBlockAccess w, WorldCoord min, WorldCoord max, AssemblerCluster ac) {
|
||||
TileAssemblerMB lastMB = null;
|
||||
|
||||
for (int x = min.x; x <= max.x; ++x) {
|
||||
for (int y = min.y; y <= max.y; ++y) {
|
||||
for (int z = min.z; z <= max.z; ++z) {
|
||||
TileEntity te = w.getTileEntity(x, y, z);
|
||||
AssemblerCluster acc;
|
||||
if (te instanceof TileAssembler) {
|
||||
if (ac == null) {
|
||||
acc = ((TileAssembler) te).ac;
|
||||
if (acc != null) {
|
||||
acc.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
((TileAssembler) te).updateStatus(ac);
|
||||
} else if (te instanceof TileAssemblerMB) {
|
||||
if (ac == null) {
|
||||
acc = ((TileAssemblerMB) te).ac;
|
||||
if (acc != null) {
|
||||
acc.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
lastMB = (TileAssemblerMB) te;
|
||||
((TileAssemblerMB) te).updateStatus(ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ac != null && lastMB != null) {
|
||||
lastMB.sendUpdate(true, null);
|
||||
try {
|
||||
IAssemblerCache cache
|
||||
= lastMB.getProxy().getGrid().getCache(IAssemblerCache.class);
|
||||
((AssemblerGridCache) cache).addCluster(ac);
|
||||
} catch (GridAccessException kek) {}
|
||||
// TODO: WTF
|
||||
//MinecraftForge.EVENT_BUS.post(new GridTileConnectivityEvent(
|
||||
// lastMB, lastMB.field_70331_k, lastMB.getLocation()
|
||||
//));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean requiresTickingUpdates() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static AssemblerCluster
|
||||
verifyOwnedRegion(IBlockAccess w, WorldCoord min, WorldCoord max) {
|
||||
AssemblerCluster ac = new AssemblerCluster(min, max);
|
||||
ac.assemblers = new ArrayList<>();
|
||||
ac.mb = new ArrayList<>();
|
||||
ac.accelerators = 1;
|
||||
|
||||
for (int x = min.x; x <= max.x; ++x) {
|
||||
for (int y = min.y; y <= max.y; ++y) {
|
||||
for (int z = min.z; z <= max.z; ++z) {
|
||||
TileEntity te = w.getTileEntity(x, y, z);
|
||||
if (x != min.x && x != max.x && y != min.y && y != max.y && z != min.z
|
||||
&& z != max.z && te instanceof TileAssembler) {
|
||||
ac.assemblers.add((TileAssembler) te);
|
||||
} else {
|
||||
if (!(te instanceof TileAssemblerMB)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Block mb = te.getBlockType();
|
||||
if (mb == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ac.mb.add((TileAssemblerMB) te);
|
||||
if (te instanceof TileAssemblerCraftingAccelerator) {
|
||||
++ac.accelerators;
|
||||
} else if (x != min.x && x != max.x && y != min.y && y != max.y && z != min.z && z != max.z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (x == min.x && z == min.z || x == min.x && z == max.z
|
||||
|| x == max.x && z == min.z || x == max.x && z == max.z
|
||||
|| x == min.x && y == min.y || x == min.x && y == max.y
|
||||
|| x == max.x && y == min.y || x == max.x && y == max.y
|
||||
|| z == min.z && y == min.y || z == min.z && y == max.y
|
||||
|| z == max.z && y == min.y || z == max.z && y == max.y
|
||||
|| y == min.y && x == min.x || y == min.y && x == max.x
|
||||
|| y == max.y && z == min.z || y == max.y && z == max.z) {
|
||||
if (!(mb instanceof BlockAssemblerWall)) {
|
||||
return null;
|
||||
}
|
||||
} else if ((x == max.x || x == min.x || y == min.y || y == max.y || z == min.z || z == max.z) && !(mb instanceof BlockAssemblerHeatVent)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ac.jobs = new AssemblerCluster.Job[ac.accelerators];
|
||||
|
||||
if (ac.assemblers.size() > 0) {
|
||||
return ac;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean verifyUnownedRegionInner(
|
||||
IBlockAccess w,
|
||||
int minx,
|
||||
int miny,
|
||||
int minz,
|
||||
int maxx,
|
||||
int maxy,
|
||||
int maxz,
|
||||
ForgeDirection side
|
||||
) {
|
||||
switch (side) {
|
||||
case WEST:
|
||||
--minx;
|
||||
maxx = minx;
|
||||
break;
|
||||
case EAST:
|
||||
++maxx;
|
||||
minx = maxx;
|
||||
break;
|
||||
case DOWN:
|
||||
--miny;
|
||||
maxy = miny;
|
||||
break;
|
||||
case NORTH:
|
||||
++maxz;
|
||||
minz = maxz;
|
||||
break;
|
||||
case SOUTH:
|
||||
--minz;
|
||||
maxz = minz;
|
||||
break;
|
||||
case UP:
|
||||
++maxy;
|
||||
miny = maxy;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int x = minx; x <= maxx; ++x) {
|
||||
for (int y = miny; y <= maxy; ++y) {
|
||||
for (int z = minz; z <= maxz; ++z) {
|
||||
TileEntity te = w.getTileEntity(x, y, z);
|
||||
if (te instanceof TileAssemblerMB) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean
|
||||
verifyUnownedRegion(IBlockAccess w, WorldCoord min, WorldCoord max) {
|
||||
ForgeDirection[] arr$ = ForgeDirection.VALID_DIRECTIONS;
|
||||
int len$ = arr$.length;
|
||||
|
||||
for (int i$ = 0; i$ < len$; ++i$) {
|
||||
ForgeDirection side = arr$[i$];
|
||||
if (verifyUnownedRegionInner(
|
||||
w, min.x, min.y, min.z, max.x, max.y, max.z, side
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateMultiblock() {
|
||||
calculateMultiblockR(this);
|
||||
}
|
||||
|
||||
public static boolean isAnAssembler(IBlockAccess w, int x, int y, int z) {
|
||||
TileEntity TE = w.getTileEntity(x, y, z);
|
||||
return TE instanceof IAssemblerMB;
|
||||
}
|
||||
|
||||
public static void calculateMultiblockR(IAssemblerMB start) {
|
||||
if (!Platform.isClient()) {
|
||||
try {
|
||||
WorldCoord min = start.getLocation();
|
||||
WorldCoord max = start.getLocation();
|
||||
|
||||
World w;
|
||||
for (w = ((TileEntity) start).getWorldObj();
|
||||
isAnAssembler(w, min.x - 1, min.y, min.z);
|
||||
--min.x) {}
|
||||
|
||||
while (isAnAssembler(w, min.x, min.y - 1, min.z)) {
|
||||
--min.y;
|
||||
}
|
||||
|
||||
while (isAnAssembler(w, min.x, min.y, min.z - 1)) {
|
||||
--min.z;
|
||||
}
|
||||
|
||||
while (isAnAssembler(w, max.x + 1, max.y, max.z)) {
|
||||
++max.x;
|
||||
}
|
||||
|
||||
while (isAnAssembler(w, max.x, max.y + 1, max.z)) {
|
||||
++max.y;
|
||||
}
|
||||
|
||||
while (isAnAssembler(w, max.x, max.y, max.z + 1)) {
|
||||
++max.z;
|
||||
}
|
||||
|
||||
if (max.x - min.x >= 2 && max.y - min.y >= 2 && max.z - min.z >= 2) {
|
||||
AssemblerCluster ac = verifyOwnedRegion(w, min, max);
|
||||
if (ac != null && verifyUnownedRegion(w, min, max)) {
|
||||
completeRegion(w, min, max, ac);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WorldCoord pos = start.getLocation();
|
||||
ForgeDirection[] arr$ = ForgeDirection.values();
|
||||
int len$ = arr$.length;
|
||||
|
||||
for (int i$ = 0; i$ < len$; ++i$) {
|
||||
ForgeDirection d = arr$[i$];
|
||||
TileEntity TE = w.getTileEntity(
|
||||
pos.x + d.offsetX, pos.y + d.offsetY, pos.z + d.offsetZ
|
||||
);
|
||||
if (TE instanceof IAssemblerMB) {
|
||||
AssemblerCluster ac
|
||||
= (AssemblerCluster) ((IAssemblerMB) TE).getCluster();
|
||||
if (ac != null) {
|
||||
ac.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable var18) {}
|
||||
}
|
||||
}
|
||||
|
||||
public String getInventoryName() {
|
||||
return "ME Pattern Provider";
|
||||
}
|
||||
|
||||
public float getPowerDrainPerTick() {
|
||||
return this.ac != null ? 1.0F : 0.0F;
|
||||
}
|
||||
|
||||
public void updateStatus(IAssemblerCluster _ac) {
|
||||
boolean wasComplete = this.ac != null;
|
||||
this.ac = (AssemblerCluster) _ac;
|
||||
if (wasComplete != (this.ac != null)) {
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.ac != null;
|
||||
}
|
||||
|
||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||
if (stack.getItem() instanceof ICraftingPatternItem) {
|
||||
InventoryAdaptor ia = new AdaptorIInventory(this);
|
||||
ItemStack used = null;
|
||||
int originalStackSize = stack.stackSize;
|
||||
if (doAdd) {
|
||||
used = ia.addItems(stack);
|
||||
} else {
|
||||
used = ia.simulateAdd(stack);
|
||||
}
|
||||
|
||||
return used == null ? originalStackSize : originalStackSize - used.stackSize;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack[] extractItem(
|
||||
boolean doRemove, ForgeDirection from, int maxItemCount
|
||||
) {
|
||||
ItemStack[] output = new ItemStack[1];
|
||||
InventoryAdaptor ia = new AdaptorIInventory(this);
|
||||
if (doRemove) {
|
||||
output[0] = ia.removeItems(
|
||||
maxItemCount, (ItemStack) null, (IInventoryDestination) null
|
||||
);
|
||||
} else {
|
||||
output[0] = ia.simulateRemove(
|
||||
maxItemCount, (ItemStack) null, (IInventoryDestination) null
|
||||
);
|
||||
}
|
||||
|
||||
return output[0] == null ? new ItemStack[0] : output;
|
||||
}
|
||||
|
||||
public boolean hasCustomInventoryName() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
if (itemstack.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails pat
|
||||
= ((ICraftingPatternItem) itemstack.getItem())
|
||||
.getPatternForItem(itemstack, this.worldObj);
|
||||
|
||||
return pat != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSeperated() {
|
||||
return !this.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this
|
||||
? false
|
||||
: entityplayer.getDistanceSq(
|
||||
(double) this.xCoord + 0.5,
|
||||
(double) this.yCoord + 0.5,
|
||||
(double) this.zCoord + 0.5
|
||||
) <= 32.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added
|
||||
) {}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return this.inv.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int idx) {
|
||||
return this.inv.getStackInSlot(idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int idx) {
|
||||
return this.inv.getStackInSlotOnClosing(idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return this.inv.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
this.inv.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
this.inv.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkLoad() {
|
||||
super.onChunkLoad();
|
||||
if (this.ac != null)
|
||||
return;
|
||||
|
||||
this.calculateMultiblock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean
|
||||
pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table) {
|
||||
if (this.ac == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < this.getSizeInventory(); i++) {
|
||||
ItemStack is = this.getStackInSlot(i);
|
||||
if (is == null || !(is.getItem() instanceof ICraftingPatternItem))
|
||||
continue;
|
||||
|
||||
if (((ICraftingPatternItem) is.getItem())
|
||||
.getPatternForItem(is, this.worldObj)
|
||||
.equals(patternDetails)) {
|
||||
return this.ac.addCraft(new AssemblerCluster.Job(patternDetails, table));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBusy() {
|
||||
if (this.ac == null)
|
||||
return true;
|
||||
|
||||
return !this.ac.canCraft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
|
||||
if (this.ac == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < this.getSizeInventory(); i++) {
|
||||
ItemStack is = this.getStackInSlot(i);
|
||||
if (is == null || !(is.getItem() instanceof ICraftingPatternItem))
|
||||
continue;
|
||||
|
||||
ICraftingPatternDetails det = ((ICraftingPatternItem) is.getItem())
|
||||
.getPatternForItem(is, this.worldObj);
|
||||
|
||||
craftingTracker.addCraftingOption(this, det);
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNbtTileAssembler(NBTTagCompound nbt) {
|
||||
this.inv.writeToNBT(nbt, "inv");
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNbtTileAssembler(NBTTagCompound nbt) {
|
||||
this.inv.readFromNBT(nbt, "inv");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package appeng.tile.legacy;
|
||||
|
||||
public class TileAssemblerCraftingAccelerator extends TileAssemblerMB {
|
||||
public TileAssemblerCraftingAccelerator() {
|
||||
super();
|
||||
this.getProxy().setIdlePowerUsage(1.0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,406 @@
|
|||
package appeng.tile.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.me.cluster.IAssemblerCluster;
|
||||
import appeng.me.cluster.IAssemblerMB;
|
||||
import appeng.me.cluster.implementations.AssemblerCluster;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.WrapperChainedInventory;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileAssemblerMB extends AENetworkTile implements IAssemblerMB, IInventory {
|
||||
public boolean complete;
|
||||
public AssemblerCluster ac;
|
||||
private boolean isEdge;
|
||||
int state = -1;
|
||||
|
||||
public TileAssemblerMB() {
|
||||
// TODO: WTF
|
||||
//super.updatesOnPower = false;
|
||||
this.getProxy().setIdlePowerUsage(0.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//protected void terminate() {
|
||||
// super.terminate();
|
||||
// if (this.ac != null) {
|
||||
// this.ac.destroy();
|
||||
// }
|
||||
|
||||
// this.ac = null;
|
||||
//}
|
||||
|
||||
public IAssemblerCluster getCluster() {
|
||||
return this.ac;
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return this.complete || this.ac != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateMultiblock() {
|
||||
TileAssembler.calculateMultiblockR(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady() {
|
||||
super.onReady();
|
||||
// TODO: crafting accelerator
|
||||
//this.isEdge
|
||||
// = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)
|
||||
// != AppEng.getInstance().registration.blkCraftingAccelerator.getMetaData();
|
||||
this.onNeighborBlockChange();
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
int o = 0;
|
||||
// TODO: WTF
|
||||
//if (AppEng.getInstance().GridManager.getEntityFromCoord(new DimentionalCoord(
|
||||
// this.worldObj, this.xCoord - 1, this.yCoord, this.zCoord
|
||||
// ))
|
||||
// != null) {
|
||||
// o |= 1;
|
||||
//}
|
||||
|
||||
//if (AppEng.getInstance().GridManager.getEntityFromCoord(new DimentionalCoord(
|
||||
// this.field_70331_k,
|
||||
// this.field_70329_l + 1,
|
||||
// this.field_70330_m,
|
||||
// this.field_70327_n
|
||||
// ))
|
||||
// != null) {
|
||||
// o |= 2;
|
||||
//}
|
||||
|
||||
//if (AppEng.getInstance().GridManager.getEntityFromCoord(new DimentionalCoord(
|
||||
// this.field_70331_k,
|
||||
// this.field_70329_l,
|
||||
// this.field_70330_m - 1,
|
||||
// this.field_70327_n
|
||||
// ))
|
||||
// != null) {
|
||||
// o |= 4;
|
||||
//}
|
||||
|
||||
//if (AppEng.getInstance().GridManager.getEntityFromCoord(new DimentionalCoord(
|
||||
// this.field_70331_k,
|
||||
// this.field_70329_l,
|
||||
// this.field_70330_m + 1,
|
||||
// this.field_70327_n
|
||||
// ))
|
||||
// != null) {
|
||||
// o |= 8;
|
||||
//}
|
||||
|
||||
//if (AppEng.getInstance().GridManager.getEntityFromCoord(new DimentionalCoord(
|
||||
// this.field_70331_k,
|
||||
// this.field_70329_l,
|
||||
// this.field_70330_m,
|
||||
// this.field_70327_n - 1
|
||||
// ))
|
||||
// != null) {
|
||||
// o |= 16;
|
||||
//}
|
||||
|
||||
//if (AppEng.getInstance().GridManager.getEntityFromCoord(new DimentionalCoord(
|
||||
// this.field_70331_k,
|
||||
// this.field_70329_l,
|
||||
// this.field_70330_m,
|
||||
// this.field_70327_n + 1
|
||||
// ))
|
||||
// != null) {
|
||||
// o |= 32;
|
||||
//}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange() {
|
||||
if (this.isEdge) {
|
||||
int newState = this.getState();
|
||||
int oldState = this.state;
|
||||
if (this.state != newState) {
|
||||
this.state = newState;
|
||||
// TODO: WTF
|
||||
//MinecraftForge.EVENT_BUS.post(new MultiBlockUpdateEvent(
|
||||
// this, this.worldObj, this.getLocation()
|
||||
//));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: renderer
|
||||
//@SideOnly(Side.CLIENT)
|
||||
//public boolean renderWorldBlock(
|
||||
// IBlockAccess world,
|
||||
// int x,
|
||||
// int y,
|
||||
// int z,
|
||||
// Block block,
|
||||
// int modelId,
|
||||
// RenderBlocks renderer
|
||||
//) {
|
||||
// AppEngBlockRenderer appEngRenderer = AppEngBlockRenderer.instance;
|
||||
// AppEngSubBlock sb = ((AppEngMultiBlock) block).getSubBlock(this.func_70322_n());
|
||||
// if (this.complete) {
|
||||
// if (sb == AppEng.getInstance().registration.blkHeatVent) {
|
||||
// block.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
// appEngRenderer.setOverrideBlockTexture(
|
||||
// block, AppEngTextureRegistry.Blocks.BlockHeatVentMerged.get()
|
||||
// );
|
||||
// renderer.func_83018_a(block);
|
||||
// renderer.func_78570_q(block, x, y, z);
|
||||
// appEngRenderer.setOverrideBlockTexture(block, (Icon) null);
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// if (sb == AppEng.getInstance().registration.blkAssemblerFieldWall) {
|
||||
// boolean XAxis = world.func_72796_p(x + 1, y, z) instanceof
|
||||
// TileAssemblerMB
|
||||
// && world.func_72796_p(x - 1, y, z) instanceof TileAssemblerMB;
|
||||
// boolean YAxis = world.func_72796_p(x, y + 1, z) instanceof
|
||||
// TileAssemblerMB
|
||||
// && world.func_72796_p(x, y - 1, z) instanceof TileAssemblerMB;
|
||||
// boolean ZAxis = world.func_72796_p(x, y, z + 1) instanceof
|
||||
// TileAssemblerMB
|
||||
// && world.func_72796_p(x, y, z - 1) instanceof TileAssemblerMB;
|
||||
// if (XAxis) {
|
||||
// block.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
// appEngRenderer.setOverrideBlockTexture(
|
||||
// block,
|
||||
// AppEngTextureRegistry.Blocks.BlockContainmentWallMerged.get()
|
||||
// );
|
||||
// renderer.func_83018_a(block);
|
||||
// renderer.func_78570_q(block, x, y, z);
|
||||
// appEngRenderer.setOverrideBlockTexture(block, (Icon) null);
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// if (YAxis) {
|
||||
// renderer.field_78683_h = 1;
|
||||
// renderer.field_78662_g = 1;
|
||||
// renderer.field_78679_j = 1;
|
||||
// renderer.field_78685_i = 1;
|
||||
// block.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
// appEngRenderer.setOverrideBlockTexture(
|
||||
// block,
|
||||
// AppEngTextureRegistry.Blocks.BlockContainmentWallMerged.get()
|
||||
// );
|
||||
// renderer.func_83018_a(block);
|
||||
// renderer.func_78570_q(block, x, y, z);
|
||||
// appEngRenderer.setOverrideBlockTexture(block, (Icon) null);
|
||||
// renderer.field_78683_h = 0;
|
||||
// renderer.field_78662_g = 0;
|
||||
// renderer.field_78679_j = 0;
|
||||
// renderer.field_78685_i = 0;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// if (ZAxis) {
|
||||
// renderer.field_78681_k = 1;
|
||||
// renderer.field_78675_l = 1;
|
||||
// block.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
// appEngRenderer.setOverrideBlockTexture(
|
||||
// block,
|
||||
// AppEngTextureRegistry.Blocks.BlockContainmentWallMerged.get()
|
||||
// );
|
||||
// renderer.func_83018_a(block);
|
||||
// renderer.func_78570_q(block, x, y, z);
|
||||
// appEngRenderer.setOverrideBlockTexture(block, (Icon) null);
|
||||
// renderer.field_78681_k = 0;
|
||||
// renderer.field_78675_l = 0;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return super.renderWorldBlock(world, x, y, z, block, modelId, renderer);
|
||||
//}
|
||||
|
||||
public void updateStatus(IAssemblerCluster _ac) {
|
||||
this.ac = (AssemblerCluster) _ac;
|
||||
if (!Platform.isClient()) {
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
if (Platform.isClient()) {
|
||||
return this.complete;
|
||||
} else {
|
||||
return this.ac != null;
|
||||
}
|
||||
}
|
||||
|
||||
public IInventory getInventory() {
|
||||
if (this.ac == null) {
|
||||
return null;
|
||||
} else {
|
||||
if (this.ac.inv == null) {
|
||||
this.ac.inv = new WrapperChainedInventory(
|
||||
this.ac.assemblers.toArray(new IInventory[0])
|
||||
);
|
||||
}
|
||||
|
||||
return this.ac.inv;
|
||||
}
|
||||
}
|
||||
|
||||
public int getSizeInventory() {
|
||||
IInventory inv = this.getInventory();
|
||||
return inv == null ? 0 : inv.getSizeInventory();
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlot(int var1) {
|
||||
IInventory inv = this.getInventory();
|
||||
return inv == null ? null : inv.getStackInSlot(var1);
|
||||
}
|
||||
|
||||
public ItemStack decrStackSize(int var1, int var2) {
|
||||
IInventory inv = this.getInventory();
|
||||
return inv == null ? null : inv.decrStackSize(var1, var2);
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlotOnClosing(int var1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setInventorySlotContents(int var1, ItemStack var2) {
|
||||
IInventory inv = this.getInventory();
|
||||
if (inv != null) {
|
||||
inv.setInventorySlotContents(var1, var2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "ME Assembler Chamber";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
IInventory inv = this.getInventory();
|
||||
return inv == null ? 0 : inv.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
if (itemstack.getItem() instanceof ICraftingPatternItem) {
|
||||
ICraftingPatternDetails pat
|
||||
= ((ICraftingPatternItem) itemstack.getItem())
|
||||
.getPatternForItem(itemstack, this.worldObj);
|
||||
|
||||
return pat != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//public void bulkUpdate(long inst, Player player) {
|
||||
// if (this.ac != null && this.ac.inst != inst) {
|
||||
// this.ac.inst = inst;
|
||||
// this.sendUpdate(true, player);
|
||||
// }
|
||||
//}
|
||||
|
||||
public boolean requiresTickingUpdates() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendUpdate(boolean newState, EntityPlayer player) {
|
||||
if (this.ac != null) {
|
||||
NBTTagCompound tc = new NBTTagCompound();
|
||||
tc.setBoolean("formed", newState);
|
||||
|
||||
// TODO: WTF
|
||||
//try {
|
||||
// Packet250CustomPayload p
|
||||
// = (new PacketBulkMAC(
|
||||
// Platform.createBulkUpdate(tc, this.ac.min, this.ac.max)
|
||||
// ))
|
||||
// .getPacket();
|
||||
// if (p != null) {
|
||||
// if (player == null) {
|
||||
// double var10002 = (double) this.field_70329_l;
|
||||
// double var10003 = (double) this.field_70330_m;
|
||||
// double var10004 = (double) this.field_70327_n;
|
||||
// AppEng.getInstance().SideProxy.sendToAllNearExcept(
|
||||
// (EntityPlayer) null,
|
||||
// var10002,
|
||||
// var10003,
|
||||
// var10004,
|
||||
// 512.0,
|
||||
// this.field_70331_k,
|
||||
// p
|
||||
// );
|
||||
// } else {
|
||||
// PacketDispatcher.sendPacketToPlayer(p, player);
|
||||
// }
|
||||
// }
|
||||
//} catch (IOException var6) {
|
||||
// var6.printStackTrace();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSeperated() {
|
||||
return !this.isEnabled();
|
||||
}
|
||||
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this
|
||||
? false
|
||||
: entityplayer.getDistanceSq(
|
||||
(double) this.xCoord + 0.5,
|
||||
(double) this.yCoord + 0.5,
|
||||
(double) this.zCoord + 0.5
|
||||
) <= 32.0;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public boolean writeToStreamTileAssemblerMB(ByteBuf buf) {
|
||||
buf.writeBoolean(this.ac != null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStreamTileAssemblerMB(ByteBuf buf) {
|
||||
this.complete = buf.readBoolean();
|
||||
this.worldObj.markBlockRangeForRenderUpdate(
|
||||
this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord
|
||||
);
|
||||
System.out.println("ALEC: " + this.complete);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(World w, int x, int y, int z, List<ItemStack> drops) {}
|
||||
}
|
|
@ -37,7 +37,7 @@ public class WrapperChainedInventory implements IInventory {
|
|||
this.setInventory(inventories);
|
||||
}
|
||||
|
||||
private void setInventory(final IInventory... a) {
|
||||
public void setInventory(final IInventory... a) {
|
||||
this.l = ImmutableList.copyOf(a);
|
||||
this.calculateSizes();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class WrapperChainedInventory implements IInventory {
|
|||
this.setInventory(inventories);
|
||||
}
|
||||
|
||||
private void setInventory(final List<IInventory> a) {
|
||||
public void setInventory(final List<IInventory> a) {
|
||||
this.l = a;
|
||||
this.calculateSizes();
|
||||
}
|
||||
|
|
|
@ -56,16 +56,23 @@ tile.appliedenergistics2.BlockCraftMonitor.name=ME Crafting Monitor
|
|||
tile.appliedenergistics2.BlockCraftTerminal.name=ME Crafting Terminal
|
||||
tile.appliedenergistics2.BlockLegacyController.name=ME Controller
|
||||
tile.appliedenergistics2.BlockPatternEncoder.name=Pattern Encoder
|
||||
tile.appliedenergistics2.BlockStorageMonitor.name=Storage Monitor
|
||||
tile.appliedenergistics2.BlockStorageMonitor.name=ME Storage Monitor
|
||||
tile.appliedenergistics2.BlockTerminal.name=ME Access Terminal
|
||||
tile.appliedenergistics2.BlockWirelessAccessPoint.name=Wireless Access Point
|
||||
|
||||
item.appliedenergistics2.ItemMaterial.ConversionMatrix.name=Conversion Matrix
|
||||
|
||||
tile.appliedenergistics2.BlockAssembler.name=ME Assembler Pattern Provider
|
||||
tile.appliedenergistics2.BlockAssemblerCraftingAccelerator.name=ME Assembler Crafting CPU
|
||||
tile.appliedenergistics2.BlockAssemblerHeatVent.name=ME Assembler Heat Vent
|
||||
tile.appliedenergistics2.BlockAssemblerWall.name=ME Assembler Containment Wall
|
||||
|
||||
# Legacy GUI
|
||||
gui.appliedenergistics2.PatternEncoder.clear=Clear
|
||||
gui.appliedenergistics2.PatternEncoder.encode=Encode
|
||||
gui.appliedenergistics2.PatternEncoder=Pattern Encoder
|
||||
gui.appliedenergistics2.Assembler=ME Pattern Provider
|
||||
gui.appliedenergistics2.MAC=ME Molecular Assembler Chamber
|
||||
|
||||
# Stairs
|
||||
tile.appliedenergistics2.ChiseledQuartzStairBlock.name=Chiseled Certus Quartz Stairs
|
||||
|
@ -211,6 +218,7 @@ gui.appliedenergistics2.SelectAmount=Select Amount
|
|||
gui.appliedenergistics2.CopyMode=Copy Mode
|
||||
gui.appliedenergistics2.CopyModeDesc=Controls if the contents of the configuration pane are cleared when you remove the cell.
|
||||
gui.appliedenergistics2.Next=Next
|
||||
gui.appliedenergistics2.Prev=Prev
|
||||
gui.appliedenergistics2.Lumen=Lumen
|
||||
gui.appliedenergistics2.Empty=Empty
|
||||
gui.appliedenergistics2.Stored=Stored
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
shaped=
|
||||
oredictionary:ingotIron oredictionary:craftingTableWood oredictionary:ingotIron,
|
||||
ae2:ItemMaterial.ConversionMatrix ae2:ItemMaterial.EngProcessor ae2:ItemMaterial.ConversionMatrix,
|
||||
oredictionary:ingotIron ae2:ItemMaterial.Cell1kPart oredictionary:ingotIron,
|
||||
-> ae2:BlockAssembler
|
||||
|
||||
shaped=
|
||||
oredictionary:ingotIron certusCrystal oredictionary:ingotIron,
|
||||
oredictionary:dustGlowstone ae2:ItemMaterial.EngProcessor oredictionary:dustGlowstone,
|
||||
oredictionary:ingotIron certusCrystal oredictionary:ingotIron,
|
||||
-> ae2:BlockAssemblerCraftingAccelerator
|
||||
|
||||
shaped=
|
||||
oredictionary:ingotIron mc:iron_bars oredictionary:ingotIron,
|
||||
mc:iron_bars ae2:CableGlass.Fluix mc:iron_bars,
|
||||
oredictionary:ingotIron mc:iron_bars oredictionary:ingotIron,
|
||||
-> ae2:BlockAssemblerHeatVent
|
||||
|
||||
shaped=
|
||||
oredictionary:ingotIron oredictionary:ingotGold oredictionary:ingotIron,
|
||||
oredictionary:ingotGold certusCrystal oredictionary:ingotGold,
|
||||
oredictionary:ingotIron oredictionary:ingotGold oredictionary:ingotIron,
|
||||
-> ae2:BlockAssemblerWall
|
|
@ -1,3 +1,5 @@
|
|||
import=legacy/assembler.recipe
|
||||
|
||||
shaped=
|
||||
oredictionary:ingotIron netherCrystal oredictionary:ingotIron,
|
||||
oreDictionary:dustFluix ae2:ItemMaterial.LogicProcessor oreDictionary:dustFluix,
|
||||
|
@ -39,3 +41,9 @@ shaped=
|
|||
ae2:CableGlass.Fluix ae2:ItemMaterial.Wireless glass,
|
||||
oredictionary:ingotIron glass oredictionary:ingotIron,
|
||||
-> ae2:BlockWirelessAccessPoint
|
||||
|
||||
shaped=
|
||||
oredictionary:ingotIron ae2:ItemMaterial.ConversionMatrix oredictionary:ingotIron,
|
||||
oredictionary:ingotIron oredictionary:craftingTableWood oredictionary:ingotIron,
|
||||
oredictionary:ingotIron oredictionary:ingotIron oredictionary:ingotIron,
|
||||
-> ae2:BlockPatternEncoder
|
||||
|
|
After Width: | Height: | Size: 443 B |
After Width: | Height: | Size: 438 B |
After Width: | Height: | Size: 415 B |
After Width: | Height: | Size: 355 B |
After Width: | Height: | Size: 439 B |
After Width: | Height: | Size: 398 B |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.3 KiB |