Implemented the Quarry Controller model in the code
This commit is contained in:
parent
e6e9ce69bc
commit
5aa1ea7ee4
8 changed files with 188 additions and 27 deletions
|
@ -11,6 +11,7 @@ import assemblyline.client.gui.GuiImprinter;
|
|||
import assemblyline.client.render.BlockRenderingHandler;
|
||||
import assemblyline.client.render.RenderArmbot;
|
||||
import assemblyline.client.render.RenderConveyorBelt;
|
||||
import assemblyline.client.render.RenderCraneController;
|
||||
import assemblyline.client.render.RenderCrate;
|
||||
import assemblyline.client.render.RenderDetector;
|
||||
import assemblyline.client.render.RenderManipulator;
|
||||
|
@ -22,6 +23,7 @@ import assemblyline.common.machine.TileEntityManipulator;
|
|||
import assemblyline.common.machine.TileEntityRejector;
|
||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||
import assemblyline.common.machine.belt.TileEntityConveyorBelt;
|
||||
import assemblyline.common.machine.crane.TileEntityCraneController;
|
||||
import assemblyline.common.machine.detector.TileEntityDetector;
|
||||
import assemblyline.common.machine.encoder.TileEntityEncoder;
|
||||
import assemblyline.common.machine.imprinter.TileEntityImprinter;
|
||||
|
@ -50,6 +52,7 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityManipulator.class, new RenderManipulator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrate.class, new RenderCrate());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityArmbot.class, new RenderArmbot());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneController.class, new RenderCraneController());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,9 +8,9 @@ package assemblyline.client.model;
|
|||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class ModelQuarryController extends ModelBase
|
||||
public class ModelCraneController extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Base2;
|
||||
|
@ -23,7 +23,7 @@ public class ModelQuarryController extends ModelBase
|
|||
ModelRenderer ConnectorTop;
|
||||
ModelRenderer ConnectorRight;
|
||||
|
||||
public ModelQuarryController()
|
||||
public ModelCraneController()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 64;
|
||||
|
@ -84,19 +84,36 @@ public class ModelQuarryController extends ModelBase
|
|||
setRotation(ConnectorRight, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
public void render(float scale)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5);
|
||||
Base2.render(f5);
|
||||
Base.render(f5);
|
||||
ConnectorFront.render(f5);
|
||||
Decoration1.render(f5);
|
||||
Decoration2.render(f5);
|
||||
Decoration3.render(f5);
|
||||
Decoration4.render(f5);
|
||||
ConnectorTop.render(f5);
|
||||
ConnectorRight.render(f5);
|
||||
Base2.setRotationPoint(-6F, 12F, -6F);
|
||||
setRotation(Base2, 0F, 0F, 0F);
|
||||
Base.setRotationPoint(-8F, 16F, -8F);
|
||||
setRotation(Base, 0F, 0F, 0F);
|
||||
Decoration1.setRotationPoint(2F, 15F, 6F);
|
||||
setRotation(Decoration1, 0F, 0F, 0F);
|
||||
Decoration2.setRotationPoint(-4F, 15F, 6F);
|
||||
setRotation(Decoration2, 0F, 0F, 0F);
|
||||
Decoration3.setRotationPoint(-7F, 15F, 2F);
|
||||
setRotation(Decoration3, 0F, 0F, 0F);
|
||||
Decoration4.setRotationPoint(-7F, 15F, -4F);
|
||||
setRotation(Decoration4, 0F, 0F, 0F);
|
||||
ConnectorTop.setRotationPoint(-4F, 16F, -4F);
|
||||
setRotation(ConnectorTop, 0F, 0F, -1.570796F);
|
||||
ConnectorFront.setRotationPoint(-4F, 12F, -0.01F);
|
||||
setRotation(ConnectorFront, 0F, 1.570796F, 0F);
|
||||
ConnectorRight.setRotationPoint(0.01F, 12F, -4F);
|
||||
setRotation(ConnectorRight, 0F, 0F, 0F);
|
||||
|
||||
Base2.render(scale);
|
||||
Base.render(scale);
|
||||
ConnectorFront.render(scale);
|
||||
Decoration1.render(scale);
|
||||
Decoration2.render(scale);
|
||||
Decoration3.render(scale);
|
||||
Decoration4.render(scale);
|
||||
ConnectorTop.render(scale);
|
||||
ConnectorRight.render(scale);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
|
@ -106,9 +123,4 @@ public class ModelQuarryController extends ModelBase
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
|
||||
}
|
||||
|
||||
}
|
|
@ -74,6 +74,16 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
RenderArmbot.MODEL.render(0.0625F, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (block.blockID == AssemblyLine.blockCraneController.blockID)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + 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);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package assemblyline.client.render;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import assemblyline.client.model.ModelCraneController;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
|
||||
public class RenderCraneController extends RenderImprintable
|
||||
{
|
||||
public static final String TEXTURE = "QuarryControllerMap.png";
|
||||
public static final ModelCraneController MODEL = new ModelCraneController();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + TEXTURE);
|
||||
ForgeDirection rot = ForgeDirection.getOrientation(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
float angle = 0f;
|
||||
switch (rot)
|
||||
{
|
||||
case NORTH:
|
||||
{
|
||||
angle = 90f;
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
{
|
||||
angle = 270f;
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
{
|
||||
angle = 180f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -5,14 +5,11 @@ import java.io.File;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.prefab.TranslationHelper;
|
||||
import universalelectricity.prefab.UETab;
|
||||
import universalelectricity.prefab.UpdateNotifier;
|
||||
import universalelectricity.prefab.multiblock.BlockMulti;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
@ -22,6 +19,7 @@ import assemblyline.common.machine.BlockManipulator;
|
|||
import assemblyline.common.machine.BlockRejector;
|
||||
import assemblyline.common.machine.armbot.BlockArmbot;
|
||||
import assemblyline.common.machine.belt.BlockConveyorBelt;
|
||||
import assemblyline.common.machine.crane.BlockCraneController;
|
||||
import assemblyline.common.machine.detector.BlockDetector;
|
||||
import assemblyline.common.machine.encoder.BlockEncoder;
|
||||
import assemblyline.common.machine.encoder.ItemDisk;
|
||||
|
@ -32,7 +30,6 @@ import cpw.mods.fml.common.Loader;
|
|||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.Mod.ServerStarted;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
|
@ -81,6 +78,7 @@ public class AssemblyLine
|
|||
public static Block blockDetector;
|
||||
public static Block blockRejector;
|
||||
public static Block blockArmbot;
|
||||
public static Block blockCraneController;
|
||||
|
||||
public static BlockMulti blockMulti;
|
||||
|
||||
|
@ -103,8 +101,8 @@ public class AssemblyLine
|
|||
blockRejector = new BlockRejector(CONFIGURATION.getBlock("Rejector", BLOCK_ID_PREFIX + 6).getInt());
|
||||
blockEncoder = new BlockEncoder(CONFIGURATION.getBlock("Encoder", BLOCK_ID_PREFIX + 7).getInt(), 7);
|
||||
blockArmbot = new BlockArmbot(CONFIGURATION.getBlock("Armbot", BLOCK_ID_PREFIX + 8).getInt());
|
||||
|
||||
blockMulti = new BlockMulti(CONFIGURATION.getBlock("Multiblock", BLOCK_ID_PREFIX + 9).getInt());
|
||||
blockCraneController = new BlockCraneController(CONFIGURATION.getBlock("CraneController", BLOCK_ID_PREFIX + 10).getInt());
|
||||
|
||||
itemImprint = new ItemImprinter(CONFIGURATION.getBlock("Imprint", ITEM_ID_PREFIX).getInt());
|
||||
itemDisk = new ItemDisk(CONFIGURATION.getBlock("Disk", ITEM_ID_PREFIX + 1).getInt());
|
||||
|
@ -119,6 +117,7 @@ public class AssemblyLine
|
|||
GameRegistry.registerBlock(blockDetector, "Detector");
|
||||
GameRegistry.registerBlock(blockRejector, "Rejector");
|
||||
GameRegistry.registerBlock(blockArmbot, "Armbot");
|
||||
GameRegistry.registerBlock(blockCraneController, "Crane Controller");
|
||||
|
||||
TabAssemblyLine.itemStack = new ItemStack(AssemblyLine.blockConveyorBelt);
|
||||
UpdateNotifier.INSTANCE.checkUpdate(NAME, VERSION, "http://calclavia.com/downloads/al/recommendedversion.txt");
|
||||
|
|
|
@ -15,6 +15,7 @@ import assemblyline.common.machine.TileEntityManipulator;
|
|||
import assemblyline.common.machine.TileEntityRejector;
|
||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||
import assemblyline.common.machine.belt.TileEntityConveyorBelt;
|
||||
import assemblyline.common.machine.crane.TileEntityCraneController;
|
||||
import assemblyline.common.machine.detector.TileEntityDetector;
|
||||
import assemblyline.common.machine.encoder.ContainerEncoder;
|
||||
import assemblyline.common.machine.encoder.TileEntityEncoder;
|
||||
|
@ -26,8 +27,8 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||
|
||||
public class CommonProxy implements IGuiHandler
|
||||
{
|
||||
public static final int GUI_IMPRINTER = 1;
|
||||
public static final int GUI_ENCODER = 2;
|
||||
public static final int GUI_IMPRINTER = 1;
|
||||
public static final int GUI_ENCODER = 2;
|
||||
|
||||
public void preInit()
|
||||
{
|
||||
|
@ -43,6 +44,7 @@ public class CommonProxy implements IGuiHandler
|
|||
GameRegistry.registerTileEntity(TileEntityDetector.class, "ALDetector");
|
||||
GameRegistry.registerTileEntity(TileEntityEncoder.class, "ALEncoder");
|
||||
GameRegistry.registerTileEntity(TileEntityArmbot.class, "ALArmbot");
|
||||
GameRegistry.registerTileEntity(TileEntityCraneController.class, "ALCraneController");
|
||||
GameRegistry.registerTileEntity(TileEntityImprinter.class, "ALImprinter");
|
||||
GameRegistry.registerTileEntity(TileEntityMulti.class, "ALMulti");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
package assemblyline.common.machine.crane;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import assemblyline.client.render.BlockRenderingHandler;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCraneController extends BlockMachine
|
||||
{
|
||||
|
||||
public BlockCraneController(int id)
|
||||
{
|
||||
super("cranecontroller", id, UniversalElectricity.machine);
|
||||
this.setResistance(5.0f);
|
||||
this.setHardness(5.0f);
|
||||
this.setCreativeTab(TabAssemblyLine.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entity)
|
||||
{
|
||||
int rot = (int) Math.min((entity.rotationYaw - 45f) / 90f, 3);
|
||||
switch (rot)
|
||||
{
|
||||
case 0: //WEST
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal());
|
||||
break;
|
||||
}
|
||||
case 1: //NORTH
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal());
|
||||
break;
|
||||
}
|
||||
case 2: //EAST
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal());
|
||||
break;
|
||||
}
|
||||
default: //SOUTH
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata)
|
||||
{
|
||||
return new TileEntityCraneController();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package assemblyline.common.machine.crane;
|
||||
|
||||
import assemblyline.common.machine.TileEntityAssemblyNetwork;
|
||||
|
||||
public class TileEntityCraneController extends TileEntityAssemblyNetwork
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in a new issue