Fixed camera view to be centered on block
This commit is contained in:
parent
fffe79ebba
commit
22e5c3efb6
3 changed files with 26 additions and 11 deletions
|
@ -39,6 +39,11 @@ public class BlockCamera extends BlockAbstractContainer {
|
|||
return new TileEntityCamera();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 1;
|
||||
|
|
|
@ -43,25 +43,21 @@ public class BlockLaserCamera extends BlockAbstractContainer {
|
|||
return new TileEntityLaserCamera();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon block activation (right click on the block.)
|
||||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (entityPlayer.getHeldItem() == null) {
|
||||
|
|
|
@ -40,8 +40,6 @@ public final class EntityCamera extends EntityLivingBase {
|
|||
|
||||
public EntityCamera(World world, final int x, final int y, final int z, EntityPlayer player) {
|
||||
super(world);
|
||||
setInvisible(true);
|
||||
// yOffset = 1.9F; // set viewpoint inside camera (requires a 3D model of the camera)
|
||||
posX = x;
|
||||
posY = y;
|
||||
posZ = z;
|
||||
|
@ -49,9 +47,25 @@ public final class EntityCamera extends EntityLivingBase {
|
|||
cameraY = y;
|
||||
cameraZ = z;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
setInvisible(true);
|
||||
// set viewpoint inside camera
|
||||
yOffset = 1.62F;
|
||||
noClip = true;
|
||||
}
|
||||
|
||||
// override to skip the block bounding override on client side
|
||||
@Override
|
||||
public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int p_70056_9_) {
|
||||
// super.setPositionAndRotation2(x, y, z, yaw, pitch, p_70056_9_);
|
||||
this.setPosition(x, y, z);
|
||||
this.setRotation(yaw, pitch);
|
||||
}
|
||||
|
||||
private void closeCamera() {
|
||||
if (!isActive) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue