use of nomble.beebuddy.item.NectarItem in project beebuddy by queenofthebees.
the class BeeEntityMixin method tame.
@Override
protected void tame(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cbir) {
ItemStack stack = player.getStackInHand(hand);
boolean friend = beebuddy$getFriend().map(player.getUuid()::equals).orElse(false);
if (!this.world.isClient) {
if (stack.getItem() == Items.HONEY_BOTTLE) {
if (friend && this.getHealth() < this.getMaxHealth()) {
if (!player.abilities.creativeMode) {
stack.decrement(1);
}
this.heal(this.getMaxHealth());
cbir.setReturnValue(ActionResult.SUCCESS);
} else if (!friend && !beebuddy$hasFriend()) {
if (!player.abilities.creativeMode) {
stack.decrement(1);
ItemStack g = new ItemStack(Items.GLASS_BOTTLE);
if (stack.isEmpty()) {
player.setStackInHand(hand, g);
} else if (!player.inventory.insertStack(g)) {
player.dropItem(g, false);
}
}
if (this.random.nextInt(4) == 0) {
beebuddy$setFriend(Optional.of(player.getUuid()));
if (player instanceof ServerPlayerEntity) {
ServerPlayerEntity p = (ServerPlayerEntity) player;
Criteria.TAME_ANIMAL.trigger(p, (BeeEntity) (Object) this);
}
beebuddy$friendify();
this.world.sendEntityStatus(this, (byte) 7);
} else {
this.world.sendEntityStatus(this, (byte) 6);
}
cbir.setReturnValue(ActionResult.SUCCESS);
}
} else if (stack.getItem() instanceof NectarItem) {
NectarItem n = (NectarItem) stack.getItem();
if (friend || !beebuddy$hasFriend()) {
if (!player.abilities.creativeMode) {
stack.decrement(1);
}
beebuddy$setNectarType(n.getType());
cbir.setReturnValue(ActionResult.SUCCESS);
}
} else {
beebuddy$setSitting(!beebuddy$isSitting());
cbir.setReturnValue(ActionResult.SUCCESS);
}
} else if (friend || stack.getItem() == Items.HONEY_BOTTLE) {
cbir.setReturnValue(ActionResult.CONSUME);
} else if (stack.getItem() instanceof NectarItem) {
cbir.setReturnValue(ActionResult.CONSUME);
}
}
use of nomble.beebuddy.item.NectarItem in project beebuddy by queenofthebees.
the class BeeBuddy method onInitialize.
@Override
public void onInitialize() {
for (String s : new String[] { "ace", "agender", "aro", "bi", "demiboy", "demigirl", "gay", "genderfluid", "genderqueer", "honeyed", "lesbian", "mlm", "nonbinary", "omni", "pan", "poly", "trans", "xenogender" }) {
Item it = new NectarItem(s, new Item.Settings().group(ItemGroup.MISC));
Identifier id = new Identifier("beebuddy", s + "_nectar");
// eh, we aren't really using item references to need to save em
Registry.register(Registry.ITEM, id, it);
}
LOGGER.info("bzzzz!");
}
Aggregations