Began work on re-adding logs

This commit is contained in:
Adubbz 2014-10-02 12:20:11 +10:00
parent 21edcbe5a6
commit 08feb58a1f
56 changed files with 516 additions and 35 deletions

View file

@ -44,9 +44,9 @@ public abstract class BOPBlock extends Block implements IConfigurable
{
if (hasVariants())
{
for (Enum value : getVariants())
for (IBOPVariant value : getVariants())
{
list.add(new ItemStack(item, 1, value.ordinal()));
list.add(new ItemStack(item, 1, value.getDefaultMetadata()));
}
}
else
@ -80,18 +80,13 @@ public abstract class BOPBlock extends Block implements IConfigurable
return variantProperty != null;
}
public final PropertyEnum getVariantProperty()
public final Collection<IBOPVariant> getVariants()
{
return variantProperty;
return (Collection<IBOPVariant>)variantProperty.getAllowedValues();
}
public final Collection<Enum> getVariants()
public final IBOPVariant getVariantFromMeta(int metadata)
{
return (Collection<Enum>)variantProperty.getAllowedValues();
}
public final Enum getVariantFromMeta(int metadata)
{
return (Enum)this.getStateFromMeta(metadata).getValue(variantProperty);
return (IBOPVariant)this.getStateFromMeta(metadata).getValue(variantProperty);
}
}

View file

@ -13,5 +13,7 @@ import net.minecraft.block.Block;
public class BOPBlocks
{
public static Block ash_block;
public static Block log;
public static Block log2;
public static Block planks;
}

View file

@ -0,0 +1,17 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.api.block;
import net.minecraft.util.IStringSerializable;
public interface IBOPVariant extends IStringSerializable
{
public String getBaseName();
public int getDefaultMetadata();
}

View file

@ -62,11 +62,6 @@ public class ModelHelper
return Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
}
public static void regsiterBlockVariants(BOPBlock block, String name)
{
getBlockModelShapes().func_178121_a(block, (new StateMap.Builder()).func_178440_a(block.getVariantProperty()).func_178439_a("_" + name).build());
}
public static BlockModelShapes getBlockModelShapes()
{
return getItemModelMesher().getModelManager().getBlockModelShapes();

View file

@ -16,6 +16,7 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.IStringSerializable;
import biomesoplenty.api.block.BOPBlock;
import biomesoplenty.api.block.IBOPVariant;
import biomesoplenty.common.util.inventory.CreativeTabBOP;
//TODO: Commented methods and calls
@ -29,8 +30,9 @@ public class BOPBlockPlanks extends BOPBlock
this.setDefaultBlockState(this.blockState.getBaseState().withProperty(VARIANT_PROP, PlankType.SACRED_OAK));
this.setHardness(2.0F);
//this.setHarvestLevel("axe", 0);
this.setHardness(2.0F);
this.setStepSound(Block.soundTypeWood);
this.setCreativeTab(CreativeTabBOP.instance);
}
@ -53,7 +55,7 @@ public class BOPBlockPlanks extends BOPBlock
return new BlockState(this, new IProperty[] { VARIANT_PROP });
}
public static enum PlankType implements IStringSerializable
public static enum PlankType implements IBOPVariant
{
SACRED_OAK,
CHERRY,
@ -71,10 +73,28 @@ public class BOPBlockPlanks extends BOPBlock
JACARANDA,
MAHOGANY;
@Override
public String getBaseName()
{
return this.equals(BAMBOO_THATCHING) ? null : "planks";
}
@Override
public String getName()
{
return this.name().toLowerCase();
}
@Override
public String toString()
{
return getName();
}
@Override
public int getDefaultMetadata()
{
return this.ordinal();
}
}
}

View file

@ -0,0 +1,14 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
public class BlockBOPColorizedLeaves extends BlockBOPLeavesBase
{
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.material.Material;
import biomesoplenty.api.block.BOPBlock;
public abstract class BlockBOPLeavesBase extends BOPBlock
{
protected boolean fastGraphics;
protected BlockBOPLeavesBase()
{
super(Material.leaves);
this.fastGraphics = false;
}
}

View file

@ -8,12 +8,75 @@
package biomesoplenty.common.block;
import net.minecraft.block.BlockLog;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import biomesoplenty.api.block.IBOPVariant;
public class BlockBOPLog extends BlockLog
public class BlockBOPLog extends BlockBOPLogBase
{
public BlockBOPLog()
{
}
public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", LogType.class);
public BlockBOPLog()
{
super(VARIANT_PROP);
}
@Override
public IBlockState getStateFromMeta(int meta)
{
int axis = meta % 3;
int type = (meta - axis) / 3;
return this.getDefaultState().withProperty(VARIANT_PROP, LogType.values()[type]).withProperty(AXIS_PROP, EnumFacing.Axis.values()[axis]);
}
@Override
public int getMetaFromState(IBlockState state)
{
int baseMeta = ((LogType)state.getValue(VARIANT_PROP)).ordinal();
return baseMeta * 3 + ((EnumFacing.Axis)state.getValue(AXIS_PROP)).ordinal();
}
@Override
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { AXIS_PROP, VARIANT_PROP });
}
public static enum LogType implements IBOPVariant
{
SACRED_OAK,
CHERRY,
DARK,
FIR,
ETHEREAL;
@Override
public String getBaseName()
{
return "log";
}
@Override
public String getName()
{
return this.name().toLowerCase();
}
@Override
public String toString()
{
return getName();
}
@Override
public int getDefaultMetadata()
{
return this.ordinal() * 3;
}
}
}

View file

@ -0,0 +1,82 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import biomesoplenty.api.block.IBOPVariant;
public class BlockBOPLog2 extends BlockBOPLogBase
{
public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", LogType.class);
public BlockBOPLog2()
{
super(VARIANT_PROP);
}
@Override
public IBlockState getStateFromMeta(int meta)
{
int axis = meta % 3;
int type = (meta - axis) / 3;
return this.getDefaultState().withProperty(VARIANT_PROP, LogType.values()[type]).withProperty(AXIS_PROP, EnumFacing.Axis.values()[axis]);
}
@Override
public int getMetaFromState(IBlockState state)
{
int baseMeta = ((LogType)state.getValue(VARIANT_PROP)).ordinal();
return baseMeta * 3 + ((EnumFacing.Axis)state.getValue(AXIS_PROP)).ordinal();
}
@Override
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { AXIS_PROP, VARIANT_PROP });
}
public static enum LogType implements IBOPVariant
{
MAGIC,
MANGROVE,
PALM,
REDWOOD,
WILLOW;
@Override
public String getBaseName()
{
return "log";
}
@Override
public String getName()
{
return this.name().toLowerCase();
}
@Override
public String toString()
{
return getName();
}
@Override
public int getDefaultMetadata()
{
return this.ordinal() * 3;
}
}
}

View file

@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import biomesoplenty.api.block.BOPBlock;
import biomesoplenty.common.util.inventory.CreativeTabBOP;
//TODO: Commented methods and calls
public abstract class BlockBOPLogBase extends BOPBlock
{
public static final PropertyEnum AXIS_PROP = PropertyEnum.create("axis", EnumFacing.Axis.class);
protected BlockBOPLogBase(PropertyEnum variantProperty)
{
super(Material.wood, variantProperty);
//this.setHarvestLevel("axe", 0);
this.setHardness(2.0F);
this.setResistance(5.0F);
this.setStepSound(Block.soundTypeWood);
this.setCreativeTab(CreativeTabBOP.instance);
}
@Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int metadata, EntityLivingBase entity)
{
return super.onBlockPlaced(world, pos, side, hitX, hitY, hitZ, metadata, entity).withProperty(AXIS_PROP, side.getAxis());
}
}

View file

@ -8,27 +8,28 @@
package biomesoplenty.common.init;
import static biomesoplenty.api.block.BOPBlocks.ash_block;
import static biomesoplenty.api.block.BOPBlocks.planks;
import static biomesoplenty.api.block.BOPBlocks.*;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.util.IStringSerializable;
import biomesoplenty.api.block.BOPBlock;
import biomesoplenty.api.block.IBOPVariant;
import biomesoplenty.client.util.ModelHelper;
import biomesoplenty.common.block.BOPBlockPlanks;
import biomesoplenty.common.block.BlockAsh;
import biomesoplenty.common.block.BlockBOPLog;
import biomesoplenty.common.block.BlockBOPLog2;
import biomesoplenty.common.item.ItemBlockWithVariants;
import biomesoplenty.common.util.RegistryUtil;
import biomesoplenty.core.BiomesOPlenty;
import com.google.common.collect.ImmutableList;
public class ModBlocks
{
public static void init()
{
ash_block = registerBlock(new BlockAsh(), "ash_block");
log = registerBlock(new BlockBOPLog(), "log");
log2 = registerBlock(new BlockBOPLog2(), "log2");
planks = registerBlock(new BOPBlockPlanks(), "planks");
}
@ -40,12 +41,12 @@ public class ModBlocks
{
RegistryUtil.registerBlock(block, ItemBlockWithVariants.class, name);
for (Enum variant : block.getVariants())
for (IBOPVariant variant : block.getVariants())
{
String variantName = ((IStringSerializable)variant).getName() + "_" + name;
String variantName = variant.getName() + (variant.getBaseName() != null ? "_" + variant.getBaseName() : "");
ModelHelper.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + variantName);
BiomesOPlenty.proxy.registerBlockForMeshing(block, variant.ordinal(), variantName);
BiomesOPlenty.proxy.registerBlockForMeshing(block, variant.getDefaultMetadata(), variantName);
}
}
else

View file

@ -37,9 +37,7 @@ public class ItemBlockWithVariants extends ItemBlock
if (bopBlock.hasVariants())
{
Enum variant = bopBlock.getVariantFromMeta(stack.getMetadata());
return super.getUnlocalizedName() + "." + ((IStringSerializable)variant).getName();
return super.getUnlocalizedName() + "." + bopBlock.getVariantFromMeta(stack.getMetadata()).getName();
}
else return super.getUnlocalizedName();
}

View file

@ -0,0 +1,19 @@
{
"variants": {
"axis=x,variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_log", "x": 90, "y": 90 },
"axis=y,variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_log" },
"axis=z,variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_log", "x": 90 },
"axis=x,variant=cherry": { "model": "biomesoplenty:cherry_log", "x": 90, "y": 90 },
"axis=y,variant=cherry": { "model": "biomesoplenty:cherry_log" },
"axis=z,variant=cherry": { "model": "biomesoplenty:cherry_log", "x": 90 },
"axis=x,variant=dark": { "model": "biomesoplenty:dark_log", "x": 90, "y": 90 },
"axis=y,variant=dark": { "model": "biomesoplenty:dark_log" },
"axis=z,variant=dark": { "model": "biomesoplenty:dark_log", "x": 90 },
"axis=x,variant=fir": { "model": "biomesoplenty:fir_log", "x": 90, "y": 90 },
"axis=y,variant=fir": { "model": "biomesoplenty:fir_log" },
"axis=z,variant=fir": { "model": "biomesoplenty:fir_log", "x": 90 },
"axis=x,variant=ethereal": { "model": "biomesoplenty:ethereal_log", "x": 90, "y": 90 },
"axis=y,variant=ethereal": { "model": "biomesoplenty:ethereal_log" },
"axis=z,variant=ethereal": { "model": "biomesoplenty:ethereal_log", "x": 90 }
}
}

View file

@ -0,0 +1,19 @@
{
"variants": {
"axis=x,variant=magic": { "model": "biomesoplenty:magic_log", "x": 90, "y": 90 },
"axis=y,variant=magic": { "model": "biomesoplenty:magic_log" },
"axis=z,variant=magic": { "model": "biomesoplenty:magic_log", "x": 90 },
"axis=x,variant=mangrove": { "model": "biomesoplenty:mangrove_log", "x": 90, "y": 90 },
"axis=y,variant=mangrove": { "model": "biomesoplenty:mangrove_log" },
"axis=z,variant=mangrove": { "model": "biomesoplenty:mangrove_log", "x": 90 },
"axis=x,variant=palm": { "model": "biomesoplenty:palm_log", "x": 90, "y": 90 },
"axis=y,variant=palm": { "model": "biomesoplenty:palm_log" },
"axis=z,variant=palm": { "model": "biomesoplenty:palm_log", "x": 90 },
"axis=x,variant=redwood": { "model": "biomesoplenty:redwood_log", "x": 90, "y": 90 },
"axis=y,variant=redwood": { "model": "biomesoplenty:redwood_log" },
"axis=z,variant=redwood": { "model": "biomesoplenty:redwood_log", "x": 90 },
"axis=x,variant=willow": { "model": "biomesoplenty:willow_log", "x": 90, "y": 90 },
"axis=y,variant=willow": { "model": "biomesoplenty:willow_log" },
"axis=z,variant=willow": { "model": "biomesoplenty:willow_log", "x": 90 }
}
}

View file

@ -1,5 +1,22 @@
tile.ash_block.name=Ash Block
tile.log.sacred_oak.name=Sacred Oak Wood
tile.log.cherry.name=Cherry Wood
tile.log.dark.name=Dark Wood
tile.log.fir.name=Fir Wood
tile.log.ethereal.name=Ethereal Wood
tile.log2.magic.name=Magic Wood
tile.log2.mangrove.name=Mangrove Wood
tile.log2.palm.name=Palm Wood
tile.log2.redwood.name=Redwood Wood
tile.log2.willow.name=Willow Wood
tile.log3.dead.name=Dead Wood
tile.log3.giant_flower_stem.name=Giant Flower Stem
tile.log3.pine.name=Pine Wood
tile.log3.hell_bark.name=Hell Bark Wood
tile.log3.jacaranda.name=Jacaranda Wood
tile.log4.mahogany.name=Mahogany Wood
tile.planks.sacred_oak.name=Sacred Oak Wood Planks
tile.planks.cherry.name=Cherry Wood Planks
tile.planks.dark.name=Dark Wood Planks

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/cherry_log_top",
"side": "biomesoplenty:blocks/cherry_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/dark_log_top",
"side": "biomesoplenty:blocks/dark_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/ethereal_log_top",
"side": "biomesoplenty:blocks/ethereal_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/fir_log_top",
"side": "biomesoplenty:blocks/fir_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/magic_log_top",
"side": "biomesoplenty:blocks/magic_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/mangrove_log_top",
"side": "biomesoplenty:blocks/mangrove_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/palm_log_top",
"side": "biomesoplenty:blocks/palm_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/redwood_log_top",
"side": "biomesoplenty:blocks/redwood_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/sacred_oak_log_top",
"side": "biomesoplenty:blocks/sacred_oak_log"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "biomesoplenty:blocks/willow_log_top",
"side": "biomesoplenty:blocks/willow_log"
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/cherry_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/dark_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/ethereal_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/fir_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/magic_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/mangrove_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/palm_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/redwood_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/sacred_oak_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/willow_log",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 B