BlockRegistryChanges
This commit is contained in:
parent
63bac6c8cc
commit
cfebdfe9de
22 changed files with 60 additions and 770 deletions
|
@ -15,8 +15,6 @@ import dark.assembly.client.gui.GuiProcessor;
|
|||
import dark.assembly.client.render.BlockRenderingHandler;
|
||||
import dark.assembly.client.render.RenderArmbot;
|
||||
import dark.assembly.client.render.RenderConveyorBelt;
|
||||
import dark.assembly.client.render.RenderCraneController;
|
||||
import dark.assembly.client.render.RenderCraneFrame;
|
||||
import dark.assembly.client.render.RenderCrate;
|
||||
import dark.assembly.client.render.RenderDetector;
|
||||
import dark.assembly.client.render.RenderManipulator;
|
||||
|
@ -30,8 +28,6 @@ import dark.assembly.common.machine.TileEntityDetector;
|
|||
import dark.assembly.common.machine.TileEntityManipulator;
|
||||
import dark.assembly.common.machine.TileEntityRejector;
|
||||
import dark.assembly.common.machine.belt.TileEntityConveyorBelt;
|
||||
import dark.assembly.common.machine.crane.TileEntityCraneController;
|
||||
import dark.assembly.common.machine.crane.TileEntityCraneRail;
|
||||
import dark.assembly.common.machine.encoder.TileEntityEncoder;
|
||||
import dark.assembly.common.machine.processor.TileEntityProcessor;
|
||||
|
||||
|
@ -57,8 +53,8 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrate.class, new RenderCrate());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityArmbot.class, new RenderArmbot());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDetector.class, new RenderDetector());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneController.class, new RenderCraneController());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneRail.class, new RenderCraneFrame());
|
||||
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneController.class, new RenderCraneController());
|
||||
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneRail.class, new RenderCraneFrame());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,26 +75,6 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
RenderArmbot.MODEL.render(0.0625F, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (block.blockID == AssemblyLine.recipeLoader.blockCraneController.blockID)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + RenderCraneController.TEXTURE));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0f, 1f, 0f);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
RenderCraneController.MODEL.render(0.0625f, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (block.blockID == AssemblyLine.recipeLoader.blockCraneFrame.blockID)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + RenderCraneFrame.TEXTURE));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0f, 1f, 0f);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
GL11.glRotatef(-90f, 0f, 1f, 0f);
|
||||
RenderCraneFrame.MODEL.render(true, true, false, false, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (block.blockID == AssemblyLine.processorMachine.blockID && metadata == 0)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + "CrusherBlock.png"));
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
package dark.assembly.client.render;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
|
||||
import static org.lwjgl.opengl.GL11.glEnable;
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
import static org.lwjgl.opengl.GL11.glTranslated;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.client.model.ModelCraneController;
|
||||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.assembly.common.machine.crane.CraneHelper;
|
||||
import dark.assembly.common.machine.crane.TileEntityCraneController;
|
||||
import dark.core.prefab.ModPrefab;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderCraneController extends RenderImprintable
|
||||
{
|
||||
public static final String TEXTURE = "crane_controller_off.png";
|
||||
public static final String TEXTURE_VALID = "crane_controller_on.png";
|
||||
public static final ModelCraneController MODEL = new ModelCraneController();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityCraneController)
|
||||
{
|
||||
ResourceLocation name = new ResourceLocation(AssemblyLine.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + (((TileEntityCraneController) tileEntity).isCraneValid() ? TEXTURE_VALID : TEXTURE));
|
||||
func_110628_a(name);
|
||||
ForgeDirection front = ForgeDirection.getOrientation(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
ForgeDirection right = CraneHelper.rotateClockwise(front);
|
||||
float angle = 0f;
|
||||
switch (front)
|
||||
{
|
||||
case NORTH:
|
||||
{
|
||||
angle = 90f;
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
{
|
||||
angle = 270f;
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
{
|
||||
angle = 180f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int tX, tY, tZ;
|
||||
tX = tileEntity.xCoord;
|
||||
tY = tileEntity.yCoord;
|
||||
tZ = tileEntity.zCoord;
|
||||
boolean connectFront = CraneHelper.canFrameConnectTo(tileEntity, tX + front.offsetX, tY, tZ + front.offsetZ, front.getOpposite());
|
||||
boolean connectRight = CraneHelper.canFrameConnectTo(tileEntity, tX + right.offsetX, tY, tZ + right.offsetZ, right.getOpposite());
|
||||
glPushMatrix();
|
||||
glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
glRotatef(180f, 0f, 0f, 1f);
|
||||
glRotatef(angle, 0f, 1f, 0f);
|
||||
glEnable(GL_LIGHTING);
|
||||
MODEL.render(0.0625f, connectRight, connectFront);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package dark.assembly.client.render;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
|
||||
import static org.lwjgl.opengl.GL11.glEnable;
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
import static org.lwjgl.opengl.GL11.glTranslated;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.client.model.ModelCraneRail;
|
||||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.assembly.common.machine.crane.CraneHelper;
|
||||
import dark.assembly.common.machine.crane.TileEntityCraneRail;
|
||||
import dark.core.prefab.ModPrefab;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderCraneFrame extends TileEntitySpecialRenderer
|
||||
{
|
||||
public static final String TEXTURE = "crane_frame.png";
|
||||
public static final ModelCraneRail MODEL = new ModelCraneRail();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityCraneRail)
|
||||
{
|
||||
int tX, tY, tZ;
|
||||
tX = tileEntity.xCoord;
|
||||
tY = tileEntity.yCoord;
|
||||
tZ = tileEntity.zCoord;
|
||||
boolean renderUp = CraneHelper.canFrameConnectTo(tileEntity, tX, tY + 1, tZ, ForgeDirection.DOWN);
|
||||
boolean renderDown = CraneHelper.canFrameConnectTo(tileEntity, tX, tY - 1, tZ, ForgeDirection.UP);
|
||||
// EAST, X-
|
||||
boolean renderLeft = CraneHelper.canFrameConnectTo(tileEntity, tX - 1, tY, tZ, ForgeDirection.EAST);
|
||||
// WAST, X+
|
||||
boolean renderRight = CraneHelper.canFrameConnectTo(tileEntity, tX + 1, tY, tZ, ForgeDirection.WEST);
|
||||
// SOUTH, Z-
|
||||
boolean renderFront = CraneHelper.canFrameConnectTo(tileEntity, tX, tY, tZ - 1, ForgeDirection.SOUTH);
|
||||
// NORTH, Z+
|
||||
boolean renderBack = CraneHelper.canFrameConnectTo(tileEntity, tX, tY, tZ + 1, ForgeDirection.NORTH);
|
||||
boolean renderFoot = tileEntity.worldObj.isBlockSolidOnSide(tX, tY - 1, tZ, ForgeDirection.UP);
|
||||
if ((renderLeft && renderRight) || (renderFront && renderBack))
|
||||
renderFoot = false;
|
||||
ResourceLocation name = new ResourceLocation(AssemblyLine.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + TEXTURE);
|
||||
func_110628_a(name);
|
||||
glPushMatrix();
|
||||
glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
glRotatef(180f, 0f, 0f, 1f);
|
||||
glEnable(GL_LIGHTING);
|
||||
MODEL.render(renderUp, renderDown && !renderFoot, renderLeft, renderRight, renderFront, renderBack, renderFoot);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
package dark.assembly.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -44,18 +42,14 @@ import dark.assembly.common.machine.TileEntityManipulator;
|
|||
import dark.assembly.common.machine.TileEntityRejector;
|
||||
import dark.assembly.common.machine.belt.BlockConveyorBelt;
|
||||
import dark.assembly.common.machine.belt.TileEntityConveyorBelt;
|
||||
import dark.assembly.common.machine.crane.BlockCraneController;
|
||||
import dark.assembly.common.machine.crane.BlockCraneFrame;
|
||||
import dark.assembly.common.machine.crane.TileEntityCraneController;
|
||||
import dark.assembly.common.machine.crane.TileEntityCraneRail;
|
||||
import dark.assembly.common.machine.encoder.BlockEncoder;
|
||||
import dark.assembly.common.machine.encoder.ItemDisk;
|
||||
import dark.assembly.common.machine.encoder.TileEntityEncoder;
|
||||
import dark.assembly.common.machine.processor.BlockProcessor;
|
||||
import dark.core.common.BlockRegistry.BlockData;
|
||||
import dark.core.common.DarkMain;
|
||||
import dark.core.prefab.ModPrefab;
|
||||
import dark.core.prefab.items.ItemBlockHolder;
|
||||
import dark.core.registration.ModObjectRegistry;
|
||||
|
||||
@ModstatInfo(prefix = "asmline")
|
||||
@Mod(modid = AssemblyLine.MOD_ID, name = AssemblyLine.MOD_NAME, version = DarkMain.VERSION, dependencies = "required-after:DarkCore", useMetadata = true)
|
||||
|
@ -127,8 +121,6 @@ public class AssemblyLine extends ModPrefab
|
|||
GameRegistry.registerTileEntity(TileEntityDetector.class, "ALDetector");
|
||||
GameRegistry.registerTileEntity(TileEntityEncoder.class, "ALEncoder");
|
||||
GameRegistry.registerTileEntity(TileEntityArmbot.class, "ALArmbot");
|
||||
GameRegistry.registerTileEntity(TileEntityCraneController.class, "ALCraneController");
|
||||
GameRegistry.registerTileEntity(TileEntityCraneRail.class, "ALCraneRail");
|
||||
GameRegistry.registerTileEntity(TileEntityImprinter.class, "ALImprinter");
|
||||
|
||||
TabAssemblyLine.itemStack = new ItemStack(recipeLoader.blockConveyorBelt);
|
||||
|
@ -149,28 +141,23 @@ public class AssemblyLine extends ModPrefab
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<BlockData> getBlocks()
|
||||
public void registerObjects()
|
||||
{
|
||||
List<BlockData> dataList = new ArrayList<BlockData>();
|
||||
if (recipeLoader == null)
|
||||
{
|
||||
recipeLoader = new ALRecipeLoader();
|
||||
}
|
||||
CONFIGURATION.load();
|
||||
recipeLoader.blockConveyorBelt = new BlockConveyorBelt(getNextID());
|
||||
dataList.add(new BlockData(recipeLoader.blockConveyorBelt, "ConveyorBelt"));
|
||||
recipeLoader.blockManipulator = new BlockManipulator(getNextID());
|
||||
recipeLoader.blockCrate = new BlockCrate(getNextID());
|
||||
recipeLoader.blockImprinter = new BlockImprinter(getNextID());
|
||||
recipeLoader.blockDetector = new BlockDetector(getNextID());
|
||||
recipeLoader.blockRejector = new BlockRejector(getNextID());
|
||||
recipeLoader.blockEncoder = new BlockEncoder(getNextID());
|
||||
recipeLoader.blockArmbot = new BlockArmbot(getNextID());
|
||||
recipeLoader.blockCraneController = new BlockCraneController(getNextID());
|
||||
recipeLoader.blockCraneFrame = new BlockCraneFrame(getNextID());
|
||||
recipeLoader.blockTurntable = new BlockTurntable(getNextID());
|
||||
AssemblyLine.processorMachine = new BlockProcessor(getNextID());
|
||||
dataList.add(new BlockData(AssemblyLine.processorMachine, ItemBlockHolder.class, "OreProcessor"));
|
||||
recipeLoader.blockConveyorBelt = ModObjectRegistry.createNewBlock(AssemblyLine.MOD_ID, BlockConveyorBelt.class);
|
||||
recipeLoader.blockManipulator = new BlockManipulator();
|
||||
recipeLoader.blockCrate = new BlockCrate();
|
||||
recipeLoader.blockImprinter = new BlockImprinter();
|
||||
recipeLoader.blockDetector = new BlockDetector();
|
||||
recipeLoader.blockRejector = new BlockRejector();
|
||||
recipeLoader.blockEncoder = new BlockEncoder();
|
||||
recipeLoader.blockArmbot = new BlockArmbot();
|
||||
recipeLoader.blockTurntable = new BlockTurntable();
|
||||
AssemblyLine.processorMachine = ModObjectRegistry.createNewBlock(AssemblyLine.MOD_ID, BlockProcessor.class, ItemBlockHolder.class);
|
||||
|
||||
recipeLoader.itemImprint = new ItemImprinter(CONFIGURATION.getItem("Imprint", ITEM_ID_PREFIX).getInt());
|
||||
recipeLoader.itemDisk = new ItemDisk(CONFIGURATION.getItem("Disk", ITEM_ID_PREFIX + 1).getInt());
|
||||
|
@ -182,7 +169,6 @@ public class AssemblyLine extends ModPrefab
|
|||
TileEntityAssembly.refresh_min_rate = CONFIGURATION.get("TileSettings", "RefreshLowestValue", 20, "Lowest value the refresh rate of the tile network will be").getInt();
|
||||
|
||||
CONFIGURATION.save();
|
||||
return dataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,12 +13,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import dark.assembly.client.render.BlockRenderingHandler;
|
||||
import dark.assembly.common.machine.BlockAssembly;
|
||||
import dark.core.prefab.IMultiBlock;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
public class BlockArmbot extends BlockAssembly
|
||||
{
|
||||
public BlockArmbot(int id)
|
||||
public BlockArmbot()
|
||||
{
|
||||
super(id, UniversalElectricity.machine, "armbot");
|
||||
super(new BlockBuildData(BlockArmbot.class, "armbot", UniversalElectricity.machine));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.assembly.common.CommonProxy;
|
||||
import dark.assembly.common.machine.BlockAssembly;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
public class BlockImprinter extends BlockAssembly
|
||||
{
|
||||
|
@ -24,9 +25,9 @@ public class BlockImprinter extends BlockAssembly
|
|||
Icon imprinter_top;
|
||||
Icon imprinter_bottom;
|
||||
|
||||
public BlockImprinter(int id)
|
||||
public BlockImprinter()
|
||||
{
|
||||
super(id, Material.wood, "imprinter");
|
||||
super(new BlockBuildData(BlockImprinter.class, "imprinter", Material.wood));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package dark.assembly.common.imprinter.prefab;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -12,16 +10,16 @@ import net.minecraft.world.World;
|
|||
import dark.assembly.api.IFilterable;
|
||||
import dark.assembly.common.imprinter.ItemImprinter;
|
||||
import dark.assembly.common.machine.BlockAssembly;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
/** Extend this block class if a filter is allowed to be placed inside of this block.
|
||||
*
|
||||
*
|
||||
* @author Calclavia */
|
||||
public abstract class BlockImprintable extends BlockAssembly
|
||||
{
|
||||
public BlockImprintable(String name, int id, Material material, CreativeTabs creativeTab)
|
||||
public BlockImprintable(BlockBuildData data)
|
||||
{
|
||||
super(id, material, name);
|
||||
this.setCreativeTab(creativeTab);
|
||||
super(data);
|
||||
}
|
||||
|
||||
/** Allows filters to be placed inside of this block. */
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
package dark.assembly.common.machine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.assembly.common.TabAssemblyLine;
|
||||
import dark.core.prefab.machine.BlockMachine;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
public abstract class BlockAssembly extends BlockMachine
|
||||
{
|
||||
public Icon machine_icon;
|
||||
|
||||
public BlockAssembly(int id, Material material, String name)
|
||||
public BlockAssembly(BlockBuildData buildBuildData)
|
||||
{
|
||||
super(name, AssemblyLine.CONFIGURATION, id, material);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setCreativeTab(TabAssemblyLine.INSTANCE);
|
||||
super(buildBuildData.setCreativeTab(TabAssemblyLine.INSTANCE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,18 +16,19 @@ import universalelectricity.core.UniversalElectricity;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
/** A block that allows the placement of mass amount of a specific item within it. It will be allowed
|
||||
* to go on Conveyor Belts
|
||||
*
|
||||
* @author Calclavia */
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class BlockCrate extends BlockAssembly
|
||||
{
|
||||
Icon crate_icon;
|
||||
|
||||
public BlockCrate(int id)
|
||||
public BlockCrate()
|
||||
{
|
||||
super(id, UniversalElectricity.machine, "crate");
|
||||
super(new BlockBuildData(BlockCrate.class, "crate", UniversalElectricity.machine));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -212,7 +213,7 @@ public class BlockCrate extends BlockAssembly
|
|||
}
|
||||
|
||||
/** Inserts all items of the same type this player has into the crate.
|
||||
*
|
||||
*
|
||||
* @return True on success */
|
||||
public boolean insertAllItems(TileEntityCrate tileEntity, EntityPlayer player)
|
||||
{
|
||||
|
@ -257,7 +258,7 @@ public class BlockCrate extends BlockAssembly
|
|||
}
|
||||
|
||||
/** Ejects and item out of the crate and spawn it under the player entity.
|
||||
*
|
||||
*
|
||||
* @param tileEntity
|
||||
* @param player
|
||||
* @param requestSize - The maximum stack size to take out. Default should be 64.
|
||||
|
@ -309,7 +310,7 @@ public class BlockCrate extends BlockAssembly
|
|||
}
|
||||
|
||||
/** Puts an itemStack into the crate.
|
||||
*
|
||||
*
|
||||
* @param tileEntity
|
||||
* @param itemStack */
|
||||
public static ItemStack addStackToCrate(TileEntityCrate tileEntity, ItemStack itemStack)
|
||||
|
|
|
@ -14,8 +14,8 @@ import universalelectricity.core.UniversalElectricity;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.assembly.common.TabAssemblyLine;
|
||||
import dark.assembly.common.imprinter.prefab.BlockImprintable;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
/** @author Briman0094 */
|
||||
public class BlockDetector extends BlockImprintable
|
||||
|
@ -23,9 +23,9 @@ public class BlockDetector extends BlockImprintable
|
|||
Icon eye_red;
|
||||
Icon eye_green;
|
||||
|
||||
public BlockDetector(int blockID)
|
||||
public BlockDetector()
|
||||
{
|
||||
super("detector", blockID, UniversalElectricity.machine, TabAssemblyLine.INSTANCE);
|
||||
super(new BlockBuildData(BlockDetector.class, "detector", UniversalElectricity.machine));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,17 +9,17 @@ import universalelectricity.core.UniversalElectricity;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.client.render.BlockRenderingHandler;
|
||||
import dark.assembly.common.TabAssemblyLine;
|
||||
import dark.assembly.common.imprinter.prefab.BlockImprintable;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
/** A block that manipulates item movement between inventories.
|
||||
*
|
||||
*
|
||||
* @author Calclavia */
|
||||
public class BlockManipulator extends BlockImprintable
|
||||
{
|
||||
public BlockManipulator(int id)
|
||||
public BlockManipulator()
|
||||
{
|
||||
super("manipulator", id, UniversalElectricity.machine, TabAssemblyLine.INSTANCE);
|
||||
super(new BlockBuildData(BlockManipulator.class, "manipulator", UniversalElectricity.machine));
|
||||
this.setBlockBounds(0, 0, 0, 1, 0.29f, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,14 @@ import universalelectricity.core.UniversalElectricity;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.client.render.BlockRenderingHandler;
|
||||
import dark.assembly.common.TabAssemblyLine;
|
||||
import dark.assembly.common.imprinter.prefab.BlockImprintable;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
public class BlockRejector extends BlockImprintable
|
||||
{
|
||||
public BlockRejector(int id)
|
||||
public BlockRejector()
|
||||
{
|
||||
super("rejector", id, UniversalElectricity.machine, TabAssemblyLine.INSTANCE);
|
||||
super(new BlockBuildData(BlockRejector.class, "rejector", UniversalElectricity.machine));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,14 +19,15 @@ import universalelectricity.prefab.tile.IRotatable;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
public class BlockTurntable extends BlockAssembly
|
||||
{
|
||||
private Icon top;
|
||||
|
||||
public BlockTurntable(int par1)
|
||||
public BlockTurntable()
|
||||
{
|
||||
super(par1, Material.piston, "turntable");
|
||||
super(new BlockBuildData(BlockTurntable.class, "turntable", Material.piston));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,15 +20,17 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import dark.assembly.client.render.BlockRenderingHandler;
|
||||
import dark.assembly.common.machine.BlockAssembly;
|
||||
import dark.assembly.common.machine.belt.TileEntityConveyorBelt.SlantType;
|
||||
import dark.core.common.DarkMain;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
/** The block for the actual conveyor belt!
|
||||
*
|
||||
*
|
||||
* @author Calclavia, DarkGuardsman */
|
||||
public class BlockConveyorBelt extends BlockAssembly
|
||||
{
|
||||
public BlockConveyorBelt(int id)
|
||||
public BlockConveyorBelt()
|
||||
{
|
||||
super(id, UniversalElectricity.machine, "conveyorBelt");
|
||||
super(new BlockBuildData(BlockConveyorBelt.class, "conveyorBelt", UniversalElectricity.machine));
|
||||
this.setBlockBounds(0, 0, 0, 1, 0.3f, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
package dark.assembly.common.machine.crane;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.client.render.BlockRenderingHandler;
|
||||
import dark.assembly.common.machine.BlockAssembly;
|
||||
|
||||
public class BlockCraneController extends BlockAssembly
|
||||
{
|
||||
public BlockCraneController(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine, "craneController");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
|
||||
{
|
||||
int rot = (int) Math.min(((entity.rotationYaw + 315f) % 360f) / 90f, 3);
|
||||
switch (rot)
|
||||
{
|
||||
case 0: // WEST
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal(), 3);
|
||||
break;
|
||||
}
|
||||
case 1: // NORTH
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal(), 3);
|
||||
break;
|
||||
}
|
||||
case 2: // EAST
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal(), 3);
|
||||
break;
|
||||
}
|
||||
default: // SOUTH
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal(), 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileEntityCraneController();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
package dark.assembly.common.machine.crane;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.assembly.client.render.BlockRenderingHandler;
|
||||
import dark.assembly.common.machine.BlockAssembly;
|
||||
|
||||
public class BlockCraneFrame extends BlockAssembly
|
||||
{
|
||||
public BlockCraneFrame(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine, "craneFrame");
|
||||
this.setBlockBounds(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
return super.getSelectedBoundingBoxFromPool(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tE = world.getBlockTileEntity(x, y, z);
|
||||
if (tE != null && tE instanceof TileEntityCraneRail)
|
||||
{
|
||||
AxisAlignedBB middle = AxisAlignedBB.getBoundingBox(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f);
|
||||
AxisAlignedBB up = AxisAlignedBB.getBoundingBox(0.25f, 0.75f, 0.25f, 0.75f, 1.0f, 0.75f);
|
||||
AxisAlignedBB down = AxisAlignedBB.getBoundingBox(0.25f, 0.0f, 0.25f, 0.75f, 0.25f, 0.75f);
|
||||
AxisAlignedBB left = AxisAlignedBB.getBoundingBox(0.0f, 0.25f, 0.25f, 0.25f, 0.75f, 0.75f);
|
||||
AxisAlignedBB right = AxisAlignedBB.getBoundingBox(0.75f, 0.25f, 0.25f, 1.0f, 0.75f, 0.75f);
|
||||
AxisAlignedBB front = AxisAlignedBB.getBoundingBox(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 0.25f);
|
||||
AxisAlignedBB back = AxisAlignedBB.getBoundingBox(0.25f, 0.25f, 0.75f, 0.75f, 0.75f, 1.0f);
|
||||
boolean connectUp = CraneHelper.canFrameConnectTo(tE, x, y + 1, z, ForgeDirection.DOWN);
|
||||
boolean connectDown = CraneHelper.canFrameConnectTo(tE, x, y - 1, z, ForgeDirection.UP);
|
||||
// EAST, X-
|
||||
boolean connectLeft = CraneHelper.canFrameConnectTo(tE, x - 1, y, z, ForgeDirection.EAST);
|
||||
// WAST, X+
|
||||
boolean connectRight = CraneHelper.canFrameConnectTo(tE, x + 1, y, z, ForgeDirection.WEST);
|
||||
// SOUTH, Z-
|
||||
boolean connectFront = CraneHelper.canFrameConnectTo(tE, x, y, z - 1, ForgeDirection.SOUTH);
|
||||
// NORTH, Z+
|
||||
boolean connectBack = CraneHelper.canFrameConnectTo(tE, x, y, z + 1, ForgeDirection.NORTH);
|
||||
if (connectUp)
|
||||
{
|
||||
middle.maxY = up.maxY;
|
||||
}
|
||||
if (connectDown)
|
||||
{
|
||||
middle.minY = down.minY;
|
||||
}
|
||||
if (connectLeft)
|
||||
{
|
||||
middle.minX = left.minX;
|
||||
}
|
||||
if (connectRight)
|
||||
{
|
||||
middle.maxX = right.maxX;
|
||||
}
|
||||
if (connectFront)
|
||||
{
|
||||
middle.minZ = front.minZ;
|
||||
}
|
||||
if (connectBack)
|
||||
{
|
||||
middle.maxZ = back.maxZ;
|
||||
}
|
||||
setBlockBounds((float) middle.minX, (float) middle.minY, (float) middle.minZ, (float) middle.maxX, (float) middle.maxY, (float) middle.maxZ);
|
||||
middle.offset(x, y, z);
|
||||
return middle;
|
||||
}
|
||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tE = world.getBlockTileEntity(x, y, z);
|
||||
if (tE != null && tE instanceof TileEntityCraneRail)
|
||||
{
|
||||
AxisAlignedBB middle = AxisAlignedBB.getBoundingBox(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f);
|
||||
AxisAlignedBB up = AxisAlignedBB.getBoundingBox(0.25f, 0.75f, 0.25f, 0.75f, 1.0f, 0.75f);
|
||||
AxisAlignedBB down = AxisAlignedBB.getBoundingBox(0.25f, 0.0f, 0.25f, 0.75f, 0.25f, 0.75f);
|
||||
AxisAlignedBB left = AxisAlignedBB.getBoundingBox(0.0f, 0.25f, 0.25f, 0.25f, 0.75f, 0.75f);
|
||||
AxisAlignedBB right = AxisAlignedBB.getBoundingBox(0.75f, 0.25f, 0.25f, 1.0f, 0.75f, 0.75f);
|
||||
AxisAlignedBB front = AxisAlignedBB.getBoundingBox(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 0.25f);
|
||||
AxisAlignedBB back = AxisAlignedBB.getBoundingBox(0.25f, 0.25f, 0.75f, 0.75f, 0.75f, 1.0f);
|
||||
boolean connectUp = CraneHelper.canFrameConnectTo(tE, x, y + 1, z, ForgeDirection.DOWN);
|
||||
boolean connectDown = CraneHelper.canFrameConnectTo(tE, x, y - 1, z, ForgeDirection.UP);
|
||||
// EAST, X-
|
||||
boolean connectLeft = CraneHelper.canFrameConnectTo(tE, x - 1, y, z, ForgeDirection.EAST);
|
||||
// WAST, X+
|
||||
boolean connectRight = CraneHelper.canFrameConnectTo(tE, x + 1, y, z, ForgeDirection.WEST);
|
||||
// SOUTH, Z-
|
||||
boolean connectFront = CraneHelper.canFrameConnectTo(tE, x, y, z - 1, ForgeDirection.SOUTH);
|
||||
// NORTH, Z+
|
||||
boolean connectBack = CraneHelper.canFrameConnectTo(tE, x, y, z + 1, ForgeDirection.NORTH);
|
||||
if (connectUp)
|
||||
{
|
||||
middle.maxY = up.maxY;
|
||||
}
|
||||
if (connectDown)
|
||||
{
|
||||
middle.minY = down.minY;
|
||||
}
|
||||
if (connectLeft)
|
||||
{
|
||||
middle.minX = left.minX;
|
||||
}
|
||||
if (connectRight)
|
||||
{
|
||||
middle.maxX = right.maxX;
|
||||
}
|
||||
if (connectFront)
|
||||
{
|
||||
middle.minZ = front.minZ;
|
||||
}
|
||||
if (connectBack)
|
||||
{
|
||||
middle.maxZ = back.maxZ;
|
||||
}
|
||||
setBlockBounds((float) middle.minX, (float) middle.minY, (float) middle.minZ, (float) middle.maxX, (float) middle.maxY, (float) middle.maxZ);
|
||||
return;
|
||||
}
|
||||
setBlockBounds(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileEntityCraneRail();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package dark.assembly.common.machine.crane;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import dark.assembly.api.ICraneConnectable;
|
||||
import dark.assembly.api.ICraneStructure;
|
||||
|
||||
/** Manager of crane movement, mapping, setup, but not AI
|
||||
*
|
||||
* @author Rseifert */
|
||||
public class CraneHelper
|
||||
{
|
||||
/** The maximum size that a crane can be */
|
||||
public static final int MAX_SIZE = 64;
|
||||
|
||||
public static boolean isCraneBlock(World world, int x, int y, int z)
|
||||
{
|
||||
return world.getBlockTileEntity(x, y, z) != null && world.getBlockTileEntity(x, y, z) instanceof ICraneConnectable;
|
||||
}
|
||||
|
||||
public static boolean isCraneStructureBlock(World world, int x, int y, int z)
|
||||
{
|
||||
return world.getBlockTileEntity(x, y, z) != null && world.getBlockTileEntity(x, y, z) instanceof ICraneStructure;
|
||||
}
|
||||
|
||||
public static boolean canFrameConnectTo(TileEntity tileEntity, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
if (tileEntity.worldObj.getBlockTileEntity(x, y, z) != null && tileEntity.worldObj.getBlockTileEntity(x, y, z) instanceof ICraneConnectable)
|
||||
{
|
||||
return ((ICraneConnectable) tileEntity.worldObj.getBlockTileEntity(x, y, z)).canFrameConnectTo(side);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ForgeDirection rotateClockwise(ForgeDirection direction)
|
||||
{
|
||||
if (direction == ForgeDirection.NORTH)
|
||||
return ForgeDirection.EAST;
|
||||
if (direction == ForgeDirection.EAST)
|
||||
return ForgeDirection.SOUTH;
|
||||
if (direction == ForgeDirection.SOUTH)
|
||||
return ForgeDirection.WEST;
|
||||
if (direction == ForgeDirection.WEST)
|
||||
return ForgeDirection.NORTH;
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public static ForgeDirection rotateCounterClockwise(ForgeDirection direction)
|
||||
{
|
||||
if (direction == ForgeDirection.NORTH)
|
||||
return ForgeDirection.WEST;
|
||||
if (direction == ForgeDirection.WEST)
|
||||
return ForgeDirection.SOUTH;
|
||||
if (direction == ForgeDirection.SOUTH)
|
||||
return ForgeDirection.EAST;
|
||||
if (direction == ForgeDirection.EAST)
|
||||
return ForgeDirection.NORTH;
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
}
|
|
@ -1,230 +0,0 @@
|
|||
package dark.assembly.common.machine.crane;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import dark.assembly.api.ICraneStructure;
|
||||
import dark.assembly.common.machine.TileEntityAssembly;
|
||||
import dark.core.common.DarkMain;
|
||||
|
||||
public class TileEntityCraneController extends TileEntityAssembly implements ICraneStructure
|
||||
{
|
||||
int width, depth;
|
||||
boolean isCraneValid;
|
||||
Vector3 armPos;
|
||||
|
||||
public TileEntityCraneController()
|
||||
{
|
||||
super(.1f);
|
||||
width = depth = 0;
|
||||
isCraneValid = false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
this.validateCrane();
|
||||
if (armPos == null || armPos.equals(new Vector3()))
|
||||
{
|
||||
int deltaX = 0;
|
||||
int deltaZ = 0;
|
||||
switch (this.getFacing())
|
||||
{
|
||||
case SOUTH:
|
||||
case EAST:
|
||||
deltaX = (this.width / 2);
|
||||
deltaZ = (this.depth / 2);
|
||||
break;
|
||||
case NORTH:
|
||||
case WEST:
|
||||
deltaX = -(this.width / 2);
|
||||
deltaZ = -(this.depth / 2);
|
||||
break;
|
||||
}
|
||||
armPos = new Vector3(this.xCoord + deltaX, this.yCoord, this.zCoord + deltaZ);
|
||||
}
|
||||
}
|
||||
|
||||
public ForgeDirection getFacing()
|
||||
{
|
||||
return ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (this.worldObj.isRemote && armPos != null)
|
||||
{
|
||||
DarkMain.proxy.renderBeam(this.worldObj, new Vector3(this), armPos, Color.BLUE, 1);
|
||||
}
|
||||
super.updateEntity();
|
||||
if (ticks % 60 == 0)
|
||||
{
|
||||
this.validateCrane();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCraneValid()
|
||||
{
|
||||
return isCraneValid;
|
||||
}
|
||||
|
||||
private void validateCrane()
|
||||
{
|
||||
isCraneValid = false;
|
||||
width = depth = 0;
|
||||
findCraneWidth();
|
||||
System.out.println("CraneValidator: Width = " + this.width);
|
||||
findCraneDepth();
|
||||
System.out.println("CraneValidator: Depth = " + this.depth);
|
||||
if (Math.abs(width) > 1 && Math.abs(depth) > 1)
|
||||
{
|
||||
isCraneValid = isFrameValid();
|
||||
|
||||
}
|
||||
System.out.println("CraneValidator: is valid? " + this.isCraneValid);
|
||||
}
|
||||
|
||||
private boolean isFrameValid()
|
||||
{
|
||||
for (int x = Math.min(0, width); x <= Math.max(0, width); x++)
|
||||
{
|
||||
if (!CraneHelper.isCraneStructureBlock(worldObj, xCoord + x, yCoord, zCoord))
|
||||
{
|
||||
System.out.println("CraneValidator: Failed width check ");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int z = Math.min(0, depth); z <= Math.max(0, depth); z++)
|
||||
{
|
||||
if (!CraneHelper.isCraneStructureBlock(worldObj, xCoord, yCoord, zCoord + z))
|
||||
{
|
||||
System.out.println("CraneValidator: Failed Depth Check? ");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int x = Math.min(width + 1, 1); x <= Math.max(-1, width - 1); x++)
|
||||
{
|
||||
for (int z = Math.min(depth + 1, 1); z <= Math.max(-1, depth - 1); z++)
|
||||
{
|
||||
if (!worldObj.isAirBlock(xCoord + x, yCoord, zCoord + z))
|
||||
{
|
||||
System.out.println("CraneValidator: Failed Area check");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Find x size and store in this.width */
|
||||
private void findCraneWidth()
|
||||
{
|
||||
int x = 0;
|
||||
ForgeDirection facing = this.getFacing();
|
||||
System.out.println("CraneValidator: Width direction = " + facing.ordinal());
|
||||
while (true)
|
||||
{
|
||||
if (Math.abs(x) >= CraneHelper.MAX_SIZE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!CraneHelper.isCraneStructureBlock(worldObj, xCoord + x, yCoord, zCoord))
|
||||
{
|
||||
System.out.println("CraneValidator: Hit non block at x = " + x);
|
||||
break;
|
||||
}
|
||||
if (facing == ForgeDirection.NORTH || facing == ForgeDirection.EAST)
|
||||
{
|
||||
x++;
|
||||
}
|
||||
else
|
||||
{
|
||||
x--;
|
||||
}
|
||||
}
|
||||
width = x; // can be negative
|
||||
if (width < 0)
|
||||
{
|
||||
width++;
|
||||
}
|
||||
if (width > 0)
|
||||
{
|
||||
width--;
|
||||
}
|
||||
}
|
||||
|
||||
/** Find x size and store in this.depth */
|
||||
private void findCraneDepth()
|
||||
{
|
||||
int z = 0;
|
||||
ForgeDirection facing = this.getFacing();
|
||||
while (true)
|
||||
{
|
||||
if (Math.abs(z) > CraneHelper.MAX_SIZE)
|
||||
break;
|
||||
if (!CraneHelper.isCraneStructureBlock(worldObj, xCoord, yCoord, zCoord + z))
|
||||
break;
|
||||
if (facing == ForgeDirection.SOUTH || facing == ForgeDirection.EAST)
|
||||
{
|
||||
z++;
|
||||
}
|
||||
else
|
||||
{
|
||||
z--;
|
||||
}
|
||||
}
|
||||
depth = z; // can be negative
|
||||
if (depth < 0)
|
||||
depth++;
|
||||
if (depth > 0)
|
||||
depth--;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFrameConnectTo(ForgeDirection side)
|
||||
{
|
||||
ForgeDirection facing = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
if (side == facing)
|
||||
return true;
|
||||
if (side == CraneHelper.rotateClockwise(facing))
|
||||
return true;
|
||||
if (side == ForgeDirection.UP)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("width", width);
|
||||
nbt.setInteger("depth", depth);
|
||||
nbt.setBoolean("isValid", isCraneValid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
width = nbt.getInteger("width");
|
||||
depth = nbt.getInteger("depth");
|
||||
isCraneValid = nbt.getBoolean("isValid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package dark.assembly.common.machine.crane;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
import dark.assembly.api.ICraneStructure;
|
||||
|
||||
public class TileEntityCraneRail extends TileEntityAdvanced implements ICraneStructure
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canFrameConnectTo(ForgeDirection side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.assembly.common.CommonProxy;
|
||||
import dark.assembly.common.machine.BlockAssembly;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
public class BlockEncoder extends BlockAssembly
|
||||
{
|
||||
|
@ -19,9 +20,9 @@ public class BlockEncoder extends BlockAssembly
|
|||
Icon encoder_top;
|
||||
Icon encoder_bottom;
|
||||
|
||||
public BlockEncoder(int id)
|
||||
public BlockEncoder()
|
||||
{
|
||||
super(id, Material.wood, "encoder");
|
||||
super(new BlockBuildData(BlockEncoder.class, "encoder", Material.wood));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -20,9 +20,11 @@ import dark.assembly.client.render.BlockRenderingHandler;
|
|||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.assembly.common.CommonProxy;
|
||||
import dark.assembly.common.TabAssemblyLine;
|
||||
import dark.core.common.DarkMain;
|
||||
import dark.core.prefab.IExtraObjectInfo;
|
||||
import dark.core.prefab.helpers.Pair;
|
||||
import dark.core.prefab.machine.BlockMachine;
|
||||
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||
|
||||
public class BlockProcessor extends BlockMachine implements IExtraObjectInfo
|
||||
{
|
||||
|
@ -30,9 +32,9 @@ public class BlockProcessor extends BlockMachine implements IExtraObjectInfo
|
|||
public static float grinderWattPerTick = .125f;
|
||||
public static float pressWattPerTick = .2f;
|
||||
|
||||
public BlockProcessor(int blockID)
|
||||
public BlockProcessor()
|
||||
{
|
||||
super("OreProcessor", AssemblyLine.CONFIGURATION, blockID, UniversalElectricity.machine);
|
||||
super(new BlockBuildData(BlockProcessor.class, "OreProcessor", UniversalElectricity.machine).setConfigProvider(AssemblyLine.CONFIGURATION));
|
||||
this.setCreativeTab(TabAssemblyLine.INSTANCE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue