Rubber log works. Need to doublecheck sap side

This commit is contained in:
drcrazy 2019-03-15 15:14:19 +03:00
parent 3cde5c8244
commit bfd6f16504
5 changed files with 57 additions and 57 deletions

View file

@ -26,9 +26,10 @@ package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockFire; import net.minecraft.block.BlockFire;
import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockLog;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
@ -37,6 +38,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty; import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -62,22 +64,21 @@ import java.util.Random;
/** /**
* Created by modmuss50 on 19/02/2016. * Created by modmuss50 on 19/02/2016.
*/ */
public class BlockRubberLog extends Block { public class BlockRubberLog extends BlockLog {
public static DirectionProperty SAP_SIDE = DirectionProperty.create("sapside", EnumFacing.Plane.HORIZONTAL); public static DirectionProperty SAP_SIDE = BlockStateProperties.HORIZONTAL_FACING;
public static BooleanProperty HAS_SAP = BooleanProperty.create("hassap"); public static BooleanProperty HAS_SAP = BooleanProperty.create("hassap");
public BlockRubberLog() { public BlockRubberLog() {
super(Block.Properties.create(Material.WOOD).hardnessAndResistance(2f).sound(SoundType.WOOD).tickRandomly()); super(MaterialColor.OBSIDIAN, Block.Properties.create(Material.WOOD, MaterialColor.BROWN).hardnessAndResistance(2.0F).sound(SoundType.WOOD).tickRandomly());
this.setDefaultState(this.getDefaultState().with(SAP_SIDE, EnumFacing.NORTH).with(HAS_SAP, false)); this.setDefaultState(this.getDefaultState().with(SAP_SIDE, EnumFacing.NORTH).with(HAS_SAP, false).with(AXIS, EnumFacing.Axis.Y));
((BlockFire) Blocks.FIRE).setFireInfo(this, 5, 5); ((BlockFire) Blocks.FIRE).setFireInfo(this, 5, 5);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this)); RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) { protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
SAP_SIDE = DirectionProperty.create("sapside", EnumFacing.Plane.HORIZONTAL); super.fillStateContainer(builder);
HAS_SAP = BooleanProperty.create("hassap");
builder.add(SAP_SIDE, HAS_SAP); builder.add(SAP_SIDE, HAS_SAP);
} }
@ -93,9 +94,9 @@ public class BlockRubberLog extends Block {
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) { if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) {
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) { for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
IBlockState state1 = worldIn.getBlockState(blockpos); IBlockState state1 = worldIn.getBlockState(blockpos);
if (state1.getBlock() instanceof BlockLeaves) { if (state1.isIn(BlockTags.LEAVES)) {
state1.tick(worldIn, pos, worldIn.getRandom()); state1.tick(worldIn, blockpos, worldIn.getRandom());
state1.randomTick(worldIn, pos, worldIn.getRandom()); state1.randomTick(worldIn, blockpos, worldIn.getRandom());
} }
} }
} }

View file

@ -1,47 +1,28 @@
{ {
"forge_marker": 1,
"defaults": {
"textures": {
"particle": "#side",
"north": "#side",
"south": "#side",
"east": "#side",
"west": "#side",
"up": "#end",
"down": "#end",
"end": "techreborn:blocks/rubber_log_top",
"sapside": "techreborn:blocks/rubber_log_sap",
"side": "techreborn:blocks/rubber_log_side"
},
"model": "cube",
"uvlock": true
},
"variants": { "variants": {
"inventory": [ "axis=y,facing=east,hassap=false": { "model": "techreborn:block/rubber_log" },
{ "axis=z,facing=east,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90 },
} "axis=x,facing=east,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 },
], "axis=y,facing=south,hassap=false": { "model": "techreborn:block/rubber_log" },
"hassap": { "axis=z,facing=south,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90 },
"true": { "axis=x,facing=south,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 },
"textures": { "axis=y,facing=west,hassap=false": { "model": "techreborn:block/rubber_log" },
"north": "#sapside" "axis=z,facing=west,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90 },
} "axis=x,facing=west,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 },
}, "axis=y,facing=north,hassap=false": { "model": "techreborn:block/rubber_log" },
"false": { "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" },
"sapside": { "axis=z,facing=east,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90 },
"north": { "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" },
"east": { "axis=z,facing=south,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90 },
"y": 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" },
"south": { "axis=z,facing=west,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90 },
"y": 180 "axis=x,facing=west,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90, "y": 90 },
}, "axis=y,facing=north,hassap=true": { "model": "techreborn:block/rubber_log_with_sap" },
"west": { "axis=z,facing=north,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90 },
"y": 270 "axis=x,facing=north,hassap=true": { "model": "techreborn:block/rubber_log_with_sap", "x": 90, "y": 90 }
}
}
} }
} }

View file

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/cube_column",
"textures": {
"end": "techreborn:block/rubber_log_top",
"side": "techreborn:block/rubber_log_side"
}
}

View file

@ -0,0 +1,8 @@
{
"parent": "minecraft:block/orientable",
"textures": {
"top": "techreborn:block/rubber_log_top",
"front": "techreborn:block/rubber_log_sap",
"side": "techreborn:block/rubber_log_side"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "techreborn:block/rubber_log"
}