1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-31 21:52:59 +00:00

Attempting to update to 1.17.

Todo: refactor rendering to avoid using direct GL calls, instead I've
read that you could use a `BufferBuilder` but need to do more looking
into that.
Also need to update some block entity things, since some calls are also
gone.
This commit is contained in:
coolsa
2021-09-23 23:22:54 -06:00
parent 0028ad8f54
commit 0dc34a7dbe
93 changed files with 648 additions and 597 deletions

View File

@@ -94,8 +94,8 @@ public abstract class BlockGeneric extends BlockWithEntity
@Nullable
@Override
public BlockEntity createBlockEntity( @Nonnull BlockView world )
public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
{
return type.instantiate();
return type.instantiate(pos, state);
}
}

View File

@@ -8,7 +8,7 @@ package dan200.computercraft.shared.common;
import dan200.computercraft.core.terminal.Terminal;
import dan200.computercraft.shared.network.client.TerminalState;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
public class ClientTerminal implements ITerminal
{
@@ -80,12 +80,12 @@ public class ClientTerminal implements ITerminal
}
}
public void readDescription( CompoundTag nbt )
public void readDescription( NbtCompound nbt )
{
colour = nbt.getBoolean( "colour" );
if( nbt.contains( "terminal" ) )
{
CompoundTag terminal = nbt.getCompound( "terminal" );
NbtCompound terminal = nbt.getCompound( "terminal" );
resizeTerminal( terminal.getInt( "term_width" ), terminal.getInt( "term_height" ) );
this.terminal.readFromNBT( terminal );
}

View File

@@ -7,7 +7,7 @@
package dan200.computercraft.shared.common;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
public interface IColouredItem
{
@@ -20,7 +20,7 @@ public interface IColouredItem
static int getColourBasic( ItemStack stack )
{
CompoundTag tag = stack.getTag();
NbtCompound tag = stack.getTag();
return tag != null && tag.contains( NBT_COLOUR ) ? tag.getInt( NBT_COLOUR ) : -1;
}
@@ -35,7 +35,7 @@ public interface IColouredItem
{
if( colour == -1 )
{
CompoundTag tag = stack.getTag();
NbtCompound tag = stack.getTag();
if( tag != null )
{
tag.remove( NBT_COLOUR );

View File

@@ -8,7 +8,7 @@ package dan200.computercraft.shared.common;
import dan200.computercraft.core.terminal.Terminal;
import dan200.computercraft.shared.network.client.TerminalState;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -85,12 +85,12 @@ public class ServerTerminal implements ITerminal
return new TerminalState( colour, terminal );
}
public void writeDescription( CompoundTag nbt )
public void writeDescription( NbtCompound nbt )
{
nbt.putBoolean( "colour", colour );
if( terminal != null )
{
CompoundTag terminal = new CompoundTag();
NbtCompound terminal = new NbtCompound();
terminal.putInt( "term_width", this.terminal.getWidth() );
terminal.putInt( "term_height", this.terminal.getHeight() );
this.terminal.writeToNBT( terminal );

View File

@@ -11,7 +11,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
@@ -21,9 +21,9 @@ import javax.annotation.Nonnull;
public abstract class TileGeneric extends BlockEntity implements BlockEntityClientSerializable
{
public TileGeneric( BlockEntityType<? extends TileGeneric> type )
public TileGeneric( BlockEntityType<? extends TileGeneric> type, BlockPos pos, BlockState state )
{
super( type );
super( type, pos, state );
}
public void destroy()
@@ -82,23 +82,23 @@ public abstract class TileGeneric extends BlockEntity implements BlockEntityClie
}
@Override
public void fromClientTag( CompoundTag compoundTag )
public void fromClientTag( NbtCompound compoundTag )
{
readDescription( compoundTag );
}
protected void readDescription( @Nonnull CompoundTag nbt )
protected void readDescription( @Nonnull NbtCompound nbt )
{
}
@Override
public CompoundTag toClientTag( CompoundTag compoundTag )
public NbtCompound toClientTag( NbtCompound compoundTag )
{
writeDescription( compoundTag );
return compoundTag;
}
protected void writeDescription( @Nonnull CompoundTag nbt )
protected void writeDescription( @Nonnull NbtCompound nbt )
{
}
}