mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 10:34:40 +00:00
ec2 style output rule and oc integration
This commit is contained in:
1 parent
19f9dee682
commit
e38869f07d
20 files changed
+503
-25
No files matched your search
@@ -0,0 +1,60 @@
|
||||
package com.glodblock.github.common.block;
|
||||
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import com.glodblock.github.common.tile.TileOCPatternEditor;
|
||||
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockOCPatternEditor extends FCBaseBlock {
|
||||
|
||||
public BlockOCPatternEditor() {
|
||||
super(Material.iron, NameConst.BLOCK_OC_PATTERN_EDITOR);
|
||||
setTileEntity(TileOCPatternEditor.class);
|
||||
setFullBlock(true);
|
||||
setOpaque(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
TileOCPatternEditor tile = getTileEntity(world, x, y, z);
|
||||
if (tile != null) {
|
||||
if (!world.isRemote) {
|
||||
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.OC_PATTERN_EDITOR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public BlockOCPatternEditor register() {
|
||||
if (ModAndClassUtil.OC) {
|
||||
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_OC_PATTERN_EDITOR);
|
||||
GameRegistry.registerTileEntity(TileOCPatternEditor.class, NameConst.BLOCK_OC_PATTERN_EDITOR);
|
||||
OCDriverInit.run();
|
||||
return this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack stack(int size) {
|
||||
return new ItemStack(this, size);
|
||||
}
|
||||
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,8 +16,6 @@ import appeng.client.texture.CableBusTextures;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
@@ -108,7 +106,7 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
return config;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_WRITE )
|
||||
@Override
|
||||
public void writeToStream(ByteBuf data) throws IOException {
|
||||
super.writeToStream( data );
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
|
||||
@@ -168,7 +168,7 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
return invFluids.drain(from, maxDrain, doDrain);
|
||||
return invFluids.drain(from.ordinal(), maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,10 +43,6 @@ public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInve
|
||||
|
||||
@Override
|
||||
public void getDrops(final World w, final int x, final int y, final int z, final List<ItemStack> drops ) {
|
||||
getDrops(w, new BlockPos(x, y, z), drops);
|
||||
}
|
||||
|
||||
public void getDrops(World world, BlockPos pos, List<ItemStack> drops) {
|
||||
for (ItemStack stack : patternInv) {
|
||||
if (stack != null) {
|
||||
drops.add(stack);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileOCPatternEditor extends AEBaseInvTile {
|
||||
|
||||
private final AppEngInternalInventory invItems = new AppEngInternalInventory(this, 16);
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory() {
|
||||
return invItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added) {
|
||||
markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( final int i, final ItemStack itemstack ) {
|
||||
return itemstack == null || itemstack.getItem() instanceof ItemEncodedPattern;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user