mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-31 01:27:55 +00:00
IT COMPILES! but crashes when placing a block.
This commit is contained in:
11
build.gradle
11
build.gradle
@@ -62,14 +62,9 @@ dependencies {
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include "fabric.mod.json"
|
||||
expand "version": project.version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude "fabric.mod.json"
|
||||
}
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
|
@@ -347,10 +347,5 @@ public class FakePlayer extends ServerPlayerEntity
|
||||
public void disableAutoRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompressionThreshold( int size )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ public final class FixedWidthFontRenderer
|
||||
private static final Matrix4f IDENTITY = AffineTransformation.identity()
|
||||
.getMatrix();
|
||||
public static final Identifier FONT = new Identifier( "computercraft", "textures/gui/term_font.png" );
|
||||
public static final RenderLayer TYPE = Type.MAIN;
|
||||
// public static final RenderLayer TYPE = Type.MAIN;
|
||||
|
||||
|
||||
private FixedWidthFontRenderer()
|
||||
@@ -48,7 +48,7 @@ public final class FixedWidthFontRenderer
|
||||
.getBufferBuilders()
|
||||
.getEntityVertexConsumers();
|
||||
drawString( IDENTITY,
|
||||
((VertexConsumerProvider) renderer).getBuffer( TYPE ),
|
||||
Tessellator.getInstance().getBuffer(),
|
||||
x,
|
||||
y,
|
||||
text,
|
||||
@@ -347,9 +347,9 @@ public final class FixedWidthFontRenderer
|
||||
VertexConsumerProvider.Immediate renderer = MinecraftClient.getInstance()
|
||||
.getBufferBuilders()
|
||||
.getEntityVertexConsumers();
|
||||
VertexConsumer buffer = renderer.getBuffer( TYPE );
|
||||
VertexConsumer buffer = Tessellator.getInstance().getBuffer();
|
||||
drawTerminal( transform, buffer, x, y, terminal, greyscale, topMarginSize, bottomMarginSize, leftMarginSize, rightMarginSize );
|
||||
renderer.draw( TYPE );
|
||||
renderer.draw();
|
||||
}
|
||||
|
||||
public static void drawTerminal( float x, float y, @Nonnull Terminal terminal, boolean greyscale, float topMarginSize, float bottomMarginSize,
|
||||
@@ -378,44 +378,44 @@ public final class FixedWidthFontRenderer
|
||||
float height )
|
||||
{
|
||||
Colour colour = Colour.BLACK;
|
||||
drawQuad( transform, renderer.getBuffer( TYPE ), x, y, width, height, colour.getR(), colour.getG(), colour.getB() );
|
||||
drawQuad( transform, Tessellator.getInstance().getBuffer(), x, y, width, height, colour.getR(), colour.getG(), colour.getB() );
|
||||
}
|
||||
|
||||
public static void drawBlocker( @Nonnull Matrix4f transform, @Nonnull VertexConsumerProvider renderer, float x, float y, float width, float height )
|
||||
{
|
||||
Colour colour = Colour.BLACK;
|
||||
drawQuad( transform, renderer.getBuffer( Type.BLOCKER ), x, y, width, height, colour.getR(), colour.getG(), colour.getB() );
|
||||
drawQuad( transform, Tessellator.getInstance().getBuffer(), x, y, width, height, colour.getR(), colour.getG(), colour.getB() );
|
||||
}
|
||||
|
||||
private static final class Type extends RenderPhase
|
||||
{
|
||||
private static final int GL_MODE = GL11.GL_TRIANGLES;
|
||||
|
||||
private static final VertexFormat FORMAT = VertexFormats.POSITION_COLOR_TEXTURE;
|
||||
|
||||
static final RenderLayer MAIN = RenderLayer.of( "terminal_font", FORMAT, GL_MODE, 1024, false, false, // useDelegate, needsSorting
|
||||
RenderLayer.MultiPhaseParameters.Builder()
|
||||
.texture( new RenderPhase.Texture( FONT,
|
||||
false,
|
||||
false ) ) // blur, minimap
|
||||
.transparency( TRANSLUCENT_TRANSPARENCY )
|
||||
.lightmap( DISABLE_LIGHTMAP )
|
||||
.writeMaskState( COLOR_MASK )
|
||||
.build( false ) );
|
||||
|
||||
static final RenderLayer BLOCKER = RenderLayer.of( "terminal_blocker", FORMAT, GL_MODE, 256, false, false, // useDelegate, needsSorting
|
||||
RenderLayer.MultiPhaseParameters.Builder()
|
||||
.texture( new RenderPhase.Texture( FONT,
|
||||
false,
|
||||
false ) ) // blur, minimap
|
||||
.transparency( TRANSLUCENT_TRANSPARENCY )
|
||||
.writeMaskState( ALL_MASK )
|
||||
.lightmap( DISABLE_LIGHTMAP )
|
||||
.build( false ) );
|
||||
|
||||
private Type( String name, Runnable setup, Runnable destroy )
|
||||
{
|
||||
super( name, setup, destroy );
|
||||
}
|
||||
}
|
||||
// private static final class Type extends RenderPhase
|
||||
// {
|
||||
// private static final int GL_MODE = GL11.GL_TRIANGLES;
|
||||
//
|
||||
// private static final VertexFormat FORMAT = VertexFormats.POSITION_COLOR_TEXTURE;
|
||||
//
|
||||
// static final RenderLayer MAIN = RenderLayer.of( "terminal_font", FORMAT, GL_MODE, 1024, false, false, // useDelegate, needsSorting
|
||||
// RenderLayer.MultiPhaseParameters.Builder()
|
||||
// .texture( new RenderPhase.Texture( FONT,
|
||||
// false,
|
||||
// false ) ) // blur, minimap
|
||||
// .transparency( TRANSLUCENT_TRANSPARENCY )
|
||||
// .lightmap( DISABLE_LIGHTMAP )
|
||||
// .writeMaskState( COLOR_MASK )
|
||||
// .build( false ) );
|
||||
//
|
||||
// static final RenderLayer BLOCKER = RenderLayer.of( "terminal_blocker", FORMAT, GL_MODE, 256, false, false, // useDelegate, needsSorting
|
||||
// RenderLayer.MultiPhaseParameters.Builder()
|
||||
// .texture( new RenderPhase.Texture( FONT,
|
||||
// false,
|
||||
// false ) ) // blur, minimap
|
||||
// .transparency( TRANSLUCENT_TRANSPARENCY )
|
||||
// .writeMaskState( ALL_MASK )
|
||||
// .lightmap( DISABLE_LIGHTMAP )
|
||||
// .build( false ) );
|
||||
//
|
||||
// private Type( String name, Runnable setup, Runnable destroy )
|
||||
// {
|
||||
// super( name, setup, destroy );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ public final class PrintoutRenderer
|
||||
|
||||
public static void drawText( Matrix4f transform, VertexConsumerProvider renderer, int x, int y, int start, TextBuffer[] text, TextBuffer[] colours )
|
||||
{
|
||||
VertexConsumer buffer = renderer.getBuffer( FixedWidthFontRenderer.TYPE );
|
||||
VertexConsumer buffer = Tessellator.getInstance().getBuffer();
|
||||
for( int line = 0; line < LINES_PER_PAGE && line < text.length; line++ )
|
||||
{
|
||||
FixedWidthFontRenderer.drawString( transform,
|
||||
@@ -72,7 +72,7 @@ public final class PrintoutRenderer
|
||||
|
||||
public static void drawText( Matrix4f transform, VertexConsumerProvider renderer, int x, int y, int start, String[] text, String[] colours )
|
||||
{
|
||||
VertexConsumer buffer = renderer.getBuffer( FixedWidthFontRenderer.TYPE );
|
||||
VertexConsumer buffer = Tessellator.getInstance().getBuffer();
|
||||
for( int line = 0; line < LINES_PER_PAGE && line < text.length; line++ )
|
||||
{
|
||||
FixedWidthFontRenderer.drawString( transform,
|
||||
@@ -94,7 +94,7 @@ public final class PrintoutRenderer
|
||||
int leftPages = page;
|
||||
int rightPages = pages - page - 1;
|
||||
|
||||
VertexConsumer buffer = renderer.getBuffer( Type.TYPE );
|
||||
VertexConsumer buffer = Tessellator.getInstance().getBuffer();
|
||||
|
||||
if( isBook )
|
||||
{
|
||||
@@ -187,28 +187,28 @@ public final class PrintoutRenderer
|
||||
.next();
|
||||
}
|
||||
|
||||
private static final class Type extends RenderLayer
|
||||
{
|
||||
|
||||
static final RenderLayer TYPE = RenderLayer.of( "printout_background",
|
||||
VertexFormats.POSITION_TEXTURE,
|
||||
GL11.GL_QUADS,
|
||||
1024,
|
||||
false,
|
||||
false,
|
||||
// useDelegate, needsSorting
|
||||
Type.MultiPhaseParameters.builder()
|
||||
.texture( new RenderPhase.Texture( BG, false, false ) ) // blur, minimap
|
||||
.transparency( TRANSLUCENT_TRANSPARENCY)
|
||||
.lightmap( DISABLE_LIGHTMAP )
|
||||
.build( false ) );
|
||||
|
||||
public Type( String name, VertexFormat vertexFormat, DrawMode drawMode,
|
||||
int expectedBufferSize, boolean hasCrumbling, boolean translucent,
|
||||
Runnable startAction, Runnable endAction )
|
||||
{
|
||||
super( name, vertexFormat, drawMode, expectedBufferSize, hasCrumbling, translucent,
|
||||
startAction, endAction );
|
||||
}
|
||||
}
|
||||
// private static final class Type extends RenderLayer
|
||||
// {
|
||||
//
|
||||
// static final RenderLayer TYPE = RenderLayer.of( "printout_background",
|
||||
// VertexFormats.POSITION_TEXTURE,
|
||||
// GL11.GL_QUADS,
|
||||
// 1024,
|
||||
// false,
|
||||
// false,
|
||||
// // useDelegate, needsSorting
|
||||
// Type.MultiPhaseParameters.builder()
|
||||
// .texture( new RenderPhase.Texture( BG, false, false ) ) // blur, minimap
|
||||
// .transparency( TRANSLUCENT_TRANSPARENCY)
|
||||
// .lightmap( DISABLE_LIGHTMAP )
|
||||
// .build( false ) );
|
||||
//
|
||||
// public Type( String name, VertexFormat vertexFormat, DrawMode drawMode,
|
||||
// int expectedBufferSize, boolean hasCrumbling, boolean translucent,
|
||||
// Runnable startAction, Runnable endAction )
|
||||
// {
|
||||
// super( name, vertexFormat, drawMode, expectedBufferSize, hasCrumbling, translucent,
|
||||
// startAction, endAction );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@@ -34,6 +34,8 @@ import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL31;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.*;
|
||||
@@ -125,8 +127,9 @@ public class TileEntityMonitorRenderer implements BlockEntityRenderer<TileMonito
|
||||
// Sneaky hack here: we get a buffer now in order to flush existing ones and set up the appropriate
|
||||
// render state. I've no clue how well this'll work in future versions of Minecraft, but it does the trick
|
||||
// for now.
|
||||
VertexConsumer buffer = renderer.getBuffer( FixedWidthFontRenderer.TYPE );
|
||||
FixedWidthFontRenderer.TYPE.startDrawing();
|
||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||
buffer.begin( VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR_TEXTURE );
|
||||
// FixedWidthFontRenderer.TYPE.startDrawing();
|
||||
|
||||
renderTerminal( matrix, originTerminal, (float) (MARGIN / xScale), (float) (MARGIN / yScale) );
|
||||
|
||||
@@ -136,7 +139,7 @@ public class TileEntityMonitorRenderer implements BlockEntityRenderer<TileMonito
|
||||
|
||||
// To go along with sneaky hack above: make sure state changes are undone. I would have thought this would
|
||||
// happen automatically after these buffers are drawn, but chests will render weird around monitors without this.
|
||||
FixedWidthFontRenderer.TYPE.endDrawing();
|
||||
buffer.end();
|
||||
|
||||
transform.pop();
|
||||
}
|
||||
@@ -233,7 +236,7 @@ public class TileEntityMonitorRenderer implements BlockEntityRenderer<TileMonito
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder builder = tessellator.getBuffer();
|
||||
builder.begin( FixedWidthFontRenderer.TYPE.getDrawMode(), FixedWidthFontRenderer.TYPE.getVertexFormat() );
|
||||
builder.begin( VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR_TEXTURE );
|
||||
FixedWidthFontRenderer.drawTerminalWithoutCursor( IDENTITY,
|
||||
builder,
|
||||
0,
|
||||
@@ -250,12 +253,12 @@ public class TileEntityMonitorRenderer implements BlockEntityRenderer<TileMonito
|
||||
}
|
||||
|
||||
vbo.bind();
|
||||
FixedWidthFontRenderer.TYPE.getVertexFormat()
|
||||
VertexFormats.POSITION_COLOR_TEXTURE
|
||||
.startDrawing();
|
||||
// vbo.draw( matrix, FixedWidthFontRenderer.TYPE.getDrawMode() );
|
||||
vbo.drawElements(); //FIXME: Is this ok?
|
||||
VertexBuffer.unbind();
|
||||
FixedWidthFontRenderer.TYPE.getVertexFormat()
|
||||
VertexFormats.POSITION_COLOR_TEXTURE
|
||||
.endDrawing();
|
||||
break;
|
||||
}
|
||||
|
@@ -7,9 +7,13 @@ package dan200.computercraft.fabric.mixin;
|
||||
|
||||
import dan200.computercraft.shared.util.DropConsumer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -23,12 +27,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin( Block.class )
|
||||
public class MixinBlock
|
||||
{
|
||||
@Inject( method = "dropStack",
|
||||
at = @At( value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z" ),
|
||||
@Inject( method = "dropStack(Lnet/minecraft/world/World;Ljava/util/function/Supplier;Lnet/minecraft/item/ItemStack;)V",
|
||||
at = @At( value = "HEAD" ),
|
||||
cancellable = true )
|
||||
private static void dropStack( World world, BlockPos pos, ItemStack stack, CallbackInfo callbackInfo )
|
||||
private static void dropStack( World world, Supplier<ItemEntity> itemEntitySupplier, ItemStack stack, CallbackInfo callbackInfo )
|
||||
{
|
||||
if( DropConsumer.onHarvestDrops( world, pos, stack ) )
|
||||
if( DropConsumer.onHarvestDrops( world, itemEntitySupplier.get().getBlockPos(), stack ) )
|
||||
{
|
||||
callbackInfo.cancel();
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@Mixin( BlockEntity.class )
|
||||
public class BlockEntityMixin
|
||||
public class MixinBlockEntity
|
||||
{
|
||||
@Final
|
||||
@Mutable
|
@@ -29,14 +29,14 @@ public class MixinWorld
|
||||
@Shadow
|
||||
protected boolean iteratingTickingBlockEntities;
|
||||
|
||||
@Inject( method = "setBlockEntity", at = @At( "HEAD" ) )
|
||||
public void setBlockEntity( BlockPos pos, @Nullable BlockEntity entity, CallbackInfo info )
|
||||
{
|
||||
if( entity != null && !entity.isRemoved() && entity.getWorld().isInBuildLimit(pos) && iteratingTickingBlockEntities )
|
||||
{
|
||||
setWorld( entity, this );
|
||||
}
|
||||
}
|
||||
// @Inject( method = "setBlockEntity", at = @At( "HEAD" ) )
|
||||
// public void setBlockEntity( BlockPos pos, @Nullable BlockEntity entity, CallbackInfo info )
|
||||
// {
|
||||
// if( entity != null && !entity.isRemoved() && entity.getWorld().isInBuildLimit(pos) && iteratingTickingBlockEntities )
|
||||
// {
|
||||
// setWorld( entity, this );
|
||||
// }
|
||||
// }
|
||||
|
||||
private static void setWorld( BlockEntity entity, Object world )
|
||||
{
|
||||
@@ -46,15 +46,15 @@ public class MixinWorld
|
||||
}
|
||||
}
|
||||
|
||||
@Inject( method = "addBlockEntities", at = @At( "HEAD" ) )
|
||||
public void addBlockEntities( Collection<BlockEntity> entities, CallbackInfo info )
|
||||
{
|
||||
if( iteratingTickingBlockEntities )
|
||||
{
|
||||
for( BlockEntity entity : entities )
|
||||
{
|
||||
setWorld( entity, this );
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Inject( method = "addBlockEntities", at = @At( "HEAD" ) )
|
||||
// public void addBlockEntities( Collection<BlockEntity> entities, CallbackInfo info )
|
||||
// {
|
||||
// if( iteratingTickingBlockEntities )
|
||||
// {
|
||||
// for( BlockEntity entity : entities )
|
||||
// {
|
||||
// setWorld( entity, this );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@@ -14,5 +14,5 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
public interface SignBlockEntityAccess
|
||||
{
|
||||
@Accessor
|
||||
Text[] getText();
|
||||
Text[] getTexts();
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ public interface IComputerItem
|
||||
|
||||
default int getComputerID( @Nonnull ItemStack stack )
|
||||
{
|
||||
NbtCompound nbt = stack.getTag();
|
||||
NbtCompound nbt = stack.getNbt();
|
||||
return nbt != null && nbt.contains( NBT_ID ) ? nbt.getInt( NBT_ID ) : -1;
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ public class ItemComputer extends ItemComputerBase
|
||||
ItemStack result = new ItemStack( this );
|
||||
if( id >= 0 )
|
||||
{
|
||||
result.getOrCreateTag()
|
||||
result.getOrCreateNbt()
|
||||
.putInt( NBT_ID, id );
|
||||
}
|
||||
if( label != null )
|
||||
|
@@ -78,14 +78,14 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
|
||||
{
|
||||
if( id >= 0 )
|
||||
{
|
||||
stack.getOrCreateTag()
|
||||
stack.getOrCreateNbt()
|
||||
.putInt( NBT_ID, id );
|
||||
}
|
||||
}
|
||||
|
||||
public static int getDiskID( @Nonnull ItemStack stack )
|
||||
{
|
||||
NbtCompound nbt = stack.getTag();
|
||||
NbtCompound nbt = stack.getNbt();
|
||||
return nbt != null && nbt.contains( NBT_ID ) ? nbt.getInt( NBT_ID ) : -1;
|
||||
}
|
||||
|
||||
|
@@ -55,12 +55,12 @@ public class ItemPrintout extends Item
|
||||
// Build NBT
|
||||
if( title != null )
|
||||
{
|
||||
stack.getOrCreateTag()
|
||||
stack.getOrCreateNbt()
|
||||
.putString( NBT_TITLE, title );
|
||||
}
|
||||
if( text != null )
|
||||
{
|
||||
NbtCompound tag = stack.getOrCreateTag();
|
||||
NbtCompound tag = stack.getOrCreateNbt();
|
||||
tag.putInt( NBT_PAGES, text.length / LINES_PER_PAGE );
|
||||
for( int i = 0; i < text.length; i++ )
|
||||
{
|
||||
@@ -72,7 +72,7 @@ public class ItemPrintout extends Item
|
||||
}
|
||||
if( colours != null )
|
||||
{
|
||||
NbtCompound tag = stack.getOrCreateTag();
|
||||
NbtCompound tag = stack.getOrCreateNbt();
|
||||
for( int i = 0; i < colours.length; i++ )
|
||||
{
|
||||
if( colours[i] != null )
|
||||
@@ -105,7 +105,7 @@ public class ItemPrintout extends Item
|
||||
|
||||
private static String[] getLines( @Nonnull ItemStack stack, String prefix )
|
||||
{
|
||||
NbtCompound nbt = stack.getTag();
|
||||
NbtCompound nbt = stack.getNbt();
|
||||
int numLines = getPageCount( stack ) * LINES_PER_PAGE;
|
||||
String[] lines = new String[numLines];
|
||||
for( int i = 0; i < lines.length; i++ )
|
||||
@@ -117,7 +117,7 @@ public class ItemPrintout extends Item
|
||||
|
||||
public static int getPageCount( @Nonnull ItemStack stack )
|
||||
{
|
||||
NbtCompound nbt = stack.getTag();
|
||||
NbtCompound nbt = stack.getNbt();
|
||||
return nbt != null && nbt.contains( NBT_PAGES ) ? nbt.getInt( NBT_PAGES ) : 1;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ItemPrintout extends Item
|
||||
|
||||
public static String getTitle( @Nonnull ItemStack stack )
|
||||
{
|
||||
NbtCompound nbt = stack.getTag();
|
||||
NbtCompound nbt = stack.getNbt();
|
||||
return nbt != null && nbt.contains( NBT_TITLE ) ? nbt.getString( NBT_TITLE ) : null;
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ public class ItemTreasureDisk extends Item implements IMedia
|
||||
public static ItemStack create( String subPath, int colourIndex )
|
||||
{
|
||||
ItemStack result = new ItemStack( ComputerCraftRegistry.ModItems.TREASURE_DISK );
|
||||
NbtCompound nbt = result.getOrCreateTag();
|
||||
NbtCompound nbt = result.getOrCreateNbt();
|
||||
nbt.putString( NBT_SUB_PATH, subPath );
|
||||
|
||||
int slash = subPath.indexOf( '/' );
|
||||
@@ -62,7 +62,7 @@ public class ItemTreasureDisk extends Item implements IMedia
|
||||
|
||||
public static int getColour( @Nonnull ItemStack stack )
|
||||
{
|
||||
NbtCompound nbt = stack.getTag();
|
||||
NbtCompound nbt = stack.getNbt();
|
||||
return nbt != null && nbt.contains( NBT_COLOUR ) ? nbt.getInt( NBT_COLOUR ) : Colour.BLUE.getHex();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ItemTreasureDisk extends Item implements IMedia
|
||||
@Nonnull
|
||||
private static String getTitle( @Nonnull ItemStack stack )
|
||||
{
|
||||
NbtCompound nbt = stack.getTag();
|
||||
NbtCompound nbt = stack.getNbt();
|
||||
return nbt != null && nbt.contains( NBT_TITLE ) ? nbt.getString( NBT_TITLE ) : "'alongtimeago' by dan200";
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class ItemTreasureDisk extends Item implements IMedia
|
||||
@Nonnull
|
||||
private static String getSubPath( @Nonnull ItemStack stack )
|
||||
{
|
||||
NbtCompound nbt = stack.getTag();
|
||||
NbtCompound nbt = stack.getNbt();
|
||||
return nbt != null && nbt.contains( NBT_SUB_PATH ) ? nbt.getString( NBT_SUB_PATH ) : "dan200/alongtimeago";
|
||||
}
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ public class ItemData
|
||||
public static <T extends Map<? super String, Object>> T fillBasic( @Nonnull T data, @Nonnull ItemStack stack )
|
||||
{
|
||||
fillBasicSafe( data, stack );
|
||||
String hash = NBTUtil.getNBTHash( stack.getTag() );
|
||||
String hash = NBTUtil.getNBTHash( stack.getNbt() );
|
||||
if( hash != null ) data.put( "nbt", hash );
|
||||
|
||||
return data;
|
||||
@@ -78,7 +78,7 @@ public class ItemData
|
||||
.collect( Collectors.toList() )
|
||||
) ); // chaos x2
|
||||
|
||||
NbtCompound tag = stack.getTag();
|
||||
NbtCompound tag = stack.getNbt();
|
||||
if( tag != null && tag.contains( "display", NBTUtil.TAG_COMPOUND ) )
|
||||
{
|
||||
NbtCompound displayTag = tag.getCompound( "display" );
|
||||
|
@@ -26,7 +26,7 @@ public class SignInspectHandler
|
||||
Map<Integer, String> textTable = new HashMap<>();
|
||||
for( int k = 0; k < 4; k++ )
|
||||
{
|
||||
textTable.put( k + 1, ((SignBlockEntityAccess) sbe).getText()[k].asString() );
|
||||
textTable.put( k + 1, ((SignBlockEntityAccess) sbe).getTexts()[k].asString() );
|
||||
}
|
||||
event.getData().put( "text", textTable );
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.core.computer.ComputerSide;
|
||||
import dan200.computercraft.fabric.mixin.MixinBlockEntity;
|
||||
import dan200.computercraft.shared.common.TileGeneric;
|
||||
import dan200.computercraft.shared.computer.blocks.ComputerProxy;
|
||||
import dan200.computercraft.shared.computer.blocks.TileComputerBase;
|
||||
@@ -24,6 +25,7 @@ import dan200.computercraft.shared.turtle.core.TurtleBrain;
|
||||
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
|
||||
import dan200.computercraft.shared.util.*;
|
||||
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.entity.player.PlayerInventory;
|
||||
@@ -254,6 +256,10 @@ public class TileTurtle extends TileComputerBase
|
||||
// Open GUI or whatever
|
||||
return super.onActivate( player, hand, hit );
|
||||
}
|
||||
|
||||
public void setBlockPos( BlockPos pos ) {
|
||||
((MixinBlockEntity) (Object) this).setBlockPos(pos); // FIXME this looks really bad.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighbourChange( @Nonnull BlockPos neighbour )
|
||||
@@ -406,11 +412,6 @@ public class TileTurtle extends TileComputerBase
|
||||
onTileEntityChange();
|
||||
}
|
||||
|
||||
public void setBlockPos( BlockPos pos )
|
||||
{
|
||||
this.pos.;
|
||||
}
|
||||
|
||||
public void onTileEntityChange()
|
||||
{
|
||||
super.markDirty();
|
||||
|
@@ -256,7 +256,7 @@ public class TurtleBrain implements ITurtleAccess
|
||||
{
|
||||
// Copy the old turtle state into the new turtle
|
||||
TileTurtle newTurtle = (TileTurtle) newTile;
|
||||
newTurtle.setLocation( world, pos ); //FIXME: setLocation no longer exists.
|
||||
newTurtle.setBlockPos( pos ); //FIXME: setLocation no longer exists.
|
||||
newTurtle.transferStateFrom( oldOwner );
|
||||
newTurtle.createServerComputer()
|
||||
.setWorld( world );
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"MinecraftServerAccess",
|
||||
"MixinBlock",
|
||||
"MixinEntity",
|
||||
"MixinBlockEntity",
|
||||
"MixinServerWorld",
|
||||
"MixinWorld",
|
||||
"SignBlockEntityAccess",
|
||||
|
@@ -21,9 +21,9 @@
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.11.3",
|
||||
"fabric": "*"
|
||||
"fabric": "*",
|
||||
"minecraft": "1.17.x",
|
||||
"java": ">=16",
|
||||
"java": ">=16"
|
||||
},
|
||||
"suggests": {
|
||||
"modmenu": "*"
|
||||
|
Reference in New Issue
Block a user