this plugin has a bug when used with reskillable when you enable simpleharvest (auto plants seeds when right clicking to harvest) it shows that you don't have the levels to perform the action correctly but still lets you harvest the crops.
to fix this open up SimpleHarvestHandler.java and change @SubscribeEvent(priority = EventPriority.HIGHEST) to @SubscribeEvent(priority = EventPriority.HIGH) this will allow the reskillable mod to act first and cancel the harvest interaction if the level is too low. you enable simpleharvest by opening up the config file xpfromharvest.cfg and change B:"Simple Harvest"=false to B:"Simple Harvest"=true
#XPFromHarvest SimpleHarvest Incompatible With Reskillable/Lycanites
1 messages · Page 1 of 1 (latest)
there may still be a different bug in regard to having mobs spawn when breaking crops, since the simple harvest is handling the process it doesn't seem to spawn any mobs like tree ents
spriggan/triffid spawn happens on BlockEvent.HarvestDropsEvent, which probably triggers after the rightclick event those other two work with
might be possible to move the simpleharvest there, behind lyca spawn and then cancel it but idk
lycanite uses normal prio
I can try to recompile simple harvest to normal priority to see if that works
its a different event so that wont work
Hmm so I would have to extract the class and dependencies to the lycanite mod and compile a new version I never used mixins before is it possible to just use that to inject the xp and replanting into the lycanite
i doubt changing the events is gonna work. would have to check exactly when harvestdropsevent is fired but i guess spawning triffids on rightclicking crops wouldnt be great
it would be the same as left clicking the crop which can spawn triffids it just replants the seed after words so i dont see how that wouldnt be great.
ah i see you would only fire the lycanite spawner if it actually harvests via rightclick. yea thats gonna be some heavier coding
could maybe try to fire a blockevent.harvestdropsevent with 0 drops or smth
would have to read up on how the event works
guess with 0 dropchance it could work
well its not pretty but i imported the simple harvest into Lycanites and set a separate config to enable so you can disable it on the original plugin and enable it on Lycanites i hard coded the silk touch to false and the the fortune to 0 since you wont be using tools to harvest, im testing it now
i feel like if i learn mixins i could do this without editing the source jars
*edit
well i compiled LycanitesMobs-2.0.8.10 so ill have to port those changed to LycanitesMobs-2.0.8.9 and test
edit again i got it to work
// ==================================================
// Harvest Drops Event SimpleHarvestHandler (right click)
// ==================================================
/** This uses the block harvest drops events to update Block Spawn Triggers. **/
@SubscribeEvent(priority = EventPriority.HIGH)
public void handleRightClick(PlayerInteractEvent.RightClickBlock event) {
EntityPlayer player = event.getEntityPlayer();
if (!(event.getWorld() instanceof WorldServer)) return;
World world = event.getWorld();
BlockPos pos = event.getPos();
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if (Arrays.asList(ModConfig.crops).contains(state.toString())) {
handleHarvest(block, world, pos, state, world.rand, player);
}
}
void handleHarvest(Block block, World world, BlockPos pos, IBlockState state, Random rand, EntityPlayer player) {
NonNullList<ItemStack> drops = NonNullList.create();
block.getDrops(drops, world, pos, state, 0);
List<BlockSpawnTrigger> blockSpawnTriggers = SpawnerEventListener.getInstance().blockSpawnTriggers;
boolean foundSeed = false;
for (ItemStack stack : drops) {
if ((stack.getItem() instanceof IPlantable) && !foundSeed) {
foundSeed = true;
continue;
}
EntityItem entityItem = new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), stack);
world.spawnEntity(entityItem);
}
if ((rand.nextInt(100) + 1) <= ModConfig.chance) {
EntityXPOrb xpOrb = new EntityXPOrb(world, pos.getX(), pos.getY(), pos.getZ(), ModConfig.xpAmount);
world.spawnEntity(xpOrb);
}
if(player != null && (!testOnCreative && player.capabilities.isCreativeMode)) { // No Spawning for Creative Players
return;
}
for(BlockSpawnTrigger spawnTrigger : blockSpawnTriggers) {
spawnTrigger.onBlockHarvest(world, player, pos, state, 0, 0, false);
}
state = block.getDefaultState();
world.setBlockState(pos, state);
}
}
those are the main parts i added to the lycanites mod as well as the stuff to register the events i can supply all files if needed
why dont you fire a forge event instead? i dont see why you need to tinker with lyca code at all
lycanites picks up BlockEvent.HarvestDropsEvent. If thats fired by xpfromharvest rightclickharvesting then it should be fine
the way the rightclick harvesting worked didnt fire a BlockEvent.HarvestDropsEvent it looked at the block you were clicking on and ran it on a array of whitelisted blocks then spawned in xp orbs and dropped the items then reset the block to its orgin state from what i understand im not the best with java ive only ever had to use it once before for making a phone app to scan barcodes years ago
😛 me neither. afaik you can fire events yourself
and i thought, since you change the xpfromharvest code anyway, why not also add that line
should work via MinecraftForge.EVENT_BUS.post(event)
possibly need to
import net.minecraftforge.common.MinecraftForge;
wouldnt firing the event to harvest break the crops? i dont know how they work