• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hi,  I'm having the same issue I have a custom bow (cannon) and an arrow which is a gem that will turn into a laser. Everything works but the arrow, even out of the normal Minecraft bow its invisible.   cannon class: package com.ClueDoh.test.objects.items.cannon; import javax.annotation.Nullable; import javax.swing.Action; import com.ClueDoh.test.Main; import com.ClueDoh.test.TestItemGroups; import com.ClueDoh.test.init.ModItems; import com.ClueDoh.test.util.IHasModel; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class CannonBase extends ItemBow implements IHasModel { public CannonBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(TestItemGroups.TESTITEMS); setMaxStackSize(1); setMaxDamage(800); ModItems.ITEMS.add(this); this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { if (entityIn == null) { return 0.0F; } else { return entityIn.getActiveItemStack().getItem() != ModItems.CANNON ? 0.0F : (float)(stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F; } } }); this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F; } }); ModItems.ITEMS.add(this); } @Override public int getItemEnchantability() { return 10; } protected boolean isArrow(ItemStack stack) { if(stack.getItem() == ModItems.GEM) { return true; } return false; } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } }     Gem Class (arrow): package com.ClueDoh.test.objects.items.cannon; import com.ClueDoh.test.Main; import com.ClueDoh.test.TestItemGroups; import com.ClueDoh.test.entity.laser.EntityLaser; import com.ClueDoh.test.init.ModItems; import com.ClueDoh.test.util.IHasModel; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemArrow; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class GemBase extends ItemArrow implements IHasModel { public GemBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(TestItemGroups.TESTITEMS); ModItems.ITEMS.add(this); } public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } @Override public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter) { EntityLaser entityLaser = new EntityLaser(worldIn, shooter); return entityLaser; } }     EntityLaser: package com.ClueDoh.test.entity.laser; import java.util.Random; import com.ClueDoh.test.init.ModItems; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; public class EntityLaser extends EntityArrow { public EntityLaser(World worldIn) { super(worldIn); } public EntityLaser(World worldIn, double x, double y, double z) { super(worldIn, x, y, z); } public EntityLaser(World worldIn, EntityLivingBase shooter) { super(worldIn, shooter); } @Override protected ItemStack getArrowStack() { return new ItemStack(ModItems.GEM); } @Override protected void arrowHit(EntityLivingBase living) { super.arrowHit(living); } @Override public void onUpdate() { super.onUpdate(); if(this.world.isRemote) { if(this.inGround) { if(this.timeInGround % 5 == 0) { this.spawnParticles(1); } } else { this.spawnParticles(2); } } } private void spawnParticles(int particleCount) { Random rand = new Random(); int i = rand.nextInt(15); double d0 = (double)(i >> 16 & 255) / 255.0D; double d1 = (double)(i >> 8 & 255) / 255.0D; double d2 = (double)(i >> 0 & 255) / 255.0D; for(int j = 0; j < particleCount; ++j) { this.world.spawnParticle(EnumParticleTypes.DRIP_LAVA, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2); } } }     RenderLaser: package com.ClueDoh.test.entity.laser; import com.ClueDoh.test.util.Reference; import net.minecraft.client.renderer.entity.RenderArrow; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class RenderLaser extends RenderArrow<EntityLaser> { public RenderLaser(RenderManager manager) { super(manager); } @Override protected ResourceLocation getEntityTexture(EntityLaser entity) { return new ResourceLocation(Reference.MOD_ID + ":textures/entity/laser/laser.png"); } }   can someone help I've been searching the web for hours trying to fix this and been working on a gun for 2 days? HELP!!!
    • Rendering and handling keyboard input should only be done on the client. Logic (pretty much everything else) should be done on the sever.   However, to make stuff look smoother, vanilla runs some logic on both client and server (so that it appears to run smoothly on the client while the real result is synced a little bit later from the server)
    • I was not handling the spawn correctly by communicating with the client side.  This fixed it for me:   https://www.minecraftforge.net/forum/topic/72657-solved-1143-entity-renderer-not-rendering/page/2/
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • I have created a way to manipulate the default reach which works absolutely perfectly in every single aspect except for opening a container at a large distance. I am having the same problem with a command I made that opens the inventory of other players, but all the containers seem to close if you're too far away.   I have been looking for a long time where this is done to see if I can bypass it, but I cannot find where it is done. Does anyone have a clue as to how to avoid this from happening? Either by altering the method that does this or some other way. I am open to suggestions.
  • Topics

  • Who's Online (See full list)