Made Belts Stoppable via Redstone
This commit is contained in:
parent
d18cbe854a
commit
45f6a4fde4
6 changed files with 59 additions and 44 deletions
|
@ -1 +1 @@
|
||||||
68
|
69
|
||||||
|
|
1
info.txt
1
info.txt
|
@ -61,3 +61,4 @@ x AssemblyLine_v0.2.4.64.jar AssemblyLine_v0.2.4.64_api.zip
|
||||||
@ AssemblyLine_v0.2.4.66.jar AssemblyLine_v0.2.4.66_api.zip
|
@ AssemblyLine_v0.2.4.66.jar AssemblyLine_v0.2.4.66_api.zip
|
||||||
@ AssemblyLine_v0.2.4.67.jar AssemblyLine_v0.2.4.67_api.zip
|
@ AssemblyLine_v0.2.4.67.jar AssemblyLine_v0.2.4.67_api.zip
|
||||||
* AssemblyLine_v0.2.4.68.jar AssemblyLine_v0.2.4.68_api.zip
|
* AssemblyLine_v0.2.4.68.jar AssemblyLine_v0.2.4.68_api.zip
|
||||||
|
@ AssemblyLine_v0.2.5.69.jar AssemblyLine_v0.2.5.69_api.zip
|
||||||
|
|
|
@ -19,8 +19,8 @@ import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||||
|
|
||||||
public class RenderArmbot extends TileEntitySpecialRenderer
|
public class RenderArmbot extends TileEntitySpecialRenderer
|
||||||
{
|
{
|
||||||
public static final ModelArmbot MODEL = new ModelArmbot();
|
public static final ModelArmbot MODEL = new ModelArmbot();
|
||||||
public static final String TEXTURE = "armbot.png";
|
public static final String TEXTURE = "armbot.png";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
|
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
|
||||||
|
@ -46,24 +46,26 @@ public class RenderArmbot extends TileEntitySpecialRenderer
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||||
GL11.glScalef(1.0F, -1F, -1F);
|
GL11.glScalef(1.0F, -1F, -1F);
|
||||||
|
|
||||||
MODEL.render(0.0625f, ((TileEntityArmbot) tileEntity).renderYaw, ((TileEntityArmbot) tileEntity).renderPitch);
|
MODEL.render(0.0625f, ((TileEntityArmbot) tileEntity).renderYaw, ((TileEntityArmbot) tileEntity).renderPitch);
|
||||||
|
|
||||||
//debug render
|
// debug render
|
||||||
/*GL11.glEnable(GL11.GL_BLEND);
|
/*
|
||||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
* GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
* GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1f,
|
||||||
GL11.glColor4f(1f, 1f, 1f, 0.25f);
|
* 1f, 1f, 0.25f); MODEL.render(0.0625f, ((TileEntityArmbot) tileEntity).rotationYaw,
|
||||||
MODEL.render(0.0625f, ((TileEntityArmbot) tileEntity).rotationYaw, ((TileEntityArmbot) tileEntity).rotationPitch);
|
* ((TileEntityArmbot) tileEntity).rotationPitch); GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||||
GL11.glColor4f(1f, 1f, 1f, 1f);*/
|
*/
|
||||||
|
|
||||||
Vector3 handPos = ((TileEntityArmbot) tileEntity).getHandPosition();
|
Vector3 handPos = ((TileEntityArmbot) tileEntity).getHandPosition();
|
||||||
handPos.subtract(new Vector3(tileEntity));
|
handPos.subtract(new Vector3(tileEntity));
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glRotatef(180, 0, 0, 1);
|
GL11.glRotatef(180, 0, 0, 1);
|
||||||
|
|
||||||
for (Entity entity : ((TileEntityArmbot) tileEntity).grabbedEntities)
|
for (Entity entity : ((TileEntityArmbot) tileEntity).grabbedEntities)
|
||||||
{
|
{
|
||||||
if (entity != null && entity instanceof EntityItem) // items don't move right, so we render them manually
|
if (entity != null && entity instanceof EntityItem) // items don't move right, so we
|
||||||
|
// render them manually
|
||||||
{
|
{
|
||||||
EntityItem item = (EntityItem) entity;
|
EntityItem item = (EntityItem) entity;
|
||||||
item.age = 0;
|
item.age = 0;
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class BlockConveyorBelt extends BlockMachine
|
||||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z);
|
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z);
|
||||||
tileEntity.updatePowerTransferRange();
|
tileEntity.updatePowerTransferRange();
|
||||||
|
|
||||||
if (tileEntity.isRunning())
|
if (tileEntity.isRunning() && !world.isBlockIndirectlyGettingPowered(x, y, z))
|
||||||
{
|
{
|
||||||
float acceleration = tileEntity.acceleration;
|
float acceleration = tileEntity.acceleration;
|
||||||
float maxSpeed = tileEntity.maxSpeed;
|
float maxSpeed = tileEntity.maxSpeed;
|
||||||
|
|
|
@ -117,9 +117,9 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
||||||
PacketManager.sendPacketToClients(this.getDescriptionPacket());
|
PacketManager.sendPacketToClients(this.getDescriptionPacket());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isRunning())
|
if (this.isRunning() && !this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord))
|
||||||
{
|
{
|
||||||
if (this.ticks % 10 == 0 && this.worldObj.isRemote && this.worldObj.getBlockId(xCoord - 1, yCoord, zCoord) != AssemblyLine.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != AssemblyLine.blockConveyorBelt.blockID)
|
if (this.ticks % 10 == 0 && this.worldObj.isRemote && this.worldObj.getBlockId(this.xCoord - 1, this.yCoord, this.zCoord) != AssemblyLine.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != AssemblyLine.blockConveyorBelt.blockID)
|
||||||
{
|
{
|
||||||
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, "assemblyline.conveyor", 0.5f, 0.7f, true);
|
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, "assemblyline.conveyor", 0.5f, 0.7f, true);
|
||||||
}
|
}
|
||||||
|
@ -278,31 +278,34 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
|
||||||
|
|
||||||
public int getAnimationFrame()
|
public int getAnimationFrame()
|
||||||
{
|
{
|
||||||
TileEntity te = null;
|
if (!this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord))
|
||||||
te = this.worldObj.getBlockTileEntity(this.xCoord - 1, this.yCoord, this.zCoord);
|
|
||||||
|
|
||||||
if (te != null)
|
|
||||||
{
|
{
|
||||||
if (te instanceof TileEntityConveyorBelt)
|
TileEntity te = null;
|
||||||
|
te = this.worldObj.getBlockTileEntity(this.xCoord - 1, this.yCoord, this.zCoord);
|
||||||
|
|
||||||
|
if (te != null)
|
||||||
{
|
{
|
||||||
if (((TileEntityConveyorBelt) te).getSlant() == this.slantType)
|
if (te instanceof TileEntityConveyorBelt)
|
||||||
return ((TileEntityConveyorBelt) te).getAnimationFrame();
|
{
|
||||||
|
if (((TileEntityConveyorBelt) te).getSlant() == this.slantType)
|
||||||
|
return ((TileEntityConveyorBelt) te).getAnimationFrame();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
te = this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord - 1);
|
||||||
|
|
||||||
te = this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord - 1);
|
if (te != null)
|
||||||
|
|
||||||
if (te != null)
|
|
||||||
{
|
|
||||||
if (te instanceof TileEntityConveyorBelt)
|
|
||||||
{
|
{
|
||||||
if (((TileEntityConveyorBelt) te).getSlant() == this.slantType)
|
if (te instanceof TileEntityConveyorBelt)
|
||||||
return ((TileEntityConveyorBelt) te).getAnimationFrame();
|
{
|
||||||
|
if (((TileEntityConveyorBelt) te).getSlant() == this.slantType)
|
||||||
|
return ((TileEntityConveyorBelt) te).getAnimationFrame();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.animFrame;
|
return this.animFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import net.minecraftforge.common.IPlantable;
|
import net.minecraftforge.common.IPlantable;
|
||||||
import universalelectricity.core.vector.Vector3;
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
|
@ -44,19 +45,27 @@ public class CommandPlace extends Command
|
||||||
else if (itemStack.getItem() instanceof IPlantable)
|
else if (itemStack.getItem() instanceof IPlantable)
|
||||||
{
|
{
|
||||||
IPlantable plantable = ((IPlantable) itemStack.getItem());
|
IPlantable plantable = ((IPlantable) itemStack.getItem());
|
||||||
int blockID = plantable.getPlantID(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
Block blockBelow = Block.blocksList[Vector3.add(serachPosition, new Vector3(0, -1, 0)).getBlockID(this.world)];
|
||||||
int blockMetadata = plantable.getPlantMetadata(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
|
||||||
|
|
||||||
if (!world.setBlockAndMetadataWithNotify(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockID, blockMetadata)) { return false; }
|
if (blockBelow != null)
|
||||||
|
|
||||||
if (world.getBlockId(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()) == blockID)
|
|
||||||
{
|
{
|
||||||
Block.blocksList[blockID].onBlockPlacedBy(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), null);
|
if (blockBelow.canSustainPlant(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), ForgeDirection.UP, plantable))
|
||||||
Block.blocksList[blockID].onPostBlockPlaced(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockMetadata);
|
{
|
||||||
}
|
int blockID = plantable.getPlantID(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||||
|
int blockMetadata = plantable.getPlantMetadata(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||||
|
|
||||||
this.tileEntity.grabbedEntities.remove(entity);
|
if (this.world.setBlockAndMetadataWithNotify(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockID, blockMetadata))
|
||||||
return false;
|
{
|
||||||
|
if (this.world.getBlockId(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()) == blockID)
|
||||||
|
{
|
||||||
|
Block.blocksList[blockID].onBlockPlacedBy(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), null);
|
||||||
|
Block.blocksList[blockID].onPostBlockPlaced(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockMetadata);
|
||||||
|
this.tileEntity.grabbedEntities.remove(entity);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue