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.BlockFire;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockLog;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -37,6 +38,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.EnumFacing;
@ -62,22 +64,21 @@ import java.util.Random;
/**
* 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 BlockRubberLog() {
super(Block.Properties.create(Material.WOOD).hardnessAndResistance(2f).sound(SoundType.WOOD).tickRandomly());
this.setDefaultState(this.getDefaultState().with(SAP_SIDE, EnumFacing.NORTH).with(HAS_SAP, false));
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).with(AXIS, EnumFacing.Axis.Y));
((BlockFire) Blocks.FIRE).setFireInfo(this, 5, 5);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
SAP_SIDE = DirectionProperty.create("sapside", EnumFacing.Plane.HORIZONTAL);
HAS_SAP = BooleanProperty.create("hassap");
super.fillStateContainer(builder);
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))) {
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
IBlockState state1 = worldIn.getBlockState(blockpos);
if (state1.getBlock() instanceof BlockLeaves) {
state1.tick(worldIn, pos, worldIn.getRandom());
state1.randomTick(worldIn, pos, worldIn.getRandom());
if (state1.isIn(BlockTags.LEAVES)) {
state1.tick(worldIn, blockpos, 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": {
"inventory": [
{
}
],
"hassap": {
"true": {
"textures": {
"north": "#sapside"
}
},
"false": {
}
},
"sapside": {
"north": {
},
"east": {
"y": 90
},
"south": {
"y": 180
},
"west": {
"y": 270
}
}
}
}
{
"variants": {
"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" },
"axis=z,facing=south,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90 },
"axis=x,facing=south,hassap=false": { "model": "techreborn:block/rubber_log", "x": 90, "y": 90 },
"axis=y,facing=west,hassap=false": { "model": "techreborn:block/rubber_log" },
"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" },
"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=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 }
}
}

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"
}