Jump to content

Recommended Posts

Posted

Hello, I've been working on my mod and ran into some problems. Anything that is glowing in red shows an error in the code.

 

package SoldierW518.Soldiers_Mod;

 

import java.util.Random;

import net.minecraft.block.Block;

import net.minecraft.block.BlockOre;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

 

public class IridiumOre extends BlockOre {

public IridiumOre (int id, int texture, Material material) {

[glow=red,2,300]super(id, texture, material);[/glow]

 

setHardness(5.0F);

setStepSound(Block.soundStoneFootstep);

[glow=red,2,300]setBlockName[/glow]("iridiumOre");

setCreativeTab(CreativeTabs.tabBlock);

}

        @Override

public String [glow=red,2,300]getTextureFile()[/glow] {

return CommonProxy.BLOCK_PNG;

}

 

public int idDropped(int par1, Random random, int par2) {

return Soldiers_Mod.iridiumOre.blockID;

}

 

}

 

Any suggestions would be very helpful and feel free to leave them down below!

 

Thanks for any help and for reading,

 

- Justin (SoldierW518)

Posted

Use this one... (please read, not copy)

package MyMod.blocks;

import java.util.Random;

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.entity.player.EntityPlayer;
import net.minecraft.util.Icon;
import net.minecraft.world.World;

import MyMod.Main;

public class BlockOre extends Block
{
public BlockOre (int id, Material material, String Unlocalized)
{
	super(id, material);
		setCreativeTab(CreativeTabs.tabBlock);
		setStepSound(Block.soundMetalFootstep);
		setUnlocalizedName(Unlocalized);
}

public int idDropped (int par1, Random random, int par2)
{
	return this.blockID;
}

@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2)
{
	return this.blockIcon;
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
	blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", ""));
}
}

This one:

	blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", ""));

Will call for /minecarft.jar/mods/MyMod/textures/blocks/Unlocalized.png

Where unlocalized is your String.

.replace("tile.", "") - and yes, this is needed.

1.7.10 is no longer supported by forge, you are on your own.

Posted

So I was looking through your code and I came up with this.

public IridiumOre (int id, Material material, String IridiumOre)
{
super(id, material);
	setCreativeTab(CreativeTabs.tabBlock);
	setStepSound(Block.soundStoneFootstep);
	setUnlocalizedName("IridiumOre");
}

 

Because by the looks of it I could just change the String Variable and that would allow me to use a IridiumOre.png

Posted

Use this one... (please read, not copy)

package MyMod.blocks;

import java.util.Random;

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.entity.player.EntityPlayer;
import net.minecraft.util.Icon;
import net.minecraft.world.World;

import MyMod.Main;

public class BlockOre extends Block
{
public BlockOre (int id, Material material, String Unlocalized)
{
	super(id, material);
		setCreativeTab(CreativeTabs.tabBlock);
		setStepSound(Block.soundMetalFootstep);
		setUnlocalizedName(Unlocalized);
}

public int idDropped (int par1, Random random, int par2)
{
	return this.blockID;
}

@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2)
{
	return this.blockIcon;
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
	blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", ""));
}
}

This one:

	blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", ""));

Will call for /minecarft.jar/mods/MyMod/textures/blocks/Unlocalized.png

Where unlocalized is your String.

.replace("tile.", "") - and yes, this is needed.

It's easier if you use getUnlocalizedName2(); that doesn't have the "tile."

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted

As far as i know, no you don't :)

public Block(int par1, Material par2Material)
{
}

Or maybe there has been changes on 1.5.2? because i am using 1.5.1 (No need to update, will when I'm finished or if I would really need something).

 

As to you Soldier - do you even know how constructors work?

Ok man, look:

You got my code, so you just leave it. Copy to BlockOre.class (or something)

Next go to the MainMod.class and write this:

public static final Block IridiumOre = new BlockOre(1000, Material.rock, "IridiumOre");
//1 - ID, 2 - Material, 3 - Unlocalized name

Now you just need to register block and add IngameName (which you can also do in BlockOre.class by adding more code of course).

 

 

ObsequiousNewt - thanks pal, didn't noticed that, but in BlockOre I personally wont use it (but in other yes) :)

1.7.10 is no longer supported by forge, you are on your own.

Posted

As far as i know, no you don't :)

public Block(int par1, Material par2Material)
{
}

Or maybe there has been changes on 1.5.2? because i am using 1.5.1 (No need to update, will when I'm finished or if I would really need something).

Block takes a Material argument. BlockOre doesn't—it's preset to Material.rock.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

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

    • Hi, this is my second post with the same content as no one answered this and it's been a long time since I made the last post, I want to make a client-only mod, everything is ok, but when I use shaders, none of the textures rendered in RenderLevelStageEvent nor the crow entity model are rendered, I want them to be visible, because it's a horror themed mod I've already tried it with different shaders, but it didn't work with any of them and I really want to add support for shaders Here is how i render the crow model in the CrowEntityRenderer<CrowEntity>, by the time i use this method, i know is not the right method but i don't think this is the cause of the problem, the renderType i'm using is entityCutout @Override public void render(CrowEntity p_entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { super.render(p_entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); ClientEventHandler.getClient().crow.renderToBuffer(poseStack, bufferSource.getBuffer(ClientEventHandler.getClient().crow .renderType(TEXTURE)), packedLight, OverlayTexture.NO_OVERLAY, Utils.rgb(255, 255, 255)); } Here renderLevelStage @Override public void renderWorld(RenderLevelStageEvent e) { horrorEvents.draw(e); } Here is how i render every event public void draw(RenderLevelStageEvent e) { for (HorrorEvent event : currentHorrorEvents) { event.tick(e.getPartialTick()); event.draw(e); } } Here is how i render the crow model on the event @Override public void draw(RenderLevelStageEvent e) { if(e.getStage() == RenderLevelStageEvent.Stage.AFTER_ENTITIES) { float arcProgress = getArcProgress(0.25f); int alpha = (int) Mth.lerp(arcProgress, 0, 255); int packedLight = LevelRenderer.getLightColor(Minecraft.getInstance().level, blockPos); VertexConsumer builder = ClientEventHandler.bufferSource.getBuffer(crow); Crow<CreepyBirdHorrorEvent> model = ClientEventHandler .getClient().crow; model.setupAnim(this); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, packedLight, OverlayTexture.NO_OVERLAY, alpha); builder = ClientEventHandler.bufferSource.getBuffer(eyes); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, 15728880, OverlayTexture.NO_OVERLAY, alpha); } } How i render the model public static void renderModelInWorld(Model model, Vector3f pos, Vector3f offset, Camera camera, PoseStack matrix, VertexConsumer builder, int light, int overlay, int alpha) { matrix.pushPose(); Vec3 cameraPos = camera.getPosition(); double finalX = pos.x - cameraPos.x + offset.x; double finalY = pos.y - cameraPos.y + offset.y; double finalZ = pos.z - cameraPos.z + offset.z; matrix.pushPose(); matrix.translate(finalX, finalY, finalZ); matrix.mulPose(Axis.XP.rotationDegrees(180f)); model.renderToBuffer(matrix, builder, light, overlay, Utils .rgba(255, 255, 255, alpha)); matrix.popPose(); matrix.popPose(); } Thanks in advance
    • Same issue - I have no idea
    • I am trying to develop a modpack for me and my friends to use on our server. Does anyone know how to develop a modpack for a server or could they help take a look at my modpack to potentially help at all?
    • un server de armas realista.  
    • removed both, nope https://pastebin.com/kgtwq9us
  • Topics

×
×
  • Create New...

Important Information

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