mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 04:22:32 +00:00
Improve engine placement and hit box
This commit is contained in:
1 parent
df02bf1d26
commit
4874b628db
8 files changed
+171
-62
No files matched your search
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -21,7 +20,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import forestry.core.render.IBlockRenderer;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class EngineDefinition extends MachineDefinition {
|
||||
|
||||
@@ -31,35 +30,22 @@ public class EngineDefinition extends MachineDefinition {
|
||||
|
||||
@Override
|
||||
public boolean isSolidOnSide(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEngine) {
|
||||
return ((TileEngine) tile).getOrientation().getOpposite().ordinal() == side;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side) {
|
||||
|
||||
if (player.isSneaking()) {
|
||||
TileEngine tile = TileUtil.getTile(world, x, y, z, TileEngine.class);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEngine tile = (TileEngine) world.getTileEntity(x, y, z);
|
||||
if (PlayerUtil.canWrench(player, x, y, z)) {
|
||||
tile.rotateEngine();
|
||||
PlayerUtil.useWrench(player, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return tile.getOrientation().getOpposite().ordinal() == side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis) {
|
||||
TileEngine tile = (TileEngine) world.getTileEntity(x, y, z);
|
||||
TileEngine tile = TileUtil.getTile(world, x, y, z, TileEngine.class);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
tile.rotateEngine();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user