Search in sources :

Example 1 with CustomBeeEntity

use of com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity in project ResourcefulBees by Resourceful-Bees.

the class RenderUtils method renderEntity.

public static void renderEntity(PoseStack matrixStack, Entity entity, ClientLevel world, float x, float y, float rotation, float renderScale) {
    if (world == null)
        return;
    float scaledSize;
    Minecraft mc = Minecraft.getInstance();
    if (mc.player != null)
        entity.tickCount = mc.player.tickCount;
    if (entity instanceof CustomBeeEntity) {
        scaledSize = 20 / ((CustomBeeEntity) entity).getRenderData().getSizeModifier();
    } else {
        scaledSize = 20 / (Math.max(entity.getBbWidth(), entity.getBbHeight()));
    }
    if (mc.player != null) {
        matrixStack.pushPose();
        matrixStack.translate(10, 20 * renderScale, 0.5);
        matrixStack.translate(x, y, 1);
        matrixStack.mulPose(Vector3f.ZP.rotationDegrees(180.0F));
        matrixStack.translate(0, 0, 1);
        matrixStack.scale(-(scaledSize * renderScale), (scaledSize * renderScale), 30);
        matrixStack.mulPose(Vector3f.YP.rotationDegrees(rotation));
        EntityRenderDispatcher entityrenderermanager = mc.getEntityRenderDispatcher();
        MultiBufferSource.BufferSource renderTypeBuffer = mc.renderBuffers().bufferSource();
        entityrenderermanager.render(entity, 0, 0, 0.0D, mc.getFrameTime(), 1, matrixStack, renderTypeBuffer, 15728880);
        renderTypeBuffer.endBatch();
    }
    matrixStack.popPose();
}
Also used : CustomBeeEntity(com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity) MultiBufferSource(net.minecraft.client.renderer.MultiBufferSource) Minecraft(net.minecraft.client.Minecraft) EntityRenderDispatcher(net.minecraft.client.renderer.entity.EntityRenderDispatcher)

Example 2 with CustomBeeEntity

use of com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity in project ResourcefulBees by Resourceful-Bees.

the class EntityMutationPage method mouseClick.

@Override
public boolean mouseClick(int xPos, int yPos, int mouseX, int mouseY) {
    if (super.mouseClick(xPos, yPos, mouseX, mouseY))
        return true;
    if (input instanceof CustomBeeEntity) {
        CustomBeeEntity beeEntity = (CustomBeeEntity) input;
        if (BeepediaScreen.mouseHovering((float) xPos + 22, (float) yPos + 27, 30, 30, mouseX, mouseY)) {
            if (BeepediaScreen.currScreenState.getPageID().equals((beeEntity.getBeeType())))
                return false;
            BeepediaScreen.saveScreenState();
            beepedia.setActive(BeepediaScreen.PageType.BEE, beeEntity.getBeeType());
            return true;
        }
    }
    Entity output = outputs.get(outputCounter).getRight().getGuiEntity(beepedia.getMinecraft().level);
    if (output instanceof CustomBeeEntity) {
        CustomBeeEntity beeEntity = (CustomBeeEntity) output;
        if (BeepediaScreen.mouseHovering((float) xPos + 112, (float) yPos + 27, 30, 30, mouseX, mouseY)) {
            if (BeepediaScreen.currScreenState.getPageID().equals(beeEntity.getBeeType()))
                return false;
            BeepediaScreen.saveScreenState();
            beepedia.setActive(BeepediaScreen.PageType.BEE, beeEntity.getBeeType());
            return true;
        }
    }
    return false;
}
Also used : CustomBeeEntity(com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity) Entity(net.minecraft.world.entity.Entity) CustomBeeEntity(com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity)

Example 3 with CustomBeeEntity

use of com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity in project ResourcefulBees by Resourceful-Bees.

the class MutationsPage method mouseClick.

public boolean mouseClick(int xPos, int yPos, int mouseX, int mouseY) {
    if (entityParent instanceof CustomBeeEntity) {
        CustomBeeEntity beeEntity = (CustomBeeEntity) entityParent;
        if (BeepediaScreen.mouseHovering((float) xPos + ((float) SUB_PAGE_WIDTH / 2) - 20, (float) yPos + 6, 30, 30, mouseX, mouseY)) {
            if (BeepediaScreen.currScreenState.getPageID().equals((beeEntity.getCoreData().getName())))
                return false;
            BeepediaScreen.saveScreenState();
            beepedia.setActive(BeepediaScreen.PageType.BEE, beeEntity.getCoreData().getName());
            return true;
        }
    }
    return false;
}
Also used : CustomBeeEntity(com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity)

Example 4 with CustomBeeEntity

use of com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity in project ResourcefulBees by Resourceful-Bees.

the class HoneyDipper method setEntityFlowerPos.

private boolean setEntityFlowerPos(Player player, LivingEntity entity) {
    if (selectedBee instanceof CustomBeeEntity) {
        CustomBeeEntity customBee = (CustomBeeEntity) selectedBee;
        if (entityTypesMatch(entity, customBee.getCoreData().getEntityFlower())) {
            customBee.setFlowerEntityID(entity.getId());
            customBee.setSavedFlowerPos(entity.blockPosition());
            sendMessageToPlayer(player, MessageTypes.FLOWER, entity.blockPosition());
            selectedBee = null;
            return true;
        }
    }
    return false;
}
Also used : CustomBeeEntity(com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity)

Example 5 with CustomBeeEntity

use of com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity in project ResourcefulBees by Resourceful-Bees.

the class HoneyDipper method useOn.

@Override
@NotNull
public InteractionResult useOn(@NotNull UseOnContext useContext) {
    if (!useContext.getLevel().isClientSide()) {
        Block clickedBlock = useContext.getLevel().getBlockState(useContext.getClickedPos()).getBlock();
        if (selectedBee instanceof CustomBeeEntity) {
            CoreData beeData = ((CustomBeeEntity) selectedBee).getCoreData();
            if (!beeData.getBlockFlowers().isEmpty() && beeData.getBlockFlowers().contains(clickedBlock)) {
                setFlowerPosition(useContext);
                return InteractionResult.SUCCESS;
            }
        } else if (selectedBee != null && clickedBlock.is(BlockTags.FLOWERS)) {
            setFlowerPosition(useContext);
            return InteractionResult.SUCCESS;
        }
        BlockEntity clickedTile = useContext.getLevel().getBlockEntity(useContext.getClickedPos());
        if (selectedBee != null && (clickedTile instanceof BeehiveBlockEntity || clickedTile instanceof ApiaryTileEntity)) {
            selectedBee.hivePos = useContext.getClickedPos();
            sendMessageToPlayer(useContext.getPlayer(), MessageTypes.HIVE, useContext.getClickedPos());
            selectedBee = null;
            return InteractionResult.SUCCESS;
        }
    }
    return super.useOn(useContext);
}
Also used : CustomBeeEntity(com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity) CoreData(com.teamresourceful.resourcefulbees.api.beedata.CoreData) ApiaryTileEntity(com.teamresourceful.resourcefulbees.tileentity.multiblocks.apiary.ApiaryTileEntity) Block(net.minecraft.world.level.block.Block) BeehiveBlockEntity(net.minecraft.world.level.block.entity.BeehiveBlockEntity) BeehiveBlockEntity(net.minecraft.world.level.block.entity.BeehiveBlockEntity) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

CustomBeeEntity (com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity)9 Block (net.minecraft.world.level.block.Block)3 Entity (net.minecraft.world.entity.Entity)2 ItemStack (net.minecraft.world.item.ItemStack)2 JsonObject (com.google.gson.JsonObject)1 JsonOps (com.mojang.serialization.JsonOps)1 ResourcefulBees (com.teamresourceful.resourcefulbees.ResourcefulBees)1 CoreData (com.teamresourceful.resourcefulbees.api.beedata.CoreData)1 HoneycombData (com.teamresourceful.resourcefulbees.api.beedata.HoneycombData)1 BreedData (com.teamresourceful.resourcefulbees.api.beedata.breeding.BreedData)1 HoneyBottleData (com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData)1 CustomHoneyBlock (com.teamresourceful.resourcefulbees.block.CustomHoneyBlock)1 CustomHoneyFluidBlock (com.teamresourceful.resourcefulbees.block.CustomHoneyFluidBlock)1 HoneycombBlock (com.teamresourceful.resourcefulbees.block.HoneycombBlock)1 Config (com.teamresourceful.resourcefulbees.config.Config)1 ResourcefulBee (com.teamresourceful.resourcefulbees.entity.passive.ResourcefulBee)1 CustomHoneyFluid (com.teamresourceful.resourcefulbees.fluids.CustomHoneyFluid)1 HoneyFluidAttributes (com.teamresourceful.resourcefulbees.fluids.HoneyFluidAttributes)1 BeeJar (com.teamresourceful.resourcefulbees.item.BeeJar)1 BeeSpawnEggItem (com.teamresourceful.resourcefulbees.item.BeeSpawnEggItem)1