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();
}
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;
}
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;
}
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;
}
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);
}
Aggregations