mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-17 21:55:12 +00:00
Update to Minecraft 1.17.1
- Remap everything to use MojMap class names too. This is what Forge
uses, so \o/.
This does NOT currently rename any classes to use suffix notation or
BlockEntity. That will come in a later change. We do however rename
references of "World" to "Level".
- Move the test mod into a separate "cctest" source set. As Forge now
works using Jigsaw we cannot have multiple mods defining the same
package, which causes problems with our JUnit test classes.
- Remove our custom test framework and replace it with vanilla's (this
is no longer stripped from the jar). RIP kotlin coroutines.
It's still worth using Kotlin here though, just for extension
methods.
- Other 1.17-related changes:
- Use separate tile/block entity tick methods for server and client
side, often avoiding ticking at all on the client.
- Switch much of the monitor rendering code to use vanilla's
built-in shader system. It's still an incredibly ugly hack, so not
really expecting this to work with any rendering mods, but we'll
cross that bridge when we come to it.
This commit is contained in:
@@ -8,10 +8,10 @@ package dan200.computercraft.shared.util;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.common.TileGeneric;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ITickList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.TickList;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -21,7 +21,7 @@ import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A thread-safe version of {@link ITickList#scheduleTick(BlockPos, Object, int)}.
|
||||
* A thread-safe version of {@link TickList#scheduleTick(BlockPos, Object, int)}.
|
||||
*
|
||||
* We use this when modems and other peripherals change a block in a different thread.
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ public final class TickScheduler
|
||||
{
|
||||
}
|
||||
|
||||
private static final Set<TileEntity> toTick = Collections.newSetFromMap(
|
||||
private static final Set<BlockEntity> toTick = Collections.newSetFromMap(
|
||||
new MapMaker()
|
||||
.weakKeys()
|
||||
.makeMap()
|
||||
@@ -40,7 +40,7 @@ public final class TickScheduler
|
||||
|
||||
public static void schedule( TileGeneric tile )
|
||||
{
|
||||
World world = tile.getLevel();
|
||||
Level world = tile.getLevel();
|
||||
if( world != null && !world.isClientSide ) toTick.add( tile );
|
||||
}
|
||||
|
||||
@@ -49,13 +49,13 @@ public final class TickScheduler
|
||||
{
|
||||
if( event.phase != TickEvent.Phase.START ) return;
|
||||
|
||||
Iterator<TileEntity> iterator = toTick.iterator();
|
||||
Iterator<BlockEntity> iterator = toTick.iterator();
|
||||
while( iterator.hasNext() )
|
||||
{
|
||||
TileEntity tile = iterator.next();
|
||||
BlockEntity tile = iterator.next();
|
||||
iterator.remove();
|
||||
|
||||
World world = tile.getLevel();
|
||||
Level world = tile.getLevel();
|
||||
BlockPos pos = tile.getBlockPos();
|
||||
|
||||
if( world != null && pos != null && world.isAreaLoaded( pos, 0 ) && world.getBlockEntity( pos ) == tile )
|
||||
|
||||
Reference in New Issue
Block a user