use of net.dries007.tfc.objects.blocks.agriculture.BlockFruitTreeLeaves in project firmalife by eerussianguy.
the class ClientRegisterEventsFL method registerColorHandlerItems.
@SuppressWarnings("deprecation")
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void registerColorHandlerItems(ColorHandlerEvent.Item event) {
ItemColors itemColors = event.getItemColors();
itemColors.registerItemColorHandler((stack, tintIndex) -> event.getBlockColors().colorMultiplier(((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata()), null, null, tintIndex), BlocksFL.getAllFruitLeaves().toArray(new BlockFruitTreeLeaves[0]));
itemColors.registerItemColorHandler((stack, tintIndex) -> event.getBlockColors().colorMultiplier(((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata()), null, null, tintIndex), BlocksFL.getAllBonsai().toArray(new BlockBonsai[0]));
itemColors.registerItemColorHandler((stack, tintIndex) -> event.getBlockColors().colorMultiplier(((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata()), null, null, tintIndex), BlocksFL.CINNAMON_LEAVES);
}
use of net.dries007.tfc.objects.blocks.agriculture.BlockFruitTreeLeaves in project firmalife by eerussianguy.
the class CommonEventHandlerFL method onBlockHarvestDrops.
@SubscribeEvent
public static void onBlockHarvestDrops(BlockEvent.HarvestDropsEvent event) {
final IBlockState state = event.getState();
final Block block = state.getBlock();
if (block instanceof BlockFruitTreeLeaves) {
event.getDrops().add(new ItemStack(ItemsFL.FRUIT_LEAF, 2 + Constants.RNG.nextInt(4)));
} else if (block instanceof BlockFruitTreeTrunk) {
if (event.isCanceled())
event.setCanceled(false);
IFruitTree tree = ((BlockFruitTreeTrunk) block).getTree();
ItemFruitPole pole = ItemFruitPole.get(tree);
if (pole != null)
event.getDrops().add(new ItemStack(pole));
}
}
use of net.dries007.tfc.objects.blocks.agriculture.BlockFruitTreeLeaves in project firmalife by eerussianguy.
the class BlocksFL method registerBlocks.
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
// this has to come first
FluidsFL.registerFluids();
IForgeRegistry<Block> r = event.getRegistry();
Builder<ItemBlock> IBs = ImmutableList.builder();
Builder<Block> normalIBs = ImmutableList.builder();
Builder<Block> foodIBs = ImmutableList.builder();
Builder<BlockFruitTreeLeaves> fruitLeaves = ImmutableList.builder();
Builder<BlockFruitTreeSapling> fruitSaps = ImmutableList.builder();
Builder<BlockFruitFence> fruitFences = ImmutableList.builder();
Builder<BlockFruitFenceGate> fruitFenceGates = ImmutableList.builder();
Builder<BlockFruitDoor> fruitDoors = ImmutableList.builder();
Builder<BlockFruitTrapDoor> fruitTrapdoors = ImmutableList.builder();
Builder<BlockCropDead> deadCrops = ImmutableList.builder();
Builder<BlockStemCrop> cropBlocks = ImmutableList.builder();
Builder<BlockJackOLantern> jackOLanterns = ImmutableList.builder();
Builder<Block> invIBs = ImmutableList.builder();
Builder<BlockBonsai> bonsais = ImmutableList.builder();
for (FruitTreeFL fruitTree : FruitTreeFL.values()) {
String name = fruitTree.getName().toLowerCase();
register(r, name + "_branch", new BlockFruitTreeBranch(fruitTree));
fruitLeaves.add(register(r, name + "_leaves", new BlockFruitTreeLeaves(fruitTree), CT_WOOD));
fruitSaps.add(register(r, name + "_sapling", new BlockFruitTreeSapling(fruitTree), CT_WOOD));
register(r, name + "_trunk", new BlockFruitTreeTrunk(fruitTree));
doFruitAdditions(r, name, fruitFences, fruitFenceGates, fruitDoors, fruitTrapdoors, bonsais, Optional.of(fruitTree));
}
doFruitAdditions(r, "cinnamon", fruitFences, fruitFenceGates, fruitDoors, fruitTrapdoors, bonsais, Optional.empty());
for (IFruitTree fruitTree : FruitTree.values()) {
String name = fruitTree.getName().toLowerCase();
doFruitAdditions(r, name, fruitFences, fruitFenceGates, fruitDoors, fruitTrapdoors, bonsais, Optional.of(fruitTree));
}
normalIBs.add(register(r, "oven", new BlockOven(), CT_DECORATIONS));
normalIBs.add(register(r, "oven_wall", new BlockOvenWall(), CT_DECORATIONS));
normalIBs.add(register(r, "oven_chimney", new BlockOvenChimney(), CT_DECORATIONS));
normalIBs.add(register(r, "leaf_mat", new BlockLeafMat(), CT_DECORATIONS));
normalIBs.add(register(r, "cinnamon_log", new BlockCinnamonLog(), CT_WOOD));
normalIBs.add(register(r, "cinnamon_leaves", new BlockCinnamonLeaves(), CT_WOOD));
register(r, "cinnamon_sapling", new BlockCinnamonSapling(), CT_WOOD);
normalIBs.add(register(r, "greenhouse_wall", new BlockGreenhouseWall(), CT_DECORATIONS));
normalIBs.add(register(r, "greenhouse_roof", new BlockGreenhouseRoof(), CT_DECORATIONS));
register(r, "greenhouse_door", new BlockGreenhouseDoor(), CT_DECORATIONS);
normalIBs.add(register(r, "climate_station", new BlockClimateStation(0), CT_DECORATIONS));
for (int i = 1; i < 6; i++) normalIBs.add(register(r, "climate_station_" + i, new BlockClimateStation(i), CT_DECORATIONS));
register(r, "quad_planter", new BlockQuadPlanter(), CT_DECORATIONS);
register(r, "large_planter", new BlockLargePlanter(), CT_DECORATIONS);
normalIBs.add(register(r, "pumpkin_hanging_planter", new BlockHangingPlanter(() -> Item.getItemFromBlock(BlocksFL.PUMPKIN_FRUIT), () -> ItemSeedsTFC.get(StemCrop.PUMPKIN), 13), CT_DECORATIONS));
normalIBs.add(register(r, "melon_hanging_planter", new BlockHangingPlanter(() -> Item.getItemFromBlock(BlocksFL.MELON_FRUIT), () -> ItemSeedsTFC.get(StemCrop.MELON), 13), CT_DECORATIONS));
normalIBs.add(register(r, "squash_hanging_planter", new BlockHangingPlanter(() -> ItemFoodTFC.get(Food.SQUASH), () -> ItemSeedsTFC.get(Crop.SQUASH), 13), CT_DECORATIONS));
register(r, "wool_string", new BlockString(() -> ItemsTFC.WOOL_YARN));
normalIBs.add(register(r, "trellis", new BlockTrellis(), CT_DECORATIONS));
normalIBs.add(register(r, "beehive", new BlockBeehive(), CT_DECORATIONS));
register(r, "honey_jar", new BlockJars(() -> ItemsFL.HONEY_JAR), CT_FOOD);
normalIBs.add(register(r, "bumper", new BlockBumper(), CT_DECORATIONS));
normalIBs.add(register(r, "candle", new BlockTorchTFC(), CT_DECORATIONS));
register(r, "bee_nest", new BlockBeeNest(), CT_DECORATIONS);
normalIBs.add(register(r, "spout", new BlockSpout(false), CT_DECORATIONS));
normalIBs.add(register(r, "sprinkler", new BlockSpout(true), CT_DECORATIONS));
normalIBs.add(register(r, "turntable", new BlockTurntable(), CT_DECORATIONS));
normalIBs.add(register(r, "cheddar_wheel", new BlockCheesewheel(() -> ItemsFL.CHEDDAR), CT_FOOD));
normalIBs.add(register(r, "chevre_wheel", new BlockCheesewheel(() -> ItemsFL.CHEVRE), CT_FOOD));
normalIBs.add(register(r, "rajya_metok_wheel", new BlockCheesewheel(() -> ItemsFL.RAJYA_METOK), CT_FOOD));
normalIBs.add(register(r, "gouda_wheel", new BlockCheesewheel(() -> ItemsFL.GOUDA), CT_FOOD));
normalIBs.add(register(r, "feta_wheel", new BlockCheesewheel(() -> ItemsFL.FETA), CT_FOOD));
normalIBs.add(register(r, "shosha_wheel", new BlockCheesewheel(() -> ItemsFL.SHOSHA), CT_FOOD));
for (BerryBush bush : BerryBush.values()) {
normalIBs.add(register(r, bush.name().toLowerCase() + "_trellis", new BlockBushTrellis(bush), CT_DECORATIONS));
}
for (BushFL bush : BushFL.values()) {
normalIBs.add(register(r, bush.name().toLowerCase() + "_bush", new BlockBerryBush(bush), CT_FLORA));
normalIBs.add(register(r, bush.name().toLowerCase() + "_trellis", new BlockBushTrellis(bush), CT_DECORATIONS));
}
for (BlockJackOLantern.Carving carving : BlockJackOLantern.Carving.values()) {
jackOLanterns.add(register(r, "lit_pumpkin_" + carving.getName(), new BlockJackOLantern(carving), CT_DECORATIONS));
}
foodIBs.add(register(r, "pumpkin_fruit", new BlockStemFruit(), CT_FLORA));
foodIBs.add(register(r, "melon_fruit", new BlockStemFruit(), CT_FLORA));
for (StemCrop crop : StemCrop.values()) {
deadCrops.add(register(r, "dead_crop/" + crop.name().toLowerCase(), new BlockCropDead(crop)));
cropBlocks.add(register(r, "crop/" + crop.name().toLowerCase(), BlockStemCrop.create(crop)));
}
Builder<BlockFluidBase> fluids = ImmutableList.builder();
for (FluidWrapper wrapper : FluidsFL.getAllFiniteFluids()) {
fluids.add(register(r, wrapper.get().getName(), new BlockFluidTFC(wrapper.get(), Material.WATER)));
}
allFluidBlocks = fluids.build();
allNormalIBs = normalIBs.build();
allNormalIBs.forEach((x) -> {
IBs.add(new ItemBlockTFC(x));
});
allInventoryIBs = invIBs.build();
allFoodIBs = foodIBs.build();
allFoodIBs.forEach((x) -> {
IBs.add(new ItemBlockRot(x));
});
allJackOLanterns = jackOLanterns.build();
allJackOLanterns.forEach((x) -> {
IBs.add(new ItemBlockTFC(x));
});
allFruitLeaves = fruitLeaves.build();
allFruitLeaves.forEach((x) -> {
IBs.add(new ItemBlockTFC(x));
});
allBonsai = bonsais.build();
allBonsai.forEach((x) -> {
IBs.add(new ItemBlockTFC(x));
});
allFruitSaps = fruitSaps.build();
allFruitSaps.forEach((x) -> {
ItemBlock ib = new ItemBlockTFC(x);
IBs.add(ib);
});
allFruitFences = fruitFences.build();
allFruitFences.forEach((x) -> {
IBs.add(new ItemBlockTFC(x));
});
allFruitFenceGates = fruitFenceGates.build();
allFruitFenceGates.forEach((x) -> {
IBs.add(new ItemBlockTFC(x));
});
allFruitDoors = fruitDoors.build();
allFruitTrapDoors = fruitTrapdoors.build();
allFruitTrapDoors.forEach((x) -> {
IBs.add(new ItemBlockTFC(x));
});
allIBs = IBs.build();
allDeadCrops = deadCrops.build();
allCropBlocks = cropBlocks.build();
register(TEOven.class, "oven");
register(TEPlanter.class, "quad_planter");
register(TELeafMat.class, "leaf_mat");
register(TEHangingPlanter.class, "hanging_planter");
register(TEString.class, "string");
register(TEStemCrop.class, "stem_crop");
register(TEClimateStation.class, "climate_station");
register(TETurntable.class, "turntable");
// needs fix
FluidsTFC.getWrapper(FluidsFL.COCONUT_MILK.get());
FluidsTFC.getWrapper(FluidsFL.YAK_MILK.get());
FluidsTFC.getWrapper(FluidsFL.GOAT_MILK.get());
FluidsTFC.getWrapper(FluidsFL.ZEBU_MILK.get());
}
use of net.dries007.tfc.objects.blocks.agriculture.BlockFruitTreeLeaves in project firmalife by eerussianguy.
the class ClientRegisterEventsFL method registerModels.
@SubscribeEvent
public static void registerModels(ModelRegistryEvent event) {
// Setting the model resource location for items
for (Item i : ItemsFL.getAllEasyItems()) ModelLoader.setCustomModelResourceLocation(i, 0, new ModelResourceLocation(i.getRegistryName().toString()));
for (ItemFruitDoor i : ItemsFL.getAllFruitDoors()) ModelLoader.setCustomModelResourceLocation(i, 0, new ModelResourceLocation(i.getRegistryName().toString()));
for (ItemBlock ib : BlocksFL.getAllIBs()) ModelLoader.setCustomModelResourceLocation(ib, 0, new ModelResourceLocation(ib.getRegistryName().toString(), "normal"));
for (BlockFruitTreeLeaves leaves : BlocksFL.getAllFruitLeaves()) ModelLoader.setCustomStateMapper(leaves, new StateMap.Builder().ignore(BlockFruitTreeLeaves.DECAYABLE).ignore(BlockFruitTreeLeaves.HARVESTABLE).build());
ModelLoader.setCustomStateMapper(BlocksFL.SPOUT, new StateMap.Builder().ignore(StatePropertiesFL.WATERED).ignore(StatePropertiesFL.NEEDS_SOURCE).build());
ModelLoader.setCustomStateMapper(BlocksFL.SPRINKLER, new StateMap.Builder().ignore(StatePropertiesFL.WATERED).ignore(StatePropertiesFL.NEEDS_SOURCE).build());
ModelLoader.setCustomStateMapper(BlocksFL.TURNTABLE, new StateMap.Builder().ignore(StatePropertiesFL.CLAY).build());
ModelLoader.setCustomModelResourceLocation(ItemsFL.CHEESECLOTH, 0, new ModelResourceLocation(ItemsFL.CHEESECLOTH.getRegistryName(), "inventory"));
ModelLoader.setCustomModelResourceLocation(ItemsFL.CRACKED_COCONUT, 0, new ModelResourceLocation(ItemsFL.CRACKED_COCONUT.getRegistryName(), "inventory"));
ModelLoader.setCustomModelResourceLocation(ItemsFL.ITEM_CINNAMON_SAPLING, 0, new ModelResourceLocation(ItemsFL.ITEM_CINNAMON_SAPLING.getRegistryName().toString()));
ModelLoader.setCustomModelResourceLocation(ItemsFL.ITEM_QUAD_PLANTER, 0, new ModelResourceLocation(ItemsFL.ITEM_QUAD_PLANTER.getRegistryName().toString(), "inventory"));
ModelLoader.setCustomModelResourceLocation(ItemsFL.ITEM_LARGE_PLANTER, 0, new ModelResourceLocation(ItemsFL.ITEM_LARGE_PLANTER.getRegistryName().toString(), "inventory"));
// Mallet mold
ItemMetalMalletMold item = ItemsFL.malletMold;
ModelBakery.registerItemVariants(item, new ModelResourceLocation(item.getRegistryName().toString()));
ModelBakery.registerItemVariants(item, TFCRegistries.METALS.getValuesCollection().stream().filter(Metal.ItemType.PROPICK_HEAD::hasMold).map(x -> new ModelResourceLocation(FirmaLife.MOD_ID + ":" + x.getRegistryName().getPath() + "_" + item.getRegistryName().getPath())).toArray(ModelResourceLocation[]::new));
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
private final ModelResourceLocation FALLBACK = new ModelResourceLocation(item.getRegistryName().toString());
@Override
@Nonnull
public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack) {
IFluidHandler cap = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);
if (cap instanceof IMoldHandler) {
Metal metal = ((IMoldHandler) cap).getMetal();
if (metal != null) {
return new ModelResourceLocation(FirmaLife.MOD_ID + ":" + metal.getRegistryName().getPath() + "_" + stack.getItem().getRegistryName().getPath());
}
}
return FALLBACK;
}
});
// use vanilla stem rendering for StemCrops
for (BlockStemCrop block : BlocksFL.getAllCropBlocks()) ModelLoader.setCustomStateMapper(block, new VanillaStemStateMapper());
for (BlockFruitDoor door : BlocksFL.getAllFruitDoors()) ModelLoader.setCustomStateMapper(door, new StateMap.Builder().ignore(BlockDoor.POWERED).build());
for (BlockFruitFenceGate gate : BlocksFL.getAllFruitFenceGates()) ModelLoader.setCustomStateMapper(gate, new StateMap.Builder().ignore(BlockFenceGate.POWERED).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_LOG, new StateMap.Builder().ignore(StatePropertiesFL.CAN_GROW).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_LEAVES, new StateMap.Builder().ignore(BlockLeaves.DECAYABLE).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_SAPLING, new StateMap.Builder().ignore(BlockSaplingTFC.STAGE).build());
for (Block block : BlocksFL.getAllFluidBlocks()) ModelLoader.setCustomStateMapper(block, new StateMap.Builder().ignore(BlockFluidBase.LEVEL).build());
ModelLoader.setCustomStateMapper(BlocksFL.GREENHOUSE_DOOR, new StateMap.Builder().ignore(BlockDoor.POWERED).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_LOG, new StateMap.Builder().ignore(StatePropertiesFL.CAN_GROW).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_LEAVES, new StateMap.Builder().ignore(BlockLeaves.DECAYABLE).build());
ModelLoader.setCustomStateMapper(BlocksFL.CINNAMON_SAPLING, new StateMap.Builder().ignore(BlockSaplingTFC.STAGE).build());
ModelLoader.setCustomStateMapper(BlocksFL.QUAD_PLANTER, new QuadPlanterStateMapper());
ModelLoader.setCustomStateMapper(BlocksFL.LARGE_PLANTER, new LargePlanterStateMapper());
ClientRegistry.bindTileEntitySpecialRenderer(TEOven.class, new TESROven());
ClientRegistry.bindTileEntitySpecialRenderer(TEString.class, new TESRString());
ClientRegistry.bindTileEntitySpecialRenderer(TELeafMat.class, new TESRLeafMat());
ClientRegistry.bindTileEntitySpecialRenderer(TETurntable.class, new TESRTurntable());
}
Aggregations