-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix duplicate deps crashing server on NeoForge/Forge (#1662)
* fix forge JIJ locator; support forge transforming BucketItem.fluid * fix forge crashing GameTest * Fix duplicated dependencies causing module resolution failure; Fixes #1011 * Fix forge launch crashing! * Remove redundant injection. * Move forge injection to corresponding bootstrap class * Move forge injection to corresponding bootstrap class * Add a check to avoid possible redundant modification of ModDiscoverer * We don't need to check since ModBootstrap won't run in application bootstrap mode
- Loading branch information
1 parent
329f5cb
commit 7cc6e16
Showing
40 changed files
with
554 additions
and
156 deletions.
There are no files selected for viewing
10 changes: 0 additions & 10 deletions
10
.../izzel/arclight/common/bridge/core/network/handshake/ServerHandshakeNetHandlerBridge.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...n/java/io/izzel/arclight/common/mixin/vanilla/world/entity/animal/SheepMixin_Vanilla.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.izzel.arclight.common.mixin.vanilla.world.entity.animal; | ||
|
||
import io.izzel.arclight.common.mixin.core.world.entity.animal.AnimalMixin; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(net.minecraft.world.entity.animal.Sheep.class) | ||
public abstract class SheepMixin_Vanilla extends AnimalMixin { | ||
@Inject(method = "shear", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/animal/Sheep;spawnAtLocation(Lnet/minecraft/world/level/ItemLike;I)Lnet/minecraft/world/entity/item/ItemEntity;")) | ||
private void arclight$forceDrop(CallbackInfo ci) { forceDrops = true; } | ||
|
||
@Inject(method = "shear", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/world/entity/animal/Sheep;spawnAtLocation(Lnet/minecraft/world/level/ItemLike;I)Lnet/minecraft/world/entity/item/ItemEntity;")) | ||
private void arclight$forceDropReset(CallbackInfo ci) { forceDrops = false; } | ||
} |
24 changes: 24 additions & 0 deletions
24
...in/java/io/izzel/arclight/common/mixin/vanilla/world/entity/animal/WolfMixin_Vanilla.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.izzel.arclight.common.mixin.vanilla.world.entity.animal; | ||
|
||
import io.izzel.arclight.common.mixin.core.world.entity.animal.TameableAnimalMixin; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.animal.Wolf; | ||
import net.minecraft.world.entity.player.Player; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(Wolf.class) | ||
public abstract class WolfMixin_Vanilla extends TameableAnimalMixin { | ||
@Inject(method = "mobInteract", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/animal/Wolf;spawnAtLocation(Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/entity/item/ItemEntity;")) | ||
private void arclight$forceDropPre(Player player, InteractionHand interactionHand, CallbackInfoReturnable<InteractionResult> cir) { | ||
this.forceDrops = true; | ||
} | ||
|
||
@Inject(method = "mobInteract", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/world/entity/animal/Wolf;spawnAtLocation(Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/entity/item/ItemEntity;")) | ||
private void arclight$forceDropPost(Player player, InteractionHand interactionHand, CallbackInfoReturnable<InteractionResult> cir) { | ||
this.forceDrops = false; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ommon/mixin/vanilla/world/level/block/entity/AbstractFurnaceBlockEntityMixin_Vanilla.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,39 @@ | ||
package io.izzel.arclight.common.mixin.vanilla.world.level.block.entity; | ||
|
||
import io.izzel.arclight.mixin.Decorate; | ||
import io.izzel.arclight.mixin.DecorationOps; | ||
import io.izzel.arclight.mixin.Local; | ||
import net.minecraft.core.NonNullList; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.craftbukkit.v.block.CraftBlock; | ||
import org.bukkit.craftbukkit.v.inventory.CraftItemStack; | ||
import org.bukkit.event.inventory.FurnaceSmeltEvent; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(AbstractFurnaceBlockEntity.class) | ||
public abstract class AbstractFurnaceBlockEntityMixin_Vanilla { | ||
|
||
@Decorate(method = "burn", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/core/NonNullList;get(I)Ljava/lang/Object;")) | ||
private static <E> E arclight$furnaceSmelt(NonNullList<E> instance, int i, @Local(ordinal = 0) AbstractFurnaceBlockEntity blockEntity, @Local(ordinal = -1) ItemStack itemStack2, @Local(ordinal = -2) ItemStack itemStack1) throws Throwable { | ||
CraftItemStack source = CraftItemStack.asCraftMirror(itemStack1); | ||
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemStack2); | ||
|
||
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos()), source, result); | ||
Bukkit.getPluginManager().callEvent(furnaceSmeltEvent); | ||
|
||
if (furnaceSmeltEvent.isCancelled()) { | ||
return (E) DecorationOps.cancel().invoke(false); | ||
} | ||
|
||
result = furnaceSmeltEvent.getResult(); | ||
itemStack2 = CraftItemStack.asNMSCopy(result); | ||
if (itemStack2.isEmpty()) { | ||
itemStack1.shrink(1); | ||
return (E) DecorationOps.cancel().invoke(true); | ||
} | ||
return (E) DecorationOps.callsite().invoke(instance, i); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.