mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-17 10:55:06 +00:00
Clean Up and Bug Fixes
This commit is contained in:
1 parent
6390a0cd11
commit
02ec97b031
56 files changed
+538
-451
No files matched your search
@@ -50,9 +50,9 @@ import forestry.core.blocks.BlockStructure;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class BlockAlveary extends BlockStructure implements IStateMapperRegister {
|
||||
private static final PropertyEnum TYPE = PropertyEnum.create("alveary", Type.class);
|
||||
private static final PropertyEnum TYPE = PropertyEnum.create("alveary", AlvearyType.class);
|
||||
private static final PropertyEnum STATE = PropertyEnum.create("state", State.class);
|
||||
private static final PropertyEnum LEVEL = PropertyEnum.create("type", Level.class);
|
||||
private static final PropertyEnum LEVEL = PropertyEnum.create("type", AlvearyLevel.class);
|
||||
|
||||
private enum State implements IStringSerializable {
|
||||
ON, OFF;
|
||||
@@ -63,8 +63,8 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
}
|
||||
}
|
||||
|
||||
private enum Level implements IStringSerializable {
|
||||
BOTTOM, LEFT, RIGHT;
|
||||
private enum AlvearyLevel implements IStringSerializable {
|
||||
MIDDLE, LEFT, RIGHT;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
@@ -72,7 +72,7 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
}
|
||||
}
|
||||
|
||||
public enum Type implements IStringSerializable {
|
||||
public enum AlvearyType implements IStringSerializable {
|
||||
PLAIN,
|
||||
ENTRANCE,
|
||||
SWARMER,
|
||||
@@ -82,7 +82,7 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
STABILISER,
|
||||
SIEVE;
|
||||
|
||||
public static final Type[] VALUES = values();
|
||||
public static final AlvearyType[] VALUES = values();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
@@ -95,7 +95,8 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
setHardness(1.0f);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(TYPE, Type.PLAIN).withProperty(STATE, State.OFF).withProperty(LEVEL, Level.BOTTOM));
|
||||
setStepSound(soundTypeWood);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(TYPE, AlvearyType.PLAIN).withProperty(STATE, State.OFF).withProperty(LEVEL, AlvearyLevel.MIDDLE));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@@ -137,11 +138,11 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
int metadata = getMetaFromState(state);
|
||||
if (metadata < 0 || metadata > Type.VALUES.length) {
|
||||
if (metadata < 0 || metadata > AlvearyType.VALUES.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Type type = Type.VALUES[metadata];
|
||||
AlvearyType type = AlvearyType.VALUES[metadata];
|
||||
switch (type) {
|
||||
case SWARMER:
|
||||
return new TileAlvearySwarmer();
|
||||
@@ -183,12 +184,12 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
/* STATES */
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(TYPE, Type.values()[meta]);
|
||||
return getDefaultState().withProperty(TYPE, AlvearyType.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((Type) state.getValue(TYPE)).ordinal();
|
||||
return ((AlvearyType) state.getValue(TYPE)).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -217,33 +218,30 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
}
|
||||
}
|
||||
|
||||
int meta = ((Type) state.getValue(TYPE)).ordinal();
|
||||
IBlockState stateXP = world.getBlockState(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()));
|
||||
IBlockState stateXM = world.getBlockState(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()));
|
||||
Block blockXP = stateXP.getBlock();
|
||||
Block blockXM = stateXM.getBlock();
|
||||
|
||||
Block blockXP = world.getBlockState(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ())).getBlock();
|
||||
Block blockXM = world.getBlockState(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ())).getBlock();
|
||||
|
||||
state = state.withProperty(LEVEL, Level.BOTTOM);
|
||||
state = state.withProperty(LEVEL, AlvearyLevel.MIDDLE);
|
||||
|
||||
if (blockXP == this && blockXM != this) {
|
||||
|
||||
IBlockState stateNeighbor = world.getBlockState(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()));
|
||||
if (stateNeighbor.getBlock().getMetaFromState(stateNeighbor) == 1) {
|
||||
if (stateXP.getValue(TYPE) == AlvearyType.ENTRANCE) {
|
||||
|
||||
if (world.getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1)).getBlock() != this) {
|
||||
switchForSide(state, world, pos);
|
||||
state = state.withProperty(LEVEL, AlvearyLevel.RIGHT);
|
||||
} else {
|
||||
switchForSide(state, world, pos);
|
||||
state = state.withProperty(LEVEL, AlvearyLevel.LEFT);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (blockXP != this && blockXM == this) {
|
||||
IBlockState stateNeighbor = world.getBlockState(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()));
|
||||
if (stateNeighbor.getBlock().getMetaFromState(stateNeighbor) == 1) {
|
||||
if (stateXM.getValue(TYPE) == AlvearyType.ENTRANCE) {
|
||||
|
||||
if (world.getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1)).getBlock() != this) {
|
||||
switchForSide(state, world, pos);
|
||||
state = state.withProperty(LEVEL, AlvearyLevel.LEFT);
|
||||
} else {
|
||||
switchForSide(state, world, pos);
|
||||
state = state.withProperty(LEVEL, AlvearyLevel.RIGHT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -252,22 +250,6 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
return super.getActualState(state, world, pos);
|
||||
}
|
||||
|
||||
private void switchForSide(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
|
||||
Block blockX = world.getBlockState(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ())).getBlock();
|
||||
Block blockY = world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())).getBlock();
|
||||
if (blockX != this && blockY == this) {
|
||||
state = state.withProperty(LEVEL, Level.LEFT);
|
||||
} else if (blockX == this && blockY == this) {
|
||||
state = state.withProperty(LEVEL, Level.RIGHT);
|
||||
} else if (blockX == this && blockY != this) {
|
||||
state = state.withProperty(LEVEL, Level.LEFT);
|
||||
} else if (blockX != this && blockY != this) {
|
||||
state = state.withProperty(LEVEL, Level.RIGHT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStateMapper() {
|
||||
Proxies.render.registerStateMapper(this, new AlvearyStateMapper());
|
||||
@@ -279,14 +261,14 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(state.getProperties());
|
||||
if (linkedhashmap.get(TYPE) != Type.PLAIN) {
|
||||
if (linkedhashmap.get(TYPE) != AlvearyType.PLAIN) {
|
||||
linkedhashmap.remove(LEVEL);
|
||||
}
|
||||
if (linkedhashmap.get(TYPE) == Type.SIEVE
|
||||
|| linkedhashmap.get(TYPE) == Type.ENTRANCE
|
||||
|| linkedhashmap.get(TYPE) == Type.STABILISER
|
||||
|| linkedhashmap.get(TYPE) == Type.HYGRO
|
||||
|| linkedhashmap.get(TYPE) == Type.PLAIN) {
|
||||
if (linkedhashmap.get(TYPE) == AlvearyType.SIEVE
|
||||
|| linkedhashmap.get(TYPE) == AlvearyType.ENTRANCE
|
||||
|| linkedhashmap.get(TYPE) == AlvearyType.STABILISER
|
||||
|| linkedhashmap.get(TYPE) == AlvearyType.HYGRO
|
||||
|| linkedhashmap.get(TYPE) == AlvearyType.PLAIN) {
|
||||
linkedhashmap.remove(STATE);
|
||||
}
|
||||
String s = String.format("%s:%s",
|
||||
@@ -311,7 +293,7 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack get(Type type) {
|
||||
public ItemStack get(AlvearyType type) {
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
}
|
||||
@@ -128,6 +128,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister {
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0, "candle");
|
||||
manager.registerItemModel(item, 1, "candle");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,10 +142,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister {
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) {
|
||||
if(renderPass < 3){
|
||||
return ((TileCandle)worldIn.getTileEntity(pos)).getColour();
|
||||
}
|
||||
return 16777215;
|
||||
return ((TileCandle)worldIn.getTileEntity(pos)).getColour();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
|
||||
@@ -30,8 +30,8 @@ public class ItemBlockCandle extends ItemBlockForestry {
|
||||
int value = 0xffffff;
|
||||
if (pass == 1 && stack.hasTagCompound()) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag.hasKey("colour")) {
|
||||
value = tag.getInteger("colour");
|
||||
if (tag.hasKey(BlockCandle.colourTagName)) {
|
||||
value = tag.getInteger(BlockCandle.colourTagName);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -48,10 +48,10 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
|
||||
private final String unlocalizedTitle;
|
||||
|
||||
protected TileAlveary() {
|
||||
this(BlockAlveary.Type.PLAIN);
|
||||
this(BlockAlveary.AlvearyType.PLAIN);
|
||||
}
|
||||
|
||||
protected TileAlveary(BlockAlveary.Type type) {
|
||||
protected TileAlveary(BlockAlveary.AlvearyType type) {
|
||||
super(new MultiblockLogicAlveary());
|
||||
this.unlocalizedTitle = "tile.for.alveary." + type.ordinal() + ".name";
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
private int transferTime;
|
||||
|
||||
public TileAlvearyHygroregulator() {
|
||||
super(BlockAlveary.Type.HYGRO);
|
||||
super(BlockAlveary.AlvearyType.HYGRO);
|
||||
|
||||
this.inventory = new InventoryHygroregulator(this);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TileAlvearyPlain extends TileAlveary implements ITriggerProvider {
|
||||
// set alveary entrance block meta
|
||||
if (getPos().getY() == maxCoord.getY()) {
|
||||
if ((getPos().getX() > minCoord.getX() && getPos().getX() < maxCoord.getX()) || (getPos().getZ() > minCoord.getZ() && getPos().getZ() < maxCoord.getZ())) {
|
||||
this.worldObj.setBlockState(getPos(), getBlockType().getStateFromMeta(BlockAlveary.Type.ENTRANCE.ordinal()), 2);
|
||||
this.worldObj.setBlockState(getPos(), getBlockType().getStateFromMeta(BlockAlveary.AlvearyType.ENTRANCE.ordinal()), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class TileAlvearyPlain extends TileAlveary implements ITriggerProvider {
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
// set alveary entrance block meta back to normal
|
||||
this.worldObj.setBlockState(getPos(), getBlockType().getStateFromMeta(BlockAlveary.Type.PLAIN.ordinal()), 2);
|
||||
this.worldObj.setBlockState(getPos(), getBlockType().getStateFromMeta(BlockAlveary.AlvearyType.PLAIN.ordinal()), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.B
|
||||
private final InventoryAlvearySieve inventory;
|
||||
|
||||
public TileAlvearySieve() {
|
||||
super(BlockAlveary.Type.SIEVE);
|
||||
super(BlockAlveary.AlvearyType.SIEVE);
|
||||
this.inventory = new InventoryAlvearySieve(this);
|
||||
this.beeListener = new AlvearySieveBeeListener(inventory);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
|
||||
private boolean active;
|
||||
|
||||
public TileAlvearySwarmer() {
|
||||
super(BlockAlveary.Type.SWARMER);
|
||||
super(BlockAlveary.AlvearyType.SWARMER);
|
||||
this.inventory = new InventorySwarmer(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -279,14 +279,18 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP
|
||||
|
||||
TileLeaves leaves = getLeafTile(world,pos);
|
||||
if (leaves == null) {
|
||||
return super.colorMultiplier(world, pos);
|
||||
return super.colorMultiplier(world, pos, 0);
|
||||
}
|
||||
int colour = super.colorMultiplier(world, pos, 0);
|
||||
if(renderPass == 0){
|
||||
colour = leaves.getFoliageColour(Proxies.common.getClientInstance().thePlayer);
|
||||
if (colour == PluginArboriculture.proxy.getFoliageColorBasic()) {
|
||||
return super.colorMultiplier(world, pos, 0);
|
||||
}
|
||||
|
||||
int colour = leaves.getFoliageColour(Proxies.common.getClientInstance().thePlayer);
|
||||
if (colour == PluginArboriculture.proxy.getFoliageColorBasic()) {
|
||||
colour = super.colorMultiplier(world, pos);
|
||||
}else{
|
||||
colour = leaves.getFruitColour();
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +62,12 @@ public class ItemBlockLeaves extends ItemBlockForestry {
|
||||
|
||||
TileLeaves tileLeaves = new TileLeaves();
|
||||
tileLeaves.readFromNBT(itemStack.getTagCompound());
|
||||
|
||||
return tileLeaves.getFoliageColour(Proxies.common.getPlayer());
|
||||
|
||||
if(renderPass == 1){
|
||||
return tileLeaves.getFruitColour();
|
||||
}else{
|
||||
return tileLeaves.getFoliageColour(Proxies.common.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
import forestry.core.render.model.ModelManager;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.world.ColorizerFoliage;
|
||||
|
||||
import forestry.arboriculture.render.ModelLeaves;
|
||||
import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.model.BlockModelIndex;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class ProxyArboricultureClient extends ProxyArboriculture {
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
@@ -21,13 +19,13 @@ import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.genetics.TreeHelper;
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.models.ModelBlockOverlay;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.model.ModelBlockOverlay;
|
||||
|
||||
public class ModelLeaves extends ModelBlockOverlay {
|
||||
public class ModelLeaves extends ModelBlockOverlay<BlockForestryLeaves> {
|
||||
|
||||
@Override
|
||||
public void renderInventory(Block block, ItemStack itemStack, IModelBaker renderer) {
|
||||
public void renderInventory(BlockForestryLeaves block, ItemStack itemStack, IModelBaker baker) {
|
||||
|
||||
if (!(itemStack.getItem() instanceof ItemBlockLeaves) || block == null) {
|
||||
return;
|
||||
@@ -40,48 +38,40 @@ public class ModelLeaves extends ModelBlockOverlay {
|
||||
leaves.setTree(TreeHelper.treeTemplates.get(0));
|
||||
}
|
||||
|
||||
TextureAtlasSprite leavesIcon = leaves.getSprite(Proxies.render.fancyGraphicsEnabled());
|
||||
TextureAtlasSprite leavesIcon = leaves.getLeaveSprite(Proxies.render.fancyGraphicsEnabled());
|
||||
if (leavesIcon == null) {
|
||||
return;
|
||||
}
|
||||
int color = leaves.getFoliageColour(Proxies.common.getPlayer());
|
||||
renderer.setColor(color);
|
||||
baker.setColorIndex(0);
|
||||
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
|
||||
renderer.renderFaceYNeg(null, leavesIcon);
|
||||
renderer.renderFaceYPos(null, leavesIcon);
|
||||
renderer.renderFaceZNeg(null, leavesIcon);
|
||||
renderer.renderFaceZPos(null, leavesIcon);
|
||||
renderer.renderFaceXNeg(null, leavesIcon);
|
||||
renderer.renderFaceXPos(null, leavesIcon);
|
||||
baker.renderFaceYNeg(null, leavesIcon);
|
||||
baker.renderFaceYPos(null, leavesIcon);
|
||||
baker.renderFaceZNeg(null, leavesIcon);
|
||||
baker.renderFaceZPos(null, leavesIcon);
|
||||
baker.renderFaceXNeg(null, leavesIcon);
|
||||
baker.renderFaceXPos(null, leavesIcon);
|
||||
|
||||
// add fruit
|
||||
if (!leaves.hasFruit()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextureAtlasSprite fruitTexture = leaves.getFruitTexture();
|
||||
TextureAtlasSprite fruitTexture = leaves.getFruitSprite();
|
||||
if (fruitTexture == null) {
|
||||
return;
|
||||
}
|
||||
int fruitColor = leaves.getFruitColour();
|
||||
renderer.setColor(fruitColor);
|
||||
baker.setColorIndex(1);
|
||||
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
|
||||
renderer.renderFaceYNeg(null, fruitTexture);
|
||||
renderer.renderFaceYPos(null, fruitTexture);
|
||||
renderer.renderFaceZNeg(null, fruitTexture);
|
||||
renderer.renderFaceZPos(null, fruitTexture);
|
||||
renderer.renderFaceXNeg(null, fruitTexture);
|
||||
renderer.renderFaceXPos(null, fruitTexture);
|
||||
baker.renderFaceYNeg(null, fruitTexture);
|
||||
baker.renderFaceYPos(null, fruitTexture);
|
||||
baker.renderFaceZNeg(null, fruitTexture);
|
||||
baker.renderFaceZPos(null, fruitTexture);
|
||||
baker.renderFaceXNeg(null, fruitTexture);
|
||||
baker.renderFaceXPos(null, fruitTexture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(Block block, IBlockAccess world, BlockPos pos, IModelBaker renderer) {
|
||||
public boolean renderInWorld(BlockForestryLeaves block, IBlockAccess world, BlockPos pos, IModelBaker baker) {
|
||||
|
||||
TileLeaves tile = BlockForestryLeaves.getLeafTile(world, pos);
|
||||
if (tile == null) {
|
||||
@@ -89,58 +79,28 @@ public class ModelLeaves extends ModelBlockOverlay {
|
||||
}
|
||||
|
||||
// Render the plain leaf block.
|
||||
renderer.renderStandardBlock(block, pos, tile.getSprite(Proxies.render.fancyGraphicsEnabled()));
|
||||
baker.renderStandardBlock(block, pos, tile.getLeaveSprite(Proxies.render.fancyGraphicsEnabled()));
|
||||
|
||||
// Render overlay for fruit leaves.
|
||||
TextureAtlasSprite fruitIcon = tile.getFruitTexture();
|
||||
TextureAtlasSprite fruitSprite = tile.getFruitSprite();
|
||||
|
||||
if (fruitIcon != null) {
|
||||
int fruitColor = tile.getFruitColour();
|
||||
renderFruitOverlay(world, block, pos, renderer, fruitIcon, fruitColor);
|
||||
if (fruitSprite != null) {
|
||||
renderFruitOverlay(world, block, pos, baker, fruitSprite, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean renderFruitOverlay(IBlockAccess world, Block block, BlockPos pos, IModelBaker renderer,
|
||||
TextureAtlasSprite texture, int multiplier) {
|
||||
|
||||
float mR = (multiplier >> 16 & 255) / 255.0F;
|
||||
float mG = (multiplier >> 8 & 255) / 255.0F;
|
||||
float mB = (multiplier & 255) / 255.0F;
|
||||
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
mR = (mR * 30.0F + mG * 59.0F + mB * 11.0F) / 100.0F;
|
||||
mG = (mR * 30.0F + mG * 70.0F) / 100.0F;
|
||||
mB = (mR * 30.0F + mB * 70.0F) / 100.0F;
|
||||
}
|
||||
|
||||
return renderFruitOverlayWithColorMultiplier(world, block, pos, mR, mG, mB, renderer, texture);
|
||||
}
|
||||
|
||||
private static boolean renderFruitOverlayWithColorMultiplier(IBlockAccess world, Block block, BlockPos pos, float r,
|
||||
float g, float b, IModelBaker renderer, TextureAtlasSprite texture) {
|
||||
|
||||
int mixedBrightness = block.getMixedBrightnessForBlock(world, pos);
|
||||
|
||||
float adjR = 0.5f * r;
|
||||
float adjG = 0.5f * g;
|
||||
float adjB = 0.5f * b;
|
||||
private boolean renderFruitOverlay(IBlockAccess world, BlockForestryLeaves block, BlockPos pos, IModelBaker baker, TextureAtlasSprite sprite, int colorIndex) {
|
||||
|
||||
// Bottom
|
||||
renderBottomFace(world, block, pos, renderer, texture, mixedBrightness, adjR, adjG, adjB);
|
||||
renderTopFace(world, block, pos, renderer, texture, mixedBrightness, adjR, adjG, adjB);
|
||||
renderEastFace(world, block, pos, renderer, texture, mixedBrightness, adjR, adjG, adjB);
|
||||
renderWestFace(world, block, pos, renderer, texture, mixedBrightness, adjR, adjG, adjB);
|
||||
renderNorthFace(world, block, pos, renderer, texture, mixedBrightness, adjR, adjG, adjB);
|
||||
renderSouthFace(world, block, pos, renderer, texture, mixedBrightness, adjR, adjG, adjB);
|
||||
renderBottomFace(world, block, pos, baker, sprite, colorIndex);
|
||||
renderTopFace(world, block, pos, baker, sprite, colorIndex);
|
||||
renderEastFace(world, block, pos, baker, sprite, colorIndex);
|
||||
renderWestFace(world, block, pos, baker, sprite, colorIndex);
|
||||
renderNorthFace(world, block, pos, baker, sprite, colorIndex);
|
||||
renderSouthFace(world, block, pos, baker, sprite, colorIndex);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getParticleTexture();
|
||||
}
|
||||
}
|
||||
@@ -286,7 +286,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSprite(boolean fancy) {
|
||||
public TextureAtlasSprite getLeaveSprite(boolean fancy) {
|
||||
if (species == null) {
|
||||
return TreeDefinition.Oak.getIndividual().getGenome().getPrimary().getLeafSprite(false, fancy);
|
||||
}
|
||||
@@ -294,7 +294,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getFruitTexture() {
|
||||
public TextureAtlasSprite getFruitSprite() {
|
||||
if (textureIndexFruits >= 0) {
|
||||
return TextureManager.getInstance().getSprite(textureIndexFruits);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
+9
-9
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
@@ -69,18 +69,18 @@ public class ModelBaker implements IModelBaker {
|
||||
renderMaxZ = i;
|
||||
}
|
||||
|
||||
protected int color = -1;
|
||||
protected int colorIndex = -1;
|
||||
|
||||
@Override
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
public void setColorIndex(int colorIndex) {
|
||||
this.colorIndex = colorIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, BlockPos pos, TextureAtlasSprite[] textures) {
|
||||
setRenderBoundsFromBlock(block);
|
||||
|
||||
setColor(0xffffff);
|
||||
setColorIndex(0);
|
||||
|
||||
renderFaceXNeg(pos, textures[EnumFacing.WEST.ordinal()]);
|
||||
renderFaceXPos(pos, textures[EnumFacing.EAST.ordinal()]);
|
||||
@@ -96,7 +96,7 @@ public class ModelBaker implements IModelBaker {
|
||||
public boolean renderStandardBlock(Block block, BlockPos pos, TextureAtlasSprite texture) {
|
||||
setRenderBoundsFromBlock(block);
|
||||
|
||||
setColor(0xffffff);
|
||||
setColorIndex(0);
|
||||
|
||||
renderFaceXNeg(pos, texture);
|
||||
renderFaceXPos(pos, texture);
|
||||
@@ -241,7 +241,7 @@ public class ModelBaker implements IModelBaker {
|
||||
}
|
||||
|
||||
protected void addFace(EnumFacing face, boolean isEdge, Vector3f to, Vector3f from, float[] defUVs2, TextureAtlasSprite texture) {
|
||||
faces.add(new ModelBakerFace(face, isEdge, color, to, from, defUVs2, texture));
|
||||
faces.add(new ModelBakerFace(face, isEdge, colorIndex, to, from, defUVs2, texture));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -256,10 +256,10 @@ public class ModelBaker implements IModelBaker {
|
||||
final float[] uvs = getFaceUvs(myFace, face.from, face.to);
|
||||
|
||||
final BlockFaceUV uv = new BlockFaceUV(uvs, 0);
|
||||
final BlockPartFace bpf = new BlockPartFace(myFace, face.color, "", uv);
|
||||
final BlockPartFace bpf = new BlockPartFace(myFace, face.colorIndex, "", uv);
|
||||
|
||||
BakedQuad bf = faceBakery.makeBakedQuad(face.to, face.from, bpf, face.spite, myFace, mr, null, true, true);
|
||||
bf = new IColoredBakedQuad.ColoredBakedQuad(bf.getVertexData(), face.color, bf.getFace());
|
||||
bf = new IColoredBakedQuad.ColoredBakedQuad(bf.getVertexData(), face.colorIndex, bf.getFace());
|
||||
|
||||
if (face.isEdge)
|
||||
this.generatedModel.getFaceQuads(myFace).add(bf);
|
||||
+4
-4
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
@@ -27,11 +27,11 @@ public class ModelBakerFace {
|
||||
|
||||
public final TextureAtlasSprite spite;
|
||||
|
||||
public final int color;
|
||||
public final int colorIndex;
|
||||
|
||||
public ModelBakerFace(EnumFacing face, boolean isEdge, int color, Vector3f to, Vector3f from, float[] defUVs2,
|
||||
public ModelBakerFace(EnumFacing face, boolean isEdge, int colorIndex, Vector3f to, Vector3f from, float[] defUVs2,
|
||||
TextureAtlasSprite sprite) {
|
||||
this.color = color;
|
||||
this.colorIndex = colorIndex;
|
||||
this.face = face;
|
||||
this.isEdge = isEdge;
|
||||
this.to = to;
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+44
-36
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -29,10 +29,9 @@ import forestry.api.core.IModelBaker;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockPos;
|
||||
|
||||
public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockModel {
|
||||
public abstract class ModelBlockOverlay<B extends Block> implements ISmartItemModel, ISmartBlockModel {
|
||||
|
||||
protected static void renderBottomFace(IBlockAccess world, Block block, BlockPos pos, IModelBaker renderer,
|
||||
TextureAtlasSprite textureIndex, int mixedBrightness, float r, float g, float b) {
|
||||
protected void renderBottomFace(IBlockAccess world, B block, BlockPos pos, IModelBaker baker, TextureAtlasSprite sprite, int colorIndex) {
|
||||
|
||||
BlockPos posNEW = new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ());
|
||||
|
||||
@@ -40,12 +39,11 @@ public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockM
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.renderFaceYNeg(pos, textureIndex);
|
||||
baker.renderFaceYNeg(pos, sprite);
|
||||
|
||||
}
|
||||
|
||||
protected static void renderTopFace(IBlockAccess world, Block block, BlockPos pos, IModelBaker renderer,
|
||||
TextureAtlasSprite textureIndex, int mixedBrightness, float r, float g, float b) {
|
||||
protected void renderTopFace(IBlockAccess world, B block, BlockPos pos, IModelBaker baker, TextureAtlasSprite sprite, int colorIndex) {
|
||||
|
||||
BlockPos posNEW = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ());
|
||||
|
||||
@@ -54,12 +52,11 @@ public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockM
|
||||
}
|
||||
|
||||
|
||||
renderer.renderFaceYPos(pos, textureIndex);
|
||||
baker.renderFaceYPos(pos, sprite);
|
||||
|
||||
}
|
||||
|
||||
protected static void renderEastFace(IBlockAccess world, Block block, BlockPos pos, IModelBaker renderer,
|
||||
TextureAtlasSprite textureIndex, int mixedBrightness, float r, float g, float b) {
|
||||
protected void renderEastFace(IBlockAccess world, B block, BlockPos pos, IModelBaker baker, TextureAtlasSprite sprite, int colorIndex) {
|
||||
|
||||
BlockPos posNEW = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
|
||||
|
||||
@@ -67,12 +64,11 @@ public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockM
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.renderFaceZNeg(pos, textureIndex);
|
||||
baker.renderFaceZNeg(pos, sprite);
|
||||
|
||||
}
|
||||
|
||||
protected static void renderWestFace(IBlockAccess world, Block block, BlockPos pos, IModelBaker renderer,
|
||||
TextureAtlasSprite textureIndex, int mixedBrightness, float r, float g, float b) {
|
||||
protected void renderWestFace(IBlockAccess world, B block, BlockPos pos, IModelBaker baker, TextureAtlasSprite sprite, int colorIndex) {
|
||||
|
||||
BlockPos posNEW = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
|
||||
@@ -80,12 +76,11 @@ public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockM
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.renderFaceZPos(pos, textureIndex);
|
||||
baker.renderFaceZPos(pos, sprite);
|
||||
|
||||
}
|
||||
|
||||
protected static void renderNorthFace(IBlockAccess world, Block block, BlockPos pos, IModelBaker renderer,
|
||||
TextureAtlasSprite textureIndex, int mixedBrightness, float r, float g, float b) {
|
||||
protected void renderNorthFace(IBlockAccess world, B block, BlockPos pos, IModelBaker baker, TextureAtlasSprite sprite, int colorIndex) {
|
||||
|
||||
BlockPos posNEW = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
|
||||
|
||||
@@ -93,12 +88,11 @@ public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockM
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.renderFaceXNeg(pos, textureIndex);
|
||||
baker.renderFaceXNeg(pos, sprite);
|
||||
|
||||
}
|
||||
|
||||
protected static void renderSouthFace(IBlockAccess world, Block block, BlockPos pos, IModelBaker renderer,
|
||||
TextureAtlasSprite textureIndex, int mixedBrightness, float r, float g, float b) {
|
||||
protected void renderSouthFace(IBlockAccess world, B block, BlockPos pos, IModelBaker baker, TextureAtlasSprite sprite, int colorIndex) {
|
||||
|
||||
BlockPos posNEW = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
|
||||
|
||||
@@ -106,12 +100,12 @@ public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockM
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.renderFaceXPos(pos, textureIndex);
|
||||
baker.renderFaceXPos(pos, sprite);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getFaceQuads(EnumFacing p_177551_1_) {
|
||||
public List getFaceQuads(EnumFacing face) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -147,27 +141,41 @@ public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockM
|
||||
|
||||
@Override
|
||||
public IBakedModel handleBlockState(IBlockState state) {
|
||||
IExtendedBlockState extend = (IExtendedBlockState) state;
|
||||
IModelBaker renderer = ModelManager.getInstance().createNewRenderer();
|
||||
Block blk = state.getBlock();
|
||||
IBlockAccess world = extend.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = extend.getValue(UnlistedBlockPos.POS);
|
||||
renderer.setRenderBoundsFromBlock(blk);
|
||||
renderInWorld(blk, world, pos, renderer);
|
||||
return renderer.bakeModel(false);
|
||||
IModelBaker baker = ModelManager.getInstance().createNewRenderer();
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
Block block = state.getBlock();
|
||||
|
||||
baker.setRenderBoundsFromBlock(block);
|
||||
try{
|
||||
renderInWorld((B) block, world, pos, baker);
|
||||
}catch(Exception e){
|
||||
return null;
|
||||
}
|
||||
|
||||
return baker.bakeModel(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handleItemState(ItemStack stack) {
|
||||
IModelBaker renderer = ModelManager.getInstance().createNewRenderer();
|
||||
Block blk = Block.getBlockFromItem(stack.getItem());
|
||||
renderer.setRenderBoundsFromBlock(blk);
|
||||
renderInventory(blk, stack, renderer);
|
||||
return renderer.bakeModel(true);
|
||||
IModelBaker baker = ModelManager.getInstance().createNewRenderer();
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
|
||||
block.setBlockBoundsForItemRender();
|
||||
baker.setRenderBoundsFromBlock(block);
|
||||
try{
|
||||
renderInventory((B) block, stack, baker);
|
||||
}catch(Exception e){
|
||||
return null;
|
||||
}
|
||||
|
||||
return baker.bakeModel(true);
|
||||
}
|
||||
|
||||
protected abstract void renderInventory(Block block, ItemStack item, IModelBaker renderer);
|
||||
protected abstract void renderInventory(B block, ItemStack item, IModelBaker renderer);
|
||||
|
||||
protected abstract boolean renderInWorld(Block block, IBlockAccess world, BlockPos pos, IModelBaker renderer);
|
||||
protected abstract boolean renderInWorld(B block, IBlockAccess world, BlockPos pos, IModelBaker renderer);
|
||||
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IModelManager;
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.render.model;
|
||||
package forestry.core.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -308,6 +308,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
*/
|
||||
private void assembleMachine(AssemblyState oldState) {
|
||||
this.assemblyState = AssemblyState.Assembled;
|
||||
|
||||
for (IMultiblockComponent part : connectedParts) {
|
||||
part.onMachineAssembled(this, getMinimumCoord(), getMaximumCoord());
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.render.model.BlockModelIndex;
|
||||
import forestry.core.render.model.ModelIndex;
|
||||
import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.models.ModelIndex;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileMill;
|
||||
|
||||
@@ -39,15 +39,15 @@ import forestry.core.entities.EntityFXHoneydust;
|
||||
import forestry.core.entities.EntityFXIgnition;
|
||||
import forestry.core.entities.EntityFXSnow;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.models.ModelIndex;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.models.RenderHandler;
|
||||
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.render.model.BlockModelIndex;
|
||||
import forestry.core.render.model.ModelIndex;
|
||||
import forestry.core.render.model.ModelManager;
|
||||
import forestry.core.render.model.RenderHandler;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileMill;
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ParticleHelper {
|
||||
double pz = pos.getZ() + (k + 0.5D) / iterations;
|
||||
int random = rand.nextInt(6);
|
||||
|
||||
EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), px, py, pz, px - pos.getX() - 0.5D, py - pos.getY() - 0.5D, pz - pos.getZ() - 0.5D, Block.getStateId(state));
|
||||
EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), px, py, pz, px - pos.getX() - 0.5D, py - pos.getY() - 0.5D, pz - pos.getZ() - 0.5D, Block.getStateId(state));
|
||||
callback.addDestroyEffects(fx, pos, state);
|
||||
effectRenderer.addEffect(fx.func_174846_a(pos));
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.inventory.InventoryEscritoire;
|
||||
import forestry.core.models.ModelEscritoire;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.model.ModelEscritoire;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
|
||||
public class RenderEscritoire extends TileEntitySpecialRenderer<TileEscritoire> {
|
||||
|
||||
@@ -13,7 +13,6 @@ import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.factory.recipes.FabricatorSmeltingRecipeManager;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.ICraftingGridHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
|
||||
-2
@@ -1,12 +1,10 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -10,7 +10,6 @@ import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.ICraftingGridHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
|
||||
@@ -5,14 +5,9 @@ import java.util.List;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import forestry.factory.recipes.SqueezerRecipeManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
|
||||
public class SqueezerRecipeMaker {
|
||||
|
||||
@@ -49,7 +49,7 @@ import forestry.core.render.ParticleHelper;
|
||||
import forestry.core.render.ParticleHelper.DefaultCallback;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.farming.render.EnumFarmBlockTexture;
|
||||
import forestry.farming.models.EnumFarmBlockTexture;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
import forestry.farming.tiles.TileFarmControl;
|
||||
import forestry.farming.tiles.TileFarmGearbox;
|
||||
@@ -61,25 +61,25 @@ public class BlockFarm extends BlockStructure {
|
||||
|
||||
private final ParticleHelper.Callback particleCallback;
|
||||
|
||||
public static final PropertyEnum META = PropertyEnum.create("meta", EnumBlockFarmType.class);
|
||||
public static final PropertyEnum META = PropertyEnum.create("meta", EnumFarmBlockType.class);
|
||||
|
||||
public BlockFarm() {
|
||||
super(Material.rock);
|
||||
setHardness(1.0f);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
this.particleCallback = new FarmCallback(this);
|
||||
setDefaultState(blockState.getBaseState().withProperty(META, EnumBlockFarmType.BASIC));
|
||||
setDefaultState(blockState.getBaseState().withProperty(META, EnumFarmBlockType.PLAIN));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(META, EnumBlockFarmType.values()[meta]);
|
||||
return getDefaultState().withProperty(META, EnumFarmBlockType.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((EnumBlockFarmType) state.getValue(META)).ordinal();
|
||||
return ((EnumFarmBlockType) state.getValue(META)).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -230,7 +230,9 @@ public class BlockFarm extends BlockStructure {
|
||||
@Override
|
||||
protected void setTexture(EntityDiggingFX fx, BlockPos pos, IBlockState state) {
|
||||
IExtendedBlockState extend = (IExtendedBlockState) state;
|
||||
fx.setParticleIcon(EnumFarmBlockTexture.getSprite(EnumFarmBlockTexture.BRICK, 0));
|
||||
TileFarm farm = (TileFarm) fx.getEntityWorld().getTileEntity(pos);
|
||||
|
||||
fx.setParticleIcon(EnumFarmBlockTexture.getSprite(farm.getFarmBlockTexture(), 2));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -240,7 +242,7 @@ public class BlockFarm extends BlockStructure {
|
||||
return getMetaFromState(world.getBlockState(pos)) == 5;
|
||||
}
|
||||
|
||||
public ItemStack get(EnumBlockFarmType type, int amount) {
|
||||
public ItemStack get(EnumFarmBlockType type, int amount) {
|
||||
return new ItemStack(this, amount, type.ordinal());
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package forestry.farming.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumBlockFarmType implements IStringSerializable {
|
||||
BASIC,
|
||||
BAND,
|
||||
GEARBOX,
|
||||
HATCH,
|
||||
VALVE,
|
||||
CONTROL;
|
||||
|
||||
public static final EnumBlockFarmType[] VALUES = values();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package forestry.farming.blocks;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.core.render.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public enum EnumFarmBlockType implements IStringSerializable {
|
||||
PLAIN,
|
||||
BAND,
|
||||
GEARBOX,
|
||||
HATCH,
|
||||
VALVE,
|
||||
CONTROL;
|
||||
|
||||
public static final EnumFarmBlockType[] VALUES = values();
|
||||
|
||||
private static final int TYPE_PLAIN = 0;
|
||||
private static final int TYPE_REVERSE = 1;
|
||||
private static final int TYPE_TOP = 2;
|
||||
private static final int TYPE_BAND = 3;
|
||||
private static final int TYPE_GEARS = 4;
|
||||
private static final int TYPE_HATCH = 5;
|
||||
private static final int TYPE_VALVE = 6;
|
||||
private static final int TYPE_CONTROL = 7;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static List<TextureAtlasSprite> sprites;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerSprites() {
|
||||
sprites = Arrays.asList(
|
||||
TextureManager.registerSprite("blocks/farm/plain"),
|
||||
TextureManager.registerSprite("blocks/farm/reverse"),
|
||||
TextureManager.registerSprite("blocks/farm/top"),
|
||||
TextureManager.registerSprite("blocks/farm/band"),
|
||||
TextureManager.registerSprite("blocks/farm/gears"),
|
||||
TextureManager.registerSprite("blocks/farm/hatch"),
|
||||
TextureManager.registerSprite("blocks/farm/valve"),
|
||||
TextureManager.registerSprite("blocks/farm/control")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The texture sprite from the type of the farm block
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite getSprite(EnumFarmBlockType type, int side) {
|
||||
switch (type) {
|
||||
case PLAIN: {
|
||||
if (side == 2) {
|
||||
return sprites.get(TYPE_REVERSE);
|
||||
} else if (side == 0 || side == 1) {
|
||||
return sprites.get(TYPE_TOP);
|
||||
} else {
|
||||
return sprites.get(TYPE_PLAIN);
|
||||
}
|
||||
}
|
||||
case BAND:
|
||||
return sprites.get(TYPE_BAND);
|
||||
case GEARBOX:
|
||||
return sprites.get(TYPE_GEARS);
|
||||
case HATCH:
|
||||
return sprites.get(TYPE_HATCH);
|
||||
case VALVE:
|
||||
return sprites.get(TYPE_VALVE);
|
||||
case CONTROL:
|
||||
return sprites.get(TYPE_CONTROL);
|
||||
default:
|
||||
return sprites.get(TYPE_PLAIN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,13 +12,12 @@ package forestry.farming.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.farming.models.EnumFarmBlockTexture;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.farming.render.EnumFarmBlockTexture;
|
||||
|
||||
public class ItemBlockFarm extends ItemBlock {
|
||||
|
||||
public ItemBlockFarm(Block block) {
|
||||
|
||||
+1
-61
@@ -8,10 +8,7 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.farming.render;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
package forestry.farming.models;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -20,7 +17,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.farming.blocks.EnumBlockFarmType;
|
||||
|
||||
public enum EnumFarmBlockTexture {
|
||||
BRICK_STONE(new ItemStack(Blocks.stonebrick, 1, 0)),
|
||||
@@ -35,68 +31,12 @@ public enum EnumFarmBlockTexture {
|
||||
QUARTZ_CHISELED(new ItemStack(Blocks.quartz_block, 1, 1)),
|
||||
QUARTZ_LINES(new ItemStack(Blocks.quartz_block, 1, 2));
|
||||
|
||||
private static final int TYPE_PLAIN = 0;
|
||||
private static final int TYPE_REVERSE = 1;
|
||||
private static final int TYPE_TOP = 2;
|
||||
private static final int TYPE_BAND = 3;
|
||||
private static final int TYPE_GEARS = 4;
|
||||
private static final int TYPE_HATCH = 5;
|
||||
private static final int TYPE_VALVE = 6;
|
||||
private static final int TYPE_CONTROL = 7;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static List<TextureAtlasSprite> sprites;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerSprites() {
|
||||
sprites = Arrays.asList(
|
||||
TextureManager.registerSprite("blocks/farm/plain"),
|
||||
TextureManager.registerSprite("blocks/farm/reverse"),
|
||||
TextureManager.registerSprite("blocks/farm/top"),
|
||||
TextureManager.registerSprite("blocks/farm/band"),
|
||||
TextureManager.registerSprite("blocks/farm/gears"),
|
||||
TextureManager.registerSprite("blocks/farm/hatch"),
|
||||
TextureManager.registerSprite("blocks/farm/valve"),
|
||||
TextureManager.registerSprite("blocks/farm/control")
|
||||
);
|
||||
}
|
||||
|
||||
private final ItemStack base;
|
||||
|
||||
EnumFarmBlockTexture(ItemStack base) {
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The texture sprite from the type of the farm block
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite getSprite(EnumBlockFarmType type, int side) {
|
||||
switch (type) {
|
||||
case BASIC: {
|
||||
if (side == 2) {
|
||||
return sprites.get(TYPE_REVERSE);
|
||||
} else if (side == 0 || side == 1) {
|
||||
return sprites.get(TYPE_TOP);
|
||||
} else {
|
||||
return sprites.get(TYPE_PLAIN);
|
||||
}
|
||||
}
|
||||
case BAND:
|
||||
return sprites.get(TYPE_BAND);
|
||||
case GEARBOX:
|
||||
return sprites.get(TYPE_GEARS);
|
||||
case HATCH:
|
||||
return sprites.get(TYPE_HATCH);
|
||||
case VALVE:
|
||||
return sprites.get(TYPE_VALVE);
|
||||
case CONTROL:
|
||||
return sprites.get(TYPE_CONTROL);
|
||||
default:
|
||||
return sprites.get(TYPE_PLAIN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The texture sprite from the material of the farm block
|
||||
*/
|
||||
@@ -0,0 +1,102 @@
|
||||
package forestry.farming.models;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.models.ModelBlockOverlay;
|
||||
import forestry.farming.blocks.BlockFarm;
|
||||
import forestry.farming.blocks.EnumFarmBlockType;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class ModelFarmBlock extends ModelBlockOverlay<BlockFarm> {
|
||||
|
||||
@Override
|
||||
public void renderInventory(BlockFarm blockFarm, ItemStack item, IModelBaker backer) {
|
||||
if (blockFarm == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnumFarmBlockTexture type = EnumFarmBlockTexture.getFromCompound(item.getTagCompound());
|
||||
|
||||
TextureAtlasSprite[] sprites = getSprites(type);
|
||||
TextureAtlasSprite[] overlaySprites = getOverlaySprites(EnumFarmBlockType.VALUES[item.getItemDamage()]);
|
||||
|
||||
backer.renderFaceYNeg(null, sprites[0]);
|
||||
backer.renderFaceYNeg(null, overlaySprites[0]);
|
||||
|
||||
backer.renderFaceYPos(null, sprites[1]);
|
||||
backer.renderFaceYPos(null, overlaySprites[1]);
|
||||
|
||||
backer.renderFaceZNeg(null, sprites[2]);
|
||||
backer.renderFaceZNeg(null, overlaySprites[2]);
|
||||
|
||||
backer.renderFaceZPos(null, sprites[3]);
|
||||
backer.renderFaceZPos(null, overlaySprites[3]);
|
||||
|
||||
backer.renderFaceXNeg(null, sprites[4]);
|
||||
backer.renderFaceXNeg(null, overlaySprites[4]);
|
||||
|
||||
backer.renderFaceXPos(null, sprites[5]);
|
||||
backer.renderFaceXPos(null, overlaySprites[5]);
|
||||
|
||||
blockFarm.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(BlockFarm blockFarm, IBlockAccess world, BlockPos pos, IModelBaker backer) {
|
||||
|
||||
TileFarm farm = (TileFarm) world.getTileEntity(pos);
|
||||
|
||||
TextureAtlasSprite[] textures = getSprites(farm.getFarmBlockTexture());
|
||||
TextureAtlasSprite[] texturesOverlay = getOverlaySprites(farm.getFarmBlockType());
|
||||
|
||||
// Render the plain block.
|
||||
backer.renderStandardBlock(blockFarm, pos, textures);
|
||||
renderFarmOverlay(world, blockFarm, pos, backer, texturesOverlay);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderFarmOverlay(IBlockAccess world, BlockFarm block, BlockPos pos, IModelBaker renderer, TextureAtlasSprite[] overlaySprites) {
|
||||
renderBottomFace(world, block, pos, renderer, overlaySprites[0], 0);
|
||||
renderTopFace(world, block, pos, renderer, overlaySprites[1], 0);
|
||||
renderEastFace(world, block, pos, renderer, overlaySprites[2], 0);
|
||||
renderWestFace(world, block, pos, renderer, overlaySprites[3], 0);
|
||||
renderNorthFace(world, block, pos, renderer, overlaySprites[4], 0);
|
||||
renderSouthFace(world, block, pos, renderer, overlaySprites[5], 0);
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite[] getSprites(EnumFarmBlockTexture texture) {
|
||||
TextureAtlasSprite[] textures = new TextureAtlasSprite[6];
|
||||
textures[0] = EnumFarmBlockTexture.getSprite(texture, 0);
|
||||
textures[1] = EnumFarmBlockTexture.getSprite(texture, 1);
|
||||
textures[2] = EnumFarmBlockTexture.getSprite(texture, 2);
|
||||
textures[3] = EnumFarmBlockTexture.getSprite(texture, 3);
|
||||
textures[4] = EnumFarmBlockTexture.getSprite(texture, 4);
|
||||
textures[5] = EnumFarmBlockTexture.getSprite(texture, 5);
|
||||
return textures;
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite[] getOverlaySprites(EnumFarmBlockType farmType) {
|
||||
TextureAtlasSprite[] textures = new TextureAtlasSprite[6];
|
||||
textures[0] = getOverlaySprite(farmType, 0);
|
||||
textures[1] = getOverlaySprite(farmType, 1);
|
||||
textures[2] = getOverlaySprite(farmType, 2);
|
||||
textures[3] = getOverlaySprite(farmType, 3);
|
||||
textures[4] = getOverlaySprite(farmType, 4);
|
||||
textures[5] = getOverlaySprite(farmType, 5);
|
||||
return textures;
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite getOverlaySprite(EnumFarmBlockType texture, int side) {
|
||||
return EnumFarmBlockType.getSprite(texture, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return getSprites(EnumFarmBlockTexture.BRICK)[0];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,9 +11,9 @@
|
||||
package forestry.farming.proxy;
|
||||
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.model.BlockModelIndex;
|
||||
import forestry.farming.render.ModelFarmBlock;
|
||||
import forestry.farming.models.ModelFarmBlock;
|
||||
import forestry.plugins.PluginFarming;
|
||||
|
||||
public class ProxyFarmingClient extends ProxyFarming {
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
package forestry.farming.render;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.render.model.ModelBlockOverlay;
|
||||
import forestry.farming.blocks.BlockFarm;
|
||||
import forestry.farming.blocks.EnumBlockFarmType;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
import forestry.plugins.PluginFarming;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class ModelFarmBlock extends ModelBlockOverlay {
|
||||
|
||||
@Override
|
||||
public void renderInventory(Block block, ItemStack item, IModelBaker renderer) {
|
||||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnumFarmBlockTexture type = EnumFarmBlockTexture.getFromCompound(item.getTagCompound());
|
||||
|
||||
TextureAtlasSprite[] textures = getSprites(type);
|
||||
TextureAtlasSprite[] texturesOverlay = getOverlaySprites(EnumBlockFarmType.VALUES[item.getItemDamage()]);
|
||||
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
|
||||
// GL11.glTranslatef(translateX, translateY, translateZ);
|
||||
renderer.renderFaceYNeg(null, textures[0]);
|
||||
renderer.renderFaceYNeg(null, texturesOverlay[0]);
|
||||
|
||||
renderer.renderFaceYPos(null, textures[1]);
|
||||
renderer.renderFaceYPos(null, texturesOverlay[1]);
|
||||
|
||||
renderer.renderFaceZNeg(null, textures[2]);
|
||||
renderer.renderFaceZNeg(null, texturesOverlay[2]);
|
||||
|
||||
renderer.renderFaceZPos(null, textures[3]);
|
||||
renderer.renderFaceZPos(null, texturesOverlay[3]);
|
||||
|
||||
renderer.renderFaceXNeg(null, textures[4]);
|
||||
renderer.renderFaceXNeg(null, texturesOverlay[4]);
|
||||
|
||||
renderer.renderFaceXPos(null, textures[5]);
|
||||
renderer.renderFaceXPos(null, texturesOverlay[5]);
|
||||
|
||||
// GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(Block block, IBlockAccess world, BlockPos pos, IModelBaker renderer) {
|
||||
|
||||
TileFarm farm = (TileFarm) world.getTileEntity(pos);
|
||||
|
||||
TextureAtlasSprite[] textures = getSprites(farm.getFarmBlockTexture());
|
||||
TextureAtlasSprite[] texturesOverlay = getOverlaySprites(EnumBlockFarmType.VALUES[farm.getBlockMetadata()]);
|
||||
|
||||
// Render the plain block.
|
||||
renderer.renderStandardBlock(block, pos, textures);
|
||||
renderFarmOverlay(world, PluginFarming.blocks.farm, pos, renderer, texturesOverlay);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void renderFarmOverlay(IBlockAccess world, BlockFarm block, BlockPos pos, IModelBaker renderer,
|
||||
TextureAtlasSprite[] texturesOverlay) {
|
||||
int mixedBrightness = block.getMixedBrightnessForBlock(world, pos);
|
||||
|
||||
float adjR = 0.5f;
|
||||
float adjG = 0.5f;
|
||||
float adjB = 0.5f;
|
||||
|
||||
renderBottomFace(world, block, pos, renderer, texturesOverlay[0], mixedBrightness, adjR, adjG, adjB);
|
||||
renderTopFace(world, block, pos, renderer, texturesOverlay[1], mixedBrightness, adjR, adjG, adjB);
|
||||
renderEastFace(world, block, pos, renderer, texturesOverlay[2], mixedBrightness, adjR, adjG, adjB);
|
||||
renderWestFace(world, block, pos, renderer, texturesOverlay[3], mixedBrightness, adjR, adjG, adjB);
|
||||
renderNorthFace(world, block, pos, renderer, texturesOverlay[4], mixedBrightness, adjR, adjG, adjB);
|
||||
renderSouthFace(world, block, pos, renderer, texturesOverlay[5], mixedBrightness, adjR, adjG, adjB);
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite[] getSprites(EnumFarmBlockTexture texture) {
|
||||
TextureAtlasSprite[] textures = new TextureAtlasSprite[6];
|
||||
textures[0] = EnumFarmBlockTexture.getSprite(texture, 0);
|
||||
textures[1] = EnumFarmBlockTexture.getSprite(texture, 1);
|
||||
textures[2] = EnumFarmBlockTexture.getSprite(texture, 2);
|
||||
textures[3] = EnumFarmBlockTexture.getSprite(texture, 3);
|
||||
textures[4] = EnumFarmBlockTexture.getSprite(texture, 4);
|
||||
textures[5] = EnumFarmBlockTexture.getSprite(texture, 5);
|
||||
return textures;
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite[] getOverlaySprites(EnumBlockFarmType type) {
|
||||
TextureAtlasSprite[] textures = new TextureAtlasSprite[6];
|
||||
textures[0] = getOverlaySprite(type, 0);
|
||||
textures[1] = getOverlaySprite(type, 1);
|
||||
textures[2] = getOverlaySprite(type, 2);
|
||||
textures[3] = getOverlaySprite(type, 3);
|
||||
textures[4] = getOverlaySprite(type, 4);
|
||||
textures[5] = getOverlaySprite(type, 5);
|
||||
return textures;
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite getOverlaySprite(EnumBlockFarmType texture, int side) {
|
||||
return EnumFarmBlockTexture.getSprite(texture, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return getSprites(EnumFarmBlockTexture.BRICK)[0];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,10 +34,11 @@ import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.tiles.ITitled;
|
||||
import forestry.farming.blocks.EnumFarmBlockType;
|
||||
import forestry.farming.gui.ContainerFarm;
|
||||
import forestry.farming.gui.GuiFarm;
|
||||
import forestry.farming.models.EnumFarmBlockTexture;
|
||||
import forestry.farming.multiblock.MultiblockLogicFarm;
|
||||
import forestry.farming.render.EnumFarmBlockTexture;
|
||||
|
||||
public abstract class TileFarm extends MultiblockTileEntityForestry<MultiblockLogicFarm> implements IFarmComponent, IHintSource, ISocketable, IStreamableGui, IErrorLogicSource, IRestrictedAccess, ITitled {
|
||||
|
||||
@@ -49,13 +50,13 @@ public abstract class TileFarm extends MultiblockTileEntityForestry<MultiblockLo
|
||||
|
||||
@Override
|
||||
public void onMachineAssembled(IMultiblockController multiblockController, BlockPos minCoord, BlockPos maxCoord) {
|
||||
worldObj.notifyBlockOfStateChange(getPos(), getBlockType());
|
||||
worldObj.notifyBlockOfStateChange(getPos(), worldObj.getBlockState(pos).getBlock());
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMachineBroken() {
|
||||
worldObj.notifyBlockOfStateChange(getPos(), getBlockType());
|
||||
worldObj.notifyBlockOfStateChange(getPos(), worldObj.getBlockState(pos).getBlock());
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@@ -94,6 +95,10 @@ public abstract class TileFarm extends MultiblockTileEntityForestry<MultiblockLo
|
||||
public EnumFarmBlockTexture getFarmBlockTexture() {
|
||||
return farmBlockTexture;
|
||||
}
|
||||
|
||||
public EnumFarmBlockType getFarmBlockType() {
|
||||
return EnumFarmBlockType.VALUES[getBlockMetadata()];
|
||||
}
|
||||
|
||||
/* TILEFORESTRY */
|
||||
|
||||
|
||||
@@ -520,14 +520,14 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'#', PluginCore.items.beeswax);
|
||||
|
||||
// / ALVEARY
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.PLAIN),
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.PLAIN),
|
||||
"###",
|
||||
"#X#",
|
||||
"###",
|
||||
'X', PluginCore.items.impregnatedCasing,
|
||||
'#', PluginCore.items.craftingMaterial.getScentedPaneling());
|
||||
// SWARMER
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.SWARMER),
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.SWARMER),
|
||||
"#G#",
|
||||
" X ",
|
||||
"#G#",
|
||||
@@ -535,7 +535,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'X', blocks.alveary,
|
||||
'G', "ingotGold");
|
||||
// FAN
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.FAN),
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.FAN),
|
||||
"I I",
|
||||
" X ",
|
||||
"I#I",
|
||||
@@ -543,7 +543,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'X', blocks.alveary,
|
||||
'I', "ingotIron");
|
||||
// HEATER
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.HEATER),
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.HEATER),
|
||||
"#I#",
|
||||
" X ",
|
||||
"YYY",
|
||||
@@ -551,7 +551,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'X', blocks.alveary,
|
||||
'I', "ingotIron", 'Y', "stone");
|
||||
// HYGROREGULATOR
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.HYGRO),
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.HYGRO),
|
||||
"GIG",
|
||||
"GXG",
|
||||
"GIG",
|
||||
@@ -559,14 +559,14 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'I', "ingotIron",
|
||||
'G', "blockGlass");
|
||||
// STABILISER
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.STABILISER),
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.STABILISER),
|
||||
"G G",
|
||||
"GXG",
|
||||
"G G",
|
||||
'X', blocks.alveary,
|
||||
'G', "gemQuartz");
|
||||
// SIEVE
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.SIEVE),
|
||||
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.SIEVE),
|
||||
"III",
|
||||
" X ",
|
||||
"WWW",
|
||||
|
||||
@@ -52,11 +52,11 @@ import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.AlleleRegistry;
|
||||
import forestry.core.items.EnumContainerType;
|
||||
import forestry.core.items.ItemRegistryCore;
|
||||
import forestry.core.models.RenderHandler;
|
||||
import forestry.core.multiblock.MultiblockLogicFactory;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.network.PacketRegistryCore;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.render.model.RenderHandler;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.ForestryModEnvWarningCallable;
|
||||
|
||||
@@ -43,7 +43,7 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.farming.blocks.BlockRegistryFarming;
|
||||
import forestry.farming.blocks.EnumBlockFarmType;
|
||||
import forestry.farming.blocks.EnumFarmBlockType;
|
||||
import forestry.farming.circuits.CircuitFarmLogic;
|
||||
import forestry.farming.logic.FarmLogicArboreal;
|
||||
import forestry.farming.logic.FarmLogicCereal;
|
||||
@@ -64,8 +64,8 @@ import forestry.farming.logic.FarmableGourd;
|
||||
import forestry.farming.logic.FarmableStacked;
|
||||
import forestry.farming.logic.FarmableVanillaMushroom;
|
||||
import forestry.farming.logic.FarmableVanillaSapling;
|
||||
import forestry.farming.models.EnumFarmBlockTexture;
|
||||
import forestry.farming.proxy.ProxyFarming;
|
||||
import forestry.farming.render.EnumFarmBlockTexture;
|
||||
import forestry.farming.tiles.TileFarmControl;
|
||||
import forestry.farming.tiles.TileFarmGearbox;
|
||||
import forestry.farming.tiles.TileFarmHatch;
|
||||
@@ -275,11 +275,11 @@ public class PluginFarming extends ForestryPlugin {
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
|
||||
ItemStack basic = blocks.farm.get(EnumBlockFarmType.BASIC, 1);
|
||||
ItemStack gearbox = blocks.farm.get(EnumBlockFarmType.GEARBOX, 1);
|
||||
ItemStack hatch = blocks.farm.get(EnumBlockFarmType.HATCH, 1);
|
||||
ItemStack valve = blocks.farm.get(EnumBlockFarmType.VALVE, 1);
|
||||
ItemStack control = blocks.farm.get(EnumBlockFarmType.CONTROL, 1);
|
||||
ItemStack basic = blocks.farm.get(EnumFarmBlockType.PLAIN, 1);
|
||||
ItemStack gearbox = blocks.farm.get(EnumFarmBlockType.GEARBOX, 1);
|
||||
ItemStack hatch = blocks.farm.get(EnumFarmBlockType.HATCH, 1);
|
||||
ItemStack valve = blocks.farm.get(EnumFarmBlockType.VALVE, 1);
|
||||
ItemStack control = blocks.farm.get(EnumFarmBlockType.CONTROL, 1);
|
||||
|
||||
for (EnumFarmBlockTexture block : EnumFarmBlockTexture.values()) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -352,6 +352,6 @@ public class PluginFarming extends ForestryPlugin {
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleTextureRemap(TextureStitchEvent.Pre event) {
|
||||
EnumFarmBlockTexture.registerSprites();
|
||||
EnumFarmBlockType.registerSprites();
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.storage.proxy;
|
||||
|
||||
import forestry.core.models.ModelCrate;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import forestry.core.render.model.ModelCrate;
|
||||
|
||||
public class ProxyStorageClient extends ProxyStorage {
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class LiquidFilter implements ItemFilter
|
||||
|
||||
public void setLiquid(FluidStack liquid)
|
||||
{
|
||||
String name = liquid.getFluid().getLocalizedName();
|
||||
String name = liquid.getFluid().getLocalizedName(liquid);
|
||||
this.liquid = liquid;
|
||||
liquidName = name.toLowerCase(Locale.ENGLISH);
|
||||
tooltip.clear();
|
||||
|
||||
@@ -109,7 +109,7 @@ public class LiquidSlot implements Slot
|
||||
{
|
||||
tooltip = new ArrayList<String>(1);
|
||||
FluidStack stack = (FluidStack)data[dataIndex];
|
||||
tooltip.add(stack.getFluid().getLocalizedName() + " (" + stack.amount + " milliBuckets)");
|
||||
tooltip.add(stack.getFluid().getLocalizedName(stack) + " (" + stack.amount + " milliBuckets)");
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
|
||||
Reference in new issue
Block a user