Skip to content

Fix (some) compile issues#1602

Closed
Onako2 wants to merge 2 commits into
PurpurMC:ver/1.21.3from
Onako2:fix-compile-issues
Closed

Fix (some) compile issues#1602
Onako2 wants to merge 2 commits into
PurpurMC:ver/1.21.3from
Onako2:fix-compile-issues

Conversation

@Onako2

@Onako2 Onako2 commented Oct 26, 2024

Copy link
Copy Markdown
Contributor

This pull request issue fixes some compile issues.
This can be merged now or later depending on when the person merging this wants to work on compile issues :) .

@granny granny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've already gone through and fixed the compilation issues myself, but I thought it could be a nice learning experience for you to see what you might've missed with your changes. Thanks for trying anyway!

int i = EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingEntity);
+ // Purpur start - Add an option to fix MC-3304 projectile looting
+ if (org.purpurmc.purpur.PurpurConfig.fixProjectileLootingTransfer && context.getParamOrNull(LootContextParams.DIRECT_ATTACKING_ENTITY) instanceof net.minecraft.world.entity.projectile.AbstractArrow arrow) {
+ if (org.purpurmc.purpur.PurpurConfig.fixProjectileLootingTransfer && context.getParameter(LootContextParams.DIRECT_ATTACKING_ENTITY) instanceof net.minecraft.world.entity.projectile.AbstractArrow arrow) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

getOptionalParameter is the replacement for getParamOrNull

+ return InteractionResult.CONSUME;
+ }
+ return net.minecraft.world.ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
+ return InteractionResult.PASS;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The replacement for ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION is InteractionResult.TRY_WITH_EMPTY_HAND

if (entity.isOnFire() && entity.mayInteract(worldserver, pos)) {
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !(worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player))) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !((worldserver.purpurConfig.powderSnowBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) || entity instanceof Player))) { // Purpur
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !((worldserver.purpurConfig.powderSnowBypassMobGriefing || ((ServerLevel) world).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) || entity instanceof Player))) { // Purpur

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line exists under an if statement that calls world instanceof ServerLevel worldserver, which means world should be worldserver.

Comment on lines -6491 to +6492
+ boolean hurt = target.hurt(target.damageSources().mobProjectile(this, (LivingEntity) shooter), level().purpurConfig.phantomFlameDamage);
+ if (hurt && level().purpurConfig.phantomFlameFireTime > 0) {
+ target.hurt(target.damageSources().mobProjectile(this, (LivingEntity) shooter), level().purpurConfig.phantomFlameDamage);
+ if (level().purpurConfig.phantomFlameFireTime > 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Entity#hurt() is replaced by Entity#hurtServer(). The boolean should not be removed.

@granny granny closed this Oct 27, 2024
@Onako2 Onako2 deleted the fix-compile-issues branch November 20, 2024 13:42
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