use of com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData in project ResourcefulBees by Resourceful-Bees.
the class KittenBee method getHoneyBottleData.
public static HoneyBottleData getHoneyBottleData() {
if (honeyBottleData == null) {
List<HoneyEffect> effects = new LinkedList<>();
effects.add(new HoneyEffect(MobEffects.MOVEMENT_SPEED, 2400, 2, 1));
effects.add(new HoneyEffect(MobEffects.JUMP, 2400, 1, 1));
effects.add(new HoneyEffect(MobEffects.NIGHT_VISION, 2400, 0, 1));
honeyBottleData = new HoneyBottleData(8, 0.9f, Color.parse("#BD5331"), false, false, false, effects).setName("catnip");
honeyBottleData.setHoneyBlockRegistryObject(ModBlocks.CATNIP_HONEY_BLOCK);
honeyBottleData.setHoneyStillFluidRegistryObject(ModFluids.CATNIP_HONEY_STILL);
honeyBottleData.setHoneyFlowingFluidRegistryObject(ModFluids.CATNIP_HONEY_FLOWING);
honeyBottleData.setHoneyBlockItemRegistryObject(ModItems.CATNIP_HONEY_BLOCK_ITEM);
honeyBottleData.setHoneyBucketItemRegistryObject(ModItems.CATNIP_HONEY_FLUID_BUCKET);
honeyBottleData.setHoneyBottleRegistryObject(ModItems.CATNIP_HONEY_BOTTLE);
}
return honeyBottleData;
}
use of com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData in project ResourcefulBees by Resourceful-Bees.
the class RegistryHandler method registerHoneyBottle.
// TODO does this need to use the codec? - epic
private static void registerHoneyBottle(String name, JsonObject honeyData) {
HoneyBottleData honeyBottleData = HoneyBottleData.CODEC.parse(JsonOps.INSTANCE, honeyData).getOrThrow(false, s -> ResourcefulBees.LOGGER.error("Could not create Custom Honey Data for {} honey", name));
final RegistryObject<Item> customHoneyBottle = ModItems.ITEMS.register(name + "_honey_bottle", () -> new CustomHoneyBottleItem(honeyBottleData.getProperties(), honeyBottleData));
honeyBottleData.setHoneyBottleRegistryObject(customHoneyBottle);
honeyBottleData.setName(name);
if (Config.HONEY_GENERATE_BLOCKS.get() && honeyBottleData.doGenerateHoneyBlock()) {
final RegistryObject<Block> customHoneyBlock = ModBlocks.BLOCKS.register(name + "_honey_block", () -> new CustomHoneyBlock(honeyBottleData));
final RegistryObject<Item> customHoneyBlockItem = ModItems.ITEMS.register(name + "_honey_block", () -> new BlockItem(customHoneyBlock.get(), new Item.Properties().tab(ItemGroupResourcefulBees.RESOURCEFUL_BEES)));
honeyBottleData.setHoneyBlockRegistryObject(customHoneyBlock);
honeyBottleData.setHoneyBlockItemRegistryObject(customHoneyBlockItem);
}
if (Config.HONEY_GENERATE_FLUIDS.get() && honeyBottleData.doGenerateHoneyFluid()) {
stillFluids.put(name, ModFluids.FLUIDS.register(name + "_honey", () -> new CustomHoneyFluid.Source(makeProperties(name, honeyBottleData), honeyBottleData)));
flowingFluids.put(name, ModFluids.FLUIDS.register(name + "_honey_flowing", () -> new CustomHoneyFluid.Flowing(makeProperties(name, honeyBottleData), honeyBottleData)));
honeyBuckets.put(name, ModItems.ITEMS.register(name + "_honey_fluid_bucket", () -> new CustomHoneyBucketItem(stillFluids.get(name), new Item.Properties().tab(ItemGroupResourcefulBees.RESOURCEFUL_BEES).craftRemainder(Items.BUCKET).stacksTo(1), honeyBottleData)));
fluidBlocks.put(name, ModBlocks.BLOCKS.register(name + "_honey", () -> new CustomHoneyFluidBlock(stillFluids.get(name), BlockBehaviour.Properties.of(Material.WATER).noCollission().strength(100.0F).noDrops(), honeyBottleData)));
honeyBottleData.setHoneyStillFluidRegistryObject(stillFluids.get(name));
honeyBottleData.setHoneyFlowingFluidRegistryObject(flowingFluids.get(name));
honeyBottleData.setHoneyBucketItemRegistryObject(honeyBuckets.get(name));
honeyBottleData.setHoneyFluidBlockRegistryObject(fluidBlocks.get(name));
}
HoneyRegistry.getRegistry().registerHoney(name, honeyBottleData);
}
use of com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData in project ResourcefulBees by Resourceful-Bees.
the class AbstractHoneyTankContainer method processFluid.
public void processFluid() {
if (canProcessFluid()) {
ItemStack stack = getTileStackHandler().getStackInSlot(BOTTLE_INPUT_EMPTY);
ItemStack output = getTileStackHandler().getStackInSlot(BOTTLE_OUTPUT_EMPTY);
BlockItem blockItem = null;
if (stack.getItem() instanceof BlockItem) {
blockItem = (BlockItem) stack.getItem();
}
if (blockItem != null && blockItem.getBlock() instanceof CustomHoneyBlock) {
stack.shrink(1);
HoneyBottleData data = ((CustomHoneyBlock) blockItem.getBlock()).getData();
getFluidTank().fill(new FluidStack(data.getHoneyStillFluidRegistryObject().get(), 1000), IFluidHandler.FluidAction.EXECUTE);
} else if (stack.getItem() instanceof BucketItem) {
BucketItem bucket = (BucketItem) stack.getItem();
getFluidTank().fill(new FluidStack(bucket.getFluid(), 1000), IFluidHandler.FluidAction.EXECUTE);
stack.shrink(1);
if (output.isEmpty()) {
getTileStackHandler().setStackInSlot(BOTTLE_OUTPUT_EMPTY, new ItemStack(Items.BUCKET));
} else {
output.grow(1);
}
} else {
FluidStack fluidStack = new FluidStack(BeeInfoUtils.getHoneyFluidFromBottle(stack), HONEY_FILL_AMOUNT);
if (!fluidStack.isEmpty())
getFluidTank().fill(fluidStack, IFluidHandler.FluidAction.EXECUTE);
stack.shrink(1);
if (output.isEmpty()) {
getTileStackHandler().setStackInSlot(BOTTLE_OUTPUT_EMPTY, new ItemStack(Items.GLASS_BOTTLE));
} else {
output.grow(1);
}
}
this.dirty = true;
}
}
use of com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData in project ResourcefulBees by Resourceful-Bees.
the class AbstractHoneyTankContainer method canProcessFluid.
public boolean canProcessFluid() {
boolean spaceLeft;
ItemStack stack = getTileStackHandler().getStackInSlot(BOTTLE_INPUT_EMPTY);
if (!canStartFluidProcess())
return false;
Fluid fluid;
BlockItem blockItem = null;
if (stack.getItem() instanceof BlockItem) {
blockItem = (BlockItem) stack.getItem();
}
if (blockItem != null && blockItem.getBlock() instanceof CustomHoneyBlock) {
HoneyBottleData item = ((CustomHoneyBlock) blockItem.getBlock()).getData();
spaceLeft = (getFluidTank().getFluidAmount() + 1000) <= getFluidTank().getCapacity();
fluid = item.getHoneyStillFluidRegistryObject().get();
} else if (stack.getItem() instanceof BucketItem) {
BucketItem item = (BucketItem) stack.getItem();
spaceLeft = (getFluidTank().getFluidAmount() + 1000) <= getFluidTank().getCapacity();
fluid = item.getFluid();
} else {
spaceLeft = (getFluidTank().getFluidAmount() + HONEY_FILL_AMOUNT) <= getFluidTank().getCapacity();
fluid = BeeInfoUtils.getHoneyFluidFromBottle(stack);
}
return spaceLeft && (getFluidTank().getFluid().getFluid() == fluid || getFluidTank().isEmpty());
}
Aggregations