-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'OpenCubicChunks:MC_1.20_neoforge' into MC_1.20_neoforge…
…_clientlevel
- Loading branch information
Showing
29 changed files
with
1,657 additions
and
192 deletions.
There are no files selected for viewing
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
258 changes: 99 additions & 159 deletions
258
src/main/java/io/github/opencubicchunks/cubicchunks/mixin/ASMConfigPlugin.java
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
src/main/java/io/github/opencubicchunks/cubicchunks/mixin/CopyFrom.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,7 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin; | ||
|
||
public @interface CopyFrom { | ||
Class<?> clazz() default Object.class; | ||
|
||
String string() default ""; | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/io/github/opencubicchunks/cubicchunks/mixin/TransformFromClass.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,7 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin; | ||
|
||
public @interface TransformFromClass { | ||
CopyFrom value(); | ||
|
||
TransformFrom.ApplicationStage stage() default TransformFrom.ApplicationStage.PRE_APPLY; | ||
} |
22 changes: 0 additions & 22 deletions
22
src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/TestMixin.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
...hub/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/MixinChunkAccess.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,30 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.world.level.chunk; | ||
|
||
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.CloAccess; | ||
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.CloPos; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.world.level.ChunkPos; | ||
import net.minecraft.world.level.LevelHeightAccessor; | ||
import net.minecraft.world.level.chunk.ChunkAccess; | ||
import net.minecraft.world.level.chunk.LevelChunkSection; | ||
import net.minecraft.world.level.chunk.UpgradeData; | ||
import net.minecraft.world.level.levelgen.blending.BlendingData; | ||
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(ChunkAccess.class) | ||
public abstract class MixinChunkAccess implements CloAccess { | ||
private CloPos cc_cloPos; | ||
|
||
@Inject(method = "<init>", at = @At("RETURN")) | ||
private void onInit(ChunkPos chunkPos, UpgradeData p_187622_, LevelHeightAccessor p_187623_, Registry p_187624_, long p_187625_, LevelChunkSection[] p_187626_, BlendingData p_187627_, | ||
CallbackInfo ci) { | ||
cc_cloPos = CloPos.chunk(chunkPos); | ||
} | ||
|
||
public CloPos cc_getCloPos() { | ||
return cc_cloPos; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...ncubicchunks/cubicchunks/mixin/core/common/world/level/chunk/MixinImposterProtoChunk.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,17 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.world.level.chunk; | ||
|
||
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.ImposterProtoClo; | ||
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.LevelClo; | ||
import net.minecraft.world.level.chunk.ImposterProtoChunk; | ||
import net.minecraft.world.level.chunk.LevelChunk; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(ImposterProtoChunk.class) | ||
public abstract class MixinImposterProtoChunk implements ImposterProtoClo { | ||
@Override public LevelClo cc_getWrappedClo() { | ||
return (LevelClo) this.getWrapped(); | ||
} | ||
|
||
@Shadow public abstract LevelChunk getWrapped(); | ||
} |
9 changes: 9 additions & 0 deletions
9
...thub/opencubicchunks/cubicchunks/mixin/core/common/world/level/chunk/MixinLevelChunk.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,9 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.world.level.chunk; | ||
|
||
import io.github.opencubicchunks.cubicchunks.world.level.chunklike.LevelClo; | ||
import net.minecraft.world.level.chunk.LevelChunk; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(LevelChunk.class) | ||
public abstract class MixinLevelChunk implements LevelClo { | ||
} |
9 changes: 9 additions & 0 deletions
9
...ithub/opencubicchunks/cubicchunks/mixin/core/common/world/level/cube/MixinCubeAccess.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,9 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.world.level.cube; | ||
|
||
import io.github.opencubicchunks.cubicchunks.world.level.cube.CubeAccess; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
// Needed for DASM to apply | ||
@Mixin(CubeAccess.class) | ||
public class MixinCubeAccess { | ||
} |
8 changes: 8 additions & 0 deletions
8
...ubicchunks/mixin/core/common/world/level/cube/MixinLevelCube$BoundTickingBlockEntity.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,8 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.world.level.cube; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
// Needed for DASM to apply | ||
@Mixin(targets = "io.github.opencubicchunks.cubicchunks.world.level.cube.LevelCube$BoundTickingBlockEntity") | ||
public class MixinLevelCube$BoundTickingBlockEntity { | ||
} |
8 changes: 8 additions & 0 deletions
8
...ixin/core/common/world/level/cube/MixinLevelCube$RebindableTickingBlockEntityWrapper.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,8 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.world.level.cube; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
// Needed for DASM to apply | ||
@Mixin(targets = "io.github.opencubicchunks.cubicchunks.world.level.cube.LevelCube$RebindableTickingBlockEntityWrapper") | ||
public class MixinLevelCube$RebindableTickingBlockEntityWrapper { | ||
} |
30 changes: 30 additions & 0 deletions
30
...github/opencubicchunks/cubicchunks/mixin/core/common/world/level/cube/MixinLevelCube.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,30 @@ | ||
package io.github.opencubicchunks.cubicchunks.mixin.core.common.world.level.cube; | ||
|
||
import io.github.opencubicchunks.cc_core.utils.Coords; | ||
import io.github.opencubicchunks.cubicchunks.world.level.cube.LevelCube; | ||
import net.minecraft.core.BlockPos; | ||
import org.spongepowered.asm.mixin.Dynamic; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
// Needed for DASM to apply | ||
@Mixin(LevelCube.class) | ||
public abstract class MixinLevelCube extends MixinCubeAccess { | ||
/** | ||
* Redirect to use cube section indexing instead of chunk section indexing | ||
*/ | ||
@Dynamic @Redirect(method = "cc_dasm$getBlockState", at = @At(value = "INVOKE", target = "Lio/github/opencubicchunks/cubicchunks/world/level/cube/LevelCube;getSectionIndex(I)I")) | ||
private int cc_onGetBlockState_SectionIndex(LevelCube instance, int i, BlockPos pos) { | ||
return Coords.blockToIndex(pos); | ||
} | ||
|
||
/** | ||
* Redirect to use cube section indexing instead of chunk section indexing | ||
*/ | ||
@Dynamic @Redirect(method = "cc_dasm$getFluidState(III)Lnet/minecraft/world/level/material/FluidState;", at = @At(value = "INVOKE", target = "Lio/github/opencubicchunks/cubicchunks" | ||
+ "/world/level/cube/LevelCube;getSectionIndex(I)I")) | ||
private int cc_onGetFluidState_SectionIndex(LevelCube instance, int i, int x, int y, int z) { | ||
return Coords.blockToIndex(x, y, z); | ||
} | ||
} |
152 changes: 151 additions & 1 deletion
152
src/main/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/CloAccess.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,4 +1,154 @@ | ||
package io.github.opencubicchunks.cubicchunks.world.level.chunklike; | ||
|
||
public interface CloAccess { | ||
import java.util.Collection; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.function.BiConsumer; | ||
import java.util.function.Function; | ||
import java.util.function.Predicate; | ||
import java.util.function.Supplier; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import it.unimi.dsi.fastutil.shorts.ShortList; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.LevelHeightAccessor; | ||
import net.minecraft.world.level.biome.BiomeGenerationSettings; | ||
import net.minecraft.world.level.biome.BiomeManager; | ||
import net.minecraft.world.level.biome.BiomeResolver; | ||
import net.minecraft.world.level.biome.Climate; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.chunk.ChunkAccess; | ||
import net.minecraft.world.level.chunk.ChunkStatus; | ||
import net.minecraft.world.level.chunk.LevelChunkSection; | ||
import net.minecraft.world.level.chunk.LightChunk; | ||
import net.minecraft.world.level.chunk.StructureAccess; | ||
import net.minecraft.world.level.chunk.UpgradeData; | ||
import net.minecraft.world.level.gameevent.GameEventListenerRegistry; | ||
import net.minecraft.world.level.levelgen.BelowZeroRetrogen; | ||
import net.minecraft.world.level.levelgen.Heightmap; | ||
import net.minecraft.world.level.levelgen.NoiseChunk; | ||
import net.minecraft.world.level.levelgen.blending.BlendingData; | ||
import net.minecraft.world.level.levelgen.structure.Structure; | ||
import net.minecraft.world.level.levelgen.structure.StructureStart; | ||
import net.minecraft.world.level.material.Fluid; | ||
import net.minecraft.world.ticks.TickContainerAccess; | ||
|
||
public interface CloAccess extends BlockGetter, BiomeManager.NoiseBiomeSource, LightChunk, StructureAccess { | ||
GameEventListenerRegistry getListenerRegistry(int p_251437_); | ||
|
||
@Nullable BlockState setBlockState(BlockPos p_62087_, BlockState p_62088_, boolean p_62089_); | ||
|
||
void setBlockEntity(BlockEntity p_156114_); | ||
|
||
void addEntity(Entity p_62078_); | ||
|
||
int getHighestFilledSectionIndex(); | ||
|
||
// Deprecated | ||
int getHighestSectionPosition(); | ||
|
||
Set<BlockPos> getBlockEntitiesPos(); | ||
|
||
LevelChunkSection[] getSections(); | ||
|
||
LevelChunkSection getSection(int p_187657_); | ||
|
||
Collection<Map.Entry<Heightmap.Types, Heightmap>> getHeightmaps(); | ||
|
||
void setHeightmap(Heightmap.Types p_62083_, long[] p_62084_); | ||
|
||
Heightmap getOrCreateHeightmapUnprimed(Heightmap.Types p_62079_); | ||
|
||
boolean hasPrimedHeightmap(Heightmap.Types p_187659_); | ||
|
||
int getHeight(Heightmap.Types p_62080_, int p_62081_, int p_62082_); | ||
|
||
// replacement of ChunkPos getPos() | ||
CloPos cc_getCloPos(); | ||
|
||
Map<Structure, StructureStart> getAllStarts(); | ||
|
||
void setAllStarts(Map<Structure, StructureStart> p_62090_); | ||
|
||
boolean isYSpaceEmpty(int p_62075_, int p_62076_); | ||
|
||
void setUnsaved(boolean p_62094_); | ||
|
||
boolean isUnsaved(); | ||
|
||
ChunkStatus getStatus(); | ||
|
||
ChunkStatus getHighestGeneratedStatus(); | ||
|
||
void removeBlockEntity(BlockPos p_62101_); | ||
|
||
void markPosForPostprocessing(BlockPos p_62102_); | ||
|
||
ShortList[] getPostProcessing(); | ||
|
||
void addPackedPostProcess(short p_62092_, int p_62093_); | ||
|
||
void setBlockEntityNbt(CompoundTag p_62091_); | ||
|
||
@Nullable CompoundTag getBlockEntityNbt(BlockPos p_62103_); | ||
|
||
@Nullable CompoundTag getBlockEntityNbtForSaving(BlockPos p_62104_); | ||
|
||
void findBlocks(Predicate<BlockState> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_); | ||
|
||
void findBlocks(java.util.function.BiPredicate<BlockState, BlockPos> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_); | ||
|
||
TickContainerAccess<Block> getBlockTicks(); | ||
|
||
TickContainerAccess<Fluid> getFluidTicks(); | ||
|
||
ChunkAccess.TicksToSave getTicksForSerialization(); | ||
|
||
UpgradeData getUpgradeData(); | ||
|
||
boolean isOldNoiseGeneration(); | ||
|
||
@Nullable BlendingData getBlendingData(); | ||
|
||
void setBlendingData(BlendingData p_187646_); | ||
|
||
long getInhabitedTime(); | ||
|
||
void incrementInhabitedTime(long p_187633_); | ||
|
||
void setInhabitedTime(long p_62099_); | ||
|
||
boolean isLightCorrect(); | ||
|
||
void setLightCorrect(boolean p_62100_); | ||
|
||
NoiseChunk getOrCreateNoiseChunk(Function<CloAccess, NoiseChunk> p_223013_); | ||
|
||
@Deprecated BiomeGenerationSettings carverBiome(Supplier<BiomeGenerationSettings> p_223015_); | ||
|
||
void fillBiomesFromNoise(BiomeResolver p_187638_, Climate.Sampler p_187639_); | ||
|
||
boolean hasAnyStructureReferences(); | ||
|
||
@Nullable BelowZeroRetrogen getBelowZeroRetrogen(); | ||
|
||
boolean isUpgrading(); | ||
|
||
LevelHeightAccessor getHeightAccessorForGeneration(); | ||
|
||
void initializeLightSources(); | ||
|
||
// TODO static methods | ||
// static ShortList getOrCreateOffsetList(ShortList[] p_62096_, int p_62097_); | ||
// | ||
// static record TicksToSave(SerializableTickContainer<Block> blocks, SerializableTickContainer<Fluid> fluids); | ||
|
||
// TODO forge method | ||
// @Nullable public net.minecraft.world.level.LevelAccessor getWorldForge() { return null; } | ||
} |
1 change: 1 addition & 0 deletions
1
...in/java/io/github/opencubicchunks/cubicchunks/world/level/chunklike/ImposterProtoClo.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,4 +1,5 @@ | ||
package io.github.opencubicchunks.cubicchunks.world.level.chunklike; | ||
|
||
public interface ImposterProtoClo extends ProtoClo { | ||
LevelClo cc_getWrappedClo(); | ||
} |
Oops, something went wrong.