From ae53bfb35e3116b5d1d23f4fefcd924295eb94a1 Mon Sep 17 00:00:00 2001 From: kuba6000 Date: Thu, 29 Dec 2022 02:48:11 +0100 Subject: [PATCH] BEES RENDERING --- .../java/kubatech/api/enums/ItemList.java | 3 +- .../client/effect/MegaApiaryBeesRenderer.java | 100 ++++++++++++++++++ .../java/kubatech/loaders/ItemLoader.java | 6 +- ...T_MetaTileEntity_MegaIndustrialApiary.java | 21 +++- .../kubatech/textures/items/beeeeee.png | Bin 0 -> 689 bytes 5 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java create mode 100644 src/main/resources/assets/kubatech/textures/items/beeeeee.png diff --git a/src/main/java/kubatech/api/enums/ItemList.java b/src/main/java/kubatech/api/enums/ItemList.java index 00334d84..b92dead1 100644 --- a/src/main/java/kubatech/api/enums/ItemList.java +++ b/src/main/java/kubatech/api/enums/ItemList.java @@ -53,7 +53,8 @@ public enum ItemList implements IItemContainer { BruisedTeaLeaf, PartiallyOxidizedTeaLeaf, TeaAcceptorResearchNote, - TeaAcceptor; + TeaAcceptor, + Beeeeee; private ItemStack mStack; private boolean mHasNotBeenSet = true; diff --git a/src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java b/src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java new file mode 100644 index 00000000..a99929c3 --- /dev/null +++ b/src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java @@ -0,0 +1,100 @@ +package kubatech.client.effect; + +import static net.minecraft.client.renderer.entity.RenderManager.*; + +import kubatech.api.enums.ItemList; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class MegaApiaryBeesRenderer extends EntityFX { + public MegaApiaryBeesRenderer(World world, double x, double y, double z, int age) { + super(world, x, y + 2, z); + this.particleMaxAge = age; + } + + @Override + public void onUpdate() { + if (this.particleAge++ == this.particleMaxAge) this.setDead(); + if (this.particleAge % 4 == 0) + if (this.particleAge % 8 == 0) this.posY += 0.1; + else this.posY -= 0.1; + } + + @Override + public boolean shouldRenderInPass(int pass) { + return pass == 3; + } + + @Override + public int getFXLayer() { + return 3; + } + + @Override + public void renderParticle( + Tessellator p_70539_1_, + float p_70539_2_, + float p_70539_3_, + float p_70539_4_, + float p_70539_5_, + float p_70539_6_, + float p_70539_7_) { + + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + + GL11.glPushMatrix(); + GL11.glTranslatef( + (float) (this.posX - renderPosX), (float) (this.posY - renderPosY), (float) (this.posZ - renderPosZ)); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glRotatef(180f, 1f, 0f, 0f); + + Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationItemsTexture); + + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + + GL11.glColor4f(1f, 1f, 1f, 1F); + + IIcon icon = ItemList.Beeeeee.get(1).getIconIndex(); + + GL11.glPushMatrix(); + GL11.glTranslatef(0f, 0f, -4f); + GL11.glScalef(0.1f, 0.1f, 0.1f); + RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + GL11.glTranslatef(1f, 0f, 3f); + GL11.glRotatef(180f, 0f, 1f, 0f); + GL11.glScalef(0.1f, 0.1f, 0.1f); + RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + GL11.glTranslatef(4f, 0f, -1f); + GL11.glRotatef(-90f, 0f, 1f, 0f); + GL11.glScalef(0.1f, 0.1f, 0.1f); + RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + GL11.glTranslatef(-3f, 0f, 1f); + GL11.glRotatef(90f, 0f, 1f, 0f); + GL11.glScalef(0.1f, 0.1f, 0.1f); + RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); + GL11.glPopMatrix(); + + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/kubatech/loaders/ItemLoader.java b/src/main/java/kubatech/loaders/ItemLoader.java index 8db9c9f1..a0b2cced 100644 --- a/src/main/java/kubatech/loaders/ItemLoader.java +++ b/src/main/java/kubatech/loaders/ItemLoader.java @@ -24,10 +24,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import kubatech.loaders.item.ItemProxy; import kubatech.loaders.item.KubaItems; -import kubatech.loaders.item.items.Tea; -import kubatech.loaders.item.items.TeaCollection; -import kubatech.loaders.item.items.TeaIngredient; -import kubatech.loaders.item.items.TeaUltimate; +import kubatech.loaders.item.items.*; public class ItemLoader { public static final KubaItems kubaitems = new KubaItems(); @@ -79,5 +76,6 @@ public static void registerItems() { TeaAcceptorResearchNote.set( kubaitems.registerProxyItem(new ItemProxy("tea_acceptor_research_note", "research_note"))); + Beeeeee.set(kubaitems.registerProxyItem(new ItemProxy("beeeeee", "beeeeee"))); } } diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java index 066a3405..7f0dde26 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java @@ -42,6 +42,8 @@ import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.api.widget.Widget; import com.gtnewhorizons.modularui.common.widget.*; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import forestry.api.apiculture.*; import forestry.apiculture.blocks.BlockAlveary; import forestry.apiculture.blocks.BlockApicultureType; @@ -69,6 +71,8 @@ import kubatech.api.helpers.GTHelper; import kubatech.api.network.CustomTileEntityPacket; import kubatech.api.tileentity.CustomTileEntityPacketHandler; +import kubatech.client.effect.MegaApiaryBeesRenderer; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; @@ -339,8 +343,23 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { packet.resetHelperData(); packet.addData(mMaxSlots); packet.sendToAllAround(20); + } else { + if (aBaseMetaTileEntity.isActive() && aTick % 100 == 0) { + int[] abc = new int[] {0, -2, 7}; + int[] xyz = new int[] {0, 0, 0}; + this.getExtendedFacing().getWorldOffset(abc, xyz); + xyz[0] += aBaseMetaTileEntity.getXCoord(); + xyz[1] += aBaseMetaTileEntity.getYCoord(); + xyz[2] += aBaseMetaTileEntity.getZCoord(); + showBees(aBaseMetaTileEntity.getWorld(), xyz[0], xyz[1], xyz[2], 100); + } } - // Beeeee rendering inside ? + } + + @SideOnly(Side.CLIENT) + private void showBees(World world, int x, int y, int z, int age) { + MegaApiaryBeesRenderer bee = new MegaApiaryBeesRenderer(world, x, y, z, age); + Minecraft.getMinecraft().effectRenderer.addEffect(bee); } @Override diff --git a/src/main/resources/assets/kubatech/textures/items/beeeeee.png b/src/main/resources/assets/kubatech/textures/items/beeeeee.png new file mode 100644 index 0000000000000000000000000000000000000000..790a321aa5eb740e5add93760bc2d5e81a89865b GIT binary patch literal 689 zcmV;i0#5yjP)EX>4Tx04R}tkv&MmKpe$iQ>7vm1q+IF$WR5rf~bh2RIvyaN?V~-2a`)bgeDD1 zii@M*T5#}VvFhOBtgC~oAP9bdI665gx=4xtOA0MwJUH&hyL*qjcYshYGu7-E2UN{6 zQt_CW&8>)mR|FBp0QxX0F;h>Z7c%f1U-$6w^)AY@ywCkPdX&7$0G~)a%XGscUMHU3 zv~ zby?xO#aS&^S@WL!g~7bGoaQ>sFydH50!fIFQN;$zun?tHBgI6D_G2FYA;+I2mrSk= zFmlYJ0u_?u2mgcL-I|5T2{$Pi13F)9`(qdg>;jFNZGRuzcH;!_KLb}<%U`JjGoPf_ zT3X}?=-mb`u3MVC2VCv|gHO6-NRH&EDHIC8`x$*x4(PuHx>w!an)^6?05a6o(hYEM z2#gddd(GqBUG2U7d#2gn54&1&#IUqX(f|Me24YJ`L;wH)0002_L%V+f000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2j&bM7aJGgdaSVk000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}0001pNkl~348+Q{zvi+a)NzC`&d&_ z*Q6Z`2Gfs?ACg4^{2CGq?#`Z