use of binnie.extratrees.blocks.decor.FenceType in project Binnie by ForestryMC.
the class MultiFenceRecipeRegistryPlugin method getRecipes.
private List<IRecipeWrapper> getRecipes(IFocus<ItemStack> focus) {
ItemStack ingredient = focus.getValue();
List<IRecipeWrapper> recipes = new ArrayList<>();
if (focus.getMode() == Mode.INPUT) {
IPlankType plankType = WoodManager.getPlankType(ingredient);
if (plankType != null) {
for (MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES) {
recipes.add(new MultiFenceRecipeSizeWrapper(pattern, plankType));
}
for (int size = 0; size < 3; size++) {
for (final boolean solid : new boolean[] { false, true }) {
recipes.add(new MultiFenceRecipeEmbeddedWrapper(plankType, new FenceType(size, solid, false)));
}
}
} else {
FenceDescription desc = WoodManager.getFenceDescription(ingredient);
if (desc != null) {
if (!desc.getFenceType().isEmbossed()) {
recipes.add(new MultiFenceRecipeEmbeddedWrapper(desc));
}
if (!desc.getFenceType().isSolid()) {
recipes.add(new MultiFenceRecipeSolidWrapper(desc));
}
}
}
} else {
FenceDescription desc = WoodManager.getFenceDescription(ingredient);
if (desc != null) {
int size = desc.getFenceType().getSize();
recipes.add(new MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern.VALUES[size * 2], desc.getPlankType(), desc.getSecondaryPlankType()));
recipes.add(new MultiFenceRecipeSizeWrapper(MultiFenceRecipePattern.VALUES[size * 2 + 1], desc.getPlankType(), desc.getSecondaryPlankType()));
if (desc.getFenceType().isEmbossed()) {
recipes.add(new MultiFenceRecipeEmbeddedWrapper(desc));
}
if (desc.getFenceType().isSolid()) {
recipes.add(new MultiFenceRecipeSolidWrapper(desc));
}
}
}
return recipes;
}
use of binnie.extratrees.blocks.decor.FenceType in project Binnie by ForestryMC.
the class MultiFenceRecipeRegistryPlugin method getRecipeWrappers.
@Override
public <T extends IRecipeWrapper> List<T> getRecipeWrappers(IRecipeCategory<T> recipeCategory) {
if (!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING)) {
return Collections.emptyList();
}
if (recipes.isEmpty()) {
for (MultiFenceRecipePattern pattern : MultiFenceRecipePattern.VALUES) {
recipes.add(new MultiFenceRecipeSizeWrapper(pattern));
}
for (FenceType fenceType : FenceType.getValues()) {
recipes.add(new MultiFenceRecipeEmbeddedWrapper(fenceType));
recipes.add(new MultiFenceRecipeSolidWrapper(fenceType));
}
}
return (List<T>) recipes;
}
use of binnie.extratrees.blocks.decor.FenceType in project Binnie by ForestryMC.
the class ModelMultiFence method bakeBlockModel.
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;
int meta = key.meta;
FenceType fenceType = key.type;
TextureAtlasSprite primarySprite = block.getSprite(meta, false);
TextureAtlasSprite secondarySprite = block.getSprite(meta, true);
modelBaker.setModelBounds(new AxisAlignedBB(minPostPos, 0.0, minPostPos, maxPostPos, POST_HEIGHT, maxPostPos));
modelBaker.addBlockModel(null, primarySprite, 0);
boolean connectNegX = key.west;
boolean connectPosX = key.east;
boolean connectNegZ = key.north;
boolean connectPosZ = key.south;
boolean connectAnyX = connectNegX || connectPosX;
boolean connectAnyZ = connectNegZ || connectPosZ;
if (!connectAnyX && !connectAnyZ) {
connectAnyX = true;
}
minPostPos = 7.0f * SCALE;
maxPostPos = 9.0f * SCALE;
float barMinY = 12.0f * SCALE;
float barMaxY = 15.0f * SCALE;
float minX = connectNegX ? 0.0f : minPostPos;
float maxX = connectPosX ? 1.0f : maxPostPos;
float minZ = connectNegZ ? 0.0f : minPostPos;
float maxZ = connectPosZ ? 1.0f : maxPostPos;
boolean renderBottom = true;
if (fenceType.getSize() == 2) {
barMaxY -= 5.0f * SCALE;
barMinY -= 5.0f * SCALE;
}
if (fenceType.isSolid()) {
renderBottom = false;
if (fenceType.getSize() == 0) {
barMinY = 6.0f * SCALE;
} else {
barMinY = SCALE;
}
}
float totalMaxY = barMaxY;
if (connectAnyX) {
modelBaker.setModelBounds(new AxisAlignedBB(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos));
modelBaker.addBlockModel(null, secondarySprite, 0);
}
if (connectAnyZ) {
modelBaker.setModelBounds(new AxisAlignedBB(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ));
modelBaker.addBlockModel(null, secondarySprite, 0);
}
if (renderBottom) {
barMinY -= 6.0f * SCALE;
barMaxY -= 6.0f * SCALE;
if (fenceType.getSize() == 1) {
barMinY += SCALE;
}
if (connectAnyX) {
modelBaker.setModelBounds(new AxisAlignedBB(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos));
modelBaker.addBlockModel(null, secondarySprite, 0);
}
if (connectAnyZ) {
modelBaker.setModelBounds(new AxisAlignedBB(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ));
modelBaker.addBlockModel(null, secondarySprite, 0);
}
if (fenceType.getSize() == 1) {
barMinY -= 6.0f * SCALE;
barMaxY -= 6.0f * SCALE;
barMaxY += SCALE;
if (connectAnyX) {
modelBaker.setModelBounds(new AxisAlignedBB(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos));
modelBaker.addBlockModel(null, secondarySprite, 0);
}
if (connectAnyZ) {
modelBaker.setModelBounds(new AxisAlignedBB(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ));
modelBaker.addBlockModel(null, secondarySprite, 0);
}
}
}
float totalMinY = barMinY;
if (fenceType.isEmbossed()) {
minPostPos -= (float) (SCALE - 0.25 * SCALE);
maxPostPos += (float) (SCALE - 0.25 * SCALE);
float minY = totalMinY + 2.0f * SCALE;
float maxY = totalMaxY - 2.0f * SCALE;
if (fenceType.getSize() == 1 && !fenceType.isSolid()) {
minY = 6.0f * SCALE;
maxY = 10.0f * SCALE;
} else if (fenceType.getSize() == 0 && fenceType.isSolid()) {
minY -= 4.0f * SCALE;
maxY -= 4.0f * SCALE;
} else if (fenceType.getSize() == 2 && fenceType.isSolid()) {
minY += 4.0f * SCALE;
maxY += 4.0f * SCALE;
}
if (connectAnyX) {
modelBaker.setModelBounds(new AxisAlignedBB(minX, minY, minPostPos, maxX, maxY, maxPostPos));
modelBaker.addBlockModel(null, primarySprite, 0);
}
if (connectAnyZ) {
modelBaker.setModelBounds(new AxisAlignedBB(minPostPos, minY, minZ, maxPostPos, maxY, maxZ));
modelBaker.addBlockModel(null, primarySprite, 0);
}
}
modelBaker.setParticleSprite(primarySprite);
}
Aggregations