End Portal Recipe (Fabric)

End Portal Recipe (Fabric)

35.8k Downloads

Submitting Pull Requests?

Brittank88 opened this issue ยท 4 comments

commented

Mod name: Collective / No Hostiles Around Campfire / Healing Campfire

Question

I'm working on submitting a pull request to resolve #491, however, I'm really struggling with building and running NHAC or HC with a newly built version of collective. It seems that the Gradle dependencies reference a hosted version of Collective rather than the local one. What should I do? I'm not exactly experienced with Gradle, but I want to help.

On the note of PRs in general - what specifications for them are there? What code style should I use? Should I pay attention to incrementing version numbers? Things like that I would like to know so I can get it right the first time.

Thanks for your time!

commented

Apologies it took me so long to work on this. At the moment with how I've got my development environment set up, it's not that easy to implement pull requests. With others, I've merged their pull request and added code manually locally. After which I synced the code again.

I have however implemented your suggested code (https://github.com/ricksouth/serilum-mc-mods/blob/master/sources/Collective/src/main/java/com/natamus/collective/functions/FABFunctions.java#L58). Thank you very much for working it out and the patience. I do really appreciate it.

The latest versions of Collective, No Hostiles Around Campfires and Healing Campfire now work with modded campfires. Please let me know if something is not correct and I'll fix it.

Thanks again!

commented

Made me smile to see my PR implemented! Thank you!

P.S. I've just been notified that instead of my code, Minecraft's own "Point of Interest"/POI tag system might be applicable instead. It's how bees find hives, and villagers find profession blocks. Either way, I'm super happy this has modded campfire support now!

commented

Also, a cleaner solution would be to only look for campfires by tag, but I don't know where else you plan to use the existing helper method so I didn't want to remove it. I guess I could remove it from CampfireEvent.java but maybe you'd prefer it stay.

commented

For the sake of explanation, I've added a new function to Collective's FABFunctions.java to get block positions in a radius of an entity, filtered by a certain block tag:

public static List<BlockPos> getAllTaggedTileEntityPositionsNearbyEntity(ITag.INamedTag<Block> tetag, Integer radius, World world, Entity entity) {
	List<BlockPos> nearbypositions = new ArrayList<BlockPos>();
	for (TileEntity loadedtileentity : world.loadedTileEntityList) {
		BlockState loadedtilestate = loadedtileentity.getBlockState();
		if (loadedtilestate == null) {
			continue;
		}

		if (loadedtilestate.isIn(tetag)) {
			BlockPos ltepos = loadedtileentity.getPos();
			if (ltepos.withinDistance(entity.getPositionVec(), radius)) {
				nearbypositions.add(loadedtileentity.getPos());
			}
		}
	}

	return nearbypositions;
}

I then (so far in my process) have added underneath line 121 of NHAC's CampfireEvent.java a new line to use this function appropriately:

nearbycampfires.addAll(FABFunctions.getAllTaggedTileEntityPositionsNearbyEntity(BlockTags.CAMPFIRES, ConfigHandler.GENERAL.preventHostilesRadius.get(), world, entity));

I'm up to the stage where I would test this before also applying it to HC and whatever else references campfires.