Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

Commit

Permalink
Add in a base distance check for it a TE is useable, re-add a NO-OP u…
Browse files Browse the repository at this point in the history
…pdate function, stub in TEs for the Calciner and Glass Bell
  • Loading branch information
pahimar committed Oct 16, 2016
1 parent a62d97a commit 1dc790d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 10 deletions.
20 changes: 18 additions & 2 deletions src/main/java/com/pahimar/ee3/block/BlockCalciner.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
package com.pahimar.ee3.block;

import com.pahimar.ee3.block.base.BlockBase;
import com.pahimar.ee3.block.base.BlockContainerBase;
import com.pahimar.ee3.tileentity.TileEntityCalciner;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockCalciner extends BlockBase {
public class BlockCalciner extends BlockContainerBase {

private static final AxisAlignedBB AABB_CALCINER = new AxisAlignedBB(0.1D, 0.0D, 0.1D, 0.9D, 1.0D, 0.9D);

public BlockCalciner() {
super("calciner");
}

@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos blockPos) {
return AABB_CALCINER;
}

@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
Expand All @@ -34,4 +45,9 @@ public boolean isOpaqueCube(IBlockState state) {
public boolean isFullCube(IBlockState state) {
return false;
}

@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileEntityCalciner();
}
}
11 changes: 3 additions & 8 deletions src/main/java/com/pahimar/ee3/block/BlockGlassBell.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pahimar.ee3.block;

import com.pahimar.ee3.block.base.BlockContainerBase;
import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
Expand Down Expand Up @@ -103,14 +104,8 @@ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing,
return this.getDefaultState().withProperty(FACING, facing);
}

/**
* Returns a new instance of a block's tile entity class. Called on placing the block.
*
* @param worldIn
* @param meta
*/
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return null; // TODO
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityGlassBell();
}
}
9 changes: 9 additions & 0 deletions src/main/java/com/pahimar/ee3/tileentity/TileEntityBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public void setOwner(EntityPlayer entityPlayer) {
}
}

public boolean canInteractWith(EntityPlayer playerIn) {
return !isInvalid() && playerIn.getDistanceSq(pos.add(0.5D, 0.5D, 0.5D)) <= 64D;
}

@Override
public void update() {
// NO-OP
}

@Override
public void readFromNBT(NBTTagCompound nbtTagCompound) {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.pahimar.ee3.tileentity;

public class TileEntityCalciner extends TileEntityBase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.pahimar.ee3.tileentity;

public class TileEntityGlassBell extends TileEntityBase {

}

0 comments on commit 1dc790d

Please sign in to comment.