mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-20 15:51:11 +00:00
Merge branch 'ver/6.5.0' into dev/7.0-2
This commit is contained in:
@@ -3,6 +3,7 @@ package com.dfsek.terra.mod;
|
||||
import com.dfsek.tectonic.api.TypeRegistry;
|
||||
import com.dfsek.tectonic.api.depth.DepthTracker;
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.boss.dragon.EnderDragonFight;
|
||||
@@ -124,6 +125,8 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
|
||||
public abstract Registry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterListRegistry();
|
||||
|
||||
public abstract Registry<Enchantment> enchantmentRegistry();
|
||||
|
||||
@Override
|
||||
public @NotNull WorldHandle getWorldHandle() {
|
||||
return worldHandle;
|
||||
@@ -133,4 +136,6 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
public @NotNull ItemHandle getItemHandle() {
|
||||
return itemHandle;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.command.argument.ParticleEffectArgumentType;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.world.biome.BiomeParticleConfig;
|
||||
|
||||
|
||||
@@ -27,7 +28,7 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticle
|
||||
|
||||
try {
|
||||
return new BiomeParticleConfig(
|
||||
ParticleEffectArgumentType.readParameters(new StringReader(particle), Registries.PARTICLE_TYPE.getReadOnlyWrapper()),
|
||||
ParticleEffectArgumentType.readParameters(new StringReader(particle), (RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE.getReadOnlyWrapper()),
|
||||
probability);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.mod.data;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
@@ -34,19 +35,19 @@ public final class Codecs {
|
||||
"No such config pack " +
|
||||
id)))));
|
||||
|
||||
public static final Codec<TerraBiomeSource> TERRA_BIOME_SOURCE = RecordCodecBuilder
|
||||
.create(instance -> instance.group(
|
||||
public static final MapCodec<TerraBiomeSource> TERRA_BIOME_SOURCE = RecordCodecBuilder
|
||||
.mapCodec(instance -> instance.group(
|
||||
CONFIG_PACK.fieldOf("pack")
|
||||
.stable()
|
||||
.forGetter(TerraBiomeSource::getPack))
|
||||
.apply(instance, instance.stable(TerraBiomeSource::new)));
|
||||
|
||||
public static final Codec<ConstantRange> TERRA_CONSTANT_RANGE = RecordCodecBuilder.create(range -> range.group(
|
||||
public static final Codec<ConstantRange> TERRA_CONSTANT_RANGE = RecordCodecBuilder.mapCodec(range -> range.group(
|
||||
Codec.INT.fieldOf("min").stable().forGetter(ConstantRange::getMin),
|
||||
Codec.INT.fieldOf("max").stable().forGetter(ConstantRange::getMax)).apply(range, range.stable(ConstantRange::new)));
|
||||
|
||||
public static final Codec<GenerationSettings> TERRA_GENERATION_SETTINGS = RecordCodecBuilder
|
||||
.create(instance -> instance.group(
|
||||
.mapCodec(instance -> instance.group(
|
||||
TERRA_CONSTANT_RANGE.fieldOf("height").stable().forGetter(GenerationSettings::height),
|
||||
Codec.INT.fieldOf("sea_level").forGetter(GenerationSettings::sealevel),
|
||||
Codec.BOOL.fieldOf("mob_generation").forGetter(GenerationSettings::mobGeneration),
|
||||
|
||||
+4
-3
@@ -18,6 +18,7 @@
|
||||
package com.dfsek.terra.mod.generation;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
@@ -86,7 +87,7 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Codec<? extends net.minecraft.world.gen.chunk.ChunkGenerator> getCodec() {
|
||||
protected MapCodec<? extends net.minecraft.world.gen.chunk.ChunkGenerator> getCodec() {
|
||||
return Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER;
|
||||
}
|
||||
|
||||
@@ -107,8 +108,8 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig,
|
||||
StructureAccessor structureAccessor, Chunk chunk) {
|
||||
public CompletableFuture<Chunk> populateNoise(Blender blender, NoiseConfig noiseConfig, StructureAccessor structureAccessor,
|
||||
Chunk chunk) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
ProtoWorld world = (ProtoWorld) ((StructureAccessorAccessor) structureAccessor).getWorld();
|
||||
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@
|
||||
package com.dfsek.terra.mod.generation;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
@@ -47,7 +48,7 @@ public class TerraBiomeSource extends BiomeSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Codec<? extends BiomeSource> getCodec() {
|
||||
protected MapCodec<? extends BiomeSource> getCodec() {
|
||||
return Codecs.TERRA_BIOME_SOURCE;
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -25,10 +25,13 @@ import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.registry.RegistryWrapper.Impl;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.dfsek.terra.api.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.inventory.Item;
|
||||
@@ -43,8 +46,13 @@ public class MinecraftItemHandle implements ItemHandle {
|
||||
try {
|
||||
return (Item) new ItemStackArgumentType(new CommandRegistryAccess() {
|
||||
@Override
|
||||
public <T> RegistryWrapper<T> createWrapper(RegistryKey<? extends Registry<T>> registryRef) {
|
||||
return CommonPlatform.get().getServer().getRegistryManager().getWrapperOrThrow(registryRef);
|
||||
public Stream<RegistryKey<? extends Registry<?>>> streamAllRegistryKeys() {
|
||||
return CommonPlatform.get().getServer().getRegistryManager().streamAllRegistryKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<Impl<T>> getOptionalWrapper(RegistryKey<? extends Registry<? extends T>> registryRef) {
|
||||
return Optional.of(CommonPlatform.get().getServer().getRegistryManager().getWrapperOrThrow(registryRef));
|
||||
}
|
||||
}).parse(new StringReader(data)).getItem();
|
||||
} catch(CommandSyntaxException e) {
|
||||
@@ -54,11 +62,11 @@ public class MinecraftItemHandle implements ItemHandle {
|
||||
|
||||
@Override
|
||||
public Enchantment getEnchantment(String id) {
|
||||
return (Enchantment) (Registries.ENCHANTMENT.get(Identifier.tryParse(id)));
|
||||
return (Enchantment) (Object) (CommonPlatform.get().enchantmentRegistry().get(Identifier.tryParse(id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Enchantment> getEnchantments() {
|
||||
return Registries.ENCHANTMENT.stream().map(enchantment -> (Enchantment) enchantment).collect(Collectors.toSet());
|
||||
return CommonPlatform.get().enchantmentRegistry().stream().map(enchantment -> (Enchantment) (Object) enchantment).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -48,9 +48,9 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
|
||||
@Shadow
|
||||
public abstract MobSpawnerLogic getLogic();
|
||||
|
||||
//method_46408
|
||||
@Shadow
|
||||
public abstract void method_46408(net.minecraft.entity.EntityType<?> entityType, Random random);
|
||||
public abstract void setEntityType(net.minecraft.entity.EntityType<?> entityType, Random random);
|
||||
|
||||
public EntityType terra$getSpawnedType() {
|
||||
return (EntityType) Registries.ENTITY_TYPE.get(
|
||||
@@ -64,7 +64,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
||||
} else {
|
||||
rand = Random.create();
|
||||
}
|
||||
method_46408((net.minecraft.entity.EntityType<?>) creatureType, rand);
|
||||
setEntityType((net.minecraft.entity.EntityType<?>) creatureType, rand);
|
||||
}
|
||||
|
||||
public int terra$getDelay() {
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package com.dfsek.terra.mod.mixin.implementations.terra.block.state;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap;
|
||||
import net.minecraft.block.AbstractBlock.AbstractBlockState;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.registry.Registries;
|
||||
@@ -24,7 +25,7 @@ import com.dfsek.terra.mod.mixin.access.StateAccessor;
|
||||
@Mixin(AbstractBlockState.class)
|
||||
@Implements(@Interface(iface = BlockState.class, prefix = "terra$"))
|
||||
public abstract class BlockStateMixin extends State<Block, net.minecraft.block.BlockState> {
|
||||
private BlockStateMixin(Block owner, ImmutableMap<net.minecraft.state.property.Property<?>, Comparable<?>> entries,
|
||||
private BlockStateMixin(Block owner, Reference2ObjectArrayMap<net.minecraft.state.property.Property<?>, Comparable<?>> entries,
|
||||
MapCodec<net.minecraft.block.BlockState> codec) {
|
||||
super(owner, entries, codec);
|
||||
}
|
||||
|
||||
+2
-2
@@ -39,14 +39,14 @@ public abstract class EntityMixin {
|
||||
private BlockPos blockPos;
|
||||
|
||||
@Shadow
|
||||
public abstract void teleport(double destX, double destY, double destZ);
|
||||
public abstract void updatePosition(double destX, double destY, double destZ);
|
||||
|
||||
public Vector3 terra$position() {
|
||||
return MinecraftAdapter.adapt(blockPos);
|
||||
}
|
||||
|
||||
public void terra$position(Vector3 location) {
|
||||
teleport(location.getX(), location.getY(), location.getZ());
|
||||
updatePosition(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
public ServerWorld terra$world() {
|
||||
|
||||
+3
-2
@@ -30,7 +30,7 @@ import com.dfsek.terra.api.inventory.ItemStack;
|
||||
@Implements(@Interface(iface = com.dfsek.terra.api.inventory.Item.class, prefix = "terra$"))
|
||||
public abstract class ItemMixin {
|
||||
@Shadow
|
||||
public abstract int getMaxDamage();
|
||||
public abstract net.minecraft.item.ItemStack getDefaultStack();
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public ItemStack terra$newItemStack(int amount) {
|
||||
@@ -38,6 +38,7 @@ public abstract class ItemMixin {
|
||||
}
|
||||
|
||||
public double terra$getMaxDurability() {
|
||||
return getMaxDamage();
|
||||
//TODO verify this is correct
|
||||
return getDefaultStack().getMaxDamage();
|
||||
}
|
||||
}
|
||||
|
||||
+17
-2
@@ -17,9 +17,14 @@
|
||||
|
||||
package com.dfsek.terra.mod.mixin.implementations.terra.inventory.item;
|
||||
|
||||
import net.minecraft.component.Component;
|
||||
import net.minecraft.component.ComponentChanges;
|
||||
import net.minecraft.component.ComponentMap;
|
||||
import net.minecraft.component.ComponentMapImpl;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Implements;
|
||||
import org.spongepowered.asm.mixin.Interface;
|
||||
import org.spongepowered.asm.mixin.Intrinsic;
|
||||
@@ -46,7 +51,11 @@ public abstract class ItemStackMixin {
|
||||
public abstract boolean isDamageable();
|
||||
|
||||
@Shadow
|
||||
public abstract void setNbt(@Nullable NbtCompound tag);
|
||||
public abstract ComponentMap getComponents();
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private ComponentMapImpl components;
|
||||
|
||||
public int terra$getAmount() {
|
||||
return getCount();
|
||||
@@ -66,7 +75,13 @@ public abstract class ItemStackMixin {
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public void terra$setItemMeta(ItemMeta meta) {
|
||||
setNbt(((ItemStack) (Object) meta).getNbt());
|
||||
ComponentChanges.Builder builder = ComponentChanges.builder();
|
||||
this.getComponents().getTypes().forEach(builder::remove);
|
||||
|
||||
ComponentMap components = ((ItemStack) (Object) meta).getComponents();
|
||||
components.forEach(builder::add);
|
||||
|
||||
this.components.applyChanges(builder.build());
|
||||
}
|
||||
|
||||
@Intrinsic
|
||||
|
||||
+11
-3
@@ -17,8 +17,13 @@
|
||||
|
||||
package com.dfsek.terra.mod.mixin.implementations.terra.inventory.meta;
|
||||
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.registry.entry.RegistryEntryList;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Implements;
|
||||
import org.spongepowered.asm.mixin.Interface;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -28,6 +33,8 @@ import java.util.Objects;
|
||||
|
||||
import com.dfsek.terra.api.inventory.ItemStack;
|
||||
|
||||
import static net.minecraft.enchantment.Enchantment.canBeCombined;
|
||||
|
||||
|
||||
@Mixin(Enchantment.class)
|
||||
@Implements(@Interface(iface = com.dfsek.terra.api.inventory.item.Enchantment.class, prefix = "terra$"))
|
||||
@@ -36,7 +43,8 @@ public abstract class EnchantmentMixin {
|
||||
public abstract boolean isAcceptableItem(net.minecraft.item.ItemStack stack);
|
||||
|
||||
@Shadow
|
||||
public abstract boolean canCombine(Enchantment other);
|
||||
@Final
|
||||
private RegistryEntryList<Enchantment> exclusiveSet;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public boolean terra$canEnchantItem(ItemStack itemStack) {
|
||||
@@ -44,10 +52,10 @@ public abstract class EnchantmentMixin {
|
||||
}
|
||||
|
||||
public boolean terra$conflictsWith(com.dfsek.terra.api.inventory.item.Enchantment other) {
|
||||
return !canCombine((Enchantment) other);
|
||||
return canBeCombined(RegistryEntry.of((Enchantment) (Object) this), RegistryEntry.of((Enchantment) (Object) other));
|
||||
}
|
||||
|
||||
public String terra$getID() {
|
||||
return Objects.requireNonNull(Registries.ENCHANTMENT.getId((Enchantment) (Object) this)).toString();
|
||||
return Objects.requireNonNull(CommonPlatform.get().enchantmentRegistry().getId((Enchantment) (Object) this)).toString();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-7
@@ -17,10 +17,12 @@
|
||||
|
||||
package com.dfsek.terra.mod.mixin.implementations.terra.inventory.meta;
|
||||
|
||||
import net.minecraft.component.type.ItemEnchantmentsComponent;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import org.spongepowered.asm.mixin.Implements;
|
||||
import org.spongepowered.asm.mixin.Interface;
|
||||
import org.spongepowered.asm.mixin.Intrinsic;
|
||||
@@ -42,13 +44,13 @@ public abstract class ItemStackMetaMixin {
|
||||
public abstract boolean hasEnchantments();
|
||||
|
||||
@Shadow
|
||||
public abstract NbtList getEnchantments();
|
||||
public abstract ItemEnchantmentsComponent getEnchantments();
|
||||
|
||||
@Shadow
|
||||
public abstract void addEnchantment(net.minecraft.enchantment.Enchantment enchantment, int level);
|
||||
public abstract void addEnchantment(RegistryEntry<net.minecraft.enchantment.Enchantment> enchantment, int level);
|
||||
|
||||
public void terra$addEnchantment(Enchantment enchantment, int level) {
|
||||
addEnchantment((net.minecraft.enchantment.Enchantment) enchantment, level);
|
||||
public void terra$addEnchantment(Enchantment enchantment, int level) { ;
|
||||
addEnchantment(RegistryEntry.of((net.minecraft.enchantment.Enchantment) (Object) enchantment), level);
|
||||
}
|
||||
|
||||
@Intrinsic(displace = true)
|
||||
@@ -56,9 +58,10 @@ public abstract class ItemStackMetaMixin {
|
||||
if(!hasEnchantments()) return Collections.emptyMap();
|
||||
Map<Enchantment, Integer> map = new HashMap<>();
|
||||
|
||||
getEnchantments().forEach(enchantment -> {
|
||||
NbtCompound eTag = (NbtCompound) enchantment;
|
||||
map.put((Enchantment) Registries.ENCHANTMENT.get(eTag.getInt("id")), eTag.getInt("lvl"));
|
||||
ItemEnchantmentsComponent enchantments = getEnchantments();
|
||||
enchantments.getEnchantments().forEach(enchantment -> {
|
||||
net.minecraft.enchantment.Enchantment enchantmentValue = enchantment.value();
|
||||
map.put((Enchantment) (Object) enchantmentValue, enchantments.getLevel(RegistryEntry.of(enchantmentValue)));
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
+8
-5
@@ -17,12 +17,16 @@
|
||||
|
||||
package com.dfsek.terra.mod.mixin.implementations.terra.world;
|
||||
|
||||
import com.dfsek.terra.mod.mixin.invoke.FluidBlockInvoker;
|
||||
|
||||
import net.minecraft.block.FluidBlock;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.util.collection.BoundedRegionArray;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkRegion;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkGenerationStep;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.tick.MultiTickScheduler;
|
||||
import net.minecraft.world.tick.OrderedTick;
|
||||
@@ -74,10 +78,9 @@ public abstract class ChunkRegionMixin {
|
||||
|
||||
|
||||
@Inject(at = @At("RETURN"),
|
||||
method = "<init>(Lnet/minecraft/server/world/ServerWorld;Ljava/util/List;Lnet/minecraft/world/chunk/ChunkStatus;I)V")
|
||||
public void injectConstructor(net.minecraft.server.world.ServerWorld world, List<net.minecraft.world.chunk.Chunk> list,
|
||||
ChunkStatus chunkStatus, int i,
|
||||
CallbackInfo ci) {
|
||||
method = "<init>(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/collection/BoundedRegionArray;Lnet/minecraft/world/chunk/ChunkGenerationStep;Lnet/minecraft/world/chunk/Chunk;)V")
|
||||
public void injectConstructor(net.minecraft.server.world.ServerWorld world, BoundedRegionArray chunks,
|
||||
ChunkGenerationStep generationStep, Chunk centerPos, CallbackInfo ci) {
|
||||
this.terra$config = ((ServerWorld) world).getPack();
|
||||
}
|
||||
|
||||
@@ -88,7 +91,7 @@ public abstract class ChunkRegionMixin {
|
||||
((ChunkRegion) (Object) this).setBlockState(pos, (net.minecraft.block.BlockState) data, physics ? 3 : 1042);
|
||||
if(physics && ((net.minecraft.block.BlockState) data).getBlock() instanceof FluidBlock) {
|
||||
fluidTickScheduler.scheduleTick(
|
||||
OrderedTick.create(((FluidBlock) ((net.minecraft.block.BlockState) data).getBlock()).getFluidState(
|
||||
OrderedTick.create((((FluidBlockInvoker) ((net.minecraft.block.BlockState) data).getBlock())).invokeGetFluidState(
|
||||
(net.minecraft.block.BlockState) data).getFluid(), pos));
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.dfsek.terra.mod.mixin.invoke;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FluidBlock;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
|
||||
@Mixin(FluidBlock.class)
|
||||
public interface FluidBlockInvoker {
|
||||
@Invoker("getFluidState")
|
||||
public FluidState invokeGetFluidState(BlockState state);
|
||||
}
|
||||
+9
-2
@@ -3,9 +3,12 @@ package com.dfsek.terra.mod.mixin.lifecycle;
|
||||
import net.minecraft.registry.DynamicRegistryManager;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.ReloadableRegistries;
|
||||
import net.minecraft.server.DataPackContents;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -16,11 +19,15 @@ import com.dfsek.terra.mod.util.TagUtil;
|
||||
|
||||
@Mixin(DataPackContents.class)
|
||||
public class DataPackContentsMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private ReloadableRegistries.Lookup reloadableRegistries;
|
||||
/*
|
||||
* #refresh populates all tags in the registries
|
||||
*/
|
||||
@Inject(method = "refresh(Lnet/minecraft/registry/DynamicRegistryManager;)V", at = @At("RETURN"))
|
||||
private void injectReload(DynamicRegistryManager dynamicRegistryManager, CallbackInfo ci) {
|
||||
@Inject(method = "refresh()V", at = @At("RETURN"))
|
||||
private void injectReload(CallbackInfo ci) {
|
||||
DynamicRegistryManager.Immutable dynamicRegistryManager = this.reloadableRegistries.getRegistryManager();
|
||||
TagUtil.registerWorldPresetTags(dynamicRegistryManager.get(RegistryKeys.WORLD_PRESET));
|
||||
|
||||
Registry<Biome> biomeRegistry = dynamicRegistryManager.get(RegistryKeys.BIOME);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class PresetUtil {
|
||||
platform.multiNoiseBiomeSourceParameterListRegistry();
|
||||
|
||||
|
||||
Identifier generatorID = Identifier.of("terra", pack.getID().toLowerCase(Locale.ROOT) + "/" + pack.getNamespace().toLowerCase(
|
||||
Identifier generatorID = Identifier.tryParse("terra:" + pack.getID().toLowerCase(Locale.ROOT) + "/" + pack.getNamespace().toLowerCase(
|
||||
Locale.ROOT));
|
||||
|
||||
PRESETS.add(generatorID);
|
||||
|
||||
@@ -2,3 +2,4 @@ accessWidener v1 named
|
||||
accessible class net/minecraft/world/biome/Biome$Weather
|
||||
accessible class net/minecraft/world/gen/WorldPresets$Registrar
|
||||
accessible field net/minecraft/world/dimension/DimensionOptionsRegistryHolder VANILLA_KEYS Ljava/util/Set;
|
||||
accessible class net/minecraft/registry/RegistryLoader$Loader
|
||||
@@ -2,7 +2,7 @@
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.dfsek.terra.mod.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"access.BiomeAccessor",
|
||||
"access.MobSpawnerLogicAccessor",
|
||||
|
||||
Reference in New Issue
Block a user