use of binnie.extratrees.blocks.decor.FenceType in project Binnie by ForestryMC.
the class MultiFenceRecipeEmbeddedWrapper method getIngredients.
@Override
public void getIngredients(IIngredients ingredients) {
List<ItemStack> fences = new ArrayList<>();
List<ItemStack> planks = new ArrayList<>();
List<ItemStack> outputFences = new ArrayList<>();
if (plankType != null) {
if (plankTypeSecondary == null) {
for (Entry<IPlankType, ItemStack> secondary : WoodManager.getAllPlankStacks().entrySet()) {
IPlankType plankTypeSecondary = secondary.getKey();
if (plankType != plankTypeSecondary) {
planks.add(plankType.getStack(false));
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), fenceType.isSolid(), false), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), fenceType.isSolid(), true), 2));
}
}
} else {
planks.add(plankType.getStack(false));
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), fenceType.isSolid(), false), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), fenceType.isSolid(), true), 2));
}
} else {
for (IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()) {
for (IPlankType plankType : WoodManager.getAllPlankTypes()) {
if (plankType != plankTypeSecondary) {
planks.add(plankType.getStack(false));
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), fenceType.isSolid(), false), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), fenceType.isSolid(), true), 2));
}
}
}
}
List<List<ItemStack>> itemInputs = new ArrayList<>();
itemInputs.add(fences);
itemInputs.add(planks);
itemInputs.add(fences);
List<List<ItemStack>> itemOutputs = new ArrayList<>();
itemOutputs.add(outputFences);
ingredients.setOutputLists(ItemStack.class, itemOutputs);
ingredients.setInputLists(ItemStack.class, itemInputs);
}
use of binnie.extratrees.blocks.decor.FenceType in project Binnie by ForestryMC.
the class ModelMultiFence method bakeItemModel.
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;
final boolean bottomBar = !type.isSolid();
float topBarMaxY = 1.0f - SCALE;
float topBarMinY = 1.0f - SCALE * 3.0f;
float bottomBarMaxY = 0.5f - SCALE;
float bottomBarMinY = 0.5f - SCALE * 3.0f;
if (type.getSize() == 2) {
bottomBarMinY -= 4.0f * SCALE;
bottomBarMaxY -= 4.0f * SCALE;
topBarMinY -= 4.0f * SCALE;
topBarMaxY -= 4.0f * SCALE;
}
if (type.getSize() == 1) {
bottomBarMinY -= 4.0f * SCALE;
bottomBarMaxY -= 4.0f * SCALE;
}
if (type.isSolid()) {
topBarMinY = bottomBarMinY;
}
float minX = 0.5f - SCALE;
float maxX = 0.5f + SCALE;
float minZ = -SCALE * 2.0f;
float maxZ = 1.0f + SCALE * 2.0f;
if (i == 0) {
modelBaker.setModelBounds(new AxisAlignedBB(0.5f - thickness, 0.0f, 0.0f, 0.5f + thickness, 1.0f, thickness * 2.0f));
} else if (i == 1) {
modelBaker.setModelBounds(new AxisAlignedBB(0.5f - thickness, 0.0f, 1.0f - thickness * 2.0f, 0.5f + thickness, 1.0f, 1.0f));
} else if (i == 2) {
modelBaker.setModelBounds(new AxisAlignedBB(minX, topBarMinY, minZ, maxX, topBarMaxY, maxZ));
secondary = true;
} else if (i == 3) {
if (!bottomBar) {
continue;
}
modelBaker.setModelBounds(new AxisAlignedBB(minX, bottomBarMinY, minZ, maxX, bottomBarMaxY, maxZ));
secondary = true;
} else if (i == 4) {
if (type.isEmbossed()) {
minX -= SCALE * 0.9f;
maxX += SCALE * 0.9f;
minZ -= SCALE;
maxZ += SCALE;
float minY = 0.0f;
float maxY = 1.0f;
if (type.getSize() != 1 && !type.isSolid()) {
minY = bottomBarMinY + 2.0f * SCALE;
maxY = topBarMaxY - 2.0f * SCALE;
} else if (type.getSize() == 1 && type.isSolid()) {
minY = bottomBarMinY + 2.0f * SCALE;
maxY = topBarMaxY - 2.0f * SCALE;
} else {
minY = 0.5f - 2.0f * SCALE;
maxY = 0.5f + 2.0f * SCALE;
}
if (type.isSolid() && type.getSize() == 0) {
minY -= SCALE;
maxY -= SCALE;
}
if (type.isSolid() && type.getSize() == 2) {
minY += SCALE;
maxY += SCALE;
}
modelBaker.setModelBounds(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ));
} else {
if (type.getSize() != 1 || type.isSolid()) {
continue;
}
modelBaker.setModelBounds(new AxisAlignedBB(minX, 0.5f - SCALE, minZ, maxX, 0.5f + SCALE, maxZ));
secondary = true;
}
}
modelBaker.addBlockModel(null, block.getSprite(meta, secondary), 0);
}
}
use of binnie.extratrees.blocks.decor.FenceType in project Binnie by ForestryMC.
the class PagePlanksOverview method onValueChanged.
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
IPoint size = getSize();
new ControlText(this, new Area(0, 0, size.xPos(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER);
new ControlText(this, new Area(12, 24, size.xPos() - 24, 24), I18N.localise(DatabaseConstants.EXTRATREES_KEY + ".planks.use"), TextJustification.MIDDLE_LEFT);
final IPlankType type = WoodManager.getPlankType(species);
int x = 12;
if (type != null) {
final ItemStack fence = WoodManager.getFence(type, new FenceType(0), 1);
final ItemStack gate = WoodManager.getGate(type);
final ItemStack door = WoodManager.getDoor(type);
if (!fence.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(fence);
x += 22;
}
if (!gate.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(gate);
x += 22;
}
if (!door.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(door);
x += 22;
}
}
final ControlText controlDescription = new ControlText(this, new Area(8, 84, this.getSize().xPos() - 16, 0), "", TextJustification.MIDDLE_CENTER);
final ControlText controlSignature = new ControlText(this, new Area(8, 84, this.getSize().xPos() - 16, 0), "", TextJustification.BOTTOM_RIGHT);
String desc = "";
if (type != null) {
desc = type.getDescription();
}
StringBuilder descBody = new StringBuilder("§o");
String descSig = "";
if (desc == null || desc.length() == 0) {
descBody.append(I18N.localise(DatabaseConstants.KEY + ".nodescription"));
} else {
final String[] descStrings = desc.split("\\|");
descBody.append(descStrings[0]);
for (int i = 1; i < descStrings.length - 1; ++i) {
descBody.append(' ').append(descStrings[i]);
}
if (descStrings.length > 1) {
descSig += descStrings[descStrings.length - 1];
}
}
controlDescription.setValue(descBody + "§r");
controlSignature.setValue(descSig + "§r");
final int descHeight = CraftGUI.RENDER.textHeight(controlDescription.getValue(), controlDescription.getSize().xPos());
controlSignature.setPosition(new Point(controlSignature.getPosition().xPos(), controlDescription.getPosition().yPos() + descHeight + 10));
}
use of binnie.extratrees.blocks.decor.FenceType in project Binnie by ForestryMC.
the class MultiFenceRecipeSolidWrapper method getIngredients.
@Override
public void getIngredients(IIngredients ingredients) {
List<ItemStack> fences = new ArrayList<>();
List<ItemStack> outputFences = new ArrayList<>();
if (plankType != null) {
if (plankTypeSecondary == null) {
for (IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()) {
if (plankType != plankTypeSecondary) {
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), false, fenceType.isEmbossed()), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), true, fenceType.isEmbossed()), 2));
}
}
} else {
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), false, fenceType.isEmbossed()), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), true, fenceType.isEmbossed()), 2));
}
} else {
for (IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()) {
for (IPlankType plankType : WoodManager.getAllPlankTypes()) {
if (plankType != plankTypeSecondary) {
fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), false, fenceType.isEmbossed()), 1));
outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.getSize(), true, fenceType.isEmbossed()), 2));
}
}
}
}
List<List<ItemStack>> itemInputs = new ArrayList<>();
itemInputs.add(fences);
itemInputs.add(fences);
itemInputs.add(fences);
List<List<ItemStack>> itemOutputs = new ArrayList<>();
itemOutputs.add(outputFences);
ingredients.setOutputLists(ItemStack.class, itemOutputs);
ingredients.setInputLists(ItemStack.class, itemInputs);
}
use of binnie.extratrees.blocks.decor.FenceType in project Binnie by ForestryMC.
the class ExtraTreesJeiPlugin method registerItemSubtypes.
@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
if (ModuleManager.isModuleEnabled(Constants.EXTRA_TREES_MOD_ID, ExtraTreesModuleUIDs.WOOD)) {
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModuleWood.blockMultiFence), (ItemStack itemStack) -> {
FenceDescription desc = WoodManager.getFenceDescription(itemStack);
if (desc != null) {
FenceType type = WoodManager.getFenceType(itemStack);
return type + ":" + desc.getPlankType().getDesignMaterialName().toLowerCase() + ':' + desc.getSecondaryPlankType().getDesignMaterialName().toLowerCase();
}
return Integer.toString(itemStack.getItemDamage());
});
}
if (ModuleManager.isModuleEnabled(Constants.EXTRA_TREES_MOD_ID, ExtraTreesModuleUIDs.ALCOHOL)) {
subtypeRegistry.registerSubtypeInterpreter(ModuleAlcohol.drink, (ItemStack itemStack) -> {
String glassware = ModuleAlcohol.drink.getGlassware(itemStack).getName();
FluidStack fluidStack = FluidUtil.getFluidContained(itemStack);
if (fluidStack == null) {
return glassware;
}
return glassware + ':' + fluidStack.getFluid().getName();
});
}
}
Aggregations