Skip to content

Commit cf63e89

Browse files

File tree

9 files changed

+249
-25
lines changed

9 files changed

+249
-25
lines changed

bootstrap/src/main/java/org/spongepowered/bootstrap/dev/DevClasspath.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static List<Path[]> resolve() {
5858

5959
final AtomicBoolean hasAPISourceSet = new AtomicBoolean(false);
6060

61+
boolean skipMixinExtras = false;
6162
for (final String str : cp) {
6263
final Path path = Paths.get(str);
6364
if (!Files.exists(path)) {
@@ -96,6 +97,9 @@ public static List<Path[]> resolve() {
9697
}
9798
break;
9899
case "", "vanilla", "forge", "neoforge":
100+
if ("forge".equals(projectName)) {
101+
skipMixinExtras = true;
102+
}
99103
final WeightedPath weightedPath = new WeightedPath(projectName.isEmpty() ? 1 : 2, path);
100104
switch (sourceSet.name()) {
101105
case "applaunchConfig":
@@ -132,6 +136,14 @@ public static List<Path[]> resolve() {
132136
}
133137
continue;
134138
}
139+
// We need to skip mixinextras-common in Forge's UserDev mode as this will cause duplicate module
140+
// errors with JPMS.
141+
if (fileName.startsWith("mixinextras-common") && skipMixinExtras) {
142+
if (Bootstrap.DEBUG) {
143+
System.out.println("Ignored: " + path);
144+
}
145+
continue;
146+
}
135147

136148
if (bootNames.contains(fileName) || fileName.startsWith("org.jacoco.core-") || fileName.startsWith("mockito-") || fileName.startsWith("objenesis-")) {
137149
if (Bootstrap.DEBUG) {
@@ -158,7 +170,7 @@ public static List<Path[]> resolve() {
158170
final List<Path[]> classpath = new ArrayList<>();
159171

160172
for (final Path lib : bootLibs) {
161-
classpath.add(new Path[] { lib });
173+
classpath.add(new Path[]{lib});
162174
}
163175

164176
for (final List<WeightedPath> sourceSets : bootUnions.values()) {

forge/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ name=SpongeForge
22
implementation=Forge
33
description=The SpongeAPI implementation for MinecraftForge
44

5-
forgeVersion=60.0.1
5+
forgeVersion=61.0.1
66
mixinConfigs=mixins.spongeforge.accessors.json,mixins.spongeforge.api.json,mixins.spongeforge.inventory.json,mixins.spongeforge.inventory.shared.json,mixins.spongeforge.core.json,mixins.spongeforge.core.shared.json,mixins.spongeforge.tracker.json

forge/src/mixins/java/org/spongepowered/forge/mixin/core/minecraftforge/registries/ForgeRegistryMixin_Forge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public abstract class ForgeRegistryMixin_Forge<V> {
5858
@Inject(method = "add(ILnet/minecraft/resources/Identifier;Ljava/lang/Object;Ljava/lang/String;)I", at = @At("TAIL"))
5959
public void forge$writeToParent(final int id, final Identifier key, final V value, final String owner, final CallbackInfoReturnable<Integer> cir) {
6060
final ResourceKey root = (ResourceKey) (Object) this.key.registry();
61-
final ResourceKey location = (ResourceKey) (Object) this.key.location();
61+
final var location = (ResourceKey) (Object) this.key.identifier();
6262

6363
if (!this.forge$warnedIfNoParent && this.forge$parents.isEmpty()) {
6464
// We only care about minecraft namespaced registries, as that is what we've got parents for.

forge/src/mixins/java/org/spongepowered/forge/mixin/core/server/ReloadableServerResourcesMixin_Forge.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import net.minecraft.server.RegistryLayer;
3434
import net.minecraft.server.ReloadableServerResources;
3535
import net.minecraft.server.packs.resources.ResourceManager;
36+
import net.minecraft.server.permissions.PermissionSet;
3637
import net.minecraft.world.flag.FeatureFlagSet;
3738
import org.spongepowered.asm.mixin.Mixin;
3839
import org.spongepowered.asm.mixin.injection.At;
@@ -44,9 +45,13 @@
4445
@Mixin(ReloadableServerResources.class)
4546
public abstract class ReloadableServerResourcesMixin_Forge {
4647

47-
@WrapOperation(method = "lambda$loadResources$1", at = @At(value = "NEW", target = "(Lnet/minecraft/core/LayeredRegistryAccess;Lnet/minecraft/core/HolderLookup$Provider;Lnet/minecraft/world/flag/FeatureFlagSet;Lnet/minecraft/commands/Commands$CommandSelection;Ljava/util/List;I)Lnet/minecraft/server/ReloadableServerResources;"))
48-
private static ReloadableServerResources impl$onCreateResources(final LayeredRegistryAccess<RegistryLayer> $$0, final HolderLookup.Provider $$1, final FeatureFlagSet $$2,
49-
final Commands.CommandSelection $$3, final List<?> $$4, final int $$5, final Operation<ReloadableServerResources> original, final @Local(argsOnly = true) ResourceManager resourceManager) {
48+
@WrapOperation(method = "lambda$loadResources$1", at = @At(value = "NEW",
49+
target = "(Lnet/minecraft/core/LayeredRegistryAccess;Lnet/minecraft/core/HolderLookup$Provider;Lnet/minecraft/world/flag/FeatureFlagSet;Lnet/minecraft/commands/Commands$CommandSelection;Ljava/util/List;Lnet/minecraft/server/permissions/PermissionSet;)Lnet/minecraft/server/ReloadableServerResources;"
50+
))
51+
private static ReloadableServerResources impl$onCreateResources(
52+
final LayeredRegistryAccess<RegistryLayer> $$0, final HolderLookup.Provider $$1, final FeatureFlagSet $$2,
53+
final Commands.CommandSelection $$3, final List<?> $$4, final PermissionSet $$5,
54+
final Operation<ReloadableServerResources> original, final @Local(argsOnly = true) ResourceManager resourceManager) {
5055
final ReloadableServerResources instance = original.call($$0, $$1, $$2, $$3, $$4, $$5);
5156
if (instance.getCommands().getDispatcher() instanceof final DelegatingCommandDispatcher delegatingCommandDispatcher) {
5257
delegatingCommandDispatcher.permissionService(((ResourceManagerBridge) resourceManager).bridge$services().permissionService());

forge/src/mixins/java/org/spongepowered/forge/mixin/core/world/entity/vehicle/BoatMixin_Forge.java renamed to forge/src/mixins/java/org/spongepowered/forge/mixin/core/world/entity/vehicle/boat/BoatMixin_Forge.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
* THE SOFTWARE.
2424
*/
25-
package org.spongepowered.forge.mixin.core.world.entity.vehicle;
25+
package org.spongepowered.forge.mixin.core.world.entity.vehicle.boat;
2626

2727
import net.minecraft.core.BlockPos;
2828
import net.minecraft.world.entity.Entity;
29-
import net.minecraft.world.entity.vehicle.AbstractBoat;
29+
import net.minecraft.world.entity.vehicle.boat.AbstractBoat;
3030
import net.minecraft.world.level.LevelReader;
3131
import net.minecraft.world.level.block.Blocks;
3232
import net.minecraft.world.level.block.state.BlockState;

forge/src/mixins/java/org/spongepowered/forge/mixin/core/world/level/block/entity/AbstractFurnaceBlockEntityMixin_Forge.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ public abstract class AbstractFurnaceBlockEntityMixin_Forge implements AbstractF
9999
final Cause cause = PhaseTracker.getInstance().currentCause();
100100
if (entity.cookingTimer == 0) { // Start
101101
final CookingEvent.Start event = SpongeEventFactory.createCookingEventStart(cause, (FurnaceBlockEntity) entityIn, Optional.of(fuel),
102-
Optional.of((CookingRecipe) recipe.value()), Optional.of((ResourceKey) (Object) recipe.id().location()));
102+
Optional.of((CookingRecipe) recipe.value()), Optional.of((ResourceKey) (Object) recipe.id().identifier()));
103103
SpongeCommon.post(event);
104104
return !event.isCancelled();
105105
} else { // Tick up
106106
final ItemStackSnapshot cooking = ItemStackUtil.snapshotOf(entity.items.getFirst());
107107
final CookingEvent.Tick event = SpongeEventFactory.createCookingEventTick(cause, (FurnaceBlockEntity) entityIn, cooking, Optional.of(fuel),
108-
Optional.of((CookingRecipe) recipe.value()), Optional.of((ResourceKey) (Object) recipe.id().location()));
108+
Optional.of((CookingRecipe) recipe.value()), Optional.of((ResourceKey) (Object) recipe.id().identifier()));
109109
SpongeCommon.post(event);
110110
return !event.isCancelled();
111111
}
@@ -122,7 +122,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Forge implements AbstractF
122122
final var recipe = entity.bridge$getCurrentRecipe();
123123
final ItemStackSnapshot cooking = ItemStackUtil.snapshotOf(entity.items.get(0));
124124
final CookingEvent.Tick event = SpongeEventFactory.createCookingEventTick(cause, (FurnaceBlockEntity) entityIn, cooking, Optional.of(fuel),
125-
recipe.map(r -> (CookingRecipe) r.value()), recipe.map(r -> (ResourceKey) (Object) r.id().location()));
125+
recipe.map(r -> (CookingRecipe) r.value()), recipe.map(r -> (ResourceKey) (Object) r.id().identifier()));
126126
SpongeCommon.post(event);
127127
if (event.isCancelled()) {
128128
return entity.cookingTimer; // dont tick down
@@ -174,7 +174,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Forge implements AbstractF
174174
}
175175
final Optional<ItemStackSnapshot> fuel = hasFuel && !slots.get(1).isEmpty() ? Optional.of(ItemStackUtil.snapshotOf(slots.get(1))) : Optional.empty();
176176
final CookingEvent.Finish event = SpongeEventFactory.createCookingEventFinish(PhaseTracker.getInstance().currentCause(), entity,
177-
fuel, Optional.of((CookingRecipe) recipe.value()), Optional.of((ResourceKey) (Object) recipe.id().location()), Collections.unmodifiableList(transactions));
177+
fuel, Optional.of((CookingRecipe) recipe.value()), Optional.of((ResourceKey) (Object) recipe.id().identifier()), Collections.unmodifiableList(transactions));
178178
SpongeCommon.post(event);
179179

180180
for (final SlotTransaction transaction : transactions) {

forge/src/mixins/resources/mixins.spongeforge.core.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"world.entity.LivingEntityMixin_Forge_Damage",
2626
"world.entity.item.ItemEntityMixin_Forge",
2727
"world.entity.player.PlayerMixin_Forge_Damage",
28-
"world.entity.vehicle.BoatMixin_Forge",
28+
"world.entity.vehicle.boat.BoatMixin_Forge",
2929
"world.level.ServerExplosionMixin_Forge",
3030
"world.level.block.FireBlockMixin_Forge",
3131
"world.level.block.entity.AbstractFurnaceBlockEntityMixin_Forge"

0 commit comments

Comments
 (0)