use of com.infinityraider.agricraft.utility.CustomWoodType in project AgriCraft by AgriCraft.
the class CustomWoodShapedRecipe method matches.
@Override
public boolean matches(InventoryCrafting ic, World world) {
final Optional<CustomWoodType> material = inferMaterial(ic);
if (!material.isPresent()) {
return false;
}
for (int r = 0; r < 3; r++) {
for (int c = 0; c < 3; c++) {
final FuzzyStack expected = layout.get(r, c);
final ItemStack input = ic.getStackInRowAndColumn(r, c);
final Optional<CustomWoodType> inputMaterial = CustomWoodTypeRegistry.getFromStack(input);
if (inputMaterial.isPresent() && !material.equals(inputMaterial)) {
return false;
} else if (!Objects.equals(input, expected)) {
return false;
}
}
}
return true;
}
use of com.infinityraider.agricraft.utility.CustomWoodType in project AgriCraft by AgriCraft.
the class RenderSprinkler method renderWorldBlockStatic.
@Override
public void renderWorldBlockStatic(ITessellator tessellator, IBlockState state, BlockSprinkler block, EnumFacing side) {
tessellator.translate(0, 4 * Constants.UNIT, 0);
CustomWoodType type;
if (state instanceof IExtendedBlockState) {
type = ((IExtendedBlockState) state).getValue(AgriProperties.CUSTOM_WOOD_TYPE);
} else {
type = CustomWoodTypeRegistry.DEFAULT;
}
tessellator.drawScaledPrism(4, 8, 4, 12, 16, 12, type.getIcon());
}
use of com.infinityraider.agricraft.utility.CustomWoodType in project AgriCraft by AgriCraft.
the class CustomWoodShapedRecipe method getCraftingResult.
@Override
public ItemStack getCraftingResult(InventoryCrafting ic) {
final ItemStack result = super.getCraftingResult(ic);
final Optional<CustomWoodType> material = inferMaterial(ic);
if (material.isPresent()) {
final NBTTagCompound tag = StackHelper.getTag(result);
material.get().writeToNBT(tag);
result.setTagCompound(tag);
}
return result;
}
use of com.infinityraider.agricraft.utility.CustomWoodType in project AgriCraft by AgriCraft.
the class RenderBlockCustomWood method renderWorldBlockStatic.
@Override
public void renderWorldBlockStatic(ITessellator tessellator, IBlockState state, B block, EnumFacing side) {
if (state instanceof IExtendedBlockState) {
CustomWoodType type = ((IExtendedBlockState) state).getValue(AgriProperties.CUSTOM_WOOD_TYPE);
this.renderWorldBlockWoodStatic(tessellator, (IExtendedBlockState) state, block, side, type.getIcon());
}
}
use of com.infinityraider.agricraft.utility.CustomWoodType in project AgriCraft by AgriCraft.
the class ItemBlockCustomWood method getSubItems.
/**
* Populates the sub-item list. This method allows getting sub blocks server side as well (no
*
* @side, like {@link #getSubItems(CreativeTabs, NonNullList)}). This method is marked for
* cleaning.
*
* @param list the list to populate.
*/
public void getSubItems(List<ItemStack> list) {
for (CustomWoodType type : CustomWoodTypeRegistry.getAllTypes()) {
ItemStack variant = new ItemStack(this.block, 1, 0);
variant.setTagCompound(type.writeToNBT(new NBTTagCompound()));
list.add(variant);
}
}
Aggregations