mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 11:49:14 +00:00
Split block type from properties, combine definition and properties
This commit is contained in:
1 parent
0672035596
commit
ab0d1cf7fc
72 files changed
+1000
-1023
No files matched your search
@@ -35,7 +35,7 @@ public class VillageHandlerApiculture /*implements IVillageCreationHandler, IVil
|
||||
ItemStack randomComb = PluginApiculture.items.beeComb.getRandomComb(1, random, false);
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), randomComb));
|
||||
|
||||
ItemStack apiary = PluginApiculture.blocks.apiculture.get(BlockApicultureType.APIARY);
|
||||
ItemStack apiary = PluginApiculture.blocks.apiculture.get(BlockTypeApiculture.APIARY);
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, OreDictionary.WILDCARD_VALUE), apiary));
|
||||
|
||||
ItemStack provenFrames = PluginApiculture.items.frameProven.getItemStack(6);
|
||||
|
||||
@@ -13,9 +13,9 @@ package forestry.apiculture.blocks;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockApiculture extends BlockBase<BlockApicultureType> {
|
||||
public class BlockApiculture extends BlockBase<BlockTypeApiculture> {
|
||||
public BlockApiculture() {
|
||||
super(BlockApicultureType.class);
|
||||
super(BlockTypeApiculture.class);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import forestry.apiculture.tiles.TileApiaristChest;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeehouse;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public enum BlockApicultureType implements IMachineProperties {
|
||||
APIARY(TileApiary.class),
|
||||
APIARIST_CHEST_LEGACY(TileApiaristChest.class, "ApiaristChest"),
|
||||
BEEHOUSE(TileBeehouse.class);
|
||||
|
||||
public static final BlockApicultureType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
|
||||
BlockApicultureType(Class<? extends TileForestry> teClass) {
|
||||
String name = toString().toLowerCase(Locale.ENGLISH);
|
||||
this.teIdent = "forestry." + WordUtils.capitalize(name);
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
BlockApicultureType(Class<? extends TileForestry> teClass, String name) {
|
||||
this.teIdent = "forestry." + name;
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public final BlockApiculture apiculture;
|
||||
public final BlockBase apicultureChest;
|
||||
public final BlockBase<BlockTypeApicultureTesr> apicultureChest;
|
||||
public final BlockBeehives beehives;
|
||||
public final BlockCandle candle;
|
||||
public final BlockStump stump;
|
||||
@@ -27,7 +27,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public BlockRegistryApiculture() {
|
||||
apiculture = registerBlock(new BlockApiculture(), ItemBlockForestry.class, "apiculture");
|
||||
|
||||
apicultureChest = registerBlock(new BlockBase(true, BlockApicultureChestType.class), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest = registerBlock(new BlockBase<>(true, BlockTypeApicultureTesr.class), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest.setCreativeTab(Tabs.tabApiculture);
|
||||
apicultureChest.setHarvestLevel("axe", 0);
|
||||
|
||||
|
||||
+17
-23
@@ -10,42 +10,36 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.apiculture.tiles.TileApiaristChest;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeeHouse;
|
||||
import forestry.core.blocks.IBlockType;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.blocks.MachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public enum BlockApicultureChestType implements IMachineProperties {
|
||||
APIARIST_CHEST(TileApiaristChest.class, "ApiaristChest");
|
||||
public enum BlockTypeApiculture implements IBlockType {
|
||||
APIARY(0, TileApiary.class, "apiary"),
|
||||
BEE_HOUSE(1, TileBeeHouse.class, "bee.house");
|
||||
|
||||
public static final BlockApicultureChestType[] VALUES = values();
|
||||
public static final BlockTypeApiculture[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
@Nonnull
|
||||
private final IMachineProperties machineProperties;
|
||||
|
||||
BlockApicultureChestType(Class<? extends TileForestry> teClass, String name) {
|
||||
this.teIdent = "forestry." + name;
|
||||
this.teClass = teClass;
|
||||
<T extends TileForestry> BlockTypeApiculture(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(meta, teClass, name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
public IMachineProperties getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.apiculture.tiles.TileApiaristChest;
|
||||
import forestry.core.blocks.IBlockTypeTesr;
|
||||
import forestry.core.blocks.IMachinePropertiesTesr;
|
||||
import forestry.core.blocks.MachinePropertiesTesr;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
|
||||
public enum BlockTypeApicultureTesr implements IBlockTypeTesr {
|
||||
APIARIST_CHEST(0, TileApiaristChest.class, "api.chest", Proxies.render.getRenderChest("apiaristchest"), TileNaturalistChest.chestBoundingBox);
|
||||
|
||||
public static final BlockTypeApicultureTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, boundingBox);
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachinePropertiesTesr<?> getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.apiculture.ApiaryBeeListener;
|
||||
import forestry.apiculture.ApiaryBeeModifier;
|
||||
import forestry.apiculture.IApiary;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
@@ -72,7 +72,7 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
|
||||
@Override
|
||||
public IBlockState getDisplayTile() {
|
||||
return PluginApiculture.blocks.apiculture.getStateFromMeta(BlockApicultureType.APIARY.ordinal());
|
||||
return PluginApiculture.blocks.apiculture.getStateFromMeta(BlockTypeApiculture.APIARY.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,7 @@ import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.apiculture.BeehouseBeeModifier;
|
||||
import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.core.config.Config;
|
||||
@@ -54,7 +54,7 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
|
||||
@Override
|
||||
public IBlockState getDisplayTile() {
|
||||
return PluginApiculture.blocks.apiculture.getStateFromMeta(BlockApicultureType.BEEHOUSE.ordinal());
|
||||
return PluginApiculture.blocks.apiculture.getStateFromMeta(BlockTypeApiculture.BEE_HOUSE.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,14 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.proxy;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public class ProxyApiculture {
|
||||
|
||||
public TileEntitySpecialRenderer getRendererAnalyzer(String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void initializeRendering() {
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.proxy;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import forestry.core.render.RenderAnalyzer;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
|
||||
public class ProxyApicultureClient extends ProxyApiculture {
|
||||
|
||||
@Override
|
||||
@@ -27,9 +23,4 @@ public class ProxyApicultureClient extends ProxyApiculture {
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntitySpecialRenderer<TileAnalyzer> getRendererAnalyzer(String gfxBase) {
|
||||
return new RenderAnalyzer(gfxBase);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,13 +23,13 @@ import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
|
||||
public class TileBeehouse extends TileBeeHousingBase {
|
||||
public class TileBeeHouse extends TileBeeHousingBase {
|
||||
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
|
||||
|
||||
private final IBeeListener beeListener;
|
||||
private final InventoryBeeHousing beeInventory;
|
||||
|
||||
public TileBeehouse() {
|
||||
public TileBeeHouse() {
|
||||
super("bee.house");
|
||||
this.beeListener = new DefaultBeeListener();
|
||||
|
||||
|
||||
@@ -39,14 +39,14 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IFlower;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.arboriculture.worldgen.BlockTypeLog;
|
||||
import forestry.arboriculture.worldgen.BlockTypeVanillaStairs;
|
||||
import forestry.arboriculture.worldgen.BlockTypeWood;
|
||||
import forestry.arboriculture.worldgen.BlockTypeWoodStairs;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.worldgen.BlockType;
|
||||
@@ -183,7 +183,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
// Escritoire
|
||||
if (random.nextInt(2) == 0) {
|
||||
IBlockType escritoireBlock = new BlockTypeTileForestry(PluginCore.blocks.core, BlockCoreType.ESCRITOIRE.ordinal());
|
||||
IBlockType escritoireBlock = new BlockTypeTileForestry(PluginCore.blocks.core, BlockTypeCoreTesr.ESCRITOIRE.ordinal());
|
||||
escritoireBlock.setDirection(getRotatedDirection(EnumFacing.EAST));
|
||||
placeBlockAtCurrentPosition(world, escritoireBlock, 1, 1, 3, structBoundingBox);
|
||||
}
|
||||
@@ -296,8 +296,8 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
return;
|
||||
}
|
||||
|
||||
world.setBlockState(posNew, PluginApiculture.blocks.apiculture.getStateFromMeta(BlockApicultureType.APIARY.ordinal()), Constants.FLAG_BLOCK_SYNCH);
|
||||
PluginApiculture.blocks.apiculture.onBlockAdded(world, posNew, PluginApiculture.blocks.apiculture.getStateFromMeta(BlockApicultureType.APIARY.ordinal()));
|
||||
world.setBlockState(posNew, PluginApiculture.blocks.apiculture.getStateFromMeta(BlockTypeApiculture.APIARY.ordinal()), Constants.FLAG_BLOCK_SYNCH);
|
||||
PluginApiculture.blocks.apiculture.onBlockAdded(world, posNew, PluginApiculture.blocks.apiculture.getStateFromMeta(BlockTypeApiculture.APIARY.ordinal()));
|
||||
|
||||
TileApiary apiary = TileUtil.getTile(world, posNew, TileApiary.class);
|
||||
if (apiary == null) {
|
||||
|
||||
@@ -13,9 +13,9 @@ package forestry.arboriculture.blocks;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockArboriculture extends BlockBase<BlockArboricultureType> {
|
||||
public class BlockArboriculture extends BlockBase<BlockTypeArboricultureTesr> {
|
||||
public BlockArboriculture() {
|
||||
super(true, BlockArboricultureType.class);
|
||||
super(true, BlockTypeArboricultureTesr.class);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.arboriculture.tiles.TileArboristChest;
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public enum BlockArboricultureType implements IMachinePropertiesTESR {
|
||||
ARBCHEST(TileArboristChest.class, "ArbChest") {
|
||||
@Override
|
||||
public TileEntitySpecialRenderer<TileNaturalistChest> getRenderer() {
|
||||
return Proxies.render.getRenderChest("arbchest");
|
||||
}
|
||||
};
|
||||
|
||||
public static final BlockArboricultureType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
|
||||
BlockArboricultureType(Class<? extends TileForestry> teClass, String teName) {
|
||||
this.teIdent = "forestry." + teName;
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.arboriculture.tiles.TileArboristChest;
|
||||
import forestry.core.blocks.IBlockTypeTesr;
|
||||
import forestry.core.blocks.IMachinePropertiesTesr;
|
||||
import forestry.core.blocks.MachinePropertiesTesr;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
|
||||
public enum BlockTypeArboricultureTesr implements IBlockTypeTesr {
|
||||
ARB_CHEST(0, TileArboristChest.class, "arb.chest", Proxies.render.getRenderChest("arbchest"), TileNaturalistChest.chestBoundingBox);
|
||||
|
||||
public static final BlockTypeArboricultureTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeArboricultureTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, boundingBox);
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachinePropertiesTesr<?> getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class StateMapperFluidPod extends StateMapperForestry{
|
||||
|
||||
protected Map mapStateModelLocations = Maps.newLinkedHashMap();
|
||||
private final Map<IBlockState, ModelResourceLocation> mapStateModelLocations = Maps.newLinkedHashMap();
|
||||
|
||||
@Override
|
||||
public Map putStateModelLocations(Block block) {
|
||||
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
|
||||
for (EnumFacing facing : EnumFacing.values()){
|
||||
if(facing != EnumFacing.UP && facing != EnumFacing.DOWN){
|
||||
for (int age = 0;age < BlockCocoa.AGE.getAllowedValues().size();age++){
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -37,71 +39,70 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.access.IAccessHandler;
|
||||
import forestry.core.circuits.ISocketable;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.StateMapperMachine;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializable> extends BlockForestry implements IItemModelRegister, IStateMapperRegister {
|
||||
private final List<MachineDefinition> definitions = new ArrayList<>();
|
||||
import jline.internal.Log;
|
||||
|
||||
public class BlockBase<C extends Enum<C> & IBlockType & IStringSerializable> extends BlockForestry implements IItemModelRegister, IStateMapperRegister {
|
||||
private final Map<C, IMachineProperties> definitions = new HashMap<>();
|
||||
private final boolean hasTESR;
|
||||
private final Class<C> clazz;
|
||||
private final Class<C> machinePropertiesClass;
|
||||
|
||||
/* PROPERTYS */
|
||||
private final PropertyEnum<C> META;
|
||||
/* PROPERTIES */
|
||||
private final PropertyEnum<C> TYPE;
|
||||
private final PropertyEnum<EnumFacing> FACE;
|
||||
|
||||
protected final BlockState blockState;
|
||||
|
||||
public boolean isReady = false;
|
||||
private boolean isReady = false;
|
||||
|
||||
public BlockBase(Class<C> clazz) {
|
||||
this(false, clazz);
|
||||
public BlockBase(Class<C> machinePropertiesClass) {
|
||||
this(false, machinePropertiesClass);
|
||||
}
|
||||
|
||||
public BlockBase(boolean hasTESR, Class<C> clazz) {
|
||||
public BlockBase(boolean hasTESR, Class<C> machinePropertiesClass) {
|
||||
super(Material.iron);
|
||||
|
||||
this.hasTESR = hasTESR;
|
||||
this.lightOpacity = this.isOpaqueCube() ? 255 : 0;
|
||||
this.clazz = clazz;
|
||||
this.machinePropertiesClass = machinePropertiesClass;
|
||||
|
||||
isReady = true;
|
||||
|
||||
META = PropertyEnum.create("meta", clazz);
|
||||
TYPE = PropertyEnum.create("type", machinePropertiesClass);
|
||||
FACE = PropertyEnum.create("face", EnumFacing.class);
|
||||
|
||||
this.blockState = this.createBlockState();
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACE, EnumFacing.NORTH));
|
||||
IBlockState state = this.blockState.getBaseState().withProperty(FACE, EnumFacing.NORTH);
|
||||
this.setDefaultState(state);
|
||||
}
|
||||
|
||||
public void addDefinitions(MachineDefinition... definitions) {
|
||||
for (MachineDefinition definition : definitions) {
|
||||
addDefinition(definition);
|
||||
@SafeVarargs
|
||||
public final void addDefinitions(C... blockTypes) {
|
||||
for (C blockType : blockTypes) {
|
||||
IMachineProperties<?> machineProperties = blockType.getMachineProperties();
|
||||
if (machineProperties != null) {
|
||||
machineProperties.setBlock(this);
|
||||
this.definitions.put(blockType, machineProperties);
|
||||
} else {
|
||||
Log.error("Null Definition found {}", Arrays.toString(blockTypes));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addDefinition(MachineDefinition definition) {
|
||||
definition.setBlock(this);
|
||||
|
||||
while (definitions.size() <= definition.getMeta()) {
|
||||
definitions.add(null);
|
||||
}
|
||||
|
||||
definitions.set(definition.getMeta(), definition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return !hasTESR;
|
||||
@@ -121,26 +122,17 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
}
|
||||
}
|
||||
|
||||
private MachineDefinition getDefinition(IBlockAccess world, BlockPos pos) {
|
||||
private IMachineProperties getDefinition(IBlockAccess world, BlockPos pos) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if (!(state.getBlock() instanceof BlockBase)) {
|
||||
return null;
|
||||
}
|
||||
IMachineProperties meta = state.getValue(META);
|
||||
return getDefinition(meta.getMeta());
|
||||
}
|
||||
|
||||
private MachineDefinition getDefinition(int metadata) {
|
||||
if (metadata < 0 || metadata >= definitions.size()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return definitions.get(metadata);
|
||||
return state.getValue(TYPE).getMachineProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) {
|
||||
MachineDefinition definition = getDefinition(world, pos);
|
||||
IMachineProperties definition = getDefinition(world, pos);
|
||||
if (definition == null) {
|
||||
return super.getCollisionBoundingBox(world, pos, state);
|
||||
}
|
||||
@@ -149,7 +141,7 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) {
|
||||
MachineDefinition definition = getDefinition(world, pos);
|
||||
IMachineProperties definition = getDefinition(world, pos);
|
||||
if (definition == null) {
|
||||
return super.collisionRayTrace(world, pos, start, end);
|
||||
} else {
|
||||
@@ -158,14 +150,10 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
}
|
||||
|
||||
/* CREATIVE INVENTORY */
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (MachineDefinition definition : definitions) {
|
||||
if (definition == null) {
|
||||
continue;
|
||||
}
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (IMachineProperties definition : definitions.values()) {
|
||||
definition.getSubBlocks(item, tab, list);
|
||||
}
|
||||
}
|
||||
@@ -173,23 +161,23 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
/* TILE ENTITY CREATION */
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
IMachineProperties definitionP = state.getValue(META);
|
||||
MachineDefinition definition = getDefinition(definitionP.getMeta());
|
||||
IMachineProperties definition = state.getValue(TYPE).getMachineProperties();
|
||||
if (definition == null) {
|
||||
return null;
|
||||
}
|
||||
return definition.createMachine();
|
||||
return definition.createTileEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return createTileEntity(world, getStateFromMeta(meta)); // TODO: refactor to just use Block, not BlockContainer
|
||||
IBlockState state = getStateFromMeta(meta);
|
||||
return createTileEntity(world, state); // TODO: refactor to just use Block, not BlockContainer
|
||||
}
|
||||
|
||||
/* INTERACTION */
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
MachineDefinition definition = getDefinition(world, pos);
|
||||
IMachineProperties definition = getDefinition(world, pos);
|
||||
return definition != null && definition.isSolidOnSide(world, pos, side);
|
||||
}
|
||||
|
||||
@@ -199,7 +187,11 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
return false;
|
||||
}
|
||||
|
||||
TileBase tile = (TileBase) world.getTileEntity(pos);
|
||||
TileBase tile = TileUtil.getTile(world, pos, TileBase.class);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TileUtil.isUsableByPlayer(player, tile)) {
|
||||
return false;
|
||||
}
|
||||
@@ -227,7 +219,7 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
||||
MachineDefinition definition = getDefinition(world, pos);
|
||||
IMachineProperties definition = getDefinition(world, pos);
|
||||
if (definition == null) {
|
||||
return super.rotateBlock(world, pos, axis);
|
||||
}
|
||||
@@ -261,10 +253,8 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
}
|
||||
|
||||
public void init() {
|
||||
for (MachineDefinition def : definitions) {
|
||||
if (def != null) {
|
||||
def.register();
|
||||
}
|
||||
for (IMachineProperties def : definitions.values()) {
|
||||
def.registerTileEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,51 +262,55 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (MachineDefinition def : definitions) {
|
||||
if (def == null)
|
||||
continue;
|
||||
C type = clazz.getEnumConstants()[def.getMeta()];
|
||||
if (type == null)
|
||||
return;
|
||||
manager.registerItemModel(item, def.getMeta(), StringUtil.cleanItemName(item) + "_" + type.getName());
|
||||
for (IMachineProperties def : definitions.values()) {
|
||||
def.registerModel(item, manager);
|
||||
}
|
||||
}
|
||||
|
||||
/* STATES */
|
||||
@Override
|
||||
public void registerStateMapper() {
|
||||
Proxies.render.registerStateMapper(this, new StateMapperMachine<C>(clazz, META, FACE));
|
||||
Proxies.render.registerStateMapper(this, new StateMapperMachine<>(machinePropertiesClass, TYPE, FACE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState() {
|
||||
if(!isReady)
|
||||
return super.createBlockState();
|
||||
return new BlockState(this, new IProperty[] { META, FACE });
|
||||
return new BlockState(this, TYPE, FACE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((IMachineProperties)state.getProperties().get(META)).getMeta();
|
||||
IBlockType blockType = (IBlockType) state.getProperties().get(this.TYPE);
|
||||
IMachineProperties machineProperties = blockType.getMachineProperties();
|
||||
return machineProperties.getMeta();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
for(C c : clazz.getEnumConstants()){
|
||||
if(c.getMeta() == meta){
|
||||
return getDefaultState().withProperty(META, c);
|
||||
for(Map.Entry<C, IMachineProperties> entry : definitions.entrySet()){
|
||||
IMachineProperties<?> machineProperties = entry.getValue();
|
||||
if (machineProperties.getMeta() == meta){
|
||||
C blockType = entry.getKey();
|
||||
return getDefaultState().withProperty(this.TYPE, blockType);
|
||||
}
|
||||
}
|
||||
return getDefaultState();
|
||||
}
|
||||
|
||||
|
||||
public String getNameFromMeta(int meta) {
|
||||
IBlockState state = getStateFromMeta(meta);
|
||||
IBlockType blockType = (IBlockType) state.getProperties().get(TYPE);
|
||||
IMachineProperties machineProperties = blockType.getMachineProperties();
|
||||
return machineProperties.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileForestry) {
|
||||
TileForestry tileF = (TileForestry) tile;
|
||||
state = state.withProperty(FACE, tileF.getOrientation());
|
||||
TileForestry tile = TileUtil.getTile(world, pos, TileForestry.class);
|
||||
if (tile != null ) {
|
||||
state = state.withProperty(FACE, tile.getOrientation());
|
||||
}
|
||||
return super.getActualState(state, world, pos);
|
||||
}
|
||||
@@ -333,6 +327,6 @@ public class BlockBase<C extends Enum<C> & IMachineProperties & IStringSerializa
|
||||
}
|
||||
|
||||
public final ItemStack get(C type) {
|
||||
return new ItemStack(this, 1, type.getMeta());
|
||||
return new ItemStack(this, 1, type.getMachineProperties().getMeta());
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
public class BlockCore extends BlockBase<BlockCoreType> {
|
||||
public class BlockCore extends BlockBase<BlockTypeCoreTesr> {
|
||||
public BlockCore() {
|
||||
super(true, BlockCoreType.class);
|
||||
super(true, BlockTypeCoreTesr.class);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public enum BlockCoreType implements IMachinePropertiesTESR {
|
||||
ANALYZER(TileAnalyzer.class, "Analyzer") {
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntitySpecialRenderer getRenderer() {
|
||||
return PluginApiculture.proxy.getRendererAnalyzer(Constants.TEXTURE_PATH_BLOCKS + "/analyzer_");
|
||||
}
|
||||
},
|
||||
ESCRITOIRE(TileEscritoire.class, "Escritoire") {
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntitySpecialRenderer getRenderer() {
|
||||
return Proxies.render.getRenderEscritoire();
|
||||
}
|
||||
};
|
||||
|
||||
public static final BlockCoreType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
|
||||
BlockCoreType(Class<? extends TileForestry> teClass, String teName) {
|
||||
this.teIdent = "forestry." + teName;
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -39,12 +39,22 @@ public class BlockResourceOre extends Block implements IItemModelRegister {
|
||||
private static final PropertyEnum<ResourceType> RESOURCE = PropertyEnum.create("resource", ResourceType.class);
|
||||
|
||||
public enum ResourceType implements IStringSerializable {
|
||||
APATITE,
|
||||
COPPER,
|
||||
TIN;
|
||||
APATITE(0),
|
||||
COPPER(1),
|
||||
TIN(2);
|
||||
|
||||
public static final ResourceType[] VALUES = values();
|
||||
|
||||
private final int meta;
|
||||
|
||||
ResourceType(int meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
@@ -66,7 +76,7 @@ public class BlockResourceOre extends Block implements IItemModelRegister {
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(RESOURCE).ordinal();
|
||||
return state.getValue(RESOURCE).getMeta();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public enum BlockTypeCoreTesr implements IBlockTypeTesr {
|
||||
ANALYZER(0, TileAnalyzer.class, "analyzer", Proxies.render.getRendererAnalyzer()),
|
||||
ESCRITOIRE(1, TileEscritoire.class, "escritoire", Proxies.render.getRenderEscritoire());
|
||||
|
||||
public static final BlockTypeCoreTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeCoreTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<T> renderer) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachinePropertiesTesr getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package forestry.core.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public interface IBlockType extends IStringSerializable {
|
||||
@Nonnull
|
||||
IMachineProperties<?> getMachineProperties();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package forestry.core.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface IBlockTypeTesr extends IBlockType {
|
||||
@Nonnull
|
||||
IMachinePropertiesTesr<?> getMachineProperties();
|
||||
}
|
||||
@@ -10,13 +10,60 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface IMachineProperties extends IStringSerializable{
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IMachineProperties<T extends TileForestry> extends IStringSerializable{
|
||||
int getMeta();
|
||||
|
||||
@Nonnull
|
||||
String getTeIdent();
|
||||
|
||||
Class<? extends TileForestry> getTeClass();
|
||||
@Nonnull
|
||||
Class<T> getTeClass();
|
||||
|
||||
/**
|
||||
* Registers the tile entity with MC.
|
||||
*/
|
||||
void registerTileEntity();
|
||||
|
||||
void registerModel(Item item, IModelManager manager);
|
||||
|
||||
@Nonnull
|
||||
TileEntity createTileEntity();
|
||||
|
||||
void setBlock(@Nonnull Block block);
|
||||
|
||||
Block getBlock();
|
||||
|
||||
void getSubBlocks(@Nonnull Item item, @Nonnull CreativeTabs tab, @Nonnull List<ItemStack> list);
|
||||
|
||||
@Nonnull
|
||||
AxisAlignedBB getBoundingBox(@Nonnull BlockPos pos, @Nonnull IBlockState state);
|
||||
|
||||
@Nonnull
|
||||
MovingObjectPosition collisionRayTrace(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec);
|
||||
|
||||
boolean isSolidOnSide(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side);
|
||||
|
||||
boolean rotateBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis);
|
||||
}
|
||||
@@ -12,10 +12,12 @@ package forestry.core.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public interface IMachinePropertiesTESR extends IMachineProperties {
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public interface IMachinePropertiesTesr<T extends TileForestry> extends IMachineProperties<T> {
|
||||
|
||||
/**
|
||||
* @return The renderer from the machine
|
||||
*/
|
||||
TileEntitySpecialRenderer getRenderer();
|
||||
TileEntitySpecialRenderer<? super T> getRenderer();
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package forestry.core.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class MachineProperties<T extends TileForestry> implements IMachineProperties<T> {
|
||||
|
||||
private final int meta;
|
||||
@Nonnull
|
||||
private final String name;
|
||||
@Nonnull
|
||||
private final String teIdent;
|
||||
@Nonnull
|
||||
private final Class<T> teClass;
|
||||
@Nonnull
|
||||
private final AxisAlignedBB boundingBox;
|
||||
@Nullable
|
||||
private Block block;
|
||||
|
||||
public MachineProperties(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this(meta, "forestry." + name, teClass, name, AxisAlignedBB.fromBounds(0, 0, 0, 1, 1, 1));
|
||||
}
|
||||
|
||||
public MachineProperties(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nonnull AxisAlignedBB boundingBox) {
|
||||
this(meta, "forestry." + name, teClass, name, boundingBox);
|
||||
}
|
||||
|
||||
private MachineProperties(int meta, @Nonnull String teIdent, @Nonnull Class<T> teClass, @Nonnull String name, @Nonnull AxisAlignedBB boundingBox) {
|
||||
this.meta = meta;
|
||||
this.teIdent = teIdent;
|
||||
this.teClass = teClass;
|
||||
this.name = name;
|
||||
this.boundingBox = boundingBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(@Nonnull Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, @Nonnull CreativeTabs tab, @Nonnull List<ItemStack> list) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(@Nonnull BlockPos pos, @Nonnull IBlockState state) {
|
||||
return boundingBox.offset(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec) {
|
||||
return BlockUtil.collisionRayTrace(pos, startVec, endVec, boundingBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidOnSide(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis) {
|
||||
T tile = TileUtil.getTile(world, pos, teClass);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
return tile.rotate(axis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTileEntity() {
|
||||
GameRegistry.registerTileEntity(teClass, teIdent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModel(@Nonnull Item item, @Nonnull IModelManager manager) {
|
||||
String identifier = StringUtil.cleanItemName(item) + "_" + name;
|
||||
manager.registerItemModel(item, meta, identifier);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
try {
|
||||
return teClass.getConstructor().newInstance();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Failed to instantiate tile entity of class " + teClass.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<T> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package forestry.core.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public class MachinePropertiesTesr<T extends TileForestry> extends MachineProperties<T> implements IMachinePropertiesTesr<T> {
|
||||
@Nullable
|
||||
private final TileEntitySpecialRenderer<? super T> renderer;
|
||||
|
||||
public MachinePropertiesTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer) {
|
||||
super(meta, teClass, name);
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
public MachinePropertiesTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nonnull AxisAlignedBB boundingBox) {
|
||||
super(meta, teClass, name, boundingBox);
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntitySpecialRenderer<? super T> getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTileEntity() {
|
||||
super.registerTileEntity();
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(getTeClass(), renderer);
|
||||
Item item = Item.getItemFromBlock(getBlock());
|
||||
if (item != null) {
|
||||
ForgeHooksClient.registerTESRItemStack(item, getMeta(), getTeClass());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import forestry.apiculture.multiblock.TileAlveary;
|
||||
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
|
||||
import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeehouse;
|
||||
import forestry.apiculture.tiles.TileBeeHouse;
|
||||
import forestry.arboriculture.items.ItemTreealyzer;
|
||||
import forestry.core.items.ItemSolderingIron;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
@@ -64,7 +64,7 @@ public class GuiIdRegistry {
|
||||
TileAlvearyHygroregulator.class,
|
||||
TileAlvearySieve.class,
|
||||
TileApiary.class,
|
||||
TileBeehouse.class,
|
||||
TileBeeHouse.class,
|
||||
|
||||
TileAnalyzer.class,
|
||||
TileEscritoire.class,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gui.ledgers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.core.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.BlockStateBase;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -19,6 +20,7 @@ import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
@@ -37,7 +39,13 @@ public class ItemBlockForestry extends ItemBlock {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack) {
|
||||
return getBlock().getUnlocalizedName() + "." + itemstack.getItemDamage();
|
||||
Block block = getBlock();
|
||||
if (block instanceof BlockBase) {
|
||||
BlockBase<?> blockBase = (BlockBase) block;
|
||||
int meta = itemstack.getMetadata();
|
||||
return block.getUnlocalizedName() + "." + blockBase.getNameFromMeta(meta);
|
||||
}
|
||||
return block.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.proxy;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
@@ -18,10 +20,11 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.models.ModelIndex;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileMill;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
@@ -36,25 +39,32 @@ public class ProxyRender {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void registerTESR(MachineDefinition definition) {
|
||||
}
|
||||
|
||||
public TileEntitySpecialRenderer getRenderDefaultMachine(String gfxBase) {
|
||||
@Nullable
|
||||
public TileEntitySpecialRenderer<TileBase> getRenderDefaultMachine(String gfxBase) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TileEntitySpecialRenderer<TileMill> getRenderMill(String gfxBase) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TileEntitySpecialRenderer<TileMill> getRenderMill(String gfxBase, byte charges) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TileEntitySpecialRenderer<TileEscritoire> getRenderEscritoire() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TileEntitySpecialRenderer getRendererAnalyzer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TileEntitySpecialRenderer<TileNaturalistChest> getRenderChest(String textureName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -27,14 +27,15 @@ import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
|
||||
import forestry.apiculture.entities.EntityFXBee;
|
||||
import forestry.apiculture.render.ParticleRenderer;
|
||||
import forestry.apiculture.render.TextureHabitatLocator;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.entities.EntityFXHoneydust;
|
||||
import forestry.core.entities.EntityFXIgnition;
|
||||
import forestry.core.entities.EntityFXSnow;
|
||||
@@ -43,12 +44,14 @@ import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.models.ModelIndex;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.models.RenderHandler;
|
||||
import forestry.core.render.RenderAnalyzer;
|
||||
import forestry.core.render.RenderEscritoire;
|
||||
import forestry.core.render.RenderMachine;
|
||||
import forestry.core.render.RenderMill;
|
||||
import forestry.core.render.RenderNaturalistChest;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileMill;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
@@ -66,14 +69,7 @@ public class ProxyRenderClient extends ProxyRender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTESR(MachineDefinition definition) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(definition.teClass, definition.renderer);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(definition.getBlock()), definition.getMeta(), definition.teClass);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntitySpecialRenderer getRenderDefaultMachine(String gfxBase) {
|
||||
public TileEntitySpecialRenderer<TileBase> getRenderDefaultMachine(String gfxBase) {
|
||||
if (gfxBase == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -95,6 +91,11 @@ public class ProxyRenderClient extends ProxyRender {
|
||||
return new RenderEscritoire();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntitySpecialRenderer<TileAnalyzer> getRendererAnalyzer() {
|
||||
return new RenderAnalyzer(Constants.TEXTURE_PATH_BLOCKS + "/analyzer_");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntitySpecialRenderer<TileNaturalistChest> getRenderChest(String textureName) {
|
||||
return new RenderNaturalistChest(textureName);
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.util.Locale;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@@ -25,8 +24,9 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IRenderableTile;
|
||||
import forestry.core.tiles.TileBase;
|
||||
|
||||
public class RenderMachine extends TileEntitySpecialRenderer {
|
||||
public class RenderMachine extends TileEntitySpecialRenderer<TileBase> {
|
||||
|
||||
private final ModelRenderer basefront;
|
||||
private final ModelRenderer baseback;
|
||||
@@ -87,7 +87,7 @@ public class RenderMachine extends TileEntitySpecialRenderer {
|
||||
* @param tile If it null its render the item else it render the tile entity.
|
||||
*/
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
public void renderTileEntityAt(TileBase tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if(tile != null){
|
||||
IRenderableTile generator = (IRenderableTile) tile;
|
||||
render(generator.getResourceTankInfo(), generator.getProductTankInfo(), generator.getOrientation(), x, y, z);
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
package forestry.core.render;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
|
||||
public abstract class StateMapperForestry implements IStateMapper {
|
||||
|
||||
protected Map mapStateModelLocations = Maps.newLinkedHashMap();
|
||||
protected Map<IBlockState, ModelResourceLocation> mapStateModelLocations = Maps.newLinkedHashMap();
|
||||
|
||||
public String getPropertyString(Map p_178131_1_) {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
Iterator iterator = p_178131_1_.entrySet().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entry entry = (Entry) iterator.next();
|
||||
for (Object o : p_178131_1_.entrySet()) {
|
||||
Entry entry = (Entry) o;
|
||||
|
||||
if (stringbuilder.length() != 0) {
|
||||
stringbuilder.append(",");
|
||||
|
||||
@@ -4,8 +4,8 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.blocks.IBlockType;
|
||||
import forestry.core.blocks.IMachinePropertiesTesr;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -17,13 +17,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class StateMapperMachine<C extends Enum<C> & IMachineProperties & IStringSerializable> extends StateMapperForestry {
|
||||
public class StateMapperMachine<C extends Enum<C> & IBlockType & IStringSerializable> extends StateMapperForestry {
|
||||
|
||||
public final Class<C> clazz;
|
||||
|
||||
/* PROPERTYS */
|
||||
public final PropertyEnum<C> META;
|
||||
public final PropertyEnum<EnumFacing> FACE;
|
||||
private final Class<C> clazz;
|
||||
private final PropertyEnum<C> META;
|
||||
private final PropertyEnum<EnumFacing> FACE;
|
||||
|
||||
public StateMapperMachine(Class<C> clazz, PropertyEnum<C> META, PropertyEnum<EnumFacing> FACE) {
|
||||
this.clazz = clazz;
|
||||
@@ -32,9 +30,9 @@ public class StateMapperMachine<C extends Enum<C> & IMachineProperties & IString
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map putStateModelLocations(Block block) {
|
||||
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
|
||||
for (C definition : clazz.getEnumConstants()) {
|
||||
if (definition instanceof IMachinePropertiesTESR)
|
||||
if (definition instanceof IMachinePropertiesTesr)
|
||||
continue;
|
||||
for (EnumFacing facing : EnumFacing.values()) {
|
||||
if (facing == EnumFacing.DOWN || facing == EnumFacing.UP)
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.tiles;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
public class MachineDefinition {
|
||||
|
||||
public final Class<? extends TileForestry> teClass;
|
||||
|
||||
private final String teIdent;
|
||||
private Block block;
|
||||
private final int meta;
|
||||
private boolean legacy;
|
||||
|
||||
public final TileEntitySpecialRenderer renderer;
|
||||
|
||||
private float minX, minY, minZ, maxX, maxY, maxZ;
|
||||
|
||||
public MachineDefinition(IMachineProperties properties) {
|
||||
this(properties.getMeta(), properties.getTeIdent(), properties.getTeClass(), null);
|
||||
}
|
||||
|
||||
public MachineDefinition(IMachinePropertiesTESR properties) {
|
||||
this(properties.getMeta(), properties.getTeIdent(), properties.getTeClass(), properties.getRenderer());
|
||||
}
|
||||
|
||||
public MachineDefinition(int meta, String teIdent, Class<? extends TileForestry> teClass, TileEntitySpecialRenderer renderer) {
|
||||
this.meta = meta;
|
||||
this.teIdent = teIdent;
|
||||
this.teClass = teClass;
|
||||
this.renderer = renderer;
|
||||
|
||||
this.faceMap = new int[8];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
faceMap[i] = 0;
|
||||
}
|
||||
|
||||
minX = 0;
|
||||
minY = 0;
|
||||
minZ = 0;
|
||||
maxX = 1;
|
||||
maxY = 1;
|
||||
maxZ = 1;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setBlock(Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public MachineDefinition setLegacy() {
|
||||
legacy = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MachineDefinition setBoundingBox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) {
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.minZ = minZ;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
this.maxZ = maxZ;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void register() {
|
||||
registerTileEntity();
|
||||
if (renderer != null) {
|
||||
Proxies.render.registerTESR(this);
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB getBoundingBox(BlockPos pos, IBlockState state) {
|
||||
return AxisAlignedBB.fromBounds(pos.getX() + minX, pos.getY() + minY, pos.getZ() + minZ, pos.getX() + maxX, pos.getY() + maxY, pos.getZ() + maxZ);
|
||||
}
|
||||
|
||||
public MovingObjectPosition collisionRayTrace(World world, BlockPos pos, Vec3 startVec, Vec3 endVec) {
|
||||
return BlockUtil.collisionRayTrace(world, pos, startVec, endVec, minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the tile entity with MC.
|
||||
*/
|
||||
private void registerTileEntity() {
|
||||
GameRegistry.registerTileEntity(teClass, teIdent);
|
||||
}
|
||||
|
||||
public TileEntity createMachine() {
|
||||
try {
|
||||
return teClass.getConstructor().newInstance();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Failed to instantiate tile entity of class " + teClass.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
if (legacy) {
|
||||
return;
|
||||
}
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
||||
/* INTERACTION */
|
||||
public boolean isSolidOnSide(IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
||||
TileForestry tile = TileUtil.getTile(world, pos, teClass);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return tile.rotate(axis);
|
||||
}
|
||||
|
||||
/* TEXTURES */
|
||||
private final int[] faceMap;
|
||||
|
||||
public MachineDefinition setFaces(int... faces) {
|
||||
|
||||
if (faces.length > 6) {
|
||||
System.arraycopy(faces, 0, faceMap, 0, faces.length);
|
||||
} else {
|
||||
System.arraycopy(faces, 0, faceMap, 0, 6);
|
||||
faceMap[6] = faces[0];
|
||||
faceMap[7] = faces[1];
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,12 @@ package forestry.core.tiles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.BlockStateBase;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.gui.IHintSource;
|
||||
@@ -39,4 +43,15 @@ public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
public final List<String> getHints() {
|
||||
return hints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedTitle() {
|
||||
Block block = getBlockType();
|
||||
if (block instanceof BlockBase) {
|
||||
BlockBase blockBase = (BlockBase) block;
|
||||
int meta = getBlockMetadata();
|
||||
return block.getUnlocalizedName() + "." + blockBase.getNameFromMeta(meta) + ".name";
|
||||
}
|
||||
return super.getUnlocalizedTitle();
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package forestry.core.tiles;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.gui.ContainerNaturalistInventory;
|
||||
@@ -25,6 +26,7 @@ import forestry.core.network.DataOutputStreamForestry;
|
||||
|
||||
public abstract class TileNaturalistChest extends TileBase implements IPagedInventory {
|
||||
private static final float lidAngleVariationPerTick = 0.1F;
|
||||
public static final AxisAlignedBB chestBoundingBox = AxisAlignedBB.fromBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
|
||||
private final ISpeciesRoot speciesRoot;
|
||||
public float lidAngle;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -19,6 +20,7 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@@ -136,10 +138,14 @@ public abstract class BlockUtil {
|
||||
|| block.getMaterial().isReplaceable();
|
||||
}
|
||||
|
||||
public static MovingObjectPosition collisionRayTrace(@Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec, @Nonnull AxisAlignedBB bounds) {
|
||||
return collisionRayTrace(pos, startVec, endVec, bounds.minX, bounds.minY, bounds.minZ, bounds.maxX, bounds.maxY, bounds.maxZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
|
||||
*/
|
||||
public static MovingObjectPosition collisionRayTrace(World world, BlockPos pos, Vec3 startVec, Vec3 endVec, float minX, float minY, float minZ, float maxX, float maxY, float maxZ) {
|
||||
public static MovingObjectPosition collisionRayTrace(@Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec, double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
startVec = startVec.addVector((-pos.getX()), (-pos.getY()), (-pos.getZ()));
|
||||
endVec = endVec.addVector((-pos.getX()), (-pos.getY()), (-pos.getZ()));
|
||||
Vec3 vec32 = startVec.getIntermediateWithXValue(endVec, minX);
|
||||
@@ -235,21 +241,21 @@ public abstract class BlockUtil {
|
||||
/**
|
||||
* Checks if a vector is within the Y and Z bounds of the block.
|
||||
*/
|
||||
private static boolean isVecInsideYZBounds(Vec3 vec, float minY, float minZ, float maxY, float maxZ) {
|
||||
private static boolean isVecInsideYZBounds(Vec3 vec, double minY, double minZ, double maxY, double maxZ) {
|
||||
return vec != null && (vec.yCoord >= minY && vec.yCoord <= maxY && vec.zCoord >= minZ && vec.zCoord <= maxZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a vector is within the X and Z bounds of the block.
|
||||
*/
|
||||
private static boolean isVecInsideXZBounds(Vec3 vec, float minX, float minZ, float maxX, float maxZ) {
|
||||
private static boolean isVecInsideXZBounds(Vec3 vec, double minX, double minZ, double maxX, double maxZ) {
|
||||
return vec != null && (vec.xCoord >= minX && vec.xCoord <= maxX && vec.zCoord >= minZ && vec.zCoord <= maxZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a vector is within the X and Y bounds of the block.
|
||||
*/
|
||||
private static boolean isVecInsideXYBounds(Vec3 vec, float minX, float minY, float maxX, float maxY) {
|
||||
private static boolean isVecInsideXYBounds(Vec3 vec, double minX, double minY, double maxX, double maxY) {
|
||||
return vec != null && (vec.xCoord >= minX && vec.xCoord <= maxX && vec.yCoord >= minY && vec.yCoord <= maxY);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ public class WorldGenerator implements IWorldGenerator {
|
||||
private void generateWorld(Random random, int chunkX, int chunkZ, World world) {
|
||||
|
||||
if (apatiteGenerator == null) {
|
||||
apatiteGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, BlockResourceOre.ResourceType.APATITE.ordinal(), 36);
|
||||
copperGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, BlockResourceOre.ResourceType.COPPER.ordinal(), 6);
|
||||
tinGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, BlockResourceOre.ResourceType.TIN.ordinal(), 6);
|
||||
apatiteGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, BlockResourceOre.ResourceType.APATITE.getMeta(), 36);
|
||||
copperGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, BlockResourceOre.ResourceType.COPPER.getMeta(), 6);
|
||||
tinGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, BlockResourceOre.ResourceType.TIN.getMeta(), 6);
|
||||
}
|
||||
|
||||
// shift to world coordinates
|
||||
|
||||
@@ -28,7 +28,7 @@ import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class BlockEngine extends BlockBase<BlockEngineType> {
|
||||
public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
private static final EnumMap<EnumFacing, List<AxisAlignedBB>> boundingBoxesForDirections = new EnumMap<>(EnumFacing.class);
|
||||
|
||||
static {
|
||||
@@ -53,7 +53,7 @@ public class BlockEngine extends BlockBase<BlockEngineType> {
|
||||
}
|
||||
|
||||
public BlockEngine() {
|
||||
super(true, BlockEngineType.class);
|
||||
super(true, BlockTypeEngine.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.energy.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.energy.tiles.TileEngineBiogas;
|
||||
import forestry.energy.tiles.TileEngineClockwork;
|
||||
import forestry.energy.tiles.TileEnginePeat;
|
||||
import forestry.plugins.PluginEnergy;
|
||||
|
||||
public enum BlockEngineType implements IMachinePropertiesTESR {
|
||||
PEAT(TileEnginePeat.class, "EngineCopper", "/engine_copper_"),
|
||||
BIOGAS(TileEngineBiogas.class, "EngineBronze", "/engine_bronze_"),
|
||||
CLOCKWORK(TileEngineClockwork.class, "EngineClockwork", "/engine_clock_");
|
||||
|
||||
public static final BlockEngineType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
protected final String texturePath;
|
||||
|
||||
BlockEngineType(Class<? extends TileForestry> teClass, String teName, String textureName) {
|
||||
this.teIdent = "forestry." + teName;
|
||||
this.teClass = teClass;
|
||||
this.texturePath = Constants.TEXTURE_PATH_BLOCKS + textureName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntitySpecialRenderer getRenderer() {
|
||||
return PluginEnergy.proxy.getRenderDefaultEngine(texturePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.energy.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
import forestry.core.blocks.IBlockTypeTesr;
|
||||
import forestry.core.blocks.IMachinePropertiesTesr;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.energy.tiles.TileEngineBiogas;
|
||||
import forestry.energy.tiles.TileEngineClockwork;
|
||||
import forestry.energy.tiles.TileEnginePeat;
|
||||
import forestry.plugins.PluginEnergy;
|
||||
|
||||
public enum BlockTypeEngine implements IBlockTypeTesr {
|
||||
PEAT(0, TileEnginePeat.class, "peat", "/engine_copper_"),
|
||||
BIOGAS(1, TileEngineBiogas.class, "biogas", "/engine_bronze_"),
|
||||
CLOCKWORK(2, TileEngineClockwork.class, "clockwork", "/engine_clock_");
|
||||
|
||||
public static final BlockTypeEngine[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
BlockTypeEngine(int meta, @Nonnull Class<? extends TileEngine> teClass, @Nonnull String name, @Nonnull String textureName) {
|
||||
TileEntitySpecialRenderer<TileEngine> renderer = PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + textureName);
|
||||
this.machineProperties = new MachinePropertiesEngine<>(meta, teClass, name, renderer);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachinePropertiesTesr<?> getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package forestry.energy.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import forestry.core.blocks.MachinePropertiesTesr;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class MachinePropertiesEngine<T extends TileEngine> extends MachinePropertiesTesr<T> {
|
||||
public MachinePropertiesEngine(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer) {
|
||||
super(meta, teClass, name, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidOnSide(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
|
||||
TileEngine tile = TileUtil.getTile(world, pos, TileEngine.class);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return tile.getOrientation().getOpposite() == side;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.energy.tiles;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class EngineDefinition extends MachineDefinition {
|
||||
|
||||
public EngineDefinition(IMachinePropertiesTESR properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidOnSide(IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
TileEngine tile = TileUtil.getTile(world, pos, TileEngine.class);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return tile.getOrientation().getOpposite() == side;
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ package forestry.factory.blocks;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockFactoryPlain extends BlockBase<BlockFactoryPlainType> {
|
||||
public class BlockFactoryPlain extends BlockBase<BlockTypeFactoryPlain> {
|
||||
public BlockFactoryPlain() {
|
||||
super(BlockFactoryPlainType.class);
|
||||
super(BlockTypeFactoryPlain.class);
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ package forestry.factory.blocks;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockFactoryTESR extends BlockBase<BlockFactoryTesrType> {
|
||||
public class BlockFactoryTESR extends BlockBase<BlockTypeFactoryTesr> {
|
||||
public BlockFactoryTESR() {
|
||||
super(true, BlockFactoryTesrType.class);
|
||||
super(true, BlockTypeFactoryTesr.class);
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.factory.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.factory.tiles.TileBottler;
|
||||
import forestry.factory.tiles.TileCarpenter;
|
||||
import forestry.factory.tiles.TileCentrifuge;
|
||||
import forestry.factory.tiles.TileFermenter;
|
||||
import forestry.factory.tiles.TileMillRainmaker;
|
||||
import forestry.factory.tiles.TileMoistener;
|
||||
import forestry.factory.tiles.TileSqueezer;
|
||||
import forestry.factory.tiles.TileStill;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public enum BlockFactoryTesrType implements IMachinePropertiesTESR {
|
||||
BOTTLER(TileBottler.class),
|
||||
CARPENTER(TileCarpenter.class),
|
||||
CENTRIFUGE(TileCentrifuge.class),
|
||||
FERMENTER(TileFermenter.class),
|
||||
MOISTENER(TileMoistener.class),
|
||||
SQUEEZER(TileSqueezer.class),
|
||||
STILL(TileStill.class),
|
||||
RAINMAKER(TileMillRainmaker.class) {
|
||||
@Override
|
||||
public TileEntitySpecialRenderer getRenderer() {
|
||||
return Proxies.render.getRenderMill(Constants.TEXTURE_PATH_BLOCKS + "/rainmaker_");
|
||||
}
|
||||
};
|
||||
|
||||
public static final BlockFactoryTesrType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
private final String name;
|
||||
|
||||
BlockFactoryTesrType(Class<? extends TileForestry> teClass) {
|
||||
String name = toString().toLowerCase(Locale.ENGLISH);
|
||||
this.teIdent = "forestry." + WordUtils.capitalize(name);
|
||||
this.teClass = teClass;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntitySpecialRenderer getRenderer() {
|
||||
return Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
+47
-58
@@ -1,58 +1,47 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.factory.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.factory.tiles.TileFabricator;
|
||||
import forestry.factory.tiles.TileRaintank;
|
||||
import forestry.factory.tiles.TileWorktable;
|
||||
|
||||
public enum BlockFactoryPlainType implements IMachineProperties {
|
||||
FABRICATOR(TileFabricator.class),
|
||||
RAINTANK(TileRaintank.class),
|
||||
WORKTABLE(TileWorktable.class);
|
||||
|
||||
public static final BlockFactoryPlainType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
|
||||
BlockFactoryPlainType(Class<? extends TileForestry> teClass) {
|
||||
String name = toString().toLowerCase(Locale.ENGLISH);
|
||||
this.teIdent = "forestry." + WordUtils.capitalize(name);
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.factory.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.blocks.IBlockType;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.blocks.MachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.factory.tiles.TileFabricator;
|
||||
import forestry.factory.tiles.TileRaintank;
|
||||
import forestry.factory.tiles.TileWorktable;
|
||||
|
||||
public enum BlockTypeFactoryPlain implements IBlockType {
|
||||
FABRICATOR(0, TileFabricator.class, "fabricator"),
|
||||
RAINTANK(1, TileRaintank.class, "raintank"),
|
||||
WORKTABLE(2, TileWorktable.class, "worktable");
|
||||
|
||||
public static final BlockTypeFactoryPlain[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachineProperties machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeFactoryPlain(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(meta, teClass, name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachineProperties getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.factory.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
import forestry.core.blocks.IBlockTypeTesr;
|
||||
import forestry.core.blocks.IMachinePropertiesTesr;
|
||||
import forestry.core.blocks.MachinePropertiesTesr;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.factory.tiles.TileBottler;
|
||||
import forestry.factory.tiles.TileCarpenter;
|
||||
import forestry.factory.tiles.TileCentrifuge;
|
||||
import forestry.factory.tiles.TileFermenter;
|
||||
import forestry.factory.tiles.TileMillRainmaker;
|
||||
import forestry.factory.tiles.TileMoistener;
|
||||
import forestry.factory.tiles.TileSqueezer;
|
||||
import forestry.factory.tiles.TileStill;
|
||||
|
||||
public enum BlockTypeFactoryTesr implements IBlockTypeTesr {
|
||||
BOTTLER(0, TileBottler.class, "bottler"),
|
||||
CARPENTER(1, TileCarpenter.class, "carpenter"),
|
||||
CENTRIFUGE(2, TileCentrifuge.class, "centrifuge"),
|
||||
FERMENTER(3, TileFermenter.class, "fermenter"),
|
||||
MOISTENER(4, TileMoistener.class, "moistener"),
|
||||
SQUEEZER(5, TileSqueezer.class, "squeezer"),
|
||||
STILL(6, TileStill.class, "still"),
|
||||
RAINMAKER(7, TileMillRainmaker.class, "rainmaker", Proxies.render.getRenderMill(Constants.TEXTURE_PATH_BLOCKS + "/rainmaker_"));
|
||||
|
||||
public static final BlockTypeFactoryTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileBase> BlockTypeFactoryTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
TileEntitySpecialRenderer<TileBase> renderer = Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer);
|
||||
}
|
||||
|
||||
<T extends TileBase> BlockTypeFactoryTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachinePropertiesTesr<?> getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class BottlerRecipeCategory extends ForestryRecipeCategory{
|
||||
private final IDrawable tankOverlay;
|
||||
|
||||
public BottlerRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 48, 11, 123, 65), "tile.for.factory.0.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 48, 11, 123, 65), "tile.for.factory.bottler.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 74, 24, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CarpenterRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawable tankOverlay;
|
||||
|
||||
public CarpenterRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.factory.1.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.factory.carpenter.name");
|
||||
|
||||
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot, craftOutputSlot);
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 59, 4, 17);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
private final ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
|
||||
public CentrifugeRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 5, 14, 166, 65), "tile.for.factory.2.name", 10);
|
||||
super(guiHelper.createDrawable(guiTexture, 5, 14, 166, 65), "tile.for.factory.centrifuge.name", 10);
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 0, 4, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 80, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class FabricatorRecipeCategory extends ForestryRecipeCategory {
|
||||
private final ICraftingGridHelper craftingGridHelper;
|
||||
|
||||
public FabricatorRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 20, 16, 136, 54), "tile.for.factory2.0.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 20, 16, 136, 54), "tile.for.factory2.fabricator.name");
|
||||
|
||||
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot, craftOutputSlot);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawable tankOverlay;
|
||||
|
||||
public FermenterRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 30, 15, 116, 65), "tile.for.factory.3.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 30, 15, 116, 65), "tile.for.factory.fermenter.name");
|
||||
|
||||
IDrawableStatic progressBarDrawable0 = guiHelper.createDrawable(guiTexture, 176, 60, 4, 18);
|
||||
this.progressBar0 = guiHelper.createAnimatedDrawable(progressBarDrawable0, 40, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MoistenerRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawable tankOverlay;
|
||||
|
||||
public MoistenerRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 15, 15, 145, 60), "tile.for.factory.4.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 15, 15, 145, 60), "tile.for.factory.moistener.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 91, 29, 55);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 80, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SqueezerRecipeCategory extends ForestryRecipeCategory {
|
||||
private final ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
|
||||
public SqueezerRecipeCategory(@Nonnull IGuiHelper guiHelper, @Nonnull String UID) {
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.factory.5.name", 10);
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.factory.squeezer.name", 10);
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 60, 43, 18);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class StillRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawableAnimated progressBar;
|
||||
|
||||
public StillRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 30, 11, 116, 65), "tile.for.factory.6.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 30, 11, 116, 65), "tile.for.factory.still.name");
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 0, 16, 58);
|
||||
|
||||
IDrawableStatic progressBarDrawable0 = guiHelper.createDrawable(guiTexture, 176, 74, 4, 18);
|
||||
|
||||
@@ -13,9 +13,9 @@ package forestry.lepidopterology.blocks;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockLepidopterology extends BlockBase<BlockLepidopterologyType> {
|
||||
public class BlockLepidopterology extends BlockBase<BlockTypeLepidopterologyTesr> {
|
||||
public BlockLepidopterology() {
|
||||
super(true, BlockLepidopterologyType.class);
|
||||
super(true, BlockTypeLepidopterologyTesr.class);
|
||||
setCreativeTab(Tabs.tabLepidopterology);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.lepidopterology.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.lepidopterology.tiles.TileLepidopteristChest;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
public enum BlockLepidopterologyType implements IMachinePropertiesTESR {
|
||||
LEPICHEST(TileLepidopteristChest.class, "LepiChest") {
|
||||
@Override
|
||||
public TileEntitySpecialRenderer getRenderer() {
|
||||
return Proxies.render.getRenderChest("lepichest");
|
||||
}
|
||||
};
|
||||
|
||||
public static final BlockLepidopterologyType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
|
||||
BlockLepidopterologyType(Class<? extends TileForestry> teClass, String teName) {
|
||||
this.teIdent = "forestry." + teName;
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.lepidopterology.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.core.blocks.IBlockTypeTesr;
|
||||
import forestry.core.blocks.IMachinePropertiesTesr;
|
||||
import forestry.core.blocks.MachinePropertiesTesr;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
import forestry.lepidopterology.tiles.TileLepidopteristChest;
|
||||
|
||||
public enum BlockTypeLepidopterologyTesr implements IBlockTypeTesr {
|
||||
LEPICHEST(0, TileLepidopteristChest.class, "lepi.chest", Proxies.render.getRenderChest("lepichest"), TileNaturalistChest.chestBoundingBox);
|
||||
|
||||
public static final BlockTypeLepidopterologyTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeLepidopterologyTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, boundingBox);
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachinePropertiesTesr<?> getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ package forestry.mail.blocks;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockMail extends BlockBase<BlockMailType> {
|
||||
public class BlockMail extends BlockBase<BlockTypeMail> {
|
||||
public BlockMail() {
|
||||
super(BlockMailType.class);
|
||||
super(BlockTypeMail.class);
|
||||
}
|
||||
}
|
||||
+50
-58
@@ -1,58 +1,50 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.mail.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.mail.tiles.TileMailbox;
|
||||
import forestry.mail.tiles.TileStampCollector;
|
||||
import forestry.mail.tiles.TileTrader;
|
||||
|
||||
public enum BlockMailType implements IMachineProperties {
|
||||
MAILBOX(TileMailbox.class),
|
||||
TRADESTATION(TileTrader.class),
|
||||
PHILATELIST(TileStampCollector.class);
|
||||
|
||||
public static final BlockMailType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
|
||||
BlockMailType(Class<? extends TileForestry> teClass) {
|
||||
String name = toString().toLowerCase(Locale.ENGLISH);
|
||||
this.teIdent = "forestry." + WordUtils.capitalize(name);
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.mail.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import forestry.core.blocks.IBlockType;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.blocks.MachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.mail.tiles.TileMailbox;
|
||||
import forestry.mail.tiles.TileStampCollector;
|
||||
import forestry.mail.tiles.TileTrader;
|
||||
|
||||
public enum BlockTypeMail implements IBlockType {
|
||||
MAILBOX(0, TileMailbox.class, "mailbox"),
|
||||
TRADE_STATION(1, TileTrader.class, "trade.station"),
|
||||
PHILATELIST(2, TileStampCollector.class, "stamp.collector");
|
||||
|
||||
public static final BlockTypeMail[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachineProperties machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeMail(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(meta, teClass, name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IMachineProperties getMachineProperties() {
|
||||
return machineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,10 @@ import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.ArmorApiaristHelper;
|
||||
import forestry.apiculture.SaveEventHandlerApiculture;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.blocks.BlockTypeApicultureTesr;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
@@ -94,7 +95,6 @@ import forestry.apiculture.multiblock.TileAlvearyStabiliser;
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.apiculture.network.PacketRegistryApiculture;
|
||||
import forestry.apiculture.proxy.ProxyApiculture;
|
||||
import forestry.apiculture.tiles.TileApiaristChest;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.apiculture.tiles.TileSwarm;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
@@ -103,7 +103,7 @@ import forestry.apiculture.worldgen.HiveDescription;
|
||||
import forestry.apiculture.worldgen.HiveGenHelper;
|
||||
import forestry.apiculture.worldgen.HiveRegistry;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
@@ -111,9 +111,7 @@ import forestry.core.entities.EntityFXSnow;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.items.EnumElectronTube;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
@@ -181,15 +179,8 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
blocks.apiculture.addDefinitions(
|
||||
new MachineDefinition(BlockApicultureType.APIARY).setFaces(0, 1, 2, 2, 4, 4, 0, 7),
|
||||
new MachineDefinition(BlockApicultureType.APIARIST_CHEST_LEGACY).setLegacy(),
|
||||
new MachineDefinition(BlockApicultureType.BEEHOUSE).setFaces(0, 1, 2, 2, 4, 4, 0, 7)
|
||||
);
|
||||
|
||||
MachineDefinition definitionChest = new MachineDefinition(0, "forestry.ApiaristChestNew", TileApiaristChest.class, Proxies.render.getRenderChest("apiaristchest"))
|
||||
.setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
blocks.apicultureChest.addDefinition(definitionChest);
|
||||
blocks.apiculture.addDefinitions(BlockTypeApiculture.VALUES);
|
||||
blocks.apicultureChest.addDefinitions(BlockTypeApicultureTesr.APIARIST_CHEST);
|
||||
|
||||
// Add triggers
|
||||
if (PluginManager.Module.BUILDCRAFT_STATEMENTS.isEnabled()) {
|
||||
@@ -465,12 +456,12 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getBeeHouseMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', blocks.apiculture.get(BlockApicultureType.BEEHOUSE),
|
||||
'B', blocks.apiculture.get(BlockTypeApiculture.BEE_HOUSE),
|
||||
'C', Items.minecart);
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getApiaryMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', blocks.apiculture.get(BlockApicultureType.APIARY),
|
||||
'B', blocks.apiculture.get(BlockTypeApiculture.APIARY),
|
||||
'C', Items.minecart);
|
||||
|
||||
// FOOD STUFF
|
||||
@@ -712,7 +703,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
// ANALYZER
|
||||
RecipeUtil.addRecipe(PluginCore.blocks.core.get(BlockCoreType.ANALYZER),
|
||||
RecipeUtil.addRecipe(PluginCore.blocks.core.get(BlockTypeCoreTesr.ANALYZER),
|
||||
"XTX",
|
||||
" Y ",
|
||||
"X X",
|
||||
@@ -720,7 +711,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'T', items.beealyzer,
|
||||
'X', "ingotBronze");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.apiculture.get(BlockApicultureType.APIARY),
|
||||
RecipeUtil.addRecipe(blocks.apiculture.get(BlockTypeApiculture.APIARY),
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
@@ -736,7 +727,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'X', "beeComb",
|
||||
'Y', "chestWood");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.apiculture.get(BlockApicultureType.BEEHOUSE),
|
||||
RecipeUtil.addRecipe(blocks.apiculture.get(BlockTypeApiculture.BEE_HOUSE),
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
|
||||
@@ -41,7 +41,7 @@ import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodItemAccess;
|
||||
import forestry.arboriculture.blocks.BlockArboricultureType;
|
||||
import forestry.arboriculture.blocks.BlockTypeArboricultureTesr;
|
||||
import forestry.arboriculture.blocks.BlockFruitPod;
|
||||
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
|
||||
import forestry.arboriculture.commands.CommandTree;
|
||||
@@ -57,20 +57,17 @@ import forestry.arboriculture.items.ItemRegistryArboriculture;
|
||||
import forestry.arboriculture.network.PacketRegistryArboriculture;
|
||||
import forestry.arboriculture.proxy.ProxyArboriculture;
|
||||
import forestry.arboriculture.render.TextureLeaves;
|
||||
import forestry.arboriculture.tiles.TileArboristChest;
|
||||
import forestry.arboriculture.tiles.TileFruitPod;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.genetics.alleles.AllelePlantType;
|
||||
import forestry.core.items.ItemFruit.EnumFruit;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.factory.recipes.FabricatorRecipe;
|
||||
|
||||
@@ -133,10 +130,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
WoodItemAccess.registerStairs(blocks.stairsFireproof, woodType, true);
|
||||
}
|
||||
|
||||
MachineDefinition definitionChest = new MachineDefinition(BlockArboricultureType.ARBCHEST.ordinal(),
|
||||
"forestry.ArbChest", TileArboristChest.class, Proxies.render.getRenderChest("arbchest"))
|
||||
.setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
blocks.arboriculture.addDefinition(definitionChest);
|
||||
blocks.arboriculture.addDefinitions(BlockTypeArboricultureTesr.ARB_CHEST);
|
||||
|
||||
// Init rendering
|
||||
proxy.initializeModels();
|
||||
@@ -326,7 +320,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
'#', "stickWood");
|
||||
|
||||
// ANALYZER
|
||||
RecipeUtil.addRecipe(PluginCore.blocks.core.get(BlockCoreType.ANALYZER),
|
||||
RecipeUtil.addRecipe(PluginCore.blocks.core.get(BlockTypeCoreTesr.ANALYZER),
|
||||
"XTX",
|
||||
" Y ",
|
||||
"X X",
|
||||
@@ -334,7 +328,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
'T', items.treealyzer,
|
||||
'X', "ingotBronze");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.arboriculture.get(BlockArboricultureType.ARBCHEST),
|
||||
RecipeUtil.addRecipe(blocks.arboriculture.get(BlockTypeArboricultureTesr.ARB_CHEST),
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
|
||||
@@ -34,7 +34,7 @@ import forestry.core.IPickupHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.PickupHandlerCore;
|
||||
import forestry.core.SaveEventHandlerCore;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.blocks.BlockRegistryCore;
|
||||
import forestry.core.blocks.BlockResourceOre;
|
||||
import forestry.core.blocks.BlockResourceStorage;
|
||||
@@ -57,7 +57,6 @@ import forestry.core.multiblock.MultiblockLogicFactory;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.network.PacketRegistryCore;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.ForestryModEnvWarningCallable;
|
||||
|
||||
@@ -101,10 +100,7 @@ public class PluginCore extends ForestryPlugin {
|
||||
rootCommand.addChildCommand(new CommandVersion());
|
||||
rootCommand.addChildCommand(new CommandPlugins());
|
||||
|
||||
blocks.core.addDefinitions(
|
||||
new MachineDefinition(BlockCoreType.ESCRITOIRE),
|
||||
new MachineDefinition(BlockCoreType.ANALYZER)
|
||||
);
|
||||
blocks.core.addDefinitions(BlockTypeCoreTesr.VALUES);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,10 +16,9 @@ import net.minecraftforge.fml.common.SidedProxy;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.energy.blocks.BlockEngineType;
|
||||
import forestry.energy.blocks.BlockTypeEngine;
|
||||
import forestry.energy.blocks.BlockRegistryEnergy;
|
||||
import forestry.energy.proxy.ProxyEnergy;
|
||||
import forestry.energy.tiles.EngineDefinition;
|
||||
|
||||
@Plugin(pluginID = "Energy", name = "Energy", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.energy.description")
|
||||
public class PluginEnergy extends ForestryPlugin {
|
||||
@@ -37,12 +36,12 @@ public class PluginEnergy extends ForestryPlugin {
|
||||
@Override
|
||||
public void preInit() {
|
||||
blocks.engine.addDefinitions(
|
||||
new EngineDefinition(BlockEngineType.PEAT),
|
||||
new EngineDefinition(BlockEngineType.BIOGAS)
|
||||
BlockTypeEngine.PEAT,
|
||||
BlockTypeEngine.BIOGAS
|
||||
);
|
||||
|
||||
if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) {
|
||||
blocks.engine.addDefinition(new EngineDefinition(BlockEngineType.CLOCKWORK));
|
||||
blocks.engine.addDefinitions(BlockTypeEngine.CLOCKWORK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +54,7 @@ public class PluginEnergy extends ForestryPlugin {
|
||||
protected void registerRecipes() {
|
||||
super.registerRecipes();
|
||||
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockEngineType.PEAT),
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.PEAT),
|
||||
"###",
|
||||
" X ",
|
||||
"YVY",
|
||||
@@ -64,7 +63,7 @@ public class PluginEnergy extends ForestryPlugin {
|
||||
'Y', "gearCopper",
|
||||
'V', Blocks.piston);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockEngineType.BIOGAS),
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.BIOGAS),
|
||||
"###",
|
||||
" X ",
|
||||
"YVY",
|
||||
@@ -74,7 +73,7 @@ public class PluginEnergy extends ForestryPlugin {
|
||||
'V', Blocks.piston);
|
||||
|
||||
if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) {
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockEngineType.CLOCKWORK),
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.CLOCKWORK),
|
||||
"###",
|
||||
" X ",
|
||||
"ZVY",
|
||||
|
||||
@@ -32,7 +32,7 @@ import forestry.api.fuels.RainSubstrate;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.blocks.BlockSoil;
|
||||
import forestry.core.circuits.Circuit;
|
||||
import forestry.core.circuits.CircuitLayout;
|
||||
@@ -45,12 +45,11 @@ import forestry.core.items.ItemElectronTube;
|
||||
import forestry.core.items.ItemRegistryCore;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.datastructures.FluidMap;
|
||||
import forestry.core.utils.datastructures.ItemStackMap;
|
||||
import forestry.factory.DummyManagers;
|
||||
import forestry.factory.blocks.BlockFactoryPlainType;
|
||||
import forestry.factory.blocks.BlockFactoryTesrType;
|
||||
import forestry.factory.blocks.BlockTypeFactoryPlain;
|
||||
import forestry.factory.blocks.BlockTypeFactoryTesr;
|
||||
import forestry.factory.blocks.BlockRegistryFactory;
|
||||
import forestry.factory.circuits.CircuitSpeedUpgrade;
|
||||
import forestry.factory.network.PacketRegistryFactory;
|
||||
@@ -175,16 +174,8 @@ public class PluginFactory extends ForestryPlugin {
|
||||
FuelManager.rainSubstrate.put(iodineCharge, new RainSubstrate(iodineCharge, Constants.RAINMAKER_RAIN_DURATION_IODINE, 0.01f));
|
||||
FuelManager.rainSubstrate.put(dissipationCharge, new RainSubstrate(dissipationCharge, 0.075f));
|
||||
|
||||
for (BlockFactoryTesrType type : BlockFactoryTesrType.VALUES) {
|
||||
MachineDefinition machineDefinition = new MachineDefinition(type);
|
||||
blocks.factoryTESR.addDefinition(machineDefinition);
|
||||
}
|
||||
|
||||
blocks.factoryPlain.addDefinitions(
|
||||
new MachineDefinition(BlockFactoryPlainType.FABRICATOR).setFaces(0, 1, 2, 3, 4, 4),
|
||||
new MachineDefinition(BlockFactoryPlainType.RAINTANK).setFaces(0, 1, 0, 0, 0, 0),
|
||||
new MachineDefinition(BlockFactoryPlainType.WORKTABLE).setFaces(0, 1, 2, 3, 4, 4)
|
||||
);
|
||||
blocks.factoryTESR.addDefinitions(BlockTypeFactoryTesr.VALUES);
|
||||
blocks.factoryPlain.addDefinitions(BlockTypeFactoryPlain.VALUES);
|
||||
|
||||
ICircuitLayout layoutMachineUpgrade = new CircuitLayout("machine.upgrade", CircuitSocketType.MACHINE);
|
||||
ChipsetManager.circuitRegistry.registerLayout(layoutMachineUpgrade);
|
||||
@@ -319,7 +310,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
"###",
|
||||
'#', "logWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(50, Fluids.SEEDOIL.getFluid(500), null,
|
||||
PluginCore.blocks.core.get(BlockCoreType.ESCRITOIRE),
|
||||
PluginCore.blocks.core.get(BlockTypeCoreTesr.ESCRITOIRE),
|
||||
"# ",
|
||||
"###",
|
||||
"# #",
|
||||
@@ -433,7 +424,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
ChipsetManager.solderManager.addRecipe(layout, PluginCore.items.tubes.get(EnumElectronTube.BLAZE, 1), Circuit.machineSpeedUpgrade2);
|
||||
ChipsetManager.solderManager.addRecipe(layout, PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1), Circuit.machineEfficiencyUpgrade1);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockFactoryTesrType.BOTTLER),
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.BOTTLER),
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -441,7 +432,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', PluginFluids.items.canEmpty,
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockFactoryTesrType.CARPENTER),
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.CARPENTER),
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -449,7 +440,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', "ingotBronze",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockFactoryTesrType.CENTRIFUGE),
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.CENTRIFUGE),
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -457,7 +448,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', "ingotCopper",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockFactoryTesrType.FERMENTER),
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.FERMENTER),
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -465,7 +456,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', "gearBronze",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockFactoryTesrType.MOISTENER),
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.MOISTENER),
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -473,7 +464,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', "gearCopper",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockFactoryTesrType.SQUEEZER),
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.SQUEEZER),
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -481,7 +472,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', "ingotTin",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockFactoryTesrType.STILL),
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.STILL),
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -489,7 +480,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', "dustRedstone",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockFactoryTesrType.RAINMAKER),
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.RAINMAKER),
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -497,7 +488,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', "gearTin",
|
||||
'Y', PluginCore.items.hardenedCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockFactoryPlainType.FABRICATOR),
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockTypeFactoryPlain.FABRICATOR),
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"XZX",
|
||||
@@ -506,7 +497,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'Y', PluginCore.items.sturdyCasing,
|
||||
'Z', "chestWood");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockFactoryPlainType.RAINTANK),
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockTypeFactoryPlain.RAINTANK),
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -514,7 +505,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'X', "ingotIron",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockFactoryPlainType.WORKTABLE),
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockTypeFactoryPlain.WORKTABLE),
|
||||
"B",
|
||||
"W",
|
||||
"C",
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
@@ -33,11 +34,10 @@ import forestry.core.config.Constants;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.lepidopterology.ButterflySpawner;
|
||||
import forestry.lepidopterology.blocks.BlockLepidopterologyType;
|
||||
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
|
||||
import forestry.lepidopterology.blocks.BlockTypeLepidopterologyTesr;
|
||||
import forestry.lepidopterology.commands.CommandButterfly;
|
||||
import forestry.lepidopterology.entities.EntityButterfly;
|
||||
import forestry.lepidopterology.genetics.AlleleButterflyEffect;
|
||||
@@ -87,9 +87,7 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
ButterflyBranchDefinition.createAlleles();
|
||||
AlleleButterflyEffect.createAlleles();
|
||||
|
||||
MachineDefinition definitionChest = new MachineDefinition(BlockLepidopterologyType.LEPICHEST)
|
||||
.setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
blocks.lepidopterology.addDefinition(definitionChest);
|
||||
blocks.lepidopterology.addDefinitions(BlockTypeLepidopterologyTesr.VALUES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,7 +136,7 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
"X#X", "X#X", "RDR", '#', "paneGlass", 'X', "ingotBronze", 'R',
|
||||
"dustRedstone", 'D', "gemDiamond");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.lepidopterology.get(BlockLepidopterologyType.LEPICHEST),
|
||||
RecipeUtil.addRecipe(blocks.lepidopterology.get(BlockTypeLepidopterologyTesr.LEPICHEST),
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
|
||||
@@ -25,12 +25,11 @@ import forestry.core.fluids.Fluids;
|
||||
import forestry.core.items.EnumElectronTube;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.mail.EventHandlerMailAlert;
|
||||
import forestry.mail.PostRegistry;
|
||||
import forestry.mail.PostalCarrier;
|
||||
import forestry.mail.SaveEventHandlerMail;
|
||||
import forestry.mail.blocks.BlockMailType;
|
||||
import forestry.mail.blocks.BlockTypeMail;
|
||||
import forestry.mail.blocks.BlockRegistryMail;
|
||||
import forestry.mail.commands.CommandMail;
|
||||
import forestry.mail.items.EnumStampDefinition;
|
||||
@@ -68,11 +67,7 @@ public class PluginMail extends ForestryPlugin {
|
||||
FMLCommonHandler.instance().bus().register(new EventHandlerMailAlert());
|
||||
}
|
||||
|
||||
blocks.mail.addDefinitions(
|
||||
new MachineDefinition(BlockMailType.MAILBOX).setFaces(0, 1, 2, 2, 2, 2, 0, 7),
|
||||
new MachineDefinition(BlockMailType.TRADESTATION).setFaces(0, 1, 2, 3, 4, 4, 0, 7),
|
||||
new MachineDefinition(BlockMailType.PHILATELIST).setFaces(0, 1, 2, 3, 2, 2, 0, 7)
|
||||
);
|
||||
blocks.mail.addDefinitions(BlockTypeMail.VALUES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,7 +134,7 @@ public class PluginMail extends ForestryPlugin {
|
||||
|
||||
RecipeUtil.addShapelessRecipe(items.catalogue.getItemStack(), items.stamps.getWildcard(), new ItemStack(Items.book));
|
||||
|
||||
RecipeUtil.addRecipe(blocks.mail.get(BlockMailType.MAILBOX),
|
||||
RecipeUtil.addRecipe(blocks.mail.get(BlockTypeMail.MAILBOX),
|
||||
" # ",
|
||||
"#Y#",
|
||||
"XXX",
|
||||
@@ -147,7 +142,7 @@ public class PluginMail extends ForestryPlugin {
|
||||
'X', "chestWood",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.mail.get(BlockMailType.TRADESTATION),
|
||||
RecipeUtil.addRecipe(blocks.mail.get(BlockTypeMail.TRADE_STATION),
|
||||
"Z#Z",
|
||||
"#Y#",
|
||||
"XWX",
|
||||
|
||||
@@ -64,7 +64,7 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.lepidopterology.blocks.BlockLepidopterologyType;
|
||||
import forestry.lepidopterology.blocks.BlockTypeLepidopterologyTesr;
|
||||
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
|
||||
import forestry.storage.BackpackDefinition;
|
||||
import forestry.storage.BackpackDefinition.BackpackDefinitionApiarist;
|
||||
@@ -509,7 +509,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
|
||||
BlockRegistryLepidopterology butterflyBlocks = PluginLepidopterology.blocks;
|
||||
if (items.lepidopteristBackpack != null && butterflyBlocks != null) {
|
||||
ItemStack chest = butterflyBlocks.lepidopterology.get(BlockLepidopterologyType.LEPICHEST);
|
||||
ItemStack chest = butterflyBlocks.lepidopterology.get(BlockTypeLepidopterologyTesr.LEPICHEST);
|
||||
addBackpackRecipe(items.lepidopteristBackpack, "stickWood", chest);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user