Jump to content

Recommended Posts

Posted

I'm having a custom liquid and now I want to make it fill a bucket. With 1.2.5 it was very easy, but now using forge 4.x, I'm not able to find the right method. I guess it has something to do with "FillBucketEvent", but I'm not able to register it for my liquid. So does anybody know how to make custom filled buckets with 4.x?

  • 1 month later...
Posted

Same problem, everytime I launch Minecraft it give me an error with the line :

	public static Item crystalbucketfull = (CrystalBucket)(new CrystalBucket(11200, mod_Freezer.frozenwaterMoving.blockID)).setIconCoord(11, 7).setItemName("crystalbucketfull").setContainerItem(crystalbucket);

But my code of my Bucket is correct ?

In mod file :

	public static Item crystalbucket = (CrystalBucket)(new CrystalBucket(11100, 0)).setIconCoord(10, 7).setItemName("crystalbucket").setMaxStackSize(16);
public static Item crystalbucketfull = (CrystalBucket)(new CrystalBucket(11200, mod_Freezer.frozenwaterMoving.blockID)).setIconCoord(11, 7).setItemName("crystalbucketfull").setContainerItem(crystalbucket);

In crystalbucket file :

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.FillBucketEvent;


//Referenced classes of package net.minecraft.src:
//         Item, EntityPlayer, Vec3D, MathHelper, 
//         ItemStack, World, MovingObjectPosition, EnumMovingObjectType, 
//         mod_IceMod, Block, Material

public class CrystalBucket extends Item
{
 private int isFull;

public CrystalBucket(int i, int j)
{
     super(i);
     maxStackSize = 1;
     isFull = j;
     this.setTabToDisplayOn(CreativeTabs.tabMisc);
}

public String getTextureFile()
{
         return "/Freezer/items.png";
}

public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
     float var4 = 1.0F;
     double var5 = par3EntityPlayer.prevPosX + (par3EntityPlayer.posX - par3EntityPlayer.prevPosX) * (double)var4;
     double var7 = par3EntityPlayer.prevPosY + (par3EntityPlayer.posY - par3EntityPlayer.prevPosY) * (double)var4 + 1.62D - (double)par3EntityPlayer.yOffset;
     double var9 = par3EntityPlayer.prevPosZ + (par3EntityPlayer.posZ - par3EntityPlayer.prevPosZ) * (double)var4;
     boolean var11 = this.isFull == 0;
     MovingObjectPosition var12 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, var11);

     if (var12 == null)
     {
         return par1ItemStack;
     }
     else
     {
         FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, par1ItemStack, par2World, var12);
         if (MinecraftForge.EVENT_BUS.post(event))
         {
             return par1ItemStack;
         }

         if (event.isHandeled())
         {
             return event.result;
         }

         if (var12.typeOfHit == EnumMovingObjectType.TILE)
         {
             int var13 = var12.blockX;
             int var14 = var12.blockY;
             int var15 = var12.blockZ;

             if (!par2World.canMineBlock(par3EntityPlayer, var13, var14, var15))
             {
                 return par1ItemStack;
             }

             if (this.isFull == 0)
             {
                 if (!par3EntityPlayer.canPlayerEdit(var13, var14, var15))
                 {
                     return par1ItemStack;
                 }

                 if (par2World.getBlockMaterial(var13, var14, var15) == Material.water && par2World.getBlockMetadata(var13, var14, var15) == 0)
                 {
                     par2World.setBlockWithNotify(var13, var14, var15, 0);

                     if (par3EntityPlayer.capabilities.isCreativeMode)
                     {
                         return par1ItemStack;
                     }

                     if (--par1ItemStack.stackSize <= 0)
                     {
                         return new ItemStack(mod_Freezer.crystalbucketfull);
                     }

                     if (!par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(mod_Freezer.crystalbucketfull)))
                     {
                         par3EntityPlayer.dropPlayerItem(new ItemStack(mod_Freezer.crystalbucketfull.shiftedIndex, 1, 0));
                     }

                     return par1ItemStack;
                 }
             }
             else
             {
                 if (this.isFull < 0)
                 {
                     return new ItemStack(mod_Freezer.crystalbucket);
                 }

                 if (var12.sideHit == 0)
                 {
                     --var14;
                 }

                 if (var12.sideHit == 1)
                 {
                     ++var14;
                 }

                 if (var12.sideHit == 2)
                 {
                     --var15;
                 }

                 if (var12.sideHit == 3)
                 {
                     ++var15;
                 }

                 if (var12.sideHit == 4)
                 {
                     --var13;
                 }

                 if (var12.sideHit == 5)
                 {
                     ++var13;
                 }

                 if (!par3EntityPlayer.canPlayerEdit(var13, var14, var15))
                 {
                     return par1ItemStack;
                 }

                 if (this.func_77875_a(par2World, var5, var7, var9, var13, var14, var15) && !par3EntityPlayer.capabilities.isCreativeMode)
                 {
                     return new ItemStack(mod_Freezer.crystalbucket);
                 }
             }
         }
         else if (this.isFull == 0 && var12.entityHit instanceof EntityGoat)
         {
             return new ItemStack(mod_Freezer.crystalbucketMilk);
         }

         return par1ItemStack;
     }
}

public boolean func_77875_a(World par1World, double par2, double par4, double par6, int par8, int par9, int par10)
{
     if (this.isFull <= 0)
     {
         return false;
     }
     else if (!par1World.isAirBlock(par8, par9, par10) && par1World.getBlockMaterial(par8, par9, par10).isSolid())
     {
         return false;
     }
     else
     {
         if (par1World.provider.isHellWorld && this.isFull == mod_Freezer.frozenwaterMoving.blockID)
         {
             par1World.playSoundEffect(par2 + 0.5D, par4 + 0.5D, par6 + 0.5D, "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F);

             for (int var11 = 0; var11 < 8; ++var11)
             {
                 par1World.spawnParticle("largesmoke", (double)par8 + Math.random(), (double)par9 + Math.random(), (double)par10 + Math.random(), 0.0D, 0.0D, 0.0D);
             }
         }
         else
         {
             par1World.setBlockAndMetadataWithNotify(par8, par9, par10, this.isFull, 0);
         }

         return true;
     }
}

}

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

    • Yes that’s the full log, I managed to get it working last night, the anvil fix mod is what was causing it to crash
    • Hey guys, i'm currently developping a mod with forge 1.12.2 2860 and i'm using optifine and gradle 4.9. The thing is i'm trying to figure out how to show the player's body in first person. So far everything's going well since i've try to use a shader. The player's body started to blink dark when using a shader. I've try a lot of shader like chocapic, zeus etc etc but still the same issue. So my question is : How should i apply the current shader to the body ? At the same time i'm also drawing a HUD so maybe it could be the problem?   Here is the issue :    And here is the code where i'm trying to display the body :    private static void renderFirstPersonBody(EntityPlayerSP player, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); try { // Préparation OpenGL GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // Éclairage correct pour shaders GlStateManager.enableLighting(); RenderHelper.enableStandardItemLighting(); GlStateManager.enableRescaleNormal(); // Active la lightmap pour les shaders mc.entityRenderer.enableLightmap(); // Position de rendu interpolée double px = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; double py = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; double pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; GlStateManager.translate( px - mc.getRenderManager().viewerPosX, py - mc.getRenderManager().viewerPosY, pz - mc.getRenderManager().viewerPosZ ); // Rendu du joueur sans la tête Render<?> render = mc.getRenderManager().getEntityRenderObject(player); if (render instanceof RenderPlayer) { RenderPlayer renderPlayer = (RenderPlayer) render; boolean oldHeadHidden = renderPlayer.getMainModel().bipedHead.isHidden; boolean oldHeadwearHidden = renderPlayer.getMainModel().bipedHeadwear.isHidden; renderPlayer.getMainModel().bipedHead.isHidden = true; renderPlayer.getMainModel().bipedHeadwear.isHidden = true; setArmorHeadVisibility(renderPlayer, false); renderPlayer.doRender(player, 0, 0, 0, player.rotationYaw, partialTicks); renderPlayer.getMainModel().bipedHead.isHidden = oldHeadHidden; renderPlayer.getMainModel().bipedHeadwear.isHidden = oldHeadwearHidden; setArmorHeadVisibility(renderPlayer, !oldHeadwearHidden); } // Nettoyage post rendu mc.entityRenderer.disableLightmap(); GlStateManager.disableRescaleNormal(); } catch (Exception e) { // silent fail } finally { GlStateManager.popAttrib(); GlStateManager.popMatrix(); } }   Ty for your help. 
    • Item successfully registered, but there was a problem with the texture of the item, it did not insert and has just the wrong texture.     
    • Keep on using the original Launcher Run Vanilla 1.12.2 once and close the game Download Optifine and run optifine as installer (click on the optifine jar) Start the launcher and make sure the Optifine profile is selected - then test it again  
    • Hi everyone, I’m hoping to revisit an old version of Minecraft — specifically around Beta 1.7.3 — for nostalgia’s sake. I’ve heard you can do this through the official Minecraft Launcher, but I’m unsure how to do it safely without affecting my current installation or save files. Are there any compatibility issues I should watch out for when switching between versions? Would really appreciate any tips or advice from anyone who’s done this before! – Adam
  • Topics

×
×
  • Create New...

Important Information

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