mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 04:32:24 +00:00
Work on MultiFence
This commit is contained in:
1 parent
c949131976
commit
f1640ff21b
8 files changed
+200
-105
No files matched your search
@@ -105,7 +105,7 @@ public class AABBModelBaker implements IModelBaker {
|
||||
}
|
||||
}
|
||||
|
||||
protected float[] getFaceUvs(final EnumFacing face, final Vector3f to, final Vector3f from) {
|
||||
protected float[] getFaceUvs(EnumFacing face, Vector3f to, Vector3f from) {
|
||||
float minU;
|
||||
float minV;
|
||||
float maxU;
|
||||
@@ -153,14 +153,22 @@ public class AABBModelBaker implements IModelBaker {
|
||||
maxV = to.z;
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
minU= 6;
|
||||
default: {
|
||||
minU = 0;
|
||||
minV = 0;
|
||||
maxU= 10;
|
||||
maxU = 16;
|
||||
maxV = 16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (minU < 0 || maxU > 16) {
|
||||
minU = 0;
|
||||
maxU = 16;
|
||||
}
|
||||
if (minV < 0 || maxV > 16) {
|
||||
minV = 0;
|
||||
maxV = 16;
|
||||
}
|
||||
minU = 16 - minU;
|
||||
minV = 16 - minV;
|
||||
maxU = 16 - maxU;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package binnie.core.models;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
@@ -10,6 +12,7 @@ import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import forestry.core.models.BlockModelEntry;
|
||||
import forestry.core.models.ModelEntry;
|
||||
import forestry.core.utils.ModelUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -28,16 +31,16 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.SimpleModelState;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.vecmath.Vector3f;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelManager implements IModelManager {
|
||||
@@ -53,56 +56,10 @@ public class ModelManager implements IModelManager {
|
||||
private final List<IColoredItem> itemColorList = new ArrayList<>();
|
||||
private final static List<ISpriteRegister> spriteRegister = new ArrayList<>();
|
||||
|
||||
private TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
public final IModelState DEFAULT_BLOCK;
|
||||
public final IModelState DEFAULT_ITEM;
|
||||
public final IModelState DEFAULT_TOOL;
|
||||
public static IModelState defaultFenceState;
|
||||
|
||||
public ModelManager(String modID) {
|
||||
this.modID = modID;
|
||||
|
||||
TRSRTransformation blockThirdperson = get(0, 2.5f, 0, 75, 45, 0, 0.375f);
|
||||
ImmutableMap.Builder<TransformType, TRSRTransformation> blockBuilder = ImmutableMap.builder();
|
||||
blockBuilder.put(TransformType.GUI, get(0, 0, 0, 30, 225, 0, 0.625f));
|
||||
blockBuilder.put(TransformType.GROUND, get(0, 3, 0, 0, 0, 0, 0.25f));
|
||||
blockBuilder.put(TransformType.FIXED, get(0, 0, 0, 0, 0, 0, 0.5f));
|
||||
blockBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, blockThirdperson);
|
||||
blockBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(blockThirdperson));
|
||||
blockBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(0, 0, 0, 0, 45, 0, 0.4f));
|
||||
blockBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0, 0, 0, 0, 225, 0, 0.4f));
|
||||
DEFAULT_BLOCK = new SimpleModelState(blockBuilder.build());
|
||||
|
||||
TRSRTransformation itemThirdperson = get(0, 3, 1, 0, 0, 0, 0.55f);
|
||||
TRSRTransformation firstperson = get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f);
|
||||
ImmutableMap.Builder<TransformType, TRSRTransformation> itemBuilder = ImmutableMap.builder();
|
||||
itemBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f));
|
||||
itemBuilder.put(TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1));
|
||||
itemBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, itemThirdperson);
|
||||
itemBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(itemThirdperson));
|
||||
itemBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, firstperson);
|
||||
itemBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, leftify(firstperson));
|
||||
DEFAULT_ITEM = new SimpleModelState(itemBuilder.build());
|
||||
|
||||
DEFAULT_TOOL = new SimpleModelState(ImmutableMap.of(
|
||||
TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 4, 0.5f, 0, -90, 55, 0.85f),
|
||||
TransformType.THIRD_PERSON_LEFT_HAND, get(0, 4, 0.5f, 0, 90, -55, 0.85f),
|
||||
TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f),
|
||||
TransformType.FIRST_PERSON_LEFT_HAND, get(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)));
|
||||
}
|
||||
|
||||
private TRSRTransformation get(float tx, float ty, float tz, float ax, float ay, float az, float s) {
|
||||
return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(
|
||||
new Vector3f(tx / 16, ty / 16, tz / 16),
|
||||
TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)),
|
||||
new Vector3f(s, s, s),
|
||||
null));
|
||||
}
|
||||
|
||||
private TRSRTransformation leftify(TRSRTransformation transform) {
|
||||
if (flipX == null) {
|
||||
flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
}
|
||||
return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,6 +98,10 @@ public class ModelManager implements IModelManager {
|
||||
return new ModelResourceLocation(new ResourceLocation(modID, identifier), "inventory");
|
||||
}
|
||||
|
||||
public static IModelState getDefaultFenceState() {
|
||||
return defaultFenceState;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockClient(Block block) {
|
||||
if (block instanceof IItemModelRegister) {
|
||||
@@ -266,6 +227,17 @@ public class ModelManager implements IModelManager {
|
||||
for (final ModelEntry entry : customModels) {
|
||||
registry.putObject(entry.modelLocation, entry.model);
|
||||
}
|
||||
IModelState defaultBlockState = ModelUtil.loadModelState(new ResourceLocation("minecraft:models/block/block"));
|
||||
IModelState defaultFenceState = ModelUtil.loadModelState(new ResourceLocation("minecraft:models/block/fence_inventory"));
|
||||
ModelManager.defaultFenceState = mergeStates(defaultBlockState, defaultFenceState);
|
||||
}
|
||||
|
||||
private static IModelState mergeStates(IModelState state, IModelState secondaryState){
|
||||
Map<TransformType, TRSRTransformation> tMap = Maps.newHashMap();
|
||||
TRSRTransformation guiTransformation = secondaryState.apply(Optional.of(TransformType.GUI)).get();
|
||||
tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(state));
|
||||
tMap.put(TransformType.GUI, guiTransformation);
|
||||
return new SimpleModelState(ImmutableMap.copyOf(tMap));
|
||||
}
|
||||
|
||||
public static void registerCustomBlockModel(BlockModelEntry index) {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class WoodManager {
|
||||
}
|
||||
|
||||
public static List<IPlankType> getAllPlankTypes() {
|
||||
final List<IPlankType> list = new ArrayList<>();
|
||||
List<IPlankType> list = new ArrayList<>();
|
||||
Collections.addAll(list, PlankType.ExtraTreePlanks.values());
|
||||
Collections.addAll(list, PlankType.ForestryPlanks.values());
|
||||
//TODO: extrabiomes 1.10.2
|
||||
@@ -136,9 +136,9 @@ public class WoodManager {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IPlankType get(final ItemStack species) {
|
||||
for (final IPlankType type : getAllPlankTypes()) {
|
||||
if (type.getStack().isItemEqual(species)) {
|
||||
public static IPlankType getPlankType(ItemStack itemStack) {
|
||||
for (IPlankType type : getAllPlankTypes()) {
|
||||
if (type.getStack(false).isItemEqual(itemStack)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package binnie.extratrees.block.decor;
|
||||
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.models.AABBModelBaker;
|
||||
import binnie.core.models.ModelManager;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import forestry.api.core.IModelBaker;
|
||||
@@ -9,10 +10,10 @@ import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -42,7 +43,7 @@ public class ModelMultiFence extends ModelBlockDefault<BlockMultiFence, ModelMul
|
||||
|
||||
@Override
|
||||
protected Key getInventoryKey(ItemStack stack) {
|
||||
return new Key(stack.getItemDamage(), ExtraTrees.blocks().blockMultiFence.getDefaultState());
|
||||
return new Key(TileEntityMetadata.getItemDamage(stack), ExtraTrees.blocks().blockMultiFence.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,14 +51,7 @@ public class ModelMultiFence extends ModelBlockDefault<BlockMultiFence, ModelMul
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
int meta;
|
||||
if(tileEntity instanceof TileEntityMetadata){
|
||||
TileEntityMetadata tileMeta = (TileEntityMetadata) tileEntity;
|
||||
meta = tileMeta.getBlockMetadata();
|
||||
}else{
|
||||
meta = 0;
|
||||
}
|
||||
int meta = TileEntityMetadata.getTileMetadata(world, pos);
|
||||
return new Key(meta, stateExtended);
|
||||
}
|
||||
|
||||
@@ -90,6 +84,7 @@ public class ModelMultiFence extends ModelBlockDefault<BlockMultiFence, ModelMul
|
||||
|
||||
IModelBaker baker = new AABBModelBaker();
|
||||
bakeBlock(bBlock, key, baker, true);
|
||||
baker.setModelState(ModelManager.getDefaultFenceState());
|
||||
|
||||
return itemModel = baker.bakeModel(true);
|
||||
}
|
||||
@@ -98,6 +93,102 @@ public class ModelMultiFence extends ModelBlockDefault<BlockMultiFence, ModelMul
|
||||
@Override
|
||||
protected void bakeBlock(BlockMultiFence block, Key key, IModelBaker baker, boolean inventory) {
|
||||
AABBModelBaker modelBaker = (AABBModelBaker) baker;
|
||||
if(inventory){
|
||||
bakeItemModel(block, modelBaker, key);
|
||||
}else{
|
||||
bakeBlockModel(block, modelBaker, key);
|
||||
}
|
||||
}
|
||||
|
||||
private void bakeItemModel(BlockMultiFence block, AABBModelBaker modelBaker, Key key){
|
||||
int meta = key.meta;
|
||||
FenceType type = key.type;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
final float thickness = 0.125f;
|
||||
boolean secondary = false;
|
||||
if (i == 0) {
|
||||
modelBaker.setModelBounds(new AxisAlignedBB(0.5f - thickness, 0.0f, 0.0f, 0.5f + thickness, 1.0f, thickness * 2.0f));
|
||||
}
|
||||
if (i == 1) {
|
||||
modelBaker.setModelBounds(new AxisAlignedBB(0.5f - thickness, 0.0f, 1.0f - thickness * 2.0f, 0.5f + thickness, 1.0f, 1.0f));
|
||||
}
|
||||
final float s = 0.0625f;
|
||||
final boolean bottomBar = !type.solid;
|
||||
float topBarMaxY = 1.0f - s;
|
||||
float topBarMinY = 1.0f - s * 3.0f;
|
||||
float bottomBarMaxY = 0.5f - s;
|
||||
float bottomBarMinY = 0.5f - s * 3.0f;
|
||||
if (type.size == 2) {
|
||||
bottomBarMinY -= 4.0f * s;
|
||||
bottomBarMaxY -= 4.0f * s;
|
||||
topBarMinY -= 4.0f * s;
|
||||
topBarMaxY -= 4.0f * s;
|
||||
}
|
||||
if (type.size == 1) {
|
||||
bottomBarMinY -= 4.0f * s;
|
||||
bottomBarMaxY -= 4.0f * s;
|
||||
}
|
||||
if (type.solid) {
|
||||
topBarMinY = bottomBarMinY;
|
||||
}
|
||||
float minX = 0.5f - s;
|
||||
float maxX = 0.5f + s;
|
||||
float minZ = -s * 2.0f;
|
||||
float maxZ = 1.0f + s * 2.0f;
|
||||
if (i == 2) {
|
||||
modelBaker.setModelBounds(new AxisAlignedBB(minX, topBarMinY, minZ, maxX, topBarMaxY, maxZ));
|
||||
secondary = true;
|
||||
}
|
||||
if (i == 3) {
|
||||
if (!bottomBar) {
|
||||
continue;
|
||||
}
|
||||
modelBaker.setModelBounds(new AxisAlignedBB(minX, bottomBarMinY, minZ, maxX, bottomBarMaxY, maxZ));
|
||||
secondary = true;
|
||||
}
|
||||
if (i == 4) {
|
||||
if (type.embossed) {
|
||||
minX -= s * 0.9f;
|
||||
maxX += s * 0.9f;
|
||||
minZ -= s;
|
||||
maxZ += s;
|
||||
float minY = 0.0f;
|
||||
float maxY = 1.0f;
|
||||
if (type.size != 1 && !type.solid) {
|
||||
minY = bottomBarMinY + 2.0f * s;
|
||||
maxY = topBarMaxY - 2.0f * s;
|
||||
}
|
||||
else if (type.size == 1 && type.solid) {
|
||||
minY = bottomBarMinY + 2.0f * s;
|
||||
maxY = topBarMaxY - 2.0f * s;
|
||||
}
|
||||
else {
|
||||
minY = 0.5f - 2.0f * s;
|
||||
maxY = 0.5f + 2.0f * s;
|
||||
}
|
||||
if (type.solid && type.size == 0) {
|
||||
minY -= s;
|
||||
maxY -= s;
|
||||
}
|
||||
if (type.solid && type.size == 2) {
|
||||
minY += s;
|
||||
maxY += s;
|
||||
}
|
||||
modelBaker.setModelBounds(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ));
|
||||
}
|
||||
else {
|
||||
if (type.size != 1 || type.solid) {
|
||||
continue;
|
||||
}
|
||||
modelBaker.setModelBounds(new AxisAlignedBB(minX, 0.5f - s, minZ, maxX, 0.5f + s, maxZ));
|
||||
secondary = true;
|
||||
}
|
||||
}
|
||||
modelBaker.addBlockModel(null, block.getSprite(meta, secondary), 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void bakeBlockModel(BlockMultiFence block, AABBModelBaker modelBaker, Key key){
|
||||
float minPostPos = 0.5f - POST_WIDGTH / 2.0f;
|
||||
float maxPostPos = 0.5f + POST_WIDGTH / 2.0f;
|
||||
IBlockState state = key.state;
|
||||
@@ -107,10 +198,10 @@ public class ModelMultiFence extends ModelBlockDefault<BlockMultiFence, ModelMul
|
||||
modelBaker.setModelBounds(new AxisAlignedBB(minPostPos, 0.0, minPostPos, maxPostPos, POST_HEIGHT, maxPostPos));
|
||||
modelBaker.addBlockModel(null, block.getSprite(meta, false), 0);
|
||||
|
||||
boolean connectNegX = state.getValue(net.minecraft.block.BlockFence.WEST);
|
||||
boolean connectPosX = state.getValue(net.minecraft.block.BlockFence.EAST);
|
||||
boolean connectNegZ = state.getValue(net.minecraft.block.BlockFence.NORTH);
|
||||
boolean connectPosZ = state.getValue(net.minecraft.block.BlockFence.SOUTH);
|
||||
boolean connectNegX = state.getValue(BlockFence.WEST);
|
||||
boolean connectPosX = state.getValue(BlockFence.EAST);
|
||||
boolean connectNegZ = state.getValue(BlockFence.NORTH);
|
||||
boolean connectPosZ = state.getValue(BlockFence.SOUTH);
|
||||
boolean connectAnyX = connectNegX || connectPosX;
|
||||
boolean connectAnyZ = connectNegZ || connectPosZ;
|
||||
if (!connectAnyX && !connectAnyZ) {
|
||||
|
||||
@@ -26,7 +26,7 @@ public class MultiFenceRecipeEmbedded implements IRecipe {
|
||||
final FenceType type2 = WoodManager.getFenceType(c);
|
||||
if (type != null && type2 != null) {
|
||||
if (type.equals(type2)) {
|
||||
final IPlankType pType = WoodManager.get(b);
|
||||
final IPlankType pType = WoodManager.getPlankType(b);
|
||||
FenceDescription fenceDescription = WoodManager.getFenceDescription(a);
|
||||
if (fenceDescription != null && fenceDescription.getPlankType() == pType) {
|
||||
this.cached = WoodManager.getFence(fenceDescription.getPlankType(), fenceDescription.getSecondaryPlankType(), new FenceType(type.size, type.solid, true), 2);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package binnie.extratrees.block.decor;
|
||||
|
||||
import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MultiFenceRecipePattern{
|
||||
public static MultiFenceRecipePattern[] VALUES;
|
||||
|
||||
static{
|
||||
VALUES = new MultiFenceRecipePattern[] {
|
||||
new MultiFenceRecipePattern(0, "010"+"0 0"+" "),
|
||||
new MultiFenceRecipePattern(0, "000"+"0 0"+" "),
|
||||
new MultiFenceRecipePattern(1, "010"+"0 0"+" 1 "),
|
||||
new MultiFenceRecipePattern(1, "000"+"0 0"+" 0 "),
|
||||
new MultiFenceRecipePattern(2, " 0 "+"1 1"+"101"),
|
||||
new MultiFenceRecipePattern(2, " 0 "+"0 0"+"000")
|
||||
};
|
||||
}
|
||||
|
||||
private final String pattern;
|
||||
private final int size;
|
||||
|
||||
private MultiFenceRecipePattern(int size, String pattern) {
|
||||
this.size = size;
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public boolean matches(String recipePattern){
|
||||
return pattern.contains(recipePattern);
|
||||
}
|
||||
|
||||
public ItemStack createFence(IPlankType plank, IPlankType plankSecondary){
|
||||
return WoodManager.getFence(plank, plankSecondary, new FenceType(size, false, false), 4);
|
||||
}
|
||||
}
|
||||
@@ -9,25 +9,28 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MultiFenceRecipeSize implements IRecipe {
|
||||
private ItemStack cached = ItemStack.EMPTY;
|
||||
|
||||
|
||||
public MultiFenceRecipeSize() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting inv, final World world) {
|
||||
String pattern = "";
|
||||
final List<IPlankType> types = new ArrayList<>();
|
||||
String recipePattern = "";
|
||||
List<IPlankType> types = new ArrayList<>();
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
final ItemStack stack = inv.getStackInSlot(i);
|
||||
final IPlankType type = (stack.isEmpty()) ? null : WoodManager.get(stack);
|
||||
if (!stack.isEmpty() && type == null) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
boolean isEmpty = stack.isEmpty();
|
||||
IPlankType type = isEmpty ? null : WoodManager.getPlankType(stack);
|
||||
if (!isEmpty && type == null) {
|
||||
return false;
|
||||
}
|
||||
if (stack.isEmpty()) {
|
||||
pattern += " ";
|
||||
if (isEmpty) {
|
||||
recipePattern += " ";
|
||||
} else {
|
||||
if (!types.contains(type)) {
|
||||
types.add(type);
|
||||
@@ -35,28 +38,20 @@ public class MultiFenceRecipeSize implements IRecipe {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
pattern += types.indexOf(type);
|
||||
recipePattern += types.indexOf(type);
|
||||
}
|
||||
}
|
||||
if (types.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
ItemStack fence = ItemStack.EMPTY;
|
||||
if (pattern.contains("0100 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(1), new FenceType(0, false, false), 4);
|
||||
} else if (pattern.contains("0000 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(0, false, false), 4);
|
||||
} else if (pattern.contains("0100 0 1 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(1), new FenceType(1, false, false), 4);
|
||||
} else if (pattern.contains("0000 0 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(1, false, false), 4);
|
||||
} else if (pattern.contains(" 0 1 1101")) {
|
||||
fence = WoodManager.getFence(types.get(1), types.get(0), new FenceType(2, false, false), 4);
|
||||
} else if (pattern.contains(" 0 0 0000")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(2, false, false), 4);
|
||||
for(MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES){
|
||||
if(pattern.matches(recipePattern)){
|
||||
cached = pattern.createFence(types.get(0), types.get(1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.cached = fence;
|
||||
return !fence.isEmpty();
|
||||
this.cached = ItemStack.EMPTY;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,13 +69,6 @@ public class MultiFenceRecipeSize implements IRecipe {
|
||||
return (this.cached.isEmpty()) ? new ItemStack(Blocks.OAK_FENCE) : this.cached;
|
||||
}
|
||||
|
||||
// TODO: what is this?
|
||||
public static void generateTypes() {
|
||||
final int type = 0;
|
||||
for (int type2 = 0; type2 < 2; ++type2) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
|
||||
@@ -30,7 +30,7 @@ public class PagePlanksOverview extends PageAbstract<ItemStack> {
|
||||
final WindowAbstractDatabase database = Window.get(this);
|
||||
new ControlText(this, new Area(0, 0, this.size().x(), 24), species.getDisplayName(), TextJustification.MiddleCenter);
|
||||
new ControlText(this, new Area(12, 24, this.size().x() - 24, 24), ExtraTrees.proxy.localise("gui.database.planks.use"), TextJustification.MIDDLE_LEFTt);
|
||||
final IPlankType type = WoodManager.get(species);
|
||||
final IPlankType type = WoodManager.getPlankType(species);
|
||||
int x = 12;
|
||||
if (type != null) {
|
||||
final ItemStack fence = WoodManager.getFence(type, new FenceType(0), 1);
|
||||
|
||||
Reference in new issue
Block a user