Jump to content

Recommended Posts

Posted

After watching multiple outdated videos on making blocks, I managed to get myself and un-textured unnamed block. When I try using the updated format, it crashes with NullPointerException (I know what that means) despite the fact that almost nothing changed. I was wondering if someone could tell me the proper way to have the "int id, int texture, Material" thing in 1.6.4. I presume this isn't too complicatated, but is yet too much for a noob like me :P

Thank you

Posted

public class BlockCompressedCobblestone extends Block{

public BlockCompressedCobblestone(int id, Material par2Material) {
	super(id, par2Material);
	this.setCreativeTab(furniturecraft.FCTab);
}
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister icon){
	this.blockIcon = icon.registerIcon(furniturecraft.modid + ":" + "CompressedCobblestone");
}
}

That is my block code for my mod, and it is 1.6.4, and...

public Block setBlockName(String string) {
    // TODO Auto-generated method stub
    return null;
}

...indeed, it should not be there.

 

Did I help? Gimme a thanks!

Posted

This is for 1.6.4? Then, first off...

public void gameRegisters(){
                        GameRegistry.registerBlock(snowstormBlock);}    

                public void LanguageRegistry(){
                        LanguageRegistry.addName(snowstormBlock, "Blanket");
}

First, get rid of the "public void LanguageRegistry", "public void gameRegistry", "gameRegisters();", and the "languageRegisters();" but keep the "LanguageRegistry.addName(snowstormBlock, "Blanket");" and the

"GameRegistry.registerBlock(snowstormBlock);" there. Second, also in your main class file, "@Init" should be "@EventHandler" And third...

public BlockSnowstormBlock(int id, int texture, Material mat) {
                super(texture, Material.cloth);
                this.setCreativeTab(CreativeTabs.tabBlock);

Change that to...

public BlockSnowstormBlock(int id, int texture, Material mat) {
                super(id, texture, Material.cloth);
                this.setCreativeTab(CreativeTabs.tabBlock);

Hope I helped

Did I help? Gimme a thanks!

Posted

That is weird. I'm sorry for asking for so much, but could I see your current code? Sorry if I'm being a pain, and thanks for your patience. :)

Did I help? Gimme a thanks!

Posted

I figured it out(I hope)! Change this...

public BlockSnowstormBlock(int id, int texture, Material mat) {
                super(id, texture, Material.cloth);
                this.setCreativeTab(CreativeTabs.tabBlock);

To this!

public BlockSnowstormBlock(int id, int texture, Material mat) {
                super(id, texture, mat);
                this.setCreativeTab(CreativeTabs.tabBlock);

That should fix it...

EDIT: Wait, you should remove the "int texture" and the "texture" inside the "super(id, texture, mat);"

Should be like

public BlockSnowstormBlock(int id, Material mat) {
                super(id, mat);
                this.setCreativeTab(CreativeTabs.tabBlock);

You can register textures like

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister icon){
	this.blockIcon = icon.registerIcon(YourModHere.modid + ":" + "YourBlocksTextureFileNameHere");
}

Did I help? Gimme a thanks!

Posted

Lets see... you do have a problem here...

 public void registerIcons(IconRegister icon);{

Remove the ";"

And if THAT doesn't work, then I think I know why. I am familiar with forge 916, which is what I use, but you are using 953.

EDIT: Almost forgot,

public static final String modid = "Snowstorm";

Put that in your main mod file. Also in your main mod file,

Block snowstormBlock;

Should be

public static Block snowstormBlock;

But once again, we are using different forge versions, so I am unsure

 

Did I help? Gimme a thanks!

Posted

So, after applying your suggestions, I fooled around with the code, and got it down to one problem.

 

Error:

 

Caused by: java.lang.Error: Unresolved compilation problems:

2014-01-03 11:06:22 [iNFO] [sTDOUT] Syntax error on token "registerIcon", VariableDeclarator expected after this token

2014-01-03 11:06:22 [iNFO] [sTDOUT] registerIcon cannot be resolved to a type

2014-01-03 11:06:22 [iNFO] [sTDOUT] Illegal modifier for parameter $missing$; only final is permitted

2014-01-03 11:06:22 [iNFO] [sTDOUT]

 

 

Changed Code:

 

package snowstorm;

 

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.util.Icon;

import snowstorm.Snowstorm;

import snowstorm.ClientProxySnowstorm;

 

 

public class BlockSnowstormBlock<registerIcons> extends Block{

     

        public BlockSnowstormBlock(int id, Material mat) {

        super(id, mat);

        this.setCreativeTab(CreativeTabs.tabBlock);

       

       

 

public registerIcon;IconRegister icon;{

                this.blockIcon = icon.registerIcon("Snowstorm:blanket");

 

        }

       

        }

 

        }

 

Thanks!

Posted
  On 1/3/2014 at 5:12 PM, Cookie160 said:

public registerIcon;IconRegister icon;{

                this.blockIcon = icon.registerIcon("Snowstorm:blanket");

 

 

@Override

public void registerIcons(IconRegister icon)

{

    this.blockIcon = icon.registerIcon("snowstorm:blanket");

}

 

Should have come up with an error in eclipse...

Posted
  On 1/3/2014 at 5:28 PM, luisc99 said:

  Quote

public registerIcon;IconRegister icon;{

                this.blockIcon = icon.registerIcon("Snowstorm:blanket");

 

Should have come up with an error in eclipse...

 

It did.

It still didn't work :(

Posted

The following should work

 

public class BlockSnowstormBlock extends Block{
       
        public BlockSnowstormBlock(int id, Material mat) {
        super(id, mat);
        this.setCreativeTab(CreativeTabs.tabBlock);
       }
       
      
      public registerIcon (IconRegister icon){
                this.blockIcon = icon.registerIcon("Snowstorm:blanket");
        }
}

Posted

Change your registers to:

 

	GameRegistry.registerBlock(snowstormBlock, "snowstormBlock");
	LanguageRegistry.addName(snowstormBlock, "Blanket");

 

You should also give the block a unlocalized name

 

public BlockSnowstormBlock(int id, Material mat) {
        super(id, mat);
        this.setCreativeTab(CreativeTabs.tabBlock);
        this.setUnlocalizedName("snowtormBlock");
       }

Posted
  On 1/4/2014 at 12:15 AM, CJLetsGame said:

Change your registers to:

 

	GameRegistry.registerBlock(snowstormBlock, "snowstormBlock");
	LanguageRegistry.addName(snowstormBlock, "Blanket");

 

You should also give the block a unlocalized name

 

public BlockSnowstormBlock(int id, Material mat) {
        super(id, mat);
        this.setCreativeTab(CreativeTabs.tabBlock);
        this.setUnlocalizedName("snowtormBlock");
       }

Yeah, that should work... But if it doesn't, then idk the problem.

Did I help? Gimme a thanks!

Posted
  On 1/4/2014 at 12:15 AM, CJLetsGame said:

Change your registers to:

 

	GameRegistry.registerBlock(snowstormBlock, "snowstormBlock");
	LanguageRegistry.addName(snowstormBlock, "Blanket");

 

You should also give the block a unlocalized name

 

public BlockSnowstormBlock(int id, Material mat) {
        super(id, mat);
        this.setCreativeTab(CreativeTabs.tabBlock);
        this.setUnlocalizedName("snowtormBlock");
       }

Haha!!! It works!!! One last thing, though, is that it doesn't show up in the creative menu, I have to use /give Player*** 500. Thank you sooooooooo much for all of everyone's support!

 

Current code:

 

  Reveal hidden contents

 

Posted

Never mind, I figured it out!!! It works!!! Thank you sooooo much to everyone, for every post helped me out. I cannot stress how important this is to me! This probably won't be the last you hear of me (hopefully in a good way!). Thank you!!!

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

    • 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
    • hello! i was trying to recreate item-in-hand feature for my custom mob. i figured out that my mob needs a custom iteminhandlayer. i created it - but the main problem is.. well.. you can see all on screenshots any idea how i can fix that? is there any implemented method to render the item perfect to hand? public void render(@NotNull PoseStack pPoseStack, @NotNull MultiBufferSource pBufferSource, int pPackedLight, @NotNull TuneGolemRenderState pRenderState, float pYRot, float pXRot) { ItemStackRenderState item = pRenderState.heldItem; if (!item.isEmpty()) { pPoseStack.pushPose(); ModelPart leftArm = this.getParentModel().leftArm; pPoseStack.translate(0.35,0.5,-1.25); pPoseStack.mulPose(Axis.XP.rotationDegrees(180.0F)); pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); leftArm.translateAndRotate(pPoseStack); // pPoseStack.translate(0,0,0); leftArm.translateAndRotate(pPoseStack); if (TuneGolemRenderState.hornPlaying) { pPoseStack.translate(0, -0.5, 0.65); pPoseStack.scale(1.25F,1.25F,1.25F); } // Minecraft.getInstance().player.displayClientMessage(Component.literal(leftArm.xRot + " " + leftArm.yRot + " " + leftArm.zRot), true); item.render(pPoseStack, pBufferSource, pPackedLight, OverlayTexture.NO_OVERLAY); pPoseStack.popPose(); // -1.0F, -2.0F, -3.0F } }  
  • Topics

×
×
  • Create New...

Important Information

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