Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.19 with experimental spawnproofing #27

Open
wants to merge 5 commits into
base: 1.19
Choose a base branch
from

Conversation

end-user
Copy link

@end-user end-user commented Jan 5, 2023

This is updated for 1.19.3, latest dependencies. I've also added an experimental new feature that allows auto-spawnproofing. A number of blocks can be used: buttons, pressure plates, slabs. Not perfect - it will not place blocks on grass, etc, where mobs could still spawn.

Also fixes the bonemeal crash.

Copy link
Owner

@flier268 flier268 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a mod related to farming, so this feature should not including in this mod.
By the way, you can use the code replace your netherSpawnproofItems table

Method isFlammableFunction = null;

boolean isFlammable(Block block) {
    boolean isFlammable = false;
    try {
        if (isFlammableFunction == null)
            isFlammableFunction = FireBlock.class.getDeclaredMethod("isFlammable", BlockState.class);
        isFlammable = (boolean) isFlammableFunction.invoke(Blocks.FIRE,
                block.getDefaultState());
    } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
            | InvocationTargetException e) {
        e.printStackTrace();
    }
    return isFlammable;
}

boolean isSpawnproofer(ItemStack itemStack) {
    var block = Block.getBlockFromItem(itemStack.getItem());
    // if (world.getRegistryKey() == World.NETHER) {
    return (!itemStack.isEmpty()
            && (block instanceof ButtonBlock || block instanceof PressurePlateBlock || block instanceof SlabBlock)
            && !isFlammable(block));
    // return (!itemStack.isEmpty()
    // && netherSpawnproofItems.contains(itemStack.getItem())
    // );
    }

@@ -122,7 +123,7 @@ public class CropManager {
FEED_MAP.put(Items.SEAGRASS, TurtleEntity.class);

// 1.14
FEED_MAP.put(Items.KELP, PandaEntity.class);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I does not found I feed panda with kelp XDD

@@ -203,7 +207,7 @@ public static boolean isCocoa(ItemStack stack) {
&& stack.getItem() == Items.COCOA_BEANS);
}

public static boolean canPaint(BlockState s, ItemStack stack) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much wrong word!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants