Jump to content

Recommended Posts

Posted

Hello,

I am trying to render  my custom projectile, but it seems to not load the texture. This is my code.

package com.mujmajnkraft.bettersurvival.client.render;

import javax.annotation.Nonnull;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.mujmajnkraft.bettersurvival.entities.EntityFlyingSpear;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;

public class RenderFlyingSpear extends Render<EntityFlyingSpear>
{
	
	public RenderFlyingSpear(RenderManager renderManager) 
	{
		super(renderManager);
	}
	
	@Override
	  public void doRender(@Nonnull EntityFlyingSpear entity, double x, double y, double z, float entityYaw, float partialTicks) {
	    // preface: Remember that the rotations are applied in reverse order.
	    // the rendering call does not apply any transformations.
	    // That'd screw things up, since it'd be applied before our transformations
	    // So remember to read this from the rendering call up to this line

	    // can be overwritten in customRendering
	    //toolCoreRenderer.setDepth(1/32f);
	    ItemStack item = entity.getSpear();

	    GL11.glPushMatrix();
	    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

	    // last step: translate from 0/0/0 to correct position in world
	    GL11.glTranslated(x, y, z);
	    // mkae it smaller
	    GL11.glScalef(0.5F, 0.5F, 0.5F);

	    customRendering(entity, x, y, z, entityYaw, partialTicks);

	    // arrow shake
	    float f11 = (float) entity.arrowShake - partialTicks;
	    if(f11 > 0.0F) {
	    	float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
	      	GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
	    }

	    if(renderManager == null || renderManager.renderEngine == null) {
	    	return;
	    }

	    // draw correct texture. not some weird block fragments.
	    renderManager.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

	    if(item != null) {
	    	Minecraft.getMinecraft().getRenderItem().renderItem(item, ItemCameraTransforms.TransformType.NONE);
	    }
	    else {
	    	ItemStack dummy = new ItemStack(Items.STICK);
	    	Minecraft.getMinecraft().getRenderItem().renderItem(dummy, Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getMissingModel());
	    }

	    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
	    GL11.glPopMatrix();

	    super.doRender(entity, x, y, z, entityYaw, partialTicks);
	  }

	  public void customRendering(EntityFlyingSpear entity, double x, double y, double z, float entityYaw, float partialTicks) {
	    // flip it, flop it, pop it, pull it, push it, rotate it, translate it, TECHNOLOGY

	    // rotate it into the direction we threw it
	    GL11.glRotatef(entity.rotationYaw, 0f, 1f, 0f);
	    GL11.glRotatef(-entity.rotationPitch, 1f, 0f, 0f);

	    // adjust "stuck" depth
	    if(entity.isInGround()) {
	      GL11.glTranslated(0, 0, 0);
	    }

	    	customCustomRendering(entity, x, y, z, entityYaw, partialTicks);

	    	// rotate it so it faces forward
	    	GL11.glRotatef(-90f, 0f, 1f, 0f);

	    	// rotate the projectile it so it faces upwards
	    	GL11.glRotatef(-45, 0f, 0f, 1f);
	  }

	  /** If you just want to rotate it or something but the overall "have it heading towards the target" should stay the same */
	  protected void customCustomRendering(EntityFlyingSpear entity, double x, double y, double z, float entityYaw, float partialTicks) {}

	@Override
	protected ResourceLocation getEntityTexture(EntityFlyingSpear entity) {
		return TextureMap.LOCATION_MISSING_TEXTURE;
	}
}

This is mostly copied from https://github.com/SlimeKnights/TinkersConstruct/blob/master/src/main/java/slimeknights/tconstruct/library/client/renderer/RenderProjectileBase.java. However the entity looks like black and pink box, not like an item. Other thinks like rotation seem to be fine. Thanks for any help.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello to everyone. I am new here... Nice to meet you.<><><>.........
    • Temmuz 2025 için En İyi 7 Temu Kampanyası: (acu729640) Kupon Kodu ile Büyük Tasarruf Edin Giriş:  Temmuz 2025, Temu’dan kaçırılmayacak fırsatlarla geliyor. Moda, elektronik, ev ürünleri veya kozmetik alışverişi yapıyor olun fark etmez – güçlü Temu kupon kodu (acu729640) ile açabileceğiniz özel indirimler sizi bekliyor. Bu rehberde, yeni ve mevcut kullanıcılar için geçerli 100$ indirimler, ekstra %40 tasarruf ve kupon paketleri dahil olmak üzere şu anda sunulan en iyi 7 Temu fırsatını sıraladık. 1. Temu Kupon Kodu (acu729640) – Yeni Kullanıcılara 100$ İndirim  Eğer Temu’dan ilk kez alışveriş yapacaksanız, (acu729640) kupon kodu ile siparişinizde anında 100$ indirim kazanabilirsiniz. Bu teklif; trend moda, elektronik ve ev dekorasyon ürünleri gibi birçok kategori için geçerlidir.  Öne Çıkanlar: Tüm site genelinde geçerlidir Ücretsiz hediye dahildir Sadece ilk kez alışveriş yapanlara özeldir ABD, Kanada, Birleşik Krallık ve Japonya’da geçerli 2. Temu Kupon Kodu (acu729640) – Mevcut Kullanıcılara 100$ İndirim  Temu’da daha önce alışveriş yaptıysanız endişelenmeyin; siz de (acu729640) kupon kodunu kullanarak 100$ indirim kazanabilirsiniz. Sadık müşterilere özel bu nadir fırsatı kaçırmayın.  Öne Çıkanlar: Geri dönen müşteriler için geçerlidir Diğer Temu kampanyaları ile birleştirilebilir 150$ üzeri alışverişler için idealdir 3. Temu Kupon Kodu (acu729640) – Ekstra %40 İndirim  Temmuz 2025’in dikkat çeken bir diğer kampanyası: Temu kupon kodu (acu729640) ile %40 ekstra indirim. Bu indirim, mevcut ürün fırsatları, flaş indirimler ve outlet ürünlerle birlikte uygulanabilir.  Öne Çıkanlar: Tüm uygun kategorilerde geçerli Flaş indirimlerle birleştirilebilir Meksika, Brezilya, Fransa ve Almanya’da geçerli 4. Temu 100$ Kupon Paketi – Tek Kodla Birden Fazla Kupon  Temu, artık birden fazla kupon içeren 100$ değerinde bir kupon paketi sunuyor. Bu, birden fazla alışverişte tasarruf etmek isteyen kullanıcılar için mükemmel.  Öne Çıkanlar: Birden fazla kupon içerir (örnek: 20$ x 5) Yeni ve mevcut kullanıcılar için uygundur (acu729640) koduyla kullanılabilir 5. Temu Yeni Kullanıcı Kuponu – Hoş Geldin Hediyesi + İndirim  Temu yeni kullanıcı kuponu sadece indirim değil, aynı zamanda 15$ değerinde bir hoş geldin hediyesi de sunuyor. 100$ indirimle birleştirildiğinde, giriş seviyesi için en cömert tekliftir.  Öne Çıkanlar: 100$ indirim + ücretsiz ürün içerir Belirli ülkelerde minimum harcama şartı yoktur Temmuz 2025 için (acu729640) koduyla geçerlidir 6. Temu Ülkelere Özel Kuponlar – Uluslararası Kullanıcılara Özel Fırsatlar  Temu’nun küresel varlığı sayesinde, farklı bölgelerdeki kullanıcılar Temmuz 2025’te (acu729640) kupon kodu ile özel avantajlar elde edebilir. İşte hızlı bir özet: ABD: 100$ indirim ve hızlı teslimat Kanada: 100$ indirim + ikinci siparişte ekstra indirim İngiltere: Ücretsiz kargo ve %40 indirim Japonya: Öncelikli teslimat ve kupon erişimi Meksika & Brezilya: Elektronik ve giyimde %40 indirim Fransa & Almanya: Temmuz indirimi için erken erişim 7. Temu Temmuz 2025 Yeni Teklifler – Flaş Fırsatlar ve Erken Erişim  Temu, Temmuz 2025’te saatlik flaş fırsatlar, özel kupon paketleri ve yaz koleksiyonlarına erken erişim gibi birçok yeni teklif sunuyor. Tüm bu fırsatlar, (acu729640) kupon kodu ile birlikte sorunsuz çalışıyor.  Öne Çıkanlar: Günlük değişen flaş satışlar Haftalık olarak yeni kupon paketleri 100$ kupon ve %40 indirimle birleştirilebilir Son Düşünceler: (acu729640) Temu kupon kodu sayesinde Temmuz 2025’te dev tasarruflar sizi bekliyor. 100$ indirimden ekstra %40 indirime kadar her teklif, alışveriş deneyiminizi daha kazançlı hale getirmek için tasarlandı. Yeni kullanıcı olun ya da mevcut müşteri, herkes için özel fırsatlar, ücretsiz hediyeler ve kupon paketleri var.  Hemen kazanmaya başlayın: Kodunuzu (acu729640) şimdi kullanın ve Temu’da akıllıca alışveriş yapın!
    • Top 7 Temu Special Offers for July 2025: Save Big with Coupon Code (acu729640) Introduction: July 2025 brings a wave of unbeatable deals from Temu. Whether you're shopping for fashion, electronics, home goods, or beauty, Temu has crafted exclusive offers that you can unlock with the powerful Temu coupon code (acu729640). This guide ranks the top seven Temu promotions available now, including $100 discounts, 40% extra savings, and coupon bundles for both new and existing users. 1. Temu Coupon Code (acu729640) – $100 Off for New Users If this is your first time shopping on Temu, you’re eligible for a flat $100 off your order using Temu coupon code (acu729640). This offer is valid on a wide range of categories, including trending fashion, electronics, and home decor. Highlights: Works sitewide Free gift included Exclusive to first-time buyers Available in USA, Canada, UK, and Japan 2. Temu Coupon Code (acu729640) – $100 Off for Existing Users Returning shoppers aren’t left out. If you’ve shopped with Temu before, you can still apply the Temu coupon code (acu729640) $100 off for existing users. This is a rare opportunity for loyal customers to get deep discounts on their next order. Highlights: Valid for returning customers Compatible with other Temu offers Ideal for larger purchases over $150 3. Temu Coupon Code (acu729640) – 40% Off Extra Discount Another standout offer for July 2025 is the Temu coupon code (acu729640) 40% off. This stacks with existing product discounts, flash sales, and clearance deals, delivering unmatched value for budget-conscious shoppers. Highlights: Applies to all eligible categories Stackable with flash sales Available in Mexico, Brazil, France, and Germany 4. Temu $100 Coupon Bundle – Multiple Coupons, One Code Temu now offers a $100 coupon bundle that includes several smaller denomination coupons you can use across multiple orders. Perfect for shoppers who want to stretch their savings over several purchases. Highlights: Includes multiple coupons (e.g., $20 x 5) Works for both new and existing users Redeem with Temu coupon code (acu729640) 5. Temu First Time User Coupon – Welcome Gift + Discounts The Temu first time user coupon gives more than just a discount — you’ll also receive a welcome gift valued up to $15. Combined with the $100 off for new users, this is the most generous entry-level offer. Highlights: Includes $100 off and a free product No minimum spend in select countries Valid with Temu discount code (acu729640) for July 2025 6. Temu Coupons by Country – Tailored International Offers Temu’s global presence means regional shoppers enjoy unique benefits when using the Temu promo code (acu729640) for July 2025. Here's a quick overview: USA: $100 off and fast shipping Canada: $100 off with bonus discount on second order. UK: Free shipping and 40% off Japan: Priority delivery with coupon code access Mexico & Brazil: 40% off electronics and apparel France & Germany: Early access to July clearance Argentina: Exclusive coupon bun7. Temu New Offers in July 2025 – Flash Deals and Early Access Temu rolls out new offers in July 2025 including hourly flash deals, exclusive bundles, and early access to summer collection sales. All these deals work seamlessly with Temu coupon code (acu729640). Highlights: Daily rotating flash sales New bundles released weekly Combine with $100 coupon code and 40% discount Final Thoughts With the Temu coupon code (acu729640), shoppers can unlock massive savings this July 2025. From the $100 off deals to the 40% extra discount, every offer is built to maximize value. Whether you're a new user or a returning customer, there’s something for everyone — including free gifts and exclusive bundles. Ready to claim your deals? Use the code (acu729640) now and shop smart with Temu.
    • welcome to evrone need to play
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.