Jump to content

[1.10] Changing village blocks


DBLouis

Recommended Posts

It's kinda working, here's what I've done:

 

 

 

private BlockPos pos;
private boolean hasChanged = false;
private UBBiome currentBiome; // UB stones biomes, not minecraft biomes!

@SubscribeEvent
public void initMapGen(InitMapGenEvent event) {
if (event.getType() == EventType.VILLAGE) {
	event.setNewGen(new MapGenVillage() {
		@Override
		public StructureStart getStructureStart(int chunkX, int chunkZ) {
			LOGGER.debug("Village start in chunk: " + chunkX + ";" + chunkZ);
			pos = new BlockPos(chunkX * 16, 0, chunkZ * 16);
			hasChanged = true;
			return super.getStructureStart(chunkX, chunkZ);
		}
	});
	event.setResult(Result.DENY);
}
}

@SubscribeEvent
public void onVillageSelectBlock(GetVillageBlockID event) {
IBlockState originalState = event.getOriginal();
Block originalBlock = originalState.getBlock();

if (hasChanged) {
	currentBiome = // getting the biome at pos...
	hasChanged = false;
}

// replace blocks
if (originalBlock == Blocks.COBBLESTONE) {
	event.setReplacement(...);
	event.setResult(Result.DENY);
}
// ...
}

 

 

 

The problem is that Minecraft don't call StructureVillagePieces.Village#getBiomeSpecificBlockState for all block of the structures.

For example in StructureVillagePieces.Church#addComponentParts:

IBlockState iblockstate = Blocks.COBBLESTONE.getDefaultState(); // Cobble is not replaced for Churches
IBlockState iblockstate1 = this.getBiomeSpecificBlockState(Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, numFacing.NORTH));
IBlockState iblockstate2 = this.getBiomeSpecificBlockState(Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.WEST));
IBlockState iblockstate3 = this.getBiomeSpecificBlockState(Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.EAST));

 

I think Forge should just patch this by replacing the first line like the ones below it, It won't break anything.

If not I will use reflection but I may need some help.

Link to comment
Share on other sites

This is a real problem, GetVillageBlockID is not usable because it is called for half the blocks. It's stupid...

Can the Forge team edit Minecraft code ? It's about ten lines to change, and I can help, just tell me where to go.

Put in a pull request on forges github, i do not know if they will accept it or not.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Thank you!

 

Should I edit the existing patch file ? Or make a new one beside? I'm not really comfortable with those.

Also if I rename the variables (iblockstate1,2,3...) should I do it in the patch file or there is a place for it?

I'm asking because I saw the processing of Minecraft sources is very ordered and complex.

Link to comment
Share on other sites

Thank you!

 

Should I edit the existing patch file ? Or make a new one beside? I'm not really comfortable with those.

Also if I rename the variables (iblockstate1,2,3...) should I do it in the patch file or there is a place for it?

I'm asking because I saw the processing of Minecraft sources is very ordered and complex.

Make it in code aka .java syntax.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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