Readded conveyor manipulator
This commit is contained in:
parent
31f0d1f208
commit
7d286bf468
15 changed files with 1163 additions and 213 deletions
|
@ -15,7 +15,7 @@ import resonantinduction.electrical.encoder.coding.IProgrammableMachine;
|
|||
import resonantinduction.electrical.encoder.coding.args.ArgumentIntData;
|
||||
import universalelectricity.api.vector.Vector2;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.utility.InvInteractionHelper;
|
||||
import calclavia.lib.utility.InventoryInteractionHelper;
|
||||
import calclavia.lib.utility.MathUtility;
|
||||
|
||||
import com.builtbroken.common.science.units.UnitHelper;
|
||||
|
@ -71,7 +71,7 @@ public class TaskGive extends TaskBaseArmbot
|
|||
{
|
||||
stacks.add(stack);
|
||||
}
|
||||
InvInteractionHelper invEx = new InvInteractionHelper(this.program.getMachine().getLocation().left(), this.program.getMachine().getLocation().right(), stacks, false);
|
||||
InventoryInteractionHelper invEx = new InventoryInteractionHelper(this.program.getMachine().getLocation().left(), this.program.getMachine().getLocation().right(), stacks, false);
|
||||
ItemStack insertStack = invEx.tryPlaceInPosition(itemStack, new Vector3(targetTile), direction.getOpposite());
|
||||
if (((IArmbot) this.program.getMachine()).clear(itemStack))
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package resonantinduction.electrical.armbot.task;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -14,7 +14,7 @@ import resonantinduction.electrical.armbot.TaskBaseProcess;
|
|||
import resonantinduction.electrical.encoder.coding.args.ArgumentIntData;
|
||||
import universalelectricity.api.vector.Vector2;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.utility.InvInteractionHelper;
|
||||
import calclavia.lib.utility.InventoryInteractionHelper;
|
||||
import calclavia.lib.utility.MathUtility;
|
||||
|
||||
import com.builtbroken.common.science.units.UnitHelper;
|
||||
|
@ -63,12 +63,12 @@ public class TaskTake extends TaskBaseArmbot
|
|||
if (targetTile != null && ((IArmbot) this.program.getMachine()).getHeldObject() instanceof ItemStack)
|
||||
{
|
||||
ForgeDirection direction = MathUtility.getFacingDirectionFromAngle(((IArmbot) this.program.getMachine()).getRotation().x);
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
Set<ItemStack> stacks = new HashSet<ItemStack>();
|
||||
if (this.stack != null)
|
||||
{
|
||||
stacks.add(stack);
|
||||
}
|
||||
InvInteractionHelper invEx = new InvInteractionHelper(this.program.getMachine().getLocation().left(), this.program.getMachine().getLocation().right(), stacks, false);
|
||||
InventoryInteractionHelper invEx = new InventoryInteractionHelper(this.program.getMachine().getLocation().left(), this.program.getMachine().getLocation().right(), stacks, false);
|
||||
((IArmbot) this.program.getMachine()).grabObject(invEx.tryGrabFromPosition(new Vector3(targetTile), direction, this.stack != null ? stack.stackSize : 1));
|
||||
return ((IArmbot) this.program.getMachine()).getHeldObject() != null ? ProcessReturn.DONE : ProcessReturn.CONTINUE;
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ import resonantinduction.mechanical.fluid.pump.TileGrate;
|
|||
import resonantinduction.mechanical.fluid.pump.TilePump;
|
||||
import resonantinduction.mechanical.fluid.tank.BlockTank;
|
||||
import resonantinduction.mechanical.fluid.tank.TileTank;
|
||||
import resonantinduction.mechanical.logistic.BlockManipulator;
|
||||
import resonantinduction.mechanical.logistic.TileManipulator;
|
||||
import calclavia.lib.content.ContentRegistry;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
@ -27,57 +29,62 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
|
||||
/** Resonant Induction Archaic Module
|
||||
/**
|
||||
* Resonant Induction Archaic Module
|
||||
*
|
||||
* @author DarkCow, Calclavia */
|
||||
* @author DarkCow, Calclavia
|
||||
*/
|
||||
@Mod(modid = Mechanical.ID, name = Mechanical.NAME, version = Reference.VERSION, dependencies = "required-after:" + ResonantInduction.ID)
|
||||
@NetworkMod(channels = Reference.CHANNEL, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class Mechanical
|
||||
{
|
||||
/** Mod Information */
|
||||
public static final String ID = "ResonantInduction|Mechanical";
|
||||
public static final String NAME = Reference.NAME + " Mechanical";
|
||||
/** Mod Information */
|
||||
public static final String ID = "ResonantInduction|Mechanical";
|
||||
public static final String NAME = Reference.NAME + " Mechanical";
|
||||
|
||||
@Instance(ID)
|
||||
public static Mechanical INSTANCE;
|
||||
@Instance(ID)
|
||||
public static Mechanical INSTANCE;
|
||||
|
||||
@SidedProxy(clientSide = "resonantinduction.mechanical.ClientProxy", serverSide = "resonantinduction.mechanical.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
@SidedProxy(clientSide = "resonantinduction.mechanical.ClientProxy", serverSide = "resonantinduction.mechanical.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Mod.Metadata(ID)
|
||||
public static ModMetadata metadata;
|
||||
@Mod.Metadata(ID)
|
||||
public static ModMetadata metadata;
|
||||
|
||||
public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, ID);
|
||||
public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, ID);
|
||||
|
||||
// Transport
|
||||
public static Block blockConveyorBelt;
|
||||
// Transport
|
||||
public static Block blockConveyorBelt;
|
||||
public static Block blockManipulator;
|
||||
public static Block blockDetector;
|
||||
|
||||
// #Fluids
|
||||
public static Block blockTank;
|
||||
public static Block blockPipe;
|
||||
public static Block blockReleaseValve;
|
||||
public static Block blockGrate;
|
||||
public static Block blockPump;
|
||||
// Fluids
|
||||
public static Block blockTank;
|
||||
public static Block blockPipe;
|
||||
public static Block blockReleaseValve;
|
||||
public static Block blockGrate;
|
||||
public static Block blockPump;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
{
|
||||
Settings.load();
|
||||
NetworkRegistry.instance().registerGuiHandler(this, proxy);
|
||||
blockConveyorBelt = contentRegistry.createTile(BlockConveyorBelt.class, TileConveyorBelt.class);
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
{
|
||||
Settings.load();
|
||||
NetworkRegistry.instance().registerGuiHandler(this, proxy);
|
||||
blockConveyorBelt = contentRegistry.createTile(BlockConveyorBelt.class, TileConveyorBelt.class);
|
||||
blockManipulator = contentRegistry.createTile(BlockManipulator.class, TileManipulator.class);
|
||||
|
||||
blockTank = contentRegistry.createBlock(BlockTank.class, ItemBlockFluidContainer.class, TileTank.class);
|
||||
blockPipe = contentRegistry.createBlock(BlockPipe.class, ItemBlockFluidContainer.class, TilePipe.class);
|
||||
blockGrate = contentRegistry.createTile(BlockGrate.class, TileGrate.class);
|
||||
blockPump = contentRegistry.createTile(BlockPump.class, TilePump.class);
|
||||
proxy.preInit();
|
||||
Settings.save();
|
||||
}
|
||||
blockTank = contentRegistry.createBlock(BlockTank.class, ItemBlockFluidContainer.class, TileTank.class);
|
||||
blockPipe = contentRegistry.createBlock(BlockPipe.class, ItemBlockFluidContainer.class, TilePipe.class);
|
||||
blockGrate = contentRegistry.createTile(BlockGrate.class, TileGrate.class);
|
||||
blockPump = contentRegistry.createTile(BlockPump.class, TilePump.class);
|
||||
proxy.preInit();
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent evt)
|
||||
{
|
||||
Settings.setModMetadata(metadata, ID, NAME);
|
||||
proxy.init();
|
||||
}
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent evt)
|
||||
{
|
||||
Settings.setModMetadata(metadata, ID, NAME);
|
||||
proxy.init();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
package resonantinduction.mechanical.logistic;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.block.BlockImprintable;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/** @author Briman0094 */
|
||||
public class BlockDetector extends BlockImprintable
|
||||
{
|
||||
Icon eye_red;
|
||||
Icon eye_green;
|
||||
|
||||
public BlockDetector()
|
||||
{
|
||||
super("detector", UniversalElectricity.machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
|
||||
{
|
||||
int angle = MathHelper.floor_double((entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int change = 2;
|
||||
|
||||
switch (angle)
|
||||
{
|
||||
case 0:
|
||||
change = ForgeDirection.NORTH.ordinal();
|
||||
break;
|
||||
case 1:
|
||||
change = ForgeDirection.EAST.ordinal();
|
||||
break;
|
||||
case 2:
|
||||
change = ForgeDirection.SOUTH.ordinal();
|
||||
break;
|
||||
case 3:
|
||||
change = ForgeDirection.WEST.ordinal();
|
||||
break;
|
||||
}
|
||||
|
||||
if (entity.rotationPitch < -70f) // up
|
||||
{
|
||||
change = ForgeDirection.DOWN.ordinal();
|
||||
}
|
||||
if (entity.rotationPitch > 70f) // down
|
||||
{
|
||||
change = ForgeDirection.UP.ordinal();
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, change, 3);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconReg)
|
||||
{
|
||||
super.registerIcons(iconReg);
|
||||
this.eye_green = iconReg.registerIcon(Reference.PREFIX + "detector_green");
|
||||
this.eye_red = iconReg.registerIcon(Reference.PREFIX + "detector_red");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getBlockTexture(IBlockAccess iBlockAccess, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntity tileEntity = iBlockAccess.getBlockTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileDetector)
|
||||
{
|
||||
if (side == ForgeDirection.getOrientation(iBlockAccess.getBlockMetadata(x, y, z)).ordinal())
|
||||
{
|
||||
if (((TileDetector) tileEntity).isInverted())
|
||||
{
|
||||
return this.eye_red;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.eye_green;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int side, int metadata)
|
||||
{
|
||||
if (side == ForgeDirection.SOUTH.ordinal())
|
||||
{
|
||||
return this.eye_green;
|
||||
}
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, side, 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int blockID)
|
||||
{
|
||||
if (!canBlockStay(world, x, y, z))
|
||||
{
|
||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlock(x, y, z, 0, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockNormalCube(World world, int x, int y, int z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolid(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int direction)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileDetector)
|
||||
{
|
||||
return ((TileDetector) tileEntity).isPoweringTo(ForgeDirection.getOrientation(direction));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int direction)
|
||||
{
|
||||
return isProvidingStrongPower(world, x, y, z, direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileDetector();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package resonantinduction.mechanical.logistic;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.prefab.block.BlockImprintable;
|
||||
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A block that manipulates item movement between inventories.
|
||||
*
|
||||
* @author Calclavia, DarkGuardsman
|
||||
*/
|
||||
public class BlockManipulator extends BlockImprintable
|
||||
{
|
||||
public BlockManipulator()
|
||||
{
|
||||
super("manipulator", UniversalElectricity.machine);
|
||||
this.setBlockBounds(0, 0, 0, 1, 0.29f, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().getAABB(par2, par3, par4, (double) par2 + 1, (double) par3 + 1, (double) par4 + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileManipulator)
|
||||
{
|
||||
((TileManipulator) tileEntity).setSelfPulse(!((TileManipulator) tileEntity).isSelfPulse());
|
||||
entityPlayer.sendChatToPlayer(ChatMessageComponent.createFromText("Manip. set to " + (((TileManipulator) tileEntity).isSelfPulse() ? "auto pulse" : "not pulse")));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileManipulator)
|
||||
{
|
||||
TileManipulator manip = (TileManipulator) tileEntity;
|
||||
boolean manipMode = manip.isOutput();
|
||||
boolean inverted = manip.isInverted();
|
||||
if (manipMode && !inverted)
|
||||
{
|
||||
manip.toggleInversion();
|
||||
}
|
||||
else if (manipMode && inverted)
|
||||
{
|
||||
manip.toggleOutput();
|
||||
manip.toggleInversion();
|
||||
}
|
||||
else if (!manipMode && !inverted)
|
||||
{
|
||||
manip.toggleInversion();
|
||||
}
|
||||
else
|
||||
{
|
||||
manip.toggleOutput();
|
||||
manip.toggleInversion();
|
||||
}
|
||||
entityPlayer.sendChatToPlayer(ChatMessageComponent.createFromText("Manip. outputing = " + manip.isOutput()));
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileManipulator();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return MechanicalBlockRenderingHandler.ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package resonantinduction.mechanical.logistic;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.block.BlockImprintable;
|
||||
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockRejector extends BlockImprintable
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected Icon front;
|
||||
|
||||
public BlockRejector()
|
||||
{
|
||||
super("rejector", UniversalElectricity.machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileRejector();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return MechanicalBlockRenderingHandler.ID;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon(Reference.PREFIX + "imprinter_bottom");
|
||||
this.front = par1IconRegister.registerIcon(Reference.PREFIX + "disk_tray");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int side, int metadata)
|
||||
{
|
||||
if (side == metadata)
|
||||
{
|
||||
return this.front;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package resonantinduction.mechanical.logistic;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.render.RenderImprintable;
|
||||
import resonantinduction.old.client.model.ModelManipulator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderManipulator extends RenderImprintable
|
||||
{
|
||||
public static final ModelManipulator MODEL = new ModelManipulator();
|
||||
public static final ResourceLocation TEXTURE_INPUT = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "manipulator1.png");
|
||||
public static final ResourceLocation TEXTURE_OUTPUT = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "manipulator2.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
|
||||
{
|
||||
TileManipulator tile = (TileManipulator) tileEntity;
|
||||
int face = tile.getDirection().ordinal();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
||||
if (tile.isOutput())
|
||||
{
|
||||
bindTexture(TEXTURE_INPUT);
|
||||
}
|
||||
else
|
||||
{
|
||||
bindTexture(TEXTURE_OUTPUT);
|
||||
}
|
||||
|
||||
if (face == 2)
|
||||
{
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
}
|
||||
else if (face == 3)
|
||||
{
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
}
|
||||
else if (face == 4)
|
||||
{
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
}
|
||||
else if (face == 5)
|
||||
{
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
}
|
||||
|
||||
MODEL.render(0.0625F, true, 0);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
package resonantinduction.mechanical.logistic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileDetector extends TileEntityFilterable implements IPacketReceiver
|
||||
{
|
||||
private boolean powering = false;
|
||||
|
||||
public TileDetector()
|
||||
{
|
||||
super(100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if (!this.worldObj.isRemote && this.ticks % 10 == 0)
|
||||
{
|
||||
int metadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
|
||||
AxisAlignedBB testArea = AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(metadata);
|
||||
testArea.offset(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
|
||||
ArrayList<Entity> entities = (ArrayList<Entity>) this.worldObj.getEntitiesWithinAABB(EntityItem.class, testArea);
|
||||
boolean powerCheck = false;
|
||||
|
||||
if (entities.size() > 0)
|
||||
{
|
||||
if (getFilter() != null)
|
||||
{
|
||||
for (int i = 0; i < entities.size(); i++)
|
||||
{
|
||||
EntityItem e = (EntityItem) entities.get(i);
|
||||
ItemStack itemStack = e.getEntityItem();
|
||||
|
||||
powerCheck = this.isFiltering(itemStack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
powerCheck = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
powerCheck = false;
|
||||
}
|
||||
|
||||
if (powerCheck != this.powering)
|
||||
{
|
||||
this.powering = powerCheck;
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, Mechanical.blockDetector.blockID);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord + 1, this.zCoord, Mechanical.blockDetector.blockID);
|
||||
for (int x = this.xCoord - 1; x <= this.xCoord + 1; x++)
|
||||
{
|
||||
for (int z = this.zCoord - 1; z <= this.zCoord + 1; z++)
|
||||
{
|
||||
this.worldObj.notifyBlocksOfNeighborChange(x, this.yCoord + 1, z, Mechanical.blockDetector.blockID);
|
||||
}
|
||||
}
|
||||
|
||||
PacketHandler.sendPacketToClients(getDescriptionPacket());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, Mechanical.blockDetector.blockID);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord + 1, this.zCoord, Mechanical.blockDetector.blockID);
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
|
||||
this.powering = tag.getBoolean("powering");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
|
||||
tag.setBoolean("powering", this.powering);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, this.functioning, this.isInverted());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
this.functioning = data.readBoolean();
|
||||
this.setInverted(data.readBoolean());
|
||||
}
|
||||
|
||||
public int isPoweringTo(ForgeDirection side)
|
||||
{
|
||||
return this.powering && this.getDirection() != side.getOpposite() ? 15 : 0;
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(ForgeDirection side)
|
||||
{
|
||||
return this.isPoweringTo(side) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction)
|
||||
{
|
||||
return direction != this.getDirection();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,273 @@
|
|||
package resonantinduction.mechanical.logistic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.api.IManipulator;
|
||||
import resonantinduction.archaic.imprint.ItemBlockImprint;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
import calclavia.lib.utility.InventoryInteractionHelper;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileManipulator extends TileEntityFilterable implements IRotatable, IManipulator, IPacketReceiver
|
||||
{
|
||||
/** True to auto output items with a redstone pulse */
|
||||
private boolean selfPulse = false;
|
||||
/** True if outputting items */
|
||||
private boolean isOutput = false;
|
||||
/** True if is currently powered by redstone */
|
||||
private boolean isRedstonePowered = false;
|
||||
/** The class that interacts with inventories for this machine */
|
||||
private InventoryInteractionHelper invExtractionHelper;
|
||||
|
||||
public TileManipulator()
|
||||
{
|
||||
super(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.isFunctioning())
|
||||
{
|
||||
if (!this.isOutput)
|
||||
{
|
||||
this.enject();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.isRedstonePowered = this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
if (this.isSelfPulse() && this.ticks % 10 == 0)
|
||||
{
|
||||
this.isRedstonePowered = true;
|
||||
}
|
||||
|
||||
/** Finds the connected inventory and outputs the items upon a redstone pulse. */
|
||||
if (this.isRedstonePowered)
|
||||
{
|
||||
this.inject();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find items going into the manipulator and input them into an inventory behind this
|
||||
* manipulator.
|
||||
*/
|
||||
@Override
|
||||
public void enject()
|
||||
{
|
||||
Vector3 inputPosition = new Vector3(this);
|
||||
/** output location up */
|
||||
Vector3 outputUp = new Vector3(this);
|
||||
outputUp.modifyPositionFromSide(ForgeDirection.UP);
|
||||
/** output location down */
|
||||
Vector3 outputDown = new Vector3(this);
|
||||
outputDown.modifyPositionFromSide(ForgeDirection.DOWN);
|
||||
/** output location facing */
|
||||
Vector3 outputPosition = new Vector3(this);
|
||||
outputPosition.modifyPositionFromSide(this.getDirection().getOpposite());
|
||||
this.consumePower(1, true);
|
||||
|
||||
/** Prevents manipulators from spamming and duping items. */
|
||||
if (outputPosition.getTileEntity(this.worldObj) instanceof TileManipulator)
|
||||
{
|
||||
if (((TileManipulator) outputPosition.getTileEntity(this.worldObj)).getDirection() == this.getDirection().getOpposite())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(inputPosition.x, inputPosition.y, inputPosition.z, inputPosition.x + 1, inputPosition.y + 1, inputPosition.z + 1);
|
||||
List<EntityItem> itemsInBound = this.worldObj.getEntitiesWithinAABB(EntityItem.class, bounds);
|
||||
|
||||
for (EntityItem entity : itemsInBound)
|
||||
{
|
||||
if (entity.isDead)
|
||||
continue;
|
||||
|
||||
/**
|
||||
* Try top first, then bottom, then the sides to see if it is possible to insert the
|
||||
* item into a inventory.
|
||||
*/
|
||||
ItemStack remainingStack = entity.getEntityItem().copy();
|
||||
|
||||
if (this.getFilter() == null || this.isFiltering(remainingStack))
|
||||
{
|
||||
remainingStack = invHelper().tryPlaceInPosition(remainingStack, outputUp, ForgeDirection.UP);
|
||||
|
||||
if (remainingStack != null)
|
||||
{
|
||||
remainingStack = invHelper().tryPlaceInPosition(remainingStack, outputDown, ForgeDirection.DOWN);
|
||||
}
|
||||
|
||||
if (remainingStack != null)
|
||||
{
|
||||
remainingStack = invHelper().tryPlaceInPosition(remainingStack, outputPosition, this.getDirection().getOpposite());
|
||||
}
|
||||
|
||||
if (remainingStack != null && remainingStack.stackSize > 0)
|
||||
{
|
||||
invHelper().throwItem(outputPosition, remainingStack);
|
||||
}
|
||||
|
||||
entity.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Inject items */
|
||||
@Override
|
||||
public void inject()
|
||||
{
|
||||
this.isRedstonePowered = false;
|
||||
/** input location up */
|
||||
Vector3 inputUp = new Vector3(this).modifyPositionFromSide(ForgeDirection.UP);
|
||||
/** input location down */
|
||||
Vector3 inputDown = new Vector3(this).modifyPositionFromSide(ForgeDirection.DOWN);
|
||||
/** input location facing */
|
||||
Vector3 inputPosition = new Vector3(this).modifyPositionFromSide(this.getDirection().getOpposite());
|
||||
/** output location facing */
|
||||
Vector3 outputPosition = new Vector3(this).modifyPositionFromSide(this.getDirection());
|
||||
|
||||
this.consumePower(1, true);
|
||||
|
||||
ItemStack itemStack = invHelper().tryGrabFromPosition(inputUp, ForgeDirection.UP, 1);
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
itemStack = invHelper().tryGrabFromPosition(inputDown, ForgeDirection.DOWN, 1);
|
||||
}
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
itemStack = invHelper().tryGrabFromPosition(inputPosition, this.getDirection().getOpposite(), 1);
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.stackSize > 0)
|
||||
{
|
||||
invHelper().throwItem(outputPosition, itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
this.isOutput = nbt.getBoolean("isOutput");
|
||||
this.setSelfPulse(nbt.getBoolean("selfpulse"));
|
||||
}
|
||||
|
||||
/** Writes a tile entity to NBT. */
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("isOutput", this.isOutput);
|
||||
nbt.setBoolean("selfpulse", this.isSelfPulse());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, this.functioning, this.isInverted(), this.isSelfPulse(), this.isOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.functioning = data.readBoolean();
|
||||
this.setInverted(data.readBoolean());
|
||||
this.setSelfPulse(data.readBoolean());
|
||||
this.setOutput(data.readBoolean());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir)
|
||||
{
|
||||
return dir != this.getDirection();
|
||||
}
|
||||
|
||||
public boolean isSelfPulse()
|
||||
{
|
||||
return selfPulse;
|
||||
}
|
||||
|
||||
public void setSelfPulse(boolean selfPulse)
|
||||
{
|
||||
this.selfPulse = selfPulse;
|
||||
}
|
||||
|
||||
/** Gets the class that managed extracting and placing items into inventories */
|
||||
public InventoryInteractionHelper invHelper()
|
||||
{
|
||||
if (invExtractionHelper == null || invExtractionHelper.world != this.worldObj)
|
||||
{
|
||||
this.invExtractionHelper = new InventoryInteractionHelper(this.worldObj, new Vector3(this), this.getFilter() != null ? ItemBlockImprint.getFilters(getFilter()) : null, this.isInverted());
|
||||
}
|
||||
return invExtractionHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilter(ItemStack filter)
|
||||
{
|
||||
super.setFilter(filter);
|
||||
/* Reset inv Helper's filters */
|
||||
this.invHelper().setFilter(this.getFilter() != null ? ItemBlockImprint.getFilters(this.getFilter()) : null, this.isInverted());
|
||||
}
|
||||
|
||||
/** Is this manipulator set to output items */
|
||||
public boolean isOutput()
|
||||
{
|
||||
return this.isOutput;
|
||||
}
|
||||
|
||||
/** True to output items */
|
||||
public void setOutput(boolean isOutput)
|
||||
{
|
||||
this.isOutput = isOutput;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
/** Inverts the current output state */
|
||||
public void toggleOutput()
|
||||
{
|
||||
this.setOutput(!this.isOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExtraLoad()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
package resonantinduction.mechanical.logistic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.api.IBelt;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.prefab.tile.TileEntityFilterable;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
/** @author Darkguardsman */
|
||||
public class TileRejector extends TileEntityFilterable
|
||||
{
|
||||
|
||||
/** should the piston fire, or be extended */
|
||||
public boolean firePiston = false;
|
||||
|
||||
public TileRejector()
|
||||
{
|
||||
super(100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
/** Has to update a bit faster than a conveyer belt */
|
||||
if (this.ticks % 5 == 0)
|
||||
{
|
||||
this.firePiston = false;
|
||||
|
||||
Vector3 searchPosition = new Vector3(this);
|
||||
searchPosition.modifyPositionFromSide(this.getDirection());
|
||||
TileEntity tileEntity = searchPosition.getTileEntity(this.worldObj);
|
||||
|
||||
try
|
||||
{
|
||||
if (this.isFunctioning())
|
||||
{
|
||||
/**
|
||||
* Find all entities in the position in which this block is facing and attempt
|
||||
* to push it out of the way.
|
||||
*/
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(searchPosition.x, searchPosition.y, searchPosition.z, searchPosition.x + 1, searchPosition.y + 1, searchPosition.z + 1);
|
||||
List<Entity> entitiesInFront = this.worldObj.getEntitiesWithinAABB(Entity.class, bounds);
|
||||
|
||||
for (Entity entity : entitiesInFront)
|
||||
{
|
||||
if (this.canEntityBeThrow(entity))
|
||||
{
|
||||
this.throwItem(tileEntity, this.getDirection(), entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Pushs an entity in the direction in which the rejector is facing */
|
||||
public void throwItem(TileEntity tileEntity, ForgeDirection side, Entity entity)
|
||||
{
|
||||
this.firePiston = true;
|
||||
// TODO add config to adjust the motion magnitude per rejector
|
||||
entity.motionX = side.offsetX * 0.1;
|
||||
entity.motionY += 0.10000000298023224D;
|
||||
entity.motionZ = side.offsetZ * 0.1;
|
||||
this.consumePower(1, true);
|
||||
|
||||
if (!this.worldObj.isRemote && tileEntity instanceof IBelt)
|
||||
{
|
||||
((IBelt) tileEntity).ignoreEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/** Checks to see if the rejector can push the entity in the facing direction */
|
||||
public boolean canEntityBeThrow(Entity entity)
|
||||
{
|
||||
// TODO Add other things than items
|
||||
if (entity instanceof EntityItem)
|
||||
{
|
||||
EntityItem entityItem = (EntityItem) entity;
|
||||
ItemStack itemStack = entityItem.getEntityItem();
|
||||
|
||||
return this.isFiltering(itemStack);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir)
|
||||
{
|
||||
return dir != this.getDirection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, this.functioning, this.isInverted(), this.firePiston);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean simplePacket(String id, ByteArrayDataInput dis, Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.worldObj.isRemote && !super.simplePacket(id, dis, player))
|
||||
{
|
||||
if (id.equalsIgnoreCase("rejector"))
|
||||
{
|
||||
this.functioning = dis.readBoolean();
|
||||
this.setInverted(dis.readBoolean());
|
||||
this.firePiston = dis.readBoolean();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.mechanical.fluid.pump.RenderPump;
|
||||
import resonantinduction.mechanical.logistic.RenderManipulator;
|
||||
import resonantinduction.old.client.model.ModelConveyorBelt;
|
||||
import resonantinduction.old.client.model.ModelCrusher;
|
||||
import resonantinduction.old.client.model.ModelGrinder;
|
||||
|
@ -24,153 +25,153 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class MechanicalBlockRenderingHandler implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static MechanicalBlockRenderingHandler INSTANCE = new MechanicalBlockRenderingHandler();
|
||||
public static final int ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
private ModelConveyorBelt modelConveyorBelt = new ModelConveyorBelt();
|
||||
private ModelRejectorPiston modelEjector = new ModelRejectorPiston();
|
||||
private ModelManipulator modelInjector = new ModelManipulator();
|
||||
private ModelCrusher modelCrushor = new ModelCrusher();
|
||||
private ModelGrinder grinderModel = new ModelGrinder();
|
||||
public static MechanicalBlockRenderingHandler INSTANCE = new MechanicalBlockRenderingHandler();
|
||||
public static final int ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
private ModelConveyorBelt modelConveyorBelt = new ModelConveyorBelt();
|
||||
private ModelRejectorPiston modelEjector = new ModelRejectorPiston();
|
||||
private ModelCrusher modelCrushor = new ModelCrusher();
|
||||
private ModelGrinder grinderModel = new ModelGrinder();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (block == Mechanical.blockConveyorBelt)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 1.3F, 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "belt/frame0.png"));
|
||||
modelConveyorBelt.render(0.0625F, 0, false, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (Mechanical.blockPump != null)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 1.3F, 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (block == Mechanical.blockConveyorBelt)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 1.3F, 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "belt/frame0.png"));
|
||||
modelConveyorBelt.render(0.0625F, 0, false, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (block == Mechanical.blockPump)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 1.3F, 0.0F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPump.TEXTURE);
|
||||
RenderPump.MODEL.render(0.0725F);
|
||||
RenderPump.MODEL.renderMotion(0.0725F, 0);
|
||||
}/*
|
||||
* else if (RecipeLoader.blockRejector != null && block.blockID ==
|
||||
* RecipeLoader.blockRejector.blockID)
|
||||
* {
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "rejector.png"));
|
||||
* GL11.glPushMatrix();
|
||||
* GL11.glTranslatef(0.6F, 1.5F, 0.6F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
* modelEjector.render(0.0625F);
|
||||
* modelEjector.renderPiston(0.0625F, 1);
|
||||
* GL11.glPopMatrix();
|
||||
* }
|
||||
* else if (RecipeLoader.blockManipulator != null && block.blockID ==
|
||||
* RecipeLoader.blockManipulator.blockID)
|
||||
* {
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "manipulator1.png"));
|
||||
* GL11.glPushMatrix();
|
||||
* GL11.glTranslatef(0.6F, 1.5F, 0.6F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
* modelInjector.render(0.0625F, true, 0);
|
||||
* GL11.glPopMatrix();
|
||||
* }
|
||||
* if (RecipeLoader.blockPumpMachine != null && block.blockID ==
|
||||
* RecipeLoader.blockPumpMachine.blockID && metadata < 4)
|
||||
* {
|
||||
* GL11.glTranslatef(0.0F, 1.1F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "pumps/WaterPump.png"));
|
||||
* modelPump.render(0.0725F);
|
||||
* modelPump.renderMotion(0.0725F, 0);
|
||||
* }
|
||||
* else if (RecipeLoader.blockSink != null && block.blockID ==
|
||||
* RecipeLoader.blockSink.blockID)
|
||||
* {
|
||||
* GL11.glTranslatef(0.0F, .8F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "Sink.png"));
|
||||
* sink.render(0.0565F);
|
||||
* }
|
||||
* else if (RecipeLoader.blockRod != null && block.blockID == RecipeLoader.blockRod.blockID)
|
||||
* {
|
||||
* GL11.glTranslatef(0.0F, 1.5F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY +
|
||||
* "mechanical/GearRod.png"));
|
||||
* modelRod.render(0.0825F, 0);
|
||||
* }
|
||||
* else if (RecipeLoader.blockConPump != null && block.blockID ==
|
||||
* RecipeLoader.blockConPump.blockID && metadata < 4)
|
||||
* {
|
||||
* GL11.glTranslatef(0.0F, 1.2F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "ConstructionPump.png"));
|
||||
* conPump.render(0.0725F);
|
||||
* conPump.renderMotor(0.0725F);
|
||||
* }
|
||||
* else if (RecipeLoader.frackingPipe != null && block.blockID ==
|
||||
* RecipeLoader.frackingPipe.blockID)
|
||||
* {
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderFrackingPipe.TEXTURE
|
||||
* );
|
||||
* GL11.glTranslatef(0, 1F, 0);
|
||||
* GL11.glScalef(1.0F, -1F, -1F);
|
||||
* RenderFrackingPipe.model.renderAll();
|
||||
* }
|
||||
* GL11.glPopMatrix();
|
||||
*/
|
||||
/*
|
||||
* else if (RecipeLoader.blockArmbot != null && block.blockID ==
|
||||
* RecipeLoader.blockArmbot.blockID)
|
||||
* {
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + RenderArmbot.TEXTURE));
|
||||
* GL11.glPushMatrix();
|
||||
* GL11.glTranslatef(0.4f, 0.8f, 0f);
|
||||
* GL11.glScalef(0.7f, 0.7f, 0.7f);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
* RenderArmbot.MODEL.render(0.0625F, 0, 0);
|
||||
* GL11.glPopMatrix();
|
||||
* }
|
||||
*/
|
||||
/*
|
||||
* else if (RecipeLoader.blockSteamGen != null && block.blockID ==
|
||||
* RecipeLoader.blockSteamGen.blockID)
|
||||
* {
|
||||
* ModelMachine model = RenderSteamGen.getModel(metadata);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderSteamGen.getTexture
|
||||
* (metadata));
|
||||
* GL11.glTranslatef(0.0F, 1.1F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* model.render(0.0625F);
|
||||
* }
|
||||
*/
|
||||
}
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPump.TEXTURE);
|
||||
RenderPump.MODEL.render(0.0725F);
|
||||
RenderPump.MODEL.renderMotion(0.0725F, 0);
|
||||
}
|
||||
if (block == Mechanical.blockManipulator)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderManipulator.TEXTURE_INPUT);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.6F, 1.5F, 0.6F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
RenderManipulator.MODEL.render(0.0625F, true, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/*
|
||||
* else if (RecipeLoader.blockRejector != null && block.blockID ==
|
||||
* RecipeLoader.blockRejector.blockID)
|
||||
* {
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "rejector.png"));
|
||||
* GL11.glPushMatrix();
|
||||
* GL11.glTranslatef(0.6F, 1.5F, 0.6F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
* modelEjector.render(0.0625F);
|
||||
* modelEjector.renderPiston(0.0625F, 1);
|
||||
* GL11.glPopMatrix();
|
||||
* }
|
||||
* else
|
||||
* if (RecipeLoader.blockPumpMachine != null && block.blockID ==
|
||||
* RecipeLoader.blockPumpMachine.blockID && metadata < 4)
|
||||
* {
|
||||
* GL11.glTranslatef(0.0F, 1.1F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "pumps/WaterPump.png"));
|
||||
* modelPump.render(0.0725F);
|
||||
* modelPump.renderMotion(0.0725F, 0);
|
||||
* }
|
||||
* else if (RecipeLoader.blockSink != null && block.blockID ==
|
||||
* RecipeLoader.blockSink.blockID)
|
||||
* {
|
||||
* GL11.glTranslatef(0.0F, .8F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "Sink.png"));
|
||||
* sink.render(0.0565F);
|
||||
* }
|
||||
* else if (RecipeLoader.blockRod != null && block.blockID == RecipeLoader.blockRod.blockID)
|
||||
* {
|
||||
* GL11.glTranslatef(0.0F, 1.5F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY +
|
||||
* "mechanical/GearRod.png"));
|
||||
* modelRod.render(0.0825F, 0);
|
||||
* }
|
||||
* else if (RecipeLoader.blockConPump != null && block.blockID ==
|
||||
* RecipeLoader.blockConPump.blockID && metadata < 4)
|
||||
* {
|
||||
* GL11.glTranslatef(0.0F, 1.2F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "ConstructionPump.png"));
|
||||
* conPump.render(0.0725F);
|
||||
* conPump.renderMotor(0.0725F);
|
||||
* }
|
||||
* else if (RecipeLoader.frackingPipe != null && block.blockID ==
|
||||
* RecipeLoader.frackingPipe.blockID)
|
||||
* {
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderFrackingPipe.TEXTURE
|
||||
* );
|
||||
* GL11.glTranslatef(0, 1F, 0);
|
||||
* GL11.glScalef(1.0F, -1F, -1F);
|
||||
* RenderFrackingPipe.model.renderAll();
|
||||
* }
|
||||
* GL11.glPopMatrix();
|
||||
*/
|
||||
/*
|
||||
* else if (RecipeLoader.blockArmbot != null && block.blockID ==
|
||||
* RecipeLoader.blockArmbot.blockID)
|
||||
* {
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(new
|
||||
* ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + RenderArmbot.TEXTURE));
|
||||
* GL11.glPushMatrix();
|
||||
* GL11.glTranslatef(0.4f, 0.8f, 0f);
|
||||
* GL11.glScalef(0.7f, 0.7f, 0.7f);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
* RenderArmbot.MODEL.render(0.0625F, 0, 0);
|
||||
* GL11.glPopMatrix();
|
||||
* }
|
||||
*/
|
||||
/*
|
||||
* else if (RecipeLoader.blockSteamGen != null && block.blockID ==
|
||||
* RecipeLoader.blockSteamGen.blockID)
|
||||
* {
|
||||
* ModelMachine model = RenderSteamGen.getModel(metadata);
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderSteamGen.getTexture
|
||||
* (metadata));
|
||||
* GL11.glTranslatef(0.0F, 1.1F, 0.0F);
|
||||
* GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
* model.render(0.0625F);
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ tile.resonantinduction\:pump.name=Pump
|
|||
tile.resonantinduction\:grate.name=Grate
|
||||
tile.resonantinduction\:conveyorBelt.name=Conveyor Belt
|
||||
tile.resonantinduction\:tank.0.name=Tank
|
||||
tile.resonantinduction\:detector.name=Detector
|
||||
tile.resonantinduction\:manipulator.name=Manipulator
|
||||
tile.resonantinduction\:rejector.name=Rejector
|
||||
|
||||
# Fluid pipes
|
||||
tile.resonantinduction\:fluidPipe.2.name=Red Wood Trough
|
||||
|
@ -139,8 +142,6 @@ tile.encoder.name=[WIP]Encoder
|
|||
tile.detector.name=Detector
|
||||
tile.craneController.name=Crane Controller
|
||||
tile.craneFrame.name=Crane Frame
|
||||
tile.manipulator.name=Manipulator
|
||||
tile.rejector.name=Rejector
|
||||
tile.turntable.name=Turn Table
|
||||
|
||||
tile.OreProcessor.0.name = Ore Crusher
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
# Blender MTL File: 'battery.blend'
|
||||
# Material Count: 2
|
||||
|
||||
newmtl Material
|
||||
Ns 96.078431
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl Material.002
|
||||
Ns 96.078431
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd bat_case_tex.png
|
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 957 B |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Loading…
Reference in a new issue