From f906aaa3cd927a203d3725094f83f9231baa9db4 Mon Sep 17 00:00:00 2001 From: drcrazy Date: Tue, 9 Apr 2019 17:04:51 +0300 Subject: [PATCH] Fix sap side --- .../techreborn/blocks/BlockRubberLog.java | 18 +++++++++------ .../techreborn/blockstates/rubber_log.json | 22 +++++++++---------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/main/java/techreborn/blocks/BlockRubberLog.java b/src/main/java/techreborn/blocks/BlockRubberLog.java index eabdee6ce..334c62433 100644 --- a/src/main/java/techreborn/blocks/BlockRubberLog.java +++ b/src/main/java/techreborn/blocks/BlockRubberLog.java @@ -106,13 +106,17 @@ public class BlockRubberLog extends BlockLog { @Override public void tick(IBlockState state, World worldIn, BlockPos pos, Random random) { super.tick(state, worldIn, pos, random); - if (!state.get(HAS_SAP)) { - if (random.nextInt(50) == 0) { - EnumFacing facing = EnumFacing.byHorizontalIndex(random.nextInt(4)); - if (worldIn.getBlockState(pos.down()).getBlock() == this - && worldIn.getBlockState(pos.up()).getBlock() == this) { - worldIn.setBlockState(pos, state.with(HAS_SAP, true).with(SAP_SIDE, facing)); - } + if (state.get(AXIS) != EnumFacing.Axis.Y) { + return; + } + if (state.get(HAS_SAP)) { + return; + } + if (random.nextInt(50) == 0) { + EnumFacing facing = EnumFacing.byHorizontalIndex(random.nextInt(4)); + if (worldIn.getBlockState(pos.down()).getBlock() == this + && worldIn.getBlockState(pos.up()).getBlock() == this) { + worldIn.setBlockState(pos, state.with(HAS_SAP, true).with(SAP_SIDE, facing)); } } } diff --git a/src/main/resources/assets/techreborn/blockstates/rubber_log.json b/src/main/resources/assets/techreborn/blockstates/rubber_log.json index 90b150ab2..6858501fd 100644 --- a/src/main/resources/assets/techreborn/blockstates/rubber_log.json +++ b/src/main/resources/assets/techreborn/blockstates/rubber_log.json @@ -12,17 +12,17 @@ "axis=y,facing=north,hassap=false": { "model": "techreborn:block/rubber_log" }, "axis=z,facing=north,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90 }, "axis=x,facing=north,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 }, - "axis=y,facing=east,hassap=true": { "model": "techreborn:block/rubber_log_with_sap" }, - "axis=z,facing=east,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90 }, - "axis=x,facing=east,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90, "y": 90 }, - "axis=y,facing=south,hassap=true": { "model": "techreborn:block/rubber_log_with_sap" }, - "axis=z,facing=south,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90 }, - "axis=x,facing=south,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90, "y": 90 }, - "axis=y,facing=west,hassap=true": { "model": "techreborn:block/rubber_log_with_sap" }, - "axis=z,facing=west,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90 }, - "axis=x,facing=west,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90, "y": 90 }, + "axis=y,facing=east,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "y": 90 }, + "axis=z,facing=east,hassap=true": { "model": "techreborn:block/rubber_log", "x": 90 }, + "axis=x,facing=east,hassap=true": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 }, + "axis=y,facing=south,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "y": 180 }, + "axis=z,facing=south,hassap=true": { "model": "techreborn:block/rubber_log", "x": 90 }, + "axis=x,facing=south,hassap=true": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 }, + "axis=y,facing=west,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "y": 270 }, + "axis=z,facing=west,hassap=true": { "model": "techreborn:block/rubber_log", "x": 90 }, + "axis=x,facing=west,hassap=true": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 }, "axis=y,facing=north,hassap=true": { "model": "techreborn:block/rubber_log_with_sap" }, - "axis=z,facing=north,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90 }, - "axis=x,facing=north,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90, "y": 90 } + "axis=z,facing=north,hassap=true": { "model": "techreborn:block/rubber_log", "x": 90 }, + "axis=x,facing=north,hassap=true": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 } } }