mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-27 16:02:17 +00:00
Update to MC 1.18
Fabric api got rid of their BE syncing helper in favor of the vanilla system. In this commit BE syncing is probably horribly broken and needs to be looked over. I did the minimum to make it compile and run.
This commit is contained in:
parent
8983ecd03a
commit
34760d3de4
@ -7,7 +7,7 @@ plugins {
|
||||
id 'fabric-loom' version '0.10-SNAPSHOT'
|
||||
}
|
||||
|
||||
def javaVersion = JavaLanguageVersion.of(16)
|
||||
def javaVersion = JavaLanguageVersion.of(17)
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = javaVersion
|
||||
@ -83,8 +83,8 @@ dependencies {
|
||||
include 'com.electronwill.night-config:toml:3.6.3'
|
||||
include "me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}"
|
||||
|
||||
modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:6.0.254-alpha"
|
||||
modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:6.0.254-alpha"
|
||||
//modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:6.0.254-alpha"
|
||||
//modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:6.0.254-alpha"
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.0'
|
||||
|
@ -5,11 +5,10 @@ org.gradle.jvmargs=-Xmx1G
|
||||
mod_version=1.97.2
|
||||
|
||||
# Minecraft properties
|
||||
mc_version=1.17.1
|
||||
fabric_api_version=0.40.1+1.17
|
||||
fabric_loader_version=0.12.0
|
||||
mc_version=1.18
|
||||
fabric_api_version=0.43.1+1.18
|
||||
fabric_loader_version=0.12.8
|
||||
|
||||
cloth_api_version=2.0.54
|
||||
cloth_config_version=5.0.34
|
||||
jankson_version=1.2.0
|
||||
modmenu_version=2.0.2
|
||||
cloth_config_version=6.0.42
|
||||
modmenu_version=3.0.0
|
||||
|
@ -253,7 +253,7 @@ public class FakePlayer extends ServerPlayer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trackChunk( ChunkPos chunkPos, Packet<?> packet, Packet<?> packet2 )
|
||||
public void trackChunk( ChunkPos chunkPos, Packet<?> packet )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -71,12 +71,12 @@ public class DynamicImageButton extends Button
|
||||
RenderSystem.disableDepthTest();
|
||||
|
||||
int yTex = yTexStart;
|
||||
if( isHovered() ) yTex += yDiffTex;
|
||||
if( isHoveredOrFocused() ) yTex += yDiffTex;
|
||||
|
||||
blit( stack, x, y, xTexStart.getAsInt(), yTex, width, height, textureWidth, textureHeight );
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
if( isHovered() ) renderToolTip( stack, mouseX, mouseY );
|
||||
if( isHoveredOrFocused() ) renderToolTip( stack, mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -6,9 +6,11 @@
|
||||
|
||||
package dan200.computercraft.shared.common;
|
||||
|
||||
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@ -16,10 +18,11 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class TileGeneric extends BlockEntity implements BlockEntityClientSerializable
|
||||
public abstract class TileGeneric extends BlockEntity
|
||||
{
|
||||
public TileGeneric( BlockEntityType<? extends TileGeneric> type, BlockPos pos, BlockState state )
|
||||
{
|
||||
@ -60,6 +63,11 @@ public abstract class TileGeneric extends BlockEntity implements BlockEntityClie
|
||||
{
|
||||
}
|
||||
|
||||
protected double getInteractRange( Player player )
|
||||
{
|
||||
return 8.0;
|
||||
}
|
||||
|
||||
public boolean isUsable( Player player, boolean ignoreRange )
|
||||
{
|
||||
if( player == null || !player.isAlive() || getLevel().getBlockEntity( getBlockPos() ) != this )
|
||||
@ -76,28 +84,25 @@ public abstract class TileGeneric extends BlockEntity implements BlockEntityClie
|
||||
return player.getCommandSenderWorld() == getLevel() && player.distanceToSqr( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 ) <= range * range;
|
||||
}
|
||||
|
||||
protected double getInteractRange( Player player )
|
||||
@Override
|
||||
public CompoundTag getUpdateTag()
|
||||
{
|
||||
return 8.0;
|
||||
CompoundTag nbt = new CompoundTag();
|
||||
writeDescription( nbt );
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public void fromClientTag( CompoundTag compoundTag )
|
||||
public Packet<ClientGamePacketListener> getUpdatePacket()
|
||||
{
|
||||
readDescription( compoundTag );
|
||||
return ClientboundBlockEntityDataPacket.create( this );
|
||||
}
|
||||
|
||||
protected void readDescription( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toClientTag( CompoundTag compoundTag )
|
||||
{
|
||||
writeDescription( compoundTag );
|
||||
return compoundTag;
|
||||
}
|
||||
|
||||
protected void writeDescription( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@ -252,7 +251,7 @@ public class CommandAPI implements ILuaAPI
|
||||
BlockEntity tile = world.getBlockEntity( pos );
|
||||
if( tile != null )
|
||||
{
|
||||
table.put( "nbt", NBTUtil.toLua( tile.save( new CompoundTag() ) ) );
|
||||
table.put( "nbt", NBTUtil.toLua( tile.saveWithFullMetadata() ) );
|
||||
}
|
||||
|
||||
return table;
|
||||
|
@ -330,9 +330,8 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
on = startOn = nbt.getBoolean( NBT_ON );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
// Save ID, label and power state
|
||||
if( computerID >= 0 )
|
||||
@ -344,7 +343,6 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
nbt.putString( NBT_LABEL, label );
|
||||
}
|
||||
nbt.putBoolean( NBT_ON, on );
|
||||
return super.save( nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,9 +120,8 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
if( customName != null )
|
||||
{
|
||||
@ -135,7 +134,8 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
diskStack.save( item );
|
||||
nbt.put( NBT_ITEM, item );
|
||||
}
|
||||
return super.save( nbt );
|
||||
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -367,13 +367,13 @@ public class TileCable extends TileGeneric implements IPeripheralTile
|
||||
peripheral.read( nbt, "" );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( CompoundTag nbt )
|
||||
public void saveAdditional( CompoundTag nbt )
|
||||
{
|
||||
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
|
||||
peripheral.write( nbt, "" );
|
||||
return super.save( nbt );
|
||||
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -397,9 +397,7 @@ public class TileCable extends TileGeneric implements IPeripheralTile
|
||||
if( state != null ) return;
|
||||
if( !level.isClientSide )
|
||||
{
|
||||
level.getBlockTicks()
|
||||
.scheduleTick( worldPosition,
|
||||
getBlockState().getBlock(), 0 );
|
||||
level.scheduleTick( worldPosition, getBlockState().getBlock(), 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,16 +325,16 @@ public class TileWiredModemFull extends TileGeneric implements IPeripheralTile
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( CompoundTag nbt )
|
||||
public void saveAdditional( CompoundTag nbt )
|
||||
{
|
||||
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
|
||||
for( int i = 0; i < peripherals.length; i++ )
|
||||
{
|
||||
peripherals[i].write( nbt, Integer.toString( i ) );
|
||||
}
|
||||
return super.save( nbt );
|
||||
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,9 +49,7 @@ public class TileWirelessModem extends TileGeneric implements IPeripheralTile
|
||||
super.setBlockState( state );
|
||||
if( state != null ) return;
|
||||
hasModemDirection = false;
|
||||
level.getBlockTicks()
|
||||
.scheduleTick( getBlockPos(),
|
||||
getBlockState().getBlock(), 0 );
|
||||
level.scheduleTick( getBlockPos(), getBlockState().getBlock(), 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -305,15 +305,15 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile
|
||||
|
||||
// Networking stuff
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( CompoundTag nbt )
|
||||
public void saveAdditional( CompoundTag nbt )
|
||||
{
|
||||
nbt.putInt( NBT_X, xIndex );
|
||||
nbt.putInt( NBT_Y, yIndex );
|
||||
nbt.putInt( NBT_WIDTH, width );
|
||||
nbt.putInt( NBT_HEIGHT, height );
|
||||
return super.save( nbt );
|
||||
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
// @Override //TODO: make BlockEntityRenderer work with this, i guess.
|
||||
|
@ -180,9 +180,8 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
ContainerHelper.loadAllItems( nbt, inventory );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
if( customName != null )
|
||||
{
|
||||
@ -200,7 +199,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
// Write inventory
|
||||
ContainerHelper.saveAllItems( nbt, inventory );
|
||||
|
||||
return super.save( nbt );
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
boolean isPrinting()
|
||||
|
@ -300,9 +300,8 @@ public class TileTurtle extends TileComputerBase
|
||||
protected void updateBlockState( ComputerState newState )
|
||||
{}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundTag save( @Nonnull CompoundTag nbt )
|
||||
public void saveAdditional( @Nonnull CompoundTag nbt )
|
||||
{
|
||||
// Write inventory
|
||||
ListTag nbttaglist = new ListTag();
|
||||
@ -321,7 +320,7 @@ public class TileTurtle extends TileComputerBase
|
||||
// Write brain
|
||||
nbt = brain.writeToNBT( nbt );
|
||||
|
||||
return super.save( nbt );
|
||||
super.saveAdditional( nbt );
|
||||
}
|
||||
|
||||
// IDirectionalTile
|
||||
|
@ -50,11 +50,7 @@ public final class TickScheduler
|
||||
|
||||
if( world != null && pos != null && world.hasChunkAt( pos ) && world.getBlockEntity( pos ) == tile )
|
||||
{
|
||||
world.getBlockTicks()
|
||||
.scheduleTick( pos,
|
||||
tile.getBlockState()
|
||||
.getBlock(),
|
||||
0 );
|
||||
world.scheduleTick( pos, tile.getBlockState().getBlock(), 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,8 +50,7 @@ public final class WaterloggableHelpers
|
||||
{
|
||||
if( state.getValue( WATERLOGGED ) )
|
||||
{
|
||||
world.getLiquidTicks()
|
||||
.scheduleTick( pos, Fluids.WATER, Fluids.WATER.getTickDelay( world ) );
|
||||
world.scheduleTick( pos, Fluids.WATER, Fluids.WATER.getTickDelay( world ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,7 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.11.3",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.17.x",
|
||||
"java": ">=16"
|
||||
"minecraft": "1.18"
|
||||
},
|
||||
"suggests": {
|
||||
"modmenu": "*"
|
||||
|
Loading…
x
Reference in New Issue
Block a user