Jump to content

BlockID Resolution and registry.


xeed

Recommended Posts

Hello there,

I have trouble with understanding how the GameRegistry works in regards of blockID's etc.

I'm currently trying to extract the id and metadata of a given location. I stumbled upon the metadatasplitting of wood logs or leaves for example:

 

public int damageDropped(int par1)
{
  return par1 & 3;
}

 

This uses the first 2 bits for subblock identification of the BlockLeaves, which has 4 different types. In order to work with all (unknown) types of blocks, I would need a method to resolve the block class by the blockId. I couldn't find such a method by now. This led me to the GameRegistry. I'm aiming for working with vanilla blocks aswell as foreign modded blocks.

 

In the GameRegistry you can resolve a block by its modid and name (which is ok). How would I get the name of a given id?

 

In addition to this I used BiomesOPlenty as a reference and found this (https://github.com/Glitchfiend/BiomesOPlenty/blob/BOP-1.7.10-2.1.x/src/main/java/biomesoplenty/common/blocks/BOPBlock.java):

 

public abstract class BOPBlock extends Block
{
protected BOPBlock(Material material)
{
	super(material);

	this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
}

 

which obviously differs from my mc block implementation in a critical way:

 

public Block(int blockID, Material par2Material) {
...
}

 

So BOP seems to use another Block implementation, which does not require an id to be set. I don't even know what to ask here. I just can't understand how the blockID is determined. So i dont know blockID->Block, blockID->blockName, in mods i don't even know Block->blockID.

 

Im working with forge-1.6.4-9.11.1.964. BOP seems to use 1.6.2. The questions are a bit vague. But feel free to elaborate how the id management is supposed to work or point to sth, i couldn't find.

 

 

 

 

Link to comment
Share on other sites

Im working with forge-1.6.4-9.11.1.964

In addition to this I used BiomesOPlenty as a reference and found this (https://github.com/Glitchfiend/BiomesOPlenty/blob/BOP-1.7.10-2.1.x/src/main/java/biomesoplenty/common/blocks/BOPBlock.java)

 

And also, why are you working on 1.6.4?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It wasnt mappings issue, I was reading fabric and not forge. Fabric has PlayerEntity while forge has Player. Through a mixin I was able to change the player's velocity so that there is a sort of slow-motion type movement. Only issue is that jumping seems to be handled separately. Changing that velocity only makes the jump lower, not slower. Unsure how to increase the duration in which a jump happens.   @Mixin(LivingEntity.class) public abstract class ExampleMixin extends Entity { public ExampleMixin(EntityType<?> type, World world) { super(type, world); } @Inject(method = "tickMovement", at = @At("HEAD")) private void onTickMovement(CallbackInfo ci) { // Access the player entity LivingEntity entity = (LivingEntity)(Object)this; // Modify player's acceleration by applying a force in the opposite direction double slowdownFactor = 0.75; // Adjust as needed entity.setVelocity(entity.getVelocity().multiply(1, slowdownFactor, 1)); } }  
    • Hi so i made a modded survival, and when i go to the page 13 of my JEI,  my game instant crash and give this error "The game crashed whilst rendering item Error", I don't know what to do i give you the crash report : https://pastebin.com/EhzYdEZg
    • You need to run build at least once before running the game for the first time in a dev environment. Make sure stuff's working *before* you start making changes to the mdk template
    • Greetings, people of the forge forums: I come to you in a time of need. While creating my silly block entity that is (in theory) supposed to point to a position within world space I've started to question how to actually implement it.   How would I get a tile entity element (or bone) to change its pitch/yaw/roll? While I do have prior experience with programming, I have no actual experience with the forge API except the things listed in its docs. Please correct me if I am in any way wrong.
    • Making my own screen by extending from net.minecraft.client.gui.screens.Screen and override render method. I am trying to make green square only to be visible when intersecting with red square. This is what I got so far: @Override public void render(PoseStack poseStack, int mx, int my, float partialTick) {     RenderSystem.enableDepthTest(); // Red square     GuiComponent.fill(pPoseStack, 32, 32, 64, 64, 0xFFFF0000);     RenderSystem.depthFunc(GlConst.GL_LEQUAL); // Green square     GuiComponent.fill(pPoseStack, mx-16, my-16, mx+16, my+16, 0xFF00FF00); } Thank you in advance.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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