Fix runtime errors

This commit is contained in:
Zoe Gidiere 2024-10-09 16:41:04 -06:00
parent 2ccf8a8805
commit be7e10c30c
4 changed files with 9 additions and 12 deletions

View File

@ -76,6 +76,6 @@ public class MinecraftWorldHandle implements WorldHandle {
if(!id.contains(":")) throw new IllegalArgumentException("Invalid entity identifier " + id);
Identifier identifier = Identifier.tryParse(id);
if(identifier == null) identifier = Identifier.tryParse(id);
return (EntityType) Registries.ENTITY_TYPE.getEntry(identifier).orElseThrow();
return (EntityType) Registries.ENTITY_TYPE.getEntry(identifier).orElseThrow().value();
}
}

View File

@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Collection;
import java.util.List;
import com.dfsek.terra.api.block.state.properties.Property;
@ -24,7 +25,7 @@ public abstract class PropertyMixin<T> {
private String name;
@Shadow
public abstract Collection<T> getValues();
public abstract List<T> getValues();
@Intrinsic
public Collection<T> terra$values() {

View File

@ -49,9 +49,6 @@ public abstract class WorldChunkMixin {
@Nullable
public abstract net.minecraft.block.BlockState setBlockState(BlockPos pos, net.minecraft.block.BlockState state, boolean moved);
@Shadow
public abstract TickSchedulers getTickSchedulers();
public void terra$setBlock(int x, int y, int z, BlockState data, boolean physics) {
BlockPos blockPos = new BlockPos(x, y, z);
setBlockState(blockPos, (net.minecraft.block.BlockState) data, false);

View File

@ -1,7 +1,8 @@
package com.dfsek.terra.lifecycle.mixin.lifecycle;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.CombinedDynamicRegistries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.ServerDynamicRegistryType;
import net.minecraft.server.SaveLoading;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -18,13 +19,11 @@ public class SaveLoadingMixin {
"Ljava/util/concurrent/CompletableFuture;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/registry/RegistryLoader;loadFromResource(Lnet/minecraft/resource/ResourceManager;" +
"Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)" +
"Lnet/minecraft/registry/DynamicRegistryManager$Immutable;"),
target = "Lnet/minecraft/server/DataPackContents;reload(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/registry/CombinedDynamicRegistries;Ljava/util/List;Lnet/minecraft/resource/featuretoggle/FeatureSet;Lnet/minecraft/server/command/CommandManager$RegistrationEnvironment;ILjava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;"),
index = 1
)
private static DynamicRegistryManager grabManager(DynamicRegistryManager registryManager) {
MinecraftUtil.registerFlora(registryManager.getOrThrow(RegistryKeys.BIOME));
return registryManager;
private static CombinedDynamicRegistries<ServerDynamicRegistryType> grabManager(CombinedDynamicRegistries<ServerDynamicRegistryType> dynamicRegistries) {
MinecraftUtil.registerFlora(dynamicRegistries.getCombinedRegistryManager().getOrThrow(RegistryKeys.BIOME));
return dynamicRegistries;
}
}