mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 11:19:28 +00:00
Improve BlockBase and Add new Bee House and Apiary Model
This commit is contained in:
1 parent
e0ea0c1073
commit
4b2d7594cb
13 files changed
+685
-47
No files matched your search
@@ -27,7 +27,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public BlockRegistryApiculture() {
|
||||
apiculture = registerBlock(new BlockApiculture(), ItemBlockForestry.class, "apiculture");
|
||||
|
||||
apicultureChest = registerBlock(new BlockBase<>(true, BlockTypeApicultureTesr.class), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest = registerBlock(new BlockBase<>(BlockTypeApicultureTesr.class), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest.setCreativeTab(Tabs.tabApiculture);
|
||||
apicultureChest.setHarvestLevel("axe", 0);
|
||||
|
||||
|
||||
@@ -15,11 +15,12 @@ import javax.annotation.Nonnull;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeeHouse;
|
||||
import forestry.core.blocks.IBlockType;
|
||||
import forestry.core.blocks.IBlockTypeCustom;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.blocks.MachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public enum BlockTypeApiculture implements IBlockType {
|
||||
public enum BlockTypeApiculture implements IBlockTypeCustom {
|
||||
APIARY(0, TileApiary.class, "apiary"),
|
||||
BEE_HOUSE(1, TileBeeHouse.class, "bee.house");
|
||||
|
||||
@@ -34,7 +35,7 @@ public enum BlockTypeApiculture implements IBlockType {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachineProperties getMachineProperties() {
|
||||
public IMachineProperties<?> getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockArboriculture extends BlockBase<BlockTypeArboricultureTesr> {
|
||||
public BlockArboriculture() {
|
||||
super(true, BlockTypeArboricultureTesr.class);
|
||||
super(BlockTypeArboricultureTesr.class);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,7 @@ import jline.internal.Log;
|
||||
public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> extends BlockForestry implements IItemModelRegister, IStateMapperRegister {
|
||||
private final Map<P, IMachineProperties> properties = new HashMap<>();
|
||||
private final boolean hasTESR;
|
||||
private final boolean hasCustom;
|
||||
private final Class<P> machinePropertiesClass;
|
||||
|
||||
/* PROPERTIES */
|
||||
@@ -68,15 +69,12 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
protected final BlockState blockState;
|
||||
|
||||
private boolean isReady = false;
|
||||
|
||||
public BlockBase(Class<P> machinePropertiesClass) {
|
||||
this(false, machinePropertiesClass);
|
||||
}
|
||||
|
||||
public BlockBase(boolean hasTESR, Class<P> machinePropertiesClass) {
|
||||
public BlockBase(Class<P> machinePropertiesClass) {
|
||||
super(Material.iron);
|
||||
|
||||
this.hasTESR = hasTESR;
|
||||
this.hasTESR = IBlockTypeTesr.class.isAssignableFrom(machinePropertiesClass);;
|
||||
this.hasCustom = IBlockTypeCustom.class.isAssignableFrom(machinePropertiesClass);
|
||||
this.lightOpacity = this.isOpaqueCube() ? 255 : 0;
|
||||
this.machinePropertiesClass = machinePropertiesClass;
|
||||
|
||||
@@ -105,12 +103,12 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return !hasTESR;
|
||||
return !hasTESR && !hasCustom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube() {
|
||||
return !hasTESR;
|
||||
return !hasTESR && !hasCustom;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,6 @@ package forestry.core.blocks;
|
||||
|
||||
public class BlockCore extends BlockBase<BlockTypeCoreTesr> {
|
||||
public BlockCore() {
|
||||
super(true, BlockTypeCoreTesr.class);
|
||||
super(BlockTypeCoreTesr.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package forestry.core.blocks;
|
||||
|
||||
public interface IBlockTypeCustom extends IBlockType{
|
||||
|
||||
}
|
||||
@@ -5,5 +5,5 @@ import javax.annotation.Nonnull;
|
||||
public interface IBlockTypeTesr extends IBlockType {
|
||||
@Override
|
||||
@Nonnull
|
||||
IMachinePropertiesTesr<?> getMachineProperties();
|
||||
IMachineProperties<?> getMachineProperties();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
}
|
||||
|
||||
public BlockEngine() {
|
||||
super(true, BlockTypeEngine.class);
|
||||
super(BlockTypeEngine.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,6 @@ import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockFactoryTESR extends BlockBase<BlockTypeFactoryTesr> {
|
||||
public BlockFactoryTESR() {
|
||||
super(true, BlockTypeFactoryTesr.class);
|
||||
super(BlockTypeFactoryTesr.class);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockLepidopterology extends BlockBase<BlockTypeLepidopterologyTesr> {
|
||||
public BlockLepidopterology() {
|
||||
super(true, BlockTypeLepidopterologyTesr.class);
|
||||
super(BlockTypeLepidopterologyTesr.class);
|
||||
setCreativeTab(Tabs.tabLepidopterology);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user