aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kubatech/api/utils/MobUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kubatech/api/utils/MobUtils.java')
-rw-r--r--src/main/java/kubatech/api/utils/MobUtils.java81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/main/java/kubatech/api/utils/MobUtils.java b/src/main/java/kubatech/api/utils/MobUtils.java
deleted file mode 100644
index d3ec59757a..0000000000
--- a/src/main/java/kubatech/api/utils/MobUtils.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * spotless:off
- * KubaTech - Gregtech Addon
- * Copyright (C) 2022 - 2023 kuba6000
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
- * spotless:on
- */
-
-package kubatech.api.utils;
-
-import net.minecraft.client.model.ModelBase;
-import net.minecraft.client.model.ModelBox;
-import net.minecraft.client.model.ModelRenderer;
-import net.minecraft.client.renderer.entity.Render;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.entity.RendererLivingEntity;
-import net.minecraft.entity.EntityLiving;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import kubatech.mixin.mixins.minecraft.RendererLivingEntityAccessor;
-
-public class MobUtils {
-
- @SideOnly(Side.CLIENT)
- public static float getDesiredScale(EntityLiving e, float desiredHeight) {
- return getDesiredScale(getMobHeight(e), desiredHeight);
- }
-
- @SideOnly(Side.CLIENT)
- public static float getDesiredScale(float entityHeight, float desiredHeight) {
- return desiredHeight / entityHeight;
- }
-
- @SideOnly(Side.CLIENT)
- public static float getMobHeight(EntityLiving e) {
- try {
- float eheight = e.height;
- float ewidth = e.width;
- Render r = RenderManager.instance.getEntityRenderObject(e);
- if (r instanceof RendererLivingEntity) {
- ModelBase mainModel = ((RendererLivingEntityAccessor) r).getMainModel();
- for (Object box : mainModel.boxList) {
- if (box instanceof ModelRenderer) {
- float minY = 999f;
- float minX = 999f;
- float maxY = -999f;
- float maxX = -999f;
- for (Object cube : ((ModelRenderer) box).cubeList) {
- if (cube instanceof ModelBox) {
- if (minY > ((ModelBox) cube).posY1) minY = ((ModelBox) cube).posY1;
- if (minX > ((ModelBox) cube).posX1) minX = ((ModelBox) cube).posX1;
- if (maxY < ((ModelBox) cube).posY2) maxY = ((ModelBox) cube).posY2;
- if (maxX < ((ModelBox) cube).posX2) maxX = ((ModelBox) cube).posX2;
- }
- }
- float cubeheight = (maxY - minY) / 10f;
- float cubewidth = (maxX - minX) / 10f;
- if (eheight < cubeheight) eheight = cubeheight;
- if (ewidth < cubewidth) ewidth = cubewidth;
- }
- }
- }
- return eheight;
- } catch (Exception ex) {
- return 1f;
- }
- }
-}