Readded Armbot

This commit is contained in:
Calclavia 2014-01-11 18:31:58 +08:00
parent a31b12ba30
commit f3f6d7858b
33 changed files with 114 additions and 96 deletions

View file

@ -94,7 +94,7 @@ public class Electrical
public static Block blockAdvancedFurnace, blockMachinePart, blockGrinderWheel, blockPurifier;
// Transport
public static Block blockEMContractor;
public static Block blockEMLevitator;
public static Block blockArmbot;
public static Item itemDisk;
@ -111,10 +111,9 @@ public class Electrical
itemTransformer = contentRegistry.createItem(ItemTransformer.class);
blockTesla = contentRegistry.createTile(BlockTesla.class, TileTesla.class);
blockBattery = contentRegistry.createTile(BlockBattery.class, TileBattery.class);
blockEMContractor = contentRegistry.createTile(BlockLevitator.class, TileLevitator.class);
// Transport
blockEMContractor = contentRegistry.createTile(BlockLevitator.class, TileLevitator.class);
blockEMLevitator = contentRegistry.createTile(BlockLevitator.class, TileLevitator.class);
blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class);
// Machines

View file

@ -13,7 +13,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.prefab.block.BlockRI;
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
import resonantinduction.electrical.render.ElectricalBlockRenderingHandler;
import calclavia.lib.content.IExtraInfo.IExtraBlockInfo;
import calclavia.lib.multiblock.link.IBlockActivate;
import calclavia.lib.multiblock.link.IMultiBlock;
@ -109,7 +109,7 @@ public class BlockArmbot extends BlockRI implements IExtraBlockInfo
@Override
public int getRenderType()
{
return MechanicalBlockRenderingHandler.ID;
return ElectricalBlockRenderingHandler.ID;
}
@Override

View file

@ -25,7 +25,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class RenderArmbot extends TileEntitySpecialRenderer
{
public static final ModelArmbot MODEL = new ModelArmbot();
public static final String TEXTURE = "armbot.png";
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "armbot.png");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
@ -46,8 +46,8 @@ public class RenderArmbot extends TileEntitySpecialRenderer
}
}
}
ResourceLocation name = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + TEXTURE);
bindTexture(name);
bindTexture(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);

View file

@ -15,6 +15,8 @@ import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import resonantinduction.electrical.armbot.BlockArmbot;
import resonantinduction.electrical.armbot.RenderArmbot;
import resonantinduction.electrical.battery.BlockBattery;
import resonantinduction.electrical.battery.RenderBattery;
import resonantinduction.electrical.generator.solar.BlockSolarPanel;
@ -77,6 +79,14 @@ public class ElectricalBlockRenderingHandler implements ISimpleBlockRenderingHan
GL11.glRotatef(180f, 0f, 0f, 1f);
RenderSolarPanel.MODEL.render(0.0625F);
}
else if (block instanceof BlockArmbot)
{
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderArmbot.TEXTURE);
GL11.glTranslatef(0.0F, 0.7F, 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glScalef(0.8f, 0.8f, 0.8f);
RenderArmbot.MODEL.render(0.0625F, 0, 0);
}
}
@Override

View file

@ -241,86 +241,90 @@ public class BlockConveyorBelt extends BlockRI
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
if (tileEntity.IgnoreList.contains(entity))
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileConveyorBelt)
{
return;
}
if (tileEntity.isFunctioning() && !world.isBlockIndirectlyGettingPowered(x, y, z))
{
float acceleration = tileEntity.acceleration;
float maxSpeed = tileEntity.maxSpeed;
SlantType slantType = tileEntity.getSlant();
ForgeDirection direction = tileEntity.getDirection();
if (entity instanceof EntityLiving)
TileConveyorBelt tile = (TileConveyorBelt) tileEntity;
if (tile.IgnoreList.contains(entity))
{
acceleration *= 5;
maxSpeed *= 10;
return;
}
if (slantType == SlantType.UP)
if (tile.isFunctioning() && !world.isBlockIndirectlyGettingPowered(x, y, z))
{
if (entity.motionY < 0.2)
float acceleration = tile.acceleration;
float maxSpeed = tile.maxSpeed;
SlantType slantType = tile.getSlant();
ForgeDirection direction = tile.getDirection();
if (entity instanceof EntityLiving)
{
entity.addVelocity(0, 0.2, 0);
acceleration *= 5;
maxSpeed *= 10;
}
}
else if (slantType == SlantType.DOWN)
{
if (entity.motionY > -0.1)
if (slantType == SlantType.UP)
{
entity.addVelocity(0, -0.1, 0);
if (entity.motionY < 0.2)
{
entity.addVelocity(0, 0.2, 0);
}
}
}
// Move the entity based on the conveyor belt's direction.
entity.addVelocity(direction.offsetX * acceleration, 0, direction.offsetZ * acceleration);
if (direction.offsetX != 0 && Math.abs(entity.motionX) > maxSpeed)
{
entity.motionX = direction.offsetX * maxSpeed;
entity.motionZ = 0;
}
if (direction.offsetZ != 0 && Math.abs(entity.motionZ) > maxSpeed)
{
entity.motionZ = direction.offsetZ * maxSpeed;
entity.motionX = 0;
}
entity.motionY += 0.0125f;
if (entity instanceof EntityItem)
{
if (direction.offsetX != 0)
else if (slantType == SlantType.DOWN)
{
double difference = (z + 0.5) - entity.posZ;
entity.motionZ += difference * 0.1;
// entity.posZ = z + 0.5;
if (entity.motionY > -0.1)
{
entity.addVelocity(0, -0.1, 0);
}
}
else if (direction.offsetZ != 0)
// Move the entity based on the conveyor belt's direction.
entity.addVelocity(direction.offsetX * acceleration, 0, direction.offsetZ * acceleration);
if (direction.offsetX != 0 && Math.abs(entity.motionX) > maxSpeed)
{
double difference = (x + 0.5) - entity.posX;
entity.motionX += difference * 0.1;
// /entity.posX = x + 0.5;
entity.motionX = direction.offsetX * maxSpeed;
entity.motionZ = 0;
}
((EntityItem) entity).age++;
boolean foundSneaking = false;
for (EntityPlayer player : (List<EntityPlayer>) world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1)))
if (direction.offsetZ != 0 && Math.abs(entity.motionZ) > maxSpeed)
{
if (player.isSneaking())
foundSneaking = true;
entity.motionZ = direction.offsetZ * maxSpeed;
entity.motionX = 0;
}
if (foundSneaking)
((EntityItem) entity).delayBeforeCanPickup = 0;
else
((EntityItem) entity).delayBeforeCanPickup = 20;
entity.onGround = false;
}
entity.motionY += 0.0125f;
if (entity instanceof EntityItem)
{
if (direction.offsetX != 0)
{
double difference = (z + 0.5) - entity.posZ;
entity.motionZ += difference * 0.1;
// entity.posZ = z + 0.5;
}
else if (direction.offsetZ != 0)
{
double difference = (x + 0.5) - entity.posX;
entity.motionX += difference * 0.1;
// /entity.posX = x + 0.5;
}
((EntityItem) entity).age++;
boolean foundSneaking = false;
for (EntityPlayer player : (List<EntityPlayer>) world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1)))
{
if (player.isSneaking())
foundSneaking = true;
}
if (foundSneaking)
((EntityItem) entity).delayBeforeCanPickup = 0;
else
((EntityItem) entity).delayBeforeCanPickup = 20;
entity.onGround = false;
}
}
}
}

View file

@ -65,40 +65,45 @@ public class BlockGrinderWheel extends BlockRotatableBase implements ITileEntity
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
TileGrinderWheel tile = (TileGrinderWheel) world.getBlockTileEntity(x, y, z);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tile.canWork())
if (tileEntity instanceof TileGrinderWheel)
{
if (entity instanceof EntityItem)
{
if (tile.canGrind(((EntityItem) entity).getEntityItem()))
{
if (tile.grindingItem == null)
{
tile.grindingItem = (EntityItem) entity;
}
TileGrinderWheel tile = (TileGrinderWheel) tileEntity;
if (!TileGrinderWheel.getTimer().containsKey(entity))
if (tile.canWork())
{
if (entity instanceof EntityItem)
{
if (tile.canGrind(((EntityItem) entity).getEntityItem()))
{
TileGrinderWheel.getTimer().put((EntityItem) entity, TileGrinderWheel.DEFAULT_TIME);
if (tile.grindingItem == null)
{
tile.grindingItem = (EntityItem) entity;
}
if (!TileGrinderWheel.getTimer().containsKey(entity))
{
TileGrinderWheel.getTimer().put((EntityItem) entity, TileGrinderWheel.DEFAULT_TIME);
}
}
else
{
entity.setPosition(entity.posX, entity.posY - 1.2, entity.posZ);
}
}
else
{
entity.setPosition(entity.posX, entity.posY - 1.2, entity.posZ);
entity.attackEntityFrom(DamageSource.cactus, 2);
}
}
else
{
entity.attackEntityFrom(DamageSource.cactus, 2);
}
// Move entity based on the direction of the block.
ForgeDirection dir = this.getDirection(world, x, y, z);
entity.motionX += dir.offsetX * 0.1;
entity.motionZ += dir.offsetZ * 0.1;
entity.motionY += 0.1;
entity.isAirBorne = true;
// Move entity based on the direction of the block.
ForgeDirection dir = this.getDirection(world, x, y, z);
entity.motionX += dir.offsetX * 0.1;
entity.motionZ += dir.offsetZ * 0.1;
entity.motionY += 0.1;
entity.isAirBorne = true;
}
}
}

View file

@ -48,6 +48,7 @@ tile.resonantinduction\:grindingWheel.name=Grinder Wheel
tile.resonantinduction\:purifier.name=Purifier Rotor
tile.resonantinduction\:filter.name=Filter
tile.resonantinduction\:solarPanel.name=Solar Panel
tile.resonantinduction\:armbot.name=Armbot
## Items
item.resonantinduction\:quantumEntangler.name=Quantum Entangler
@ -132,7 +133,6 @@ tile.DMHopper.0.name = [WIP]Hopper 2.0
tile.imprinter.name=Imprinter
tile.encoder.name=[WIP]Encoder
tile.detector.name=Detector
tile.armbot.name=[WIP]Armbot
tile.craneController.name=Crane Controller
tile.craneFrame.name=Crane Frame
tile.manipulator.name=Manipulator

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB