mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-05 15:00:29 +00:00
Switch to Mojang mappings
ForgeGradle (probably sensibly) yells at me about doing this. However: - There's a reasonable number of mods doing this, which establishes some optimistic precedent. - The licence update in Aug 2020 now allows you to use them for "development purposes". I guess source code counts?? - I'm fairly sure this is also compatible with the CCPL - there's an exception for Minecraft code. The main motivation for this is to make the Fabric port a little easier. Hopefully folks (maybe me in the future, we'll see) will no longer have to deal with mapping hell when merging - only mod loader hell.
This commit is contained in:
parent
c864576619
commit
34b5ede326
@ -75,7 +75,7 @@ minecraft {
|
||||
}
|
||||
}
|
||||
|
||||
mappings channel: 'snapshot', version: "${mappings_version}".toString()
|
||||
mappings channel: 'official', version: project.mc_version
|
||||
|
||||
accessTransformer file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
}
|
||||
|
@ -4,4 +4,3 @@ mod_version=1.95.1
|
||||
# Minecraft properties (update mods.toml when changing)
|
||||
mc_version=1.15.2
|
||||
forge_version=31.1.41
|
||||
mappings_version=20200429-1.15.1
|
||||
|
@ -54,7 +54,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
|
||||
public static InputStream getResourceFile( String domain, String subPath )
|
||||
{
|
||||
IReloadableResourceManager manager = ServerLifecycleHooks.getCurrentServer().getResourceManager();
|
||||
IReloadableResourceManager manager = ServerLifecycleHooks.getCurrentServer().getResources();
|
||||
try
|
||||
{
|
||||
return manager.getResource( new ResourceLocation( domain, subPath ) ).getInputStream();
|
||||
@ -97,7 +97,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
@Override
|
||||
public IMount createResourceMount( @Nonnull String domain, @Nonnull String subPath )
|
||||
{
|
||||
IReloadableResourceManager manager = ServerLifecycleHooks.getCurrentServer().getResourceManager();
|
||||
IReloadableResourceManager manager = ServerLifecycleHooks.getCurrentServer().getResources();
|
||||
ResourceMount mount = ResourceMount.get( domain, subPath, manager );
|
||||
return mount.exists( "" ) ? mount : null;
|
||||
}
|
||||
@ -162,7 +162,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
@Override
|
||||
public LazyOptional<IWiredElement> getWiredElementAt( @Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
{
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
return tile == null ? LazyOptional.empty() : tile.getCapability( CAPABILITY_WIRED_ELEMENT, side );
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public final class TransformedModel
|
||||
|
||||
public static TransformedModel of( @Nonnull ItemStack item, @Nonnull TransformationMatrix transform )
|
||||
{
|
||||
IBakedModel model = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getItemModel( item );
|
||||
IBakedModel model = Minecraft.getInstance().getItemRenderer().getItemModelShaper().getItemModel( item );
|
||||
return new TransformedModel( model, transform );
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public abstract class AbstractPocketUpgrade implements IPocketUpgrade
|
||||
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, NonNullSupplier<ItemStack> item )
|
||||
{
|
||||
this( id, Util.makeTranslationKey( "upgrade", id ) + ".adjective", item );
|
||||
this( id, Util.makeDescriptionId( "upgrade", id ) + ".adjective", item );
|
||||
}
|
||||
|
||||
protected AbstractPocketUpgrade( ResourceLocation id, String adjective, ItemStack stack )
|
||||
|
@ -37,7 +37,7 @@ public abstract class AbstractTurtleUpgrade implements ITurtleUpgrade
|
||||
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, NonNullSupplier<ItemStack> stack )
|
||||
{
|
||||
this( id, type, Util.makeTranslationKey( "upgrade", id ) + ".adjective", stack );
|
||||
this( id, type, Util.makeDescriptionId( "upgrade", id ) + ".adjective", stack );
|
||||
}
|
||||
|
||||
protected AbstractTurtleUpgrade( ResourceLocation id, TurtleUpgradeType type, String adjective, ItemStack stack )
|
||||
|
@ -78,7 +78,7 @@ public final class ClientRegistry
|
||||
@SubscribeEvent
|
||||
public static void onTextureStitchEvent( TextureStitchEvent.Pre event )
|
||||
{
|
||||
if( !event.getMap().getTextureLocation().equals( PlayerContainer.LOCATION_BLOCKS_TEXTURE ) ) return;
|
||||
if( !event.getMap().location().equals( PlayerContainer.BLOCK_ATLAS ) ) return;
|
||||
|
||||
for( String extra : EXTRA_TEXTURES )
|
||||
{
|
||||
@ -96,10 +96,10 @@ public final class ClientRegistry
|
||||
for( String modelName : EXTRA_MODELS )
|
||||
{
|
||||
ResourceLocation location = new ResourceLocation( ComputerCraft.MOD_ID, "item/" + modelName );
|
||||
IUnbakedModel model = loader.getUnbakedModel( location );
|
||||
model.getTextures( loader::getUnbakedModel, new HashSet<>() );
|
||||
IUnbakedModel model = loader.getModel( location );
|
||||
model.getMaterials( loader::getModel, new HashSet<>() );
|
||||
|
||||
IBakedModel baked = model.bakeModel( loader, ModelLoader.defaultTextureGetter(), SimpleModelTransform.IDENTITY, location );
|
||||
IBakedModel baked = model.bake( loader, ModelLoader.defaultTextureGetter(), SimpleModelTransform.IDENTITY, location );
|
||||
if( baked != null )
|
||||
{
|
||||
registry.put( new ModelResourceLocation( new ResourceLocation( ComputerCraft.MOD_ID, modelName ), "inventory" ), baked );
|
||||
|
@ -29,7 +29,7 @@ public class ClientTableFormatter implements TableFormatter
|
||||
|
||||
private static FontRenderer renderer()
|
||||
{
|
||||
return Minecraft.getInstance().fontRenderer;
|
||||
return Minecraft.getInstance().font;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -41,7 +41,7 @@ public class ClientTableFormatter implements TableFormatter
|
||||
|
||||
FontRenderer renderer = renderer();
|
||||
|
||||
float spaceWidth = renderer.getStringWidth( " " );
|
||||
float spaceWidth = renderer.width( " " );
|
||||
int spaces = MathHelper.floor( extraWidth / spaceWidth );
|
||||
int extra = extraWidth - (int) (spaces * spaceWidth);
|
||||
|
||||
@ -57,32 +57,32 @@ public class ClientTableFormatter implements TableFormatter
|
||||
@Override
|
||||
public int getWidth( ITextComponent component )
|
||||
{
|
||||
return renderer().getStringWidth( component.getFormattedText() );
|
||||
return renderer().width( component.getColoredString() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeLine( int id, ITextComponent component )
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
NewChatGui chat = mc.ingameGUI.getChatGUI();
|
||||
NewChatGui chat = mc.gui.getChat();
|
||||
|
||||
// Trim the text if it goes over the allowed length
|
||||
int maxWidth = MathHelper.floor( chat.getChatWidth() / chat.getScale() );
|
||||
List<ITextComponent> list = RenderComponentsUtil.splitText( component, maxWidth, mc.fontRenderer, false, false );
|
||||
if( !list.isEmpty() ) chat.printChatMessageWithOptionalDeletion( list.get( 0 ), id );
|
||||
int maxWidth = MathHelper.floor( chat.getWidth() / chat.getScale() );
|
||||
List<ITextComponent> list = RenderComponentsUtil.wrapComponents( component, maxWidth, mc.font, false, false );
|
||||
if( !list.isEmpty() ) chat.addMessage( list.get( 0 ), id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int display( TableBuilder table )
|
||||
{
|
||||
NewChatGui chat = Minecraft.getInstance().ingameGUI.getChatGUI();
|
||||
NewChatGui chat = Minecraft.getInstance().gui.getChat();
|
||||
|
||||
int lastHeight = lastHeights.get( table.getId() );
|
||||
|
||||
int height = TableFormatter.super.display( table );
|
||||
lastHeights.put( table.getId(), height );
|
||||
|
||||
for( int i = height; i < lastHeight; i++ ) chat.deleteChatLine( i + table.getId() );
|
||||
for( int i = height; i < lastHeight; i++ ) chat.removeById( i + table.getId() );
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
@ -62,22 +62,22 @@ public final class FixedWidthFontRenderer
|
||||
int xStart = 1 + column * (FONT_WIDTH + 2);
|
||||
int yStart = 1 + row * (FONT_HEIGHT + 2);
|
||||
|
||||
buffer.pos( transform, x, y, 0f ).color( r, g, b, 1.0f ).tex( xStart / WIDTH, yStart / WIDTH ).endVertex();
|
||||
buffer.pos( transform, x, y + FONT_HEIGHT, 0f ).color( r, g, b, 1.0f ).tex( xStart / WIDTH, (yStart + FONT_HEIGHT) / WIDTH ).endVertex();
|
||||
buffer.pos( transform, x + FONT_WIDTH, y, 0f ).color( r, g, b, 1.0f ).tex( (xStart + FONT_WIDTH) / WIDTH, yStart / WIDTH ).endVertex();
|
||||
buffer.pos( transform, x + FONT_WIDTH, y, 0f ).color( r, g, b, 1.0f ).tex( (xStart + FONT_WIDTH) / WIDTH, yStart / WIDTH ).endVertex();
|
||||
buffer.pos( transform, x, y + FONT_HEIGHT, 0f ).color( r, g, b, 1.0f ).tex( xStart / WIDTH, (yStart + FONT_HEIGHT) / WIDTH ).endVertex();
|
||||
buffer.pos( transform, x + FONT_WIDTH, y + FONT_HEIGHT, 0f ).color( r, g, b, 1.0f ).tex( (xStart + FONT_WIDTH) / WIDTH, (yStart + FONT_HEIGHT) / WIDTH ).endVertex();
|
||||
buffer.vertex( transform, x, y, 0f ).color( r, g, b, 1.0f ).uv( xStart / WIDTH, yStart / WIDTH ).endVertex();
|
||||
buffer.vertex( transform, x, y + FONT_HEIGHT, 0f ).color( r, g, b, 1.0f ).uv( xStart / WIDTH, (yStart + FONT_HEIGHT) / WIDTH ).endVertex();
|
||||
buffer.vertex( transform, x + FONT_WIDTH, y, 0f ).color( r, g, b, 1.0f ).uv( (xStart + FONT_WIDTH) / WIDTH, yStart / WIDTH ).endVertex();
|
||||
buffer.vertex( transform, x + FONT_WIDTH, y, 0f ).color( r, g, b, 1.0f ).uv( (xStart + FONT_WIDTH) / WIDTH, yStart / WIDTH ).endVertex();
|
||||
buffer.vertex( transform, x, y + FONT_HEIGHT, 0f ).color( r, g, b, 1.0f ).uv( xStart / WIDTH, (yStart + FONT_HEIGHT) / WIDTH ).endVertex();
|
||||
buffer.vertex( transform, x + FONT_WIDTH, y + FONT_HEIGHT, 0f ).color( r, g, b, 1.0f ).uv( (xStart + FONT_WIDTH) / WIDTH, (yStart + FONT_HEIGHT) / WIDTH ).endVertex();
|
||||
}
|
||||
|
||||
private static void drawQuad( Matrix4f transform, IVertexBuilder buffer, float x, float y, float width, float height, float r, float g, float b )
|
||||
{
|
||||
buffer.pos( transform, x, y, 0 ).color( r, g, b, 1.0f ).tex( BACKGROUND_START, BACKGROUND_START ).endVertex();
|
||||
buffer.pos( transform, x, y + height, 0 ).color( r, g, b, 1.0f ).tex( BACKGROUND_START, BACKGROUND_END ).endVertex();
|
||||
buffer.pos( transform, x + width, y, 0 ).color( r, g, b, 1.0f ).tex( BACKGROUND_END, BACKGROUND_START ).endVertex();
|
||||
buffer.pos( transform, x + width, y, 0 ).color( r, g, b, 1.0f ).tex( BACKGROUND_END, BACKGROUND_START ).endVertex();
|
||||
buffer.pos( transform, x, y + height, 0 ).color( r, g, b, 1.0f ).tex( BACKGROUND_START, BACKGROUND_END ).endVertex();
|
||||
buffer.pos( transform, x + width, y + height, 0 ).color( r, g, b, 1.0f ).tex( BACKGROUND_END, BACKGROUND_END ).endVertex();
|
||||
buffer.vertex( transform, x, y, 0 ).color( r, g, b, 1.0f ).uv( BACKGROUND_START, BACKGROUND_START ).endVertex();
|
||||
buffer.vertex( transform, x, y + height, 0 ).color( r, g, b, 1.0f ).uv( BACKGROUND_START, BACKGROUND_END ).endVertex();
|
||||
buffer.vertex( transform, x + width, y, 0 ).color( r, g, b, 1.0f ).uv( BACKGROUND_END, BACKGROUND_START ).endVertex();
|
||||
buffer.vertex( transform, x + width, y, 0 ).color( r, g, b, 1.0f ).uv( BACKGROUND_END, BACKGROUND_START ).endVertex();
|
||||
buffer.vertex( transform, x, y + height, 0 ).color( r, g, b, 1.0f ).uv( BACKGROUND_START, BACKGROUND_END ).endVertex();
|
||||
buffer.vertex( transform, x + width, y + height, 0 ).color( r, g, b, 1.0f ).uv( BACKGROUND_END, BACKGROUND_END ).endVertex();
|
||||
}
|
||||
|
||||
private static void drawQuad( Matrix4f transform, IVertexBuilder buffer, float x, float y, float width, float height, Palette palette, boolean greyscale, char colourIndex )
|
||||
@ -178,9 +178,9 @@ public final class FixedWidthFontRenderer
|
||||
{
|
||||
bindFont();
|
||||
|
||||
IRenderTypeBuffer.Impl renderer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
||||
IRenderTypeBuffer.Impl renderer = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
drawString( IDENTITY, ((IRenderTypeBuffer) renderer).getBuffer( TYPE ), x, y, text, textColour, backgroundColour, palette, greyscale, leftMarginSize, rightMarginSize );
|
||||
renderer.finish();
|
||||
renderer.endBatch();
|
||||
}
|
||||
|
||||
public static void drawTerminalWithoutCursor(
|
||||
@ -263,10 +263,10 @@ public final class FixedWidthFontRenderer
|
||||
{
|
||||
bindFont();
|
||||
|
||||
IRenderTypeBuffer.Impl renderer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
||||
IRenderTypeBuffer.Impl renderer = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
IVertexBuilder buffer = renderer.getBuffer( TYPE );
|
||||
drawTerminal( transform, buffer, x, y, terminal, greyscale, topMarginSize, bottomMarginSize, leftMarginSize, rightMarginSize );
|
||||
renderer.finish( TYPE );
|
||||
renderer.endBatch( TYPE );
|
||||
}
|
||||
|
||||
public static void drawTerminal(
|
||||
@ -287,9 +287,9 @@ public final class FixedWidthFontRenderer
|
||||
{
|
||||
bindFont();
|
||||
|
||||
IRenderTypeBuffer.Impl renderer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
||||
IRenderTypeBuffer.Impl renderer = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
drawEmptyTerminal( transform, renderer, x, y, width, height );
|
||||
renderer.finish();
|
||||
renderer.endBatch();
|
||||
}
|
||||
|
||||
public static void drawEmptyTerminal( float x, float y, float width, float height )
|
||||
@ -305,7 +305,7 @@ public final class FixedWidthFontRenderer
|
||||
|
||||
private static void bindFont()
|
||||
{
|
||||
Minecraft.getInstance().getTextureManager().bindTexture( FONT );
|
||||
Minecraft.getInstance().getTextureManager().bind( FONT );
|
||||
RenderSystem.texParameter( GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP );
|
||||
}
|
||||
|
||||
@ -315,26 +315,26 @@ public final class FixedWidthFontRenderer
|
||||
|
||||
private static final VertexFormat FORMAT = DefaultVertexFormats.POSITION_COLOR_TEX;
|
||||
|
||||
static final RenderType MAIN = RenderType.makeType(
|
||||
static final RenderType MAIN = RenderType.create(
|
||||
"terminal_font", FORMAT, GL_MODE, 1024,
|
||||
false, false, // useDelegate, needsSorting
|
||||
RenderType.State.getBuilder()
|
||||
.texture( new RenderState.TextureState( FONT, false, false ) ) // blur, minimap
|
||||
.alpha( DEFAULT_ALPHA )
|
||||
.lightmap( LIGHTMAP_DISABLED )
|
||||
.writeMask( COLOR_WRITE )
|
||||
.build( false )
|
||||
RenderType.State.builder()
|
||||
.setTextureState( new RenderState.TextureState( FONT, false, false ) ) // blur, minimap
|
||||
.setAlphaState( DEFAULT_ALPHA )
|
||||
.setLightmapState( NO_LIGHTMAP )
|
||||
.setWriteMaskState( COLOR_WRITE )
|
||||
.createCompositeState( false )
|
||||
);
|
||||
|
||||
static final RenderType BLOCKER = RenderType.makeType(
|
||||
static final RenderType BLOCKER = RenderType.create(
|
||||
"terminal_blocker", FORMAT, GL_MODE, 256,
|
||||
false, false, // useDelegate, needsSorting
|
||||
RenderType.State.getBuilder()
|
||||
.texture( new RenderState.TextureState( FONT, false, false ) ) // blur, minimap
|
||||
.alpha( DEFAULT_ALPHA )
|
||||
.writeMask( DEPTH_WRITE )
|
||||
.lightmap( LIGHTMAP_DISABLED )
|
||||
.build( false )
|
||||
RenderType.State.builder()
|
||||
.setTextureState( new RenderState.TextureState( FONT, false, false ) ) // blur, minimap
|
||||
.setAlphaState( DEFAULT_ALPHA )
|
||||
.setWriteMaskState( DEPTH_WRITE )
|
||||
.setLightmapState( NO_LIGHTMAP )
|
||||
.createCompositeState( false )
|
||||
);
|
||||
|
||||
private Type( String name, Runnable setup, Runnable destroy )
|
||||
|
@ -74,18 +74,18 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Containe
|
||||
@Override
|
||||
protected void init()
|
||||
{
|
||||
minecraft.keyboardListener.enableRepeatEvents( true );
|
||||
minecraft.keyboardHandler.setSendRepeatsToGui( true );
|
||||
|
||||
int termPxWidth = termWidth * FixedWidthFontRenderer.FONT_WIDTH;
|
||||
int termPxHeight = termHeight * FixedWidthFontRenderer.FONT_HEIGHT;
|
||||
|
||||
xSize = termPxWidth + MARGIN * 2 + BORDER * 2;
|
||||
ySize = termPxHeight + MARGIN * 2 + BORDER * 2;
|
||||
imageWidth = termPxWidth + MARGIN * 2 + BORDER * 2;
|
||||
imageHeight = termPxHeight + MARGIN * 2 + BORDER * 2;
|
||||
|
||||
super.init();
|
||||
|
||||
terminal = new WidgetTerminal( minecraft, () -> computer, termWidth, termHeight, MARGIN, MARGIN, MARGIN, MARGIN );
|
||||
terminalWrapper = new WidgetWrapper( terminal, MARGIN + BORDER + guiLeft, MARGIN + BORDER + guiTop, termPxWidth, termPxHeight );
|
||||
terminalWrapper = new WidgetWrapper( terminal, MARGIN + BORDER + leftPos, MARGIN + BORDER + topPos, termPxWidth, termPxHeight );
|
||||
|
||||
children.add( terminalWrapper );
|
||||
setFocused( terminalWrapper );
|
||||
@ -97,7 +97,7 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Containe
|
||||
super.removed();
|
||||
children.remove( terminal );
|
||||
terminal = null;
|
||||
minecraft.keyboardListener.enableRepeatEvents( false );
|
||||
minecraft.keyboardHandler.setSendRepeatsToGui( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -120,14 +120,14 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Containe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY )
|
||||
public void renderBg( float partialTicks, int mouseX, int mouseY )
|
||||
{
|
||||
// Draw terminal
|
||||
terminal.draw( terminalWrapper.getX(), terminalWrapper.getY() );
|
||||
|
||||
// Draw a border around the terminal
|
||||
RenderSystem.color4f( 1, 1, 1, 1 );
|
||||
minecraft.getTextureManager().bindTexture( ComputerBorderRenderer.getTexture( family ) );
|
||||
minecraft.getTextureManager().bind( ComputerBorderRenderer.getTexture( family ) );
|
||||
ComputerBorderRenderer.render(
|
||||
terminalWrapper.getX() - MARGIN, terminalWrapper.getY() - MARGIN, getBlitOffset(),
|
||||
terminalWrapper.getWidth() + MARGIN * 2, terminalWrapper.getHeight() + MARGIN * 2
|
||||
@ -139,7 +139,7 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Containe
|
||||
{
|
||||
renderBackground();
|
||||
super.render( mouseX, mouseY, partialTicks );
|
||||
renderHoveredToolTip( mouseX, mouseY );
|
||||
renderTooltip( mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,19 +22,19 @@ public class GuiDiskDrive extends ContainerScreen<ContainerDiskDrive>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int mouseX, int mouseY )
|
||||
protected void renderLabels( int mouseX, int mouseY )
|
||||
{
|
||||
String title = this.title.getFormattedText();
|
||||
font.drawString( title, (xSize - font.getStringWidth( title )) / 2.0f, 6, 0x404040 );
|
||||
font.drawString( title, 8, ySize - 96 + 2, 0x404040 );
|
||||
String title = this.title.getColoredString();
|
||||
font.draw( title, (imageWidth - font.width( title )) / 2.0f, 6, 0x404040 );
|
||||
font.draw( title, 8, imageHeight - 96 + 2, 0x404040 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY )
|
||||
protected void renderBg( float partialTicks, int mouseX, int mouseY )
|
||||
{
|
||||
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
minecraft.getTextureManager().bindTexture( BACKGROUND );
|
||||
blit( guiLeft, guiTop, 0, 0, xSize, ySize );
|
||||
minecraft.getTextureManager().bind( BACKGROUND );
|
||||
blit( leftPos, topPos, 0, 0, imageWidth, imageHeight );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,6 +42,6 @@ public class GuiDiskDrive extends ContainerScreen<ContainerDiskDrive>
|
||||
{
|
||||
renderBackground();
|
||||
super.render( mouseX, mouseY, partialTicks );
|
||||
renderHoveredToolTip( mouseX, mouseY );
|
||||
renderTooltip( mouseX, mouseY );
|
||||
}
|
||||
}
|
||||
|
@ -23,21 +23,21 @@ public class GuiPrinter extends ContainerScreen<ContainerPrinter>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int mouseX, int mouseY )
|
||||
protected void renderLabels( int mouseX, int mouseY )
|
||||
{
|
||||
String title = getTitle().getFormattedText();
|
||||
font.drawString( title, (xSize - font.getStringWidth( title )) / 2.0f, 6, 0x404040 );
|
||||
font.drawString( I18n.format( "container.inventory" ), 8, ySize - 96 + 2, 0x404040 );
|
||||
String title = getTitle().getColoredString();
|
||||
font.draw( title, (imageWidth - font.width( title )) / 2.0f, 6, 0x404040 );
|
||||
font.draw( I18n.get( "container.inventory" ), 8, imageHeight - 96 + 2, 0x404040 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY )
|
||||
protected void renderBg( float partialTicks, int mouseX, int mouseY )
|
||||
{
|
||||
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
minecraft.getTextureManager().bindTexture( BACKGROUND );
|
||||
blit( guiLeft, guiTop, 0, 0, xSize, ySize );
|
||||
minecraft.getTextureManager().bind( BACKGROUND );
|
||||
blit( leftPos, topPos, 0, 0, imageWidth, imageHeight );
|
||||
|
||||
if( getContainer().isPrinting() ) blit( guiLeft + 34, guiTop + 21, 176, 0, 25, 45 );
|
||||
if( getMenu().isPrinting() ) blit( leftPos + 34, topPos + 21, 176, 0, 25, 45 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,6 +45,6 @@ public class GuiPrinter extends ContainerScreen<ContainerPrinter>
|
||||
{
|
||||
renderBackground();
|
||||
super.render( mouseX, mouseY, partialTicks );
|
||||
renderHoveredToolTip( mouseX, mouseY );
|
||||
renderTooltip( mouseX, mouseY );
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class GuiPrintout extends ContainerScreen<ContainerHeldItem>
|
||||
{
|
||||
super( container, player, title );
|
||||
|
||||
ySize = Y_SIZE;
|
||||
imageHeight = Y_SIZE;
|
||||
|
||||
String[] text = ItemPrintout.getText( container.getStack() );
|
||||
m_text = new TextBuffer[text.length];
|
||||
@ -91,16 +91,16 @@ public class GuiPrintout extends ContainerScreen<ContainerHeldItem>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY )
|
||||
public void renderBg( float partialTicks, int mouseX, int mouseY )
|
||||
{
|
||||
// Draw the printout
|
||||
RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
IRenderTypeBuffer.Impl renderer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
||||
drawBorder( IDENTITY, renderer, guiLeft, guiTop, getBlitOffset(), m_page, m_pages, m_book );
|
||||
drawText( IDENTITY, renderer, guiLeft + X_TEXT_MARGIN, guiTop + Y_TEXT_MARGIN, ItemPrintout.LINES_PER_PAGE * m_page, m_text, m_colours );
|
||||
renderer.finish();
|
||||
IRenderTypeBuffer.Impl renderer = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
drawBorder( IDENTITY, renderer, leftPos, topPos, getBlitOffset(), m_page, m_pages, m_book );
|
||||
drawText( IDENTITY, renderer, leftPos + X_TEXT_MARGIN, topPos + Y_TEXT_MARGIN, ItemPrintout.LINES_PER_PAGE * m_page, m_text, m_colours );
|
||||
renderer.endBatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,6 +112,6 @@ public class GuiPrintout extends ContainerScreen<ContainerHeldItem>
|
||||
setBlitOffset( getBlitOffset() + 1 );
|
||||
|
||||
super.render( mouseX, mouseY, partialTicks );
|
||||
renderHoveredToolTip( mouseX, mouseY );
|
||||
renderTooltip( mouseX, mouseY );
|
||||
}
|
||||
}
|
||||
|
@ -39,15 +39,15 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
m_family = container.getFamily();
|
||||
m_computer = (ClientComputer) container.getComputer();
|
||||
|
||||
xSize = 254;
|
||||
ySize = 217;
|
||||
imageWidth = 254;
|
||||
imageHeight = 217;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init()
|
||||
{
|
||||
super.init();
|
||||
minecraft.keyboardListener.enableRepeatEvents( true );
|
||||
minecraft.keyboardHandler.setSendRepeatsToGui( true );
|
||||
|
||||
int termPxWidth = ComputerCraft.turtleTermWidth * FixedWidthFontRenderer.FONT_WIDTH;
|
||||
int termPxHeight = ComputerCraft.turtleTermHeight * FixedWidthFontRenderer.FONT_HEIGHT;
|
||||
@ -58,7 +58,7 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
ComputerCraft.turtleTermHeight,
|
||||
2, 2, 2, 2
|
||||
);
|
||||
terminalWrapper = new WidgetWrapper( terminal, 2 + 8 + guiLeft, 2 + 8 + guiTop, termPxWidth, termPxHeight );
|
||||
terminalWrapper = new WidgetWrapper( terminal, 2 + 8 + leftPos, 2 + 8 + topPos, termPxWidth, termPxHeight );
|
||||
|
||||
children.add( terminalWrapper );
|
||||
setFocused( terminalWrapper );
|
||||
@ -70,7 +70,7 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
super.removed();
|
||||
children.remove( terminal );
|
||||
terminal = null;
|
||||
minecraft.keyboardListener.enableRepeatEvents( false );
|
||||
minecraft.keyboardHandler.setSendRepeatsToGui( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,13 +101,13 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
int slotX = slot % 4;
|
||||
int slotY = slot / 4;
|
||||
minecraft.getTextureManager().bindTexture( advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL );
|
||||
blit( guiLeft + ContainerTurtle.TURTLE_START_X - 2 + slotX * 18, guiTop + ContainerTurtle.PLAYER_START_Y - 2 + slotY * 18, 0, 217, 24, 24 );
|
||||
minecraft.getTextureManager().bind( advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL );
|
||||
blit( leftPos + ContainerTurtle.TURTLE_START_X - 2 + slotX * 18, topPos + ContainerTurtle.PLAYER_START_Y - 2 + slotY * 18, 0, 217, 24, 24 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY )
|
||||
protected void renderBg( float partialTicks, int mouseX, int mouseY )
|
||||
{
|
||||
// Draw term
|
||||
boolean advanced = m_family == ComputerFamily.ADVANCED;
|
||||
@ -115,8 +115,8 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
|
||||
// Draw border/inventory
|
||||
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
minecraft.getTextureManager().bindTexture( advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL );
|
||||
blit( guiLeft, guiTop, 0, 0, xSize, ySize );
|
||||
minecraft.getTextureManager().bind( advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL );
|
||||
blit( leftPos, topPos, 0, 0, imageWidth, imageHeight );
|
||||
|
||||
drawSelectionSlot( advanced );
|
||||
}
|
||||
@ -126,7 +126,7 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
{
|
||||
renderBackground();
|
||||
super.render( mouseX, mouseY, partialTicks );
|
||||
renderHoveredToolTip( mouseX, mouseY );
|
||||
renderTooltip( mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,7 +91,7 @@ public class WidgetTerminal implements IGuiEventListener
|
||||
|
||||
case GLFW.GLFW_KEY_V:
|
||||
// Ctrl+V for paste
|
||||
String clipboard = client.keyboardListener.getClipboardString();
|
||||
String clipboard = client.keyboardHandler.getClipboard();
|
||||
if( clipboard != null )
|
||||
{
|
||||
// Clip to the first occurrence of \r or \n
|
||||
@ -111,7 +111,7 @@ public class WidgetTerminal implements IGuiEventListener
|
||||
}
|
||||
|
||||
// Filter the string
|
||||
clipboard = SharedConstants.filterAllowedCharacters( clipboard );
|
||||
clipboard = SharedConstants.filterText( clipboard );
|
||||
if( !clipboard.isEmpty() )
|
||||
{
|
||||
// Clip to 512 characters and queue the event
|
||||
|
@ -35,12 +35,12 @@ public final class ComputerCraftProxyClient
|
||||
registerContainers();
|
||||
|
||||
// While turtles themselves are not transparent, their upgrades may be.
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.TURTLE_NORMAL.get(), RenderType.getTranslucent() );
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.TURTLE_ADVANCED.get(), RenderType.getTranslucent() );
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.TURTLE_NORMAL.get(), RenderType.translucent() );
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.TURTLE_ADVANCED.get(), RenderType.translucent() );
|
||||
|
||||
// Monitors' textures have transparent fronts and so count as cutouts.
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.MONITOR_NORMAL.get(), RenderType.getCutout() );
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.MONITOR_ADVANCED.get(), RenderType.getCutout() );
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.MONITOR_NORMAL.get(), RenderType.cutout() );
|
||||
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.MONITOR_ADVANCED.get(), RenderType.cutout() );
|
||||
|
||||
// Setup TESRs
|
||||
ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.MONITOR_NORMAL.get(), TileEntityMonitorRenderer::new );
|
||||
@ -55,15 +55,15 @@ public final class ComputerCraftProxyClient
|
||||
{
|
||||
// My IDE doesn't think so, but we do actually need these generics.
|
||||
|
||||
ScreenManager.<ContainerComputer, GuiComputer<ContainerComputer>>registerFactory( Registry.ModContainers.COMPUTER.get(), GuiComputer::create );
|
||||
ScreenManager.<ContainerPocketComputer, GuiComputer<ContainerPocketComputer>>registerFactory( Registry.ModContainers.POCKET_COMPUTER.get(), GuiComputer::createPocket );
|
||||
ScreenManager.registerFactory( Registry.ModContainers.TURTLE.get(), GuiTurtle::new );
|
||||
ScreenManager.<ContainerComputer, GuiComputer<ContainerComputer>>register( Registry.ModContainers.COMPUTER.get(), GuiComputer::create );
|
||||
ScreenManager.<ContainerPocketComputer, GuiComputer<ContainerPocketComputer>>register( Registry.ModContainers.POCKET_COMPUTER.get(), GuiComputer::createPocket );
|
||||
ScreenManager.register( Registry.ModContainers.TURTLE.get(), GuiTurtle::new );
|
||||
|
||||
ScreenManager.registerFactory( Registry.ModContainers.PRINTER.get(), GuiPrinter::new );
|
||||
ScreenManager.registerFactory( Registry.ModContainers.DISK_DRIVE.get(), GuiDiskDrive::new );
|
||||
ScreenManager.registerFactory( Registry.ModContainers.PRINTOUT.get(), GuiPrintout::new );
|
||||
ScreenManager.register( Registry.ModContainers.PRINTER.get(), GuiPrinter::new );
|
||||
ScreenManager.register( Registry.ModContainers.DISK_DRIVE.get(), GuiDiskDrive::new );
|
||||
ScreenManager.register( Registry.ModContainers.PRINTOUT.get(), GuiPrintout::new );
|
||||
|
||||
ScreenManager.<ContainerViewComputer, GuiComputer<ContainerViewComputer>>registerFactory( Registry.ModContainers.VIEW_COMPUTER.get(), GuiComputer::createView );
|
||||
ScreenManager.<ContainerViewComputer, GuiComputer<ContainerViewComputer>>register( Registry.ModContainers.VIEW_COMPUTER.get(), GuiComputer::createView );
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, value = Dist.CLIENT )
|
||||
@ -72,7 +72,7 @@ public final class ComputerCraftProxyClient
|
||||
@SubscribeEvent
|
||||
public static void onWorldUnload( WorldEvent.Unload event )
|
||||
{
|
||||
if( event.getWorld().isRemote() )
|
||||
if( event.getWorld().isClientSide() )
|
||||
{
|
||||
ClientMonitor.destroyAll();
|
||||
}
|
||||
|
@ -45,35 +45,35 @@ public final class CableHighlightRenderer
|
||||
public static void drawHighlight( DrawHighlightEvent.HighlightBlock event )
|
||||
{
|
||||
BlockRayTraceResult hit = event.getTarget();
|
||||
BlockPos pos = hit.getPos();
|
||||
World world = event.getInfo().getRenderViewEntity().getEntityWorld();
|
||||
BlockPos pos = hit.getBlockPos();
|
||||
World world = event.getInfo().getEntity().getCommandSenderWorld();
|
||||
ActiveRenderInfo info = event.getInfo();
|
||||
|
||||
BlockState state = world.getBlockState( pos );
|
||||
|
||||
// We only care about instances with both cable and modem.
|
||||
if( state.getBlock() != Registry.ModBlocks.CABLE.get() || state.get( BlockCable.MODEM ).getFacing() == null || !state.get( BlockCable.CABLE ) )
|
||||
if( state.getBlock() != Registry.ModBlocks.CABLE.get() || state.getValue( BlockCable.MODEM ).getFacing() == null || !state.getValue( BlockCable.CABLE ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCanceled( true );
|
||||
|
||||
VoxelShape shape = WorldUtil.isVecInside( CableShapes.getModemShape( state ), hit.getHitVec().subtract( pos.getX(), pos.getY(), pos.getZ() ) )
|
||||
VoxelShape shape = WorldUtil.isVecInside( CableShapes.getModemShape( state ), hit.getLocation().subtract( pos.getX(), pos.getY(), pos.getZ() ) )
|
||||
? CableShapes.getModemShape( state )
|
||||
: CableShapes.getCableShape( state );
|
||||
|
||||
Vec3d cameraPos = info.getProjectedView();
|
||||
double xOffset = pos.getX() - cameraPos.getX();
|
||||
double yOffset = pos.getY() - cameraPos.getY();
|
||||
double zOffset = pos.getZ() - cameraPos.getZ();
|
||||
Vec3d cameraPos = info.getPosition();
|
||||
double xOffset = pos.getX() - cameraPos.x();
|
||||
double yOffset = pos.getY() - cameraPos.y();
|
||||
double zOffset = pos.getZ() - cameraPos.z();
|
||||
|
||||
IVertexBuilder buffer = event.getBuffers().getBuffer( RenderType.getLines() );
|
||||
Matrix4f matrix4f = event.getMatrix().getLast().getMatrix();
|
||||
shape.forEachEdge( ( x1, y1, z1, x2, y2, z2 ) -> {
|
||||
buffer.pos( matrix4f, (float) (x1 + xOffset), (float) (y1 + yOffset), (float) (z1 + zOffset) )
|
||||
IVertexBuilder buffer = event.getBuffers().getBuffer( RenderType.lines() );
|
||||
Matrix4f matrix4f = event.getMatrix().last().pose();
|
||||
shape.forAllEdges( ( x1, y1, z1, x2, y2, z2 ) -> {
|
||||
buffer.vertex( matrix4f, (float) (x1 + xOffset), (float) (y1 + yOffset), (float) (z1 + zOffset) )
|
||||
.color( 0, 0, 0, 0.4f ).endVertex();
|
||||
buffer.pos( matrix4f, (float) (x2 + xOffset), (float) (y2 + yOffset), (float) (z2 + zOffset) )
|
||||
buffer.vertex( matrix4f, (float) (x2 + xOffset), (float) (y2 + yOffset), (float) (z2 + zOffset) )
|
||||
.color( 0, 0, 0, 0.4f ).endVertex();
|
||||
} );
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ public class ComputerBorderRenderer
|
||||
public static void render( int x, int y, int z, int width, int height )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuilder();
|
||||
buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX );
|
||||
|
||||
render( IDENTITY, buffer, x, y, z, width, height );
|
||||
|
||||
RenderSystem.enableAlphaTest();
|
||||
tessellator.draw();
|
||||
tessellator.end();
|
||||
}
|
||||
|
||||
public static void render( Matrix4f transform, IVertexBuilder buffer, int x, int y, int z, int width, int height )
|
||||
@ -166,9 +166,9 @@ public class ComputerBorderRenderer
|
||||
|
||||
private void renderTexture( int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight )
|
||||
{
|
||||
builder.pos( transform, x, y + height, z ).color( r, g, b, 1.0f ).tex( u * TEX_SCALE, (v + textureHeight) * TEX_SCALE ).endVertex();
|
||||
builder.pos( transform, x + width, y + height, z ).color( r, g, b, 1.0f ).tex( (u + textureWidth) * TEX_SCALE, (v + textureHeight) * TEX_SCALE ).endVertex();
|
||||
builder.pos( transform, x + width, y, z ).color( r, g, b, 1.0f ).tex( (u + textureWidth) * TEX_SCALE, v * TEX_SCALE ).endVertex();
|
||||
builder.pos( transform, x, y, z ).color( r, g, b, 1.0f ).tex( u * TEX_SCALE, v * TEX_SCALE ).endVertex();
|
||||
builder.vertex( transform, x, y + height, z ).color( r, g, b, 1.0f ).uv( u * TEX_SCALE, (v + textureHeight) * TEX_SCALE ).endVertex();
|
||||
builder.vertex( transform, x + width, y + height, z ).color( r, g, b, 1.0f ).uv( (u + textureWidth) * TEX_SCALE, (v + textureHeight) * TEX_SCALE ).endVertex();
|
||||
builder.vertex( transform, x + width, y, z ).color( r, g, b, 1.0f ).uv( (u + textureWidth) * TEX_SCALE, v * TEX_SCALE ).endVertex();
|
||||
builder.vertex( transform, x, y, z ).color( r, g, b, 1.0f ).uv( u * TEX_SCALE, v * TEX_SCALE ).endVertex();
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ public abstract class ItemMapLikeRenderer
|
||||
{
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
|
||||
transform.push();
|
||||
if( hand == Hand.MAIN_HAND && player.getHeldItemOffhand().isEmpty() )
|
||||
transform.pushPose();
|
||||
if( hand == Hand.MAIN_HAND && player.getOffhandItem().isEmpty() )
|
||||
{
|
||||
renderItemFirstPersonCenter( transform, render, lightTexture, pitch, equipProgress, swingProgress, stack );
|
||||
}
|
||||
@ -42,11 +42,11 @@ public abstract class ItemMapLikeRenderer
|
||||
{
|
||||
renderItemFirstPersonSide(
|
||||
transform, render, lightTexture,
|
||||
hand == Hand.MAIN_HAND ? player.getPrimaryHand() : player.getPrimaryHand().opposite(),
|
||||
hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite(),
|
||||
equipProgress, swingProgress, stack
|
||||
);
|
||||
}
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,15 +70,15 @@ public abstract class ItemMapLikeRenderer
|
||||
// If the player is not invisible then render a single arm
|
||||
if( !minecraft.player.isInvisible() )
|
||||
{
|
||||
transform.push();
|
||||
transform.rotate( Vector3f.ZP.rotationDegrees( offset * 10f ) );
|
||||
minecraft.getFirstPersonRenderer().renderArmFirstPerson( transform, render, combinedLight, equipProgress, swingProgress, side );
|
||||
transform.pop();
|
||||
transform.pushPose();
|
||||
transform.mulPose( Vector3f.ZP.rotationDegrees( offset * 10f ) );
|
||||
minecraft.getItemInHandRenderer().renderPlayerArm( transform, render, combinedLight, equipProgress, swingProgress, side );
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
// Setup the appropriate transformations. This is just copied from the
|
||||
// corresponding method in ItemRenderer.
|
||||
transform.push();
|
||||
transform.pushPose();
|
||||
transform.translate( offset * 0.51f, -0.08f + equipProgress * -1.2f, -0.75f );
|
||||
float f1 = MathHelper.sqrt( swingProgress );
|
||||
float f2 = MathHelper.sin( f1 * (float) Math.PI );
|
||||
@ -86,12 +86,12 @@ public abstract class ItemMapLikeRenderer
|
||||
float f4 = 0.4f * MathHelper.sin( f1 * ((float) Math.PI * 2f) );
|
||||
float f5 = -0.3f * MathHelper.sin( swingProgress * (float) Math.PI );
|
||||
transform.translate( offset * f3, f4 - 0.3f * f2, f5 );
|
||||
transform.rotate( Vector3f.XP.rotationDegrees( f2 * -45f ) );
|
||||
transform.rotate( Vector3f.YP.rotationDegrees( offset * f2 * -30f ) );
|
||||
transform.mulPose( Vector3f.XP.rotationDegrees( f2 * -45f ) );
|
||||
transform.mulPose( Vector3f.YP.rotationDegrees( offset * f2 * -30f ) );
|
||||
|
||||
renderItem( transform, render, stack );
|
||||
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +109,7 @@ public abstract class ItemMapLikeRenderer
|
||||
private void renderItemFirstPersonCenter( MatrixStack transform, IRenderTypeBuffer render, int combinedLight, float pitch, float equipProgress, float swingProgress, ItemStack stack )
|
||||
{
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
FirstPersonRenderer renderer = minecraft.getFirstPersonRenderer();
|
||||
FirstPersonRenderer renderer = minecraft.getItemInHandRenderer();
|
||||
|
||||
// Setup the appropriate transformations. This is just copied from the
|
||||
// corresponding method in ItemRenderer.
|
||||
@ -118,20 +118,20 @@ public abstract class ItemMapLikeRenderer
|
||||
float tZ = -0.4f * MathHelper.sin( swingRt * (float) Math.PI );
|
||||
transform.translate( 0, -tX / 2, tZ );
|
||||
|
||||
float pitchAngle = renderer.getMapAngleFromPitch( pitch );
|
||||
float pitchAngle = renderer.calculateMapTilt( pitch );
|
||||
transform.translate( 0, 0.04F + equipProgress * -1.2f + pitchAngle * -0.5f, -0.72f );
|
||||
transform.rotate( Vector3f.XP.rotationDegrees( pitchAngle * -85.0f ) );
|
||||
transform.mulPose( Vector3f.XP.rotationDegrees( pitchAngle * -85.0f ) );
|
||||
if( !minecraft.player.isInvisible() )
|
||||
{
|
||||
transform.push();
|
||||
transform.rotate( Vector3f.YP.rotationDegrees( 90.0F ) );
|
||||
renderer.renderArm( transform, render, combinedLight, HandSide.RIGHT );
|
||||
renderer.renderArm( transform, render, combinedLight, HandSide.LEFT );
|
||||
transform.pop();
|
||||
transform.pushPose();
|
||||
transform.mulPose( Vector3f.YP.rotationDegrees( 90.0F ) );
|
||||
renderer.renderMapHand( transform, render, combinedLight, HandSide.RIGHT );
|
||||
renderer.renderMapHand( transform, render, combinedLight, HandSide.LEFT );
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
float rX = MathHelper.sin( swingRt * (float) Math.PI );
|
||||
transform.rotate( Vector3f.XP.rotationDegrees( rX * 20.0F ) );
|
||||
transform.mulPose( Vector3f.XP.rotationDegrees( rX * 20.0F ) );
|
||||
transform.scale( 2.0F, 2.0F, 2.0F );
|
||||
|
||||
renderItem( transform, render, stack );
|
||||
|
@ -79,9 +79,9 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer
|
||||
|
||||
// Setup various transformations. Note that these are partially adapted from the corresponding method
|
||||
// in ItemRenderer
|
||||
transform.push();
|
||||
transform.rotate( Vector3f.YP.rotationDegrees( 180f ) );
|
||||
transform.rotate( Vector3f.ZP.rotationDegrees( 180f ) );
|
||||
transform.pushPose();
|
||||
transform.mulPose( Vector3f.YP.rotationDegrees( 180f ) );
|
||||
transform.mulPose( Vector3f.ZP.rotationDegrees( 180f ) );
|
||||
transform.scale( 0.5f, 0.5f, 0.5f );
|
||||
|
||||
float scale = 0.75f / Math.max( width + BORDER * 2, height + BORDER * 2 + LIGHT_HEIGHT );
|
||||
@ -93,7 +93,7 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer
|
||||
ComputerFamily family = item.getFamily();
|
||||
int frameColour = item.getColour( stack );
|
||||
|
||||
Matrix4f matrix = transform.getLast().getMatrix();
|
||||
Matrix4f matrix = transform.last().pose();
|
||||
renderFrame( matrix, family, frameColour, width, height );
|
||||
|
||||
// Render the light
|
||||
@ -110,26 +110,26 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer
|
||||
FixedWidthFontRenderer.drawEmptyTerminal( matrix, 0, 0, width, height );
|
||||
}
|
||||
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
private static void renderFrame( Matrix4f transform, ComputerFamily family, int colour, int width, int height )
|
||||
{
|
||||
RenderSystem.enableBlend();
|
||||
Minecraft.getInstance().getTextureManager()
|
||||
.bindTexture( colour != -1 ? ComputerBorderRenderer.BACKGROUND_COLOUR : ComputerBorderRenderer.getTexture( family ) );
|
||||
.bind( colour != -1 ? ComputerBorderRenderer.BACKGROUND_COLOUR : ComputerBorderRenderer.getTexture( family ) );
|
||||
|
||||
float r = ((colour >>> 16) & 0xFF) / 255.0f;
|
||||
float g = ((colour >>> 8) & 0xFF) / 255.0f;
|
||||
float b = (colour & 0xFF) / 255.0f;
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuilder();
|
||||
buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX );
|
||||
|
||||
ComputerBorderRenderer.render( transform, buffer, 0, 0, 0, width, height, LIGHT_HEIGHT, r, g, b );
|
||||
|
||||
tessellator.draw();
|
||||
tessellator.end();
|
||||
}
|
||||
|
||||
private static void renderLight( Matrix4f transform, int colour, int width, int height )
|
||||
@ -141,14 +141,14 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer
|
||||
float b = (colour & 0xFF) / 255.0f;
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuilder();
|
||||
buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR );
|
||||
buffer.pos( transform, width - LIGHT_HEIGHT * 2, height + LIGHT_HEIGHT + BORDER / 2.0f, 0 ).color( r, g, b, 1.0f ).endVertex();
|
||||
buffer.pos( transform, width, height + LIGHT_HEIGHT + BORDER / 2.0f, 0 ).color( r, g, b, 1.0f ).endVertex();
|
||||
buffer.pos( transform, width, height + BORDER / 2.0f, 0 ).color( r, g, b, 1.0f ).endVertex();
|
||||
buffer.pos( transform, width - LIGHT_HEIGHT * 2, height + BORDER / 2.0f, 0 ).color( r, g, b, 1.0f ).endVertex();
|
||||
buffer.vertex( transform, width - LIGHT_HEIGHT * 2, height + LIGHT_HEIGHT + BORDER / 2.0f, 0 ).color( r, g, b, 1.0f ).endVertex();
|
||||
buffer.vertex( transform, width, height + LIGHT_HEIGHT + BORDER / 2.0f, 0 ).color( r, g, b, 1.0f ).endVertex();
|
||||
buffer.vertex( transform, width, height + BORDER / 2.0f, 0 ).color( r, g, b, 1.0f ).endVertex();
|
||||
buffer.vertex( transform, width - LIGHT_HEIGHT * 2, height + BORDER / 2.0f, 0 ).color( r, g, b, 1.0f ).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
tessellator.end();
|
||||
RenderSystem.enableTexture();
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer
|
||||
@Override
|
||||
protected void renderItem( MatrixStack transform, IRenderTypeBuffer render, ItemStack stack )
|
||||
{
|
||||
transform.rotate( Vector3f.XP.rotationDegrees( 180f ) );
|
||||
transform.mulPose( Vector3f.XP.rotationDegrees( 180f ) );
|
||||
transform.scale( 0.42f, 0.42f, -0.42f );
|
||||
transform.translate( -0.5f, -0.48f, 0.0f );
|
||||
|
||||
@ -70,7 +70,7 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer
|
||||
|
||||
// Move a little bit forward to ensure we're not clipping with the frame
|
||||
transform.translate( 0.0f, 0.0f, -0.001f );
|
||||
transform.rotate( Vector3f.ZP.rotationDegrees( 180f ) );
|
||||
transform.mulPose( Vector3f.ZP.rotationDegrees( 180f ) );
|
||||
transform.scale( 0.95f, 0.95f, -0.95f );
|
||||
transform.translate( -0.5f, -0.5f, 0.0f );
|
||||
|
||||
@ -104,7 +104,7 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer
|
||||
transform.scale( scale, scale, scale );
|
||||
transform.translate( (max - width) / 2.0, (max - height) / 2.0, 0.0 );
|
||||
|
||||
Matrix4f matrix = transform.getLast().getMatrix();
|
||||
Matrix4f matrix = transform.last().pose();
|
||||
drawBorder( matrix, render, 0, 0, -0.01f, 0, pages, book );
|
||||
drawText( matrix, render,
|
||||
X_TEXT_MARGIN, Y_TEXT_MARGIN, 0, ItemPrintout.getText( stack ), ItemPrintout.getColours( stack )
|
||||
|
@ -40,12 +40,12 @@ public final class MonitorHighlightRenderer
|
||||
public static void drawHighlight( DrawHighlightEvent.HighlightBlock event )
|
||||
{
|
||||
// Preserve normal behaviour when crouching.
|
||||
if( event.getInfo().getRenderViewEntity().isCrouching() ) return;
|
||||
if( event.getInfo().getEntity().isCrouching() ) return;
|
||||
|
||||
World world = event.getInfo().getRenderViewEntity().getEntityWorld();
|
||||
BlockPos pos = event.getTarget().getPos();
|
||||
World world = event.getInfo().getEntity().getCommandSenderWorld();
|
||||
BlockPos pos = event.getTarget().getBlockPos();
|
||||
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( !(tile instanceof TileMonitor) ) return;
|
||||
|
||||
TileMonitor monitor = (TileMonitor) tile;
|
||||
@ -61,13 +61,13 @@ public final class MonitorHighlightRenderer
|
||||
if( monitor.getYIndex() != monitor.getHeight() - 1 ) faces.remove( monitor.getDown() );
|
||||
|
||||
MatrixStack transformStack = event.getMatrix();
|
||||
Vec3d cameraPos = event.getInfo().getProjectedView();
|
||||
transformStack.push();
|
||||
transformStack.translate( pos.getX() - cameraPos.getX(), pos.getY() - cameraPos.getY(), pos.getZ() - cameraPos.getZ() );
|
||||
Vec3d cameraPos = event.getInfo().getPosition();
|
||||
transformStack.pushPose();
|
||||
transformStack.translate( pos.getX() - cameraPos.x(), pos.getY() - cameraPos.y(), pos.getZ() - cameraPos.z() );
|
||||
|
||||
// I wish I could think of a better way to do this
|
||||
IVertexBuilder buffer = event.getBuffers().getBuffer( RenderType.getLines() );
|
||||
Matrix4f transform = transformStack.getLast().getMatrix();
|
||||
IVertexBuilder buffer = event.getBuffers().getBuffer( RenderType.lines() );
|
||||
Matrix4f transform = transformStack.last().pose();
|
||||
if( faces.contains( NORTH ) || faces.contains( WEST ) ) line( buffer, transform, 0, 0, 0, UP );
|
||||
if( faces.contains( SOUTH ) || faces.contains( WEST ) ) line( buffer, transform, 0, 0, 1, UP );
|
||||
if( faces.contains( NORTH ) || faces.contains( EAST ) ) line( buffer, transform, 1, 0, 0, UP );
|
||||
@ -81,16 +81,16 @@ public final class MonitorHighlightRenderer
|
||||
if( faces.contains( WEST ) || faces.contains( UP ) ) line( buffer, transform, 0, 1, 0, SOUTH );
|
||||
if( faces.contains( EAST ) || faces.contains( UP ) ) line( buffer, transform, 1, 1, 0, SOUTH );
|
||||
|
||||
transformStack.pop();
|
||||
transformStack.popPose();
|
||||
}
|
||||
|
||||
private static void line( IVertexBuilder buffer, Matrix4f transform, float x, float y, float z, Direction direction )
|
||||
{
|
||||
buffer.pos( transform, x, y, z ).color( 0, 0, 0, 0.4f ).endVertex();
|
||||
buffer.pos( transform,
|
||||
x + direction.getXOffset(),
|
||||
y + direction.getYOffset(),
|
||||
z + direction.getZOffset()
|
||||
buffer.vertex( transform, x, y, z ).color( 0, 0, 0, 0.4f ).endVertex();
|
||||
buffer.vertex( transform,
|
||||
x + direction.getStepX(),
|
||||
y + direction.getStepY(),
|
||||
z + direction.getStepZ()
|
||||
).color( 0, 0, 0, 0.4f ).endVertex();
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class MonitorTextureBufferShader
|
||||
static void setupUniform( Matrix4f transform, int width, int height, Palette palette, boolean greyscale )
|
||||
{
|
||||
MATRIX_BUFFER.rewind();
|
||||
transform.write( MATRIX_BUFFER );
|
||||
transform.store( MATRIX_BUFFER );
|
||||
MATRIX_BUFFER.rewind();
|
||||
RenderSystem.glUniformMatrix4( uniformMv, false, MATRIX_BUFFER );
|
||||
|
||||
@ -71,7 +71,7 @@ class MonitorTextureBufferShader
|
||||
{
|
||||
if( initialised )
|
||||
{
|
||||
if( ok ) GlStateManager.useProgram( program );
|
||||
if( ok ) GlStateManager._glUseProgram( program );
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -94,14 +94,14 @@ class MonitorTextureBufferShader
|
||||
int vertexShader = loadShader( GL20.GL_VERTEX_SHADER, "assets/computercraft/shaders/monitor.vert" );
|
||||
int fragmentShader = loadShader( GL20.GL_FRAGMENT_SHADER, "assets/computercraft/shaders/monitor.frag" );
|
||||
|
||||
program = GlStateManager.createProgram();
|
||||
GlStateManager.attachShader( program, vertexShader );
|
||||
GlStateManager.attachShader( program, fragmentShader );
|
||||
program = GlStateManager.glCreateProgram();
|
||||
GlStateManager.glAttachShader( program, vertexShader );
|
||||
GlStateManager.glAttachShader( program, fragmentShader );
|
||||
GL20.glBindAttribLocation( program, 0, "v_pos" );
|
||||
|
||||
GlStateManager.linkProgram( program );
|
||||
boolean ok = GlStateManager.getProgram( program, GL20.GL_LINK_STATUS ) != 0;
|
||||
String log = GlStateManager.getProgramInfoLog( program, Short.MAX_VALUE ).trim();
|
||||
GlStateManager.glLinkProgram( program );
|
||||
boolean ok = GlStateManager.glGetProgrami( program, GL20.GL_LINK_STATUS ) != 0;
|
||||
String log = GlStateManager.glGetProgramInfoLog( program, Short.MAX_VALUE ).trim();
|
||||
if( !Strings.isNullOrEmpty( log ) )
|
||||
{
|
||||
ComputerCraft.log.warn( "Problems when linking monitor shader: {}", log );
|
||||
@ -109,8 +109,8 @@ class MonitorTextureBufferShader
|
||||
|
||||
GL20.glDetachShader( program, vertexShader );
|
||||
GL20.glDetachShader( program, fragmentShader );
|
||||
GlStateManager.deleteShader( vertexShader );
|
||||
GlStateManager.deleteShader( fragmentShader );
|
||||
GlStateManager.glDeleteShader( vertexShader );
|
||||
GlStateManager.glDeleteShader( fragmentShader );
|
||||
|
||||
if( !ok ) return false;
|
||||
|
||||
@ -137,13 +137,13 @@ class MonitorTextureBufferShader
|
||||
if( stream == null ) throw new IllegalArgumentException( "Cannot find " + path );
|
||||
String contents = TextureUtil.readResourceAsString( stream );
|
||||
|
||||
int shader = GlStateManager.createShader( kind );
|
||||
int shader = GlStateManager.glCreateShader( kind );
|
||||
|
||||
GlStateManager.shaderSource( shader, contents );
|
||||
GlStateManager.compileShader( shader );
|
||||
GlStateManager.glShaderSource( shader, contents );
|
||||
GlStateManager.glCompileShader( shader );
|
||||
|
||||
boolean ok = GlStateManager.getShader( shader, GL20.GL_COMPILE_STATUS ) != 0;
|
||||
String log = GlStateManager.getShaderInfoLog( shader, Short.MAX_VALUE ).trim();
|
||||
boolean ok = GlStateManager.glGetShaderi( shader, GL20.GL_COMPILE_STATUS ) != 0;
|
||||
String log = GlStateManager.glGetShaderInfoLog( shader, Short.MAX_VALUE ).trim();
|
||||
if( !Strings.isNullOrEmpty( log ) )
|
||||
{
|
||||
ComputerCraft.log.warn( "Problems when loading monitor shader {}: {}", path, log );
|
||||
@ -155,7 +155,7 @@ class MonitorTextureBufferShader
|
||||
|
||||
private static int getUniformLocation( int program, String name )
|
||||
{
|
||||
int uniform = GlStateManager.getUniformLocation( program, name );
|
||||
int uniform = GlStateManager._glGetUniformLocation( program, name );
|
||||
if( uniform == -1 ) throw new IllegalStateException( "Cannot find uniform " + name );
|
||||
return uniform;
|
||||
}
|
||||
|
@ -146,18 +146,18 @@ public final class PrintoutRenderer
|
||||
|
||||
private static void drawTexture( Matrix4f matrix, IVertexBuilder buffer, float x, float y, float z, float u, float v, float width, float height )
|
||||
{
|
||||
buffer.pos( matrix, x, y + height, z ).tex( u / BG_SIZE, (v + height) / BG_SIZE ).endVertex();
|
||||
buffer.pos( matrix, x + width, y + height, z ).tex( (u + width) / BG_SIZE, (v + height) / BG_SIZE ).endVertex();
|
||||
buffer.pos( matrix, x + width, y, z ).tex( (u + width) / BG_SIZE, v / BG_SIZE ).endVertex();
|
||||
buffer.pos( matrix, x, y, z ).tex( u / BG_SIZE, v / BG_SIZE ).endVertex();
|
||||
buffer.vertex( matrix, x, y + height, z ).uv( u / BG_SIZE, (v + height) / BG_SIZE ).endVertex();
|
||||
buffer.vertex( matrix, x + width, y + height, z ).uv( (u + width) / BG_SIZE, (v + height) / BG_SIZE ).endVertex();
|
||||
buffer.vertex( matrix, x + width, y, z ).uv( (u + width) / BG_SIZE, v / BG_SIZE ).endVertex();
|
||||
buffer.vertex( matrix, x, y, z ).uv( u / BG_SIZE, v / BG_SIZE ).endVertex();
|
||||
}
|
||||
|
||||
private static void drawTexture( Matrix4f matrix, IVertexBuilder buffer, float x, float y, float z, float width, float height, float u, float v, float tWidth, float tHeight )
|
||||
{
|
||||
buffer.pos( matrix, x, y + height, z ).tex( u / BG_SIZE, (v + tHeight) / BG_SIZE ).endVertex();
|
||||
buffer.pos( matrix, x + width, y + height, z ).tex( (u + tWidth) / BG_SIZE, (v + tHeight) / BG_SIZE ).endVertex();
|
||||
buffer.pos( matrix, x + width, y, z ).tex( (u + tWidth) / BG_SIZE, v / BG_SIZE ).endVertex();
|
||||
buffer.pos( matrix, x, y, z ).tex( u / BG_SIZE, v / BG_SIZE ).endVertex();
|
||||
buffer.vertex( matrix, x, y + height, z ).uv( u / BG_SIZE, (v + tHeight) / BG_SIZE ).endVertex();
|
||||
buffer.vertex( matrix, x + width, y + height, z ).uv( (u + tWidth) / BG_SIZE, (v + tHeight) / BG_SIZE ).endVertex();
|
||||
buffer.vertex( matrix, x + width, y, z ).uv( (u + tWidth) / BG_SIZE, v / BG_SIZE ).endVertex();
|
||||
buffer.vertex( matrix, x, y, z ).uv( u / BG_SIZE, v / BG_SIZE ).endVertex();
|
||||
}
|
||||
|
||||
public static float offsetAt( int page )
|
||||
@ -167,14 +167,14 @@ public final class PrintoutRenderer
|
||||
|
||||
private static final class Type extends RenderState
|
||||
{
|
||||
static final RenderType TYPE = RenderType.makeType(
|
||||
static final RenderType TYPE = RenderType.create(
|
||||
"printout_background", DefaultVertexFormats.POSITION_TEX, GL11.GL_QUADS, 1024,
|
||||
false, false, // useDelegate, needsSorting
|
||||
RenderType.State.getBuilder()
|
||||
.texture( new RenderState.TextureState( BG, false, false ) ) // blur, minimap
|
||||
.alpha( DEFAULT_ALPHA )
|
||||
.lightmap( LIGHTMAP_DISABLED )
|
||||
.build( false )
|
||||
RenderType.State.builder()
|
||||
.setTextureState( new RenderState.TextureState( BG, false, false ) ) // blur, minimap
|
||||
.setAlphaState( DEFAULT_ALPHA )
|
||||
.setLightmapState( NO_LIGHTMAP )
|
||||
.createCompositeState( false )
|
||||
);
|
||||
|
||||
private Type( String name, Runnable setup, Runnable destroy )
|
||||
|
@ -58,7 +58,7 @@ public class TileEntityMonitorRenderer extends TileEntityRenderer<TileMonitor>
|
||||
|
||||
if( originTerminal == null ) return;
|
||||
TileMonitor origin = originTerminal.getOrigin();
|
||||
BlockPos monitorPos = monitor.getPos();
|
||||
BlockPos monitorPos = monitor.getBlockPos();
|
||||
|
||||
// Ensure each monitor terminal is rendered only once. We allow rendering a specific tile
|
||||
// multiple times in a single frame to ensure compatibility with shaders which may run a
|
||||
@ -72,24 +72,24 @@ public class TileEntityMonitorRenderer extends TileEntityRenderer<TileMonitor>
|
||||
originTerminal.lastRenderFrame = renderFrame;
|
||||
originTerminal.lastRenderPos = monitorPos;
|
||||
|
||||
BlockPos originPos = origin.getPos();
|
||||
BlockPos originPos = origin.getBlockPos();
|
||||
|
||||
// Determine orientation
|
||||
Direction dir = origin.getDirection();
|
||||
Direction front = origin.getFront();
|
||||
float yaw = dir.getHorizontalAngle();
|
||||
float yaw = dir.toYRot();
|
||||
float pitch = DirectionUtil.toPitchAngle( front );
|
||||
|
||||
// Setup initial transform
|
||||
transform.push();
|
||||
transform.pushPose();
|
||||
transform.translate(
|
||||
originPos.getX() - monitorPos.getX() + 0.5,
|
||||
originPos.getY() - monitorPos.getY() + 0.5,
|
||||
originPos.getZ() - monitorPos.getZ() + 0.5
|
||||
);
|
||||
|
||||
transform.rotate( Vector3f.YN.rotationDegrees( yaw ) );
|
||||
transform.rotate( Vector3f.XP.rotationDegrees( pitch ) );
|
||||
transform.mulPose( Vector3f.YN.rotationDegrees( yaw ) );
|
||||
transform.mulPose( Vector3f.XP.rotationDegrees( pitch ) );
|
||||
transform.translate(
|
||||
-0.5 + TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN,
|
||||
origin.getHeight() - 0.5 - (TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN) + 0,
|
||||
@ -107,10 +107,10 @@ public class TileEntityMonitorRenderer extends TileEntityRenderer<TileMonitor>
|
||||
int pixelWidth = width * FONT_WIDTH, pixelHeight = height * FONT_HEIGHT;
|
||||
double xScale = xSize / pixelWidth;
|
||||
double yScale = ySize / pixelHeight;
|
||||
transform.push();
|
||||
transform.pushPose();
|
||||
transform.scale( (float) xScale, (float) -yScale, 1.0f );
|
||||
|
||||
Matrix4f matrix = transform.getLast().getMatrix();
|
||||
Matrix4f matrix = transform.last().pose();
|
||||
|
||||
// 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
|
||||
@ -124,24 +124,24 @@ public class TileEntityMonitorRenderer extends TileEntityRenderer<TileMonitor>
|
||||
// reasonable.
|
||||
FixedWidthFontRenderer.drawCursor( matrix, buffer, 0, 0, terminal, !originTerminal.isColour() );
|
||||
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
}
|
||||
else
|
||||
{
|
||||
FixedWidthFontRenderer.drawEmptyTerminal(
|
||||
transform.getLast().getMatrix(), renderer,
|
||||
transform.last().pose(), renderer,
|
||||
-MARGIN, MARGIN,
|
||||
(float) (xSize + 2 * MARGIN), (float) -(ySize + MARGIN * 2)
|
||||
);
|
||||
}
|
||||
|
||||
FixedWidthFontRenderer.drawBlocker(
|
||||
transform.getLast().getMatrix(), renderer,
|
||||
transform.last().pose(), renderer,
|
||||
(float) -TileMonitor.RENDER_MARGIN, (float) TileMonitor.RENDER_MARGIN,
|
||||
(float) (xSize + 2 * TileMonitor.RENDER_MARGIN), (float) -(ySize + TileMonitor.RENDER_MARGIN * 2)
|
||||
);
|
||||
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
private static void renderTerminal( Matrix4f matrix, ClientMonitor monitor, float xMargin, float yMargin )
|
||||
@ -166,7 +166,7 @@ public class TileEntityMonitorRenderer extends TileEntityRenderer<TileMonitor>
|
||||
int size = width * height * 3;
|
||||
if( tboContents == null || tboContents.capacity() < size )
|
||||
{
|
||||
tboContents = GLAllocation.createDirectByteBuffer( size );
|
||||
tboContents = GLAllocation.createByteBuffer( size );
|
||||
}
|
||||
|
||||
ByteBuffer monitorBuffer = tboContents;
|
||||
@ -183,28 +183,28 @@ public class TileEntityMonitorRenderer extends TileEntityRenderer<TileMonitor>
|
||||
}
|
||||
monitorBuffer.flip();
|
||||
|
||||
GlStateManager.bindBuffer( GL31.GL_TEXTURE_BUFFER, monitor.tboBuffer );
|
||||
GlStateManager.bufferData( GL31.GL_TEXTURE_BUFFER, monitorBuffer, GL20.GL_STATIC_DRAW );
|
||||
GlStateManager.bindBuffer( GL31.GL_TEXTURE_BUFFER, 0 );
|
||||
GlStateManager._glBindBuffer( GL31.GL_TEXTURE_BUFFER, monitor.tboBuffer );
|
||||
GlStateManager._glBufferData( GL31.GL_TEXTURE_BUFFER, monitorBuffer, GL20.GL_STATIC_DRAW );
|
||||
GlStateManager._glBindBuffer( GL31.GL_TEXTURE_BUFFER, 0 );
|
||||
}
|
||||
|
||||
// Nobody knows what they're doing!
|
||||
GlStateManager.activeTexture( MonitorTextureBufferShader.TEXTURE_INDEX );
|
||||
GlStateManager._activeTexture( MonitorTextureBufferShader.TEXTURE_INDEX );
|
||||
GL11.glBindTexture( GL31.GL_TEXTURE_BUFFER, monitor.tboTexture );
|
||||
GlStateManager.activeTexture( GL13.GL_TEXTURE0 );
|
||||
GlStateManager._activeTexture( GL13.GL_TEXTURE0 );
|
||||
|
||||
MonitorTextureBufferShader.setupUniform( matrix, width, height, terminal.getPalette(), !monitor.isColour() );
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuilder();
|
||||
buffer.begin( GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION );
|
||||
buffer.pos( -xMargin, -yMargin, 0 ).endVertex();
|
||||
buffer.pos( -xMargin, pixelHeight + yMargin, 0 ).endVertex();
|
||||
buffer.pos( pixelWidth + xMargin, -yMargin, 0 ).endVertex();
|
||||
buffer.pos( pixelWidth + xMargin, pixelHeight + yMargin, 0 ).endVertex();
|
||||
tessellator.draw();
|
||||
buffer.vertex( -xMargin, -yMargin, 0 ).endVertex();
|
||||
buffer.vertex( -xMargin, pixelHeight + yMargin, 0 ).endVertex();
|
||||
buffer.vertex( pixelWidth + xMargin, -yMargin, 0 ).endVertex();
|
||||
buffer.vertex( pixelWidth + xMargin, pixelHeight + yMargin, 0 ).endVertex();
|
||||
tessellator.end();
|
||||
|
||||
GlStateManager.useProgram( 0 );
|
||||
GlStateManager._glUseProgram( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -214,22 +214,22 @@ public class TileEntityMonitorRenderer extends TileEntityRenderer<TileMonitor>
|
||||
if( redraw )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder builder = tessellator.getBuffer();
|
||||
builder.begin( FixedWidthFontRenderer.TYPE.getDrawMode(), FixedWidthFontRenderer.TYPE.getVertexFormat() );
|
||||
BufferBuilder builder = tessellator.getBuilder();
|
||||
builder.begin( FixedWidthFontRenderer.TYPE.mode(), FixedWidthFontRenderer.TYPE.format() );
|
||||
FixedWidthFontRenderer.drawTerminalWithoutCursor(
|
||||
IDENTITY, builder, 0, 0,
|
||||
terminal, !monitor.isColour(), yMargin, yMargin, xMargin, xMargin
|
||||
);
|
||||
|
||||
builder.finishDrawing();
|
||||
builder.end();
|
||||
vbo.upload( builder );
|
||||
}
|
||||
|
||||
vbo.bindBuffer();
|
||||
FixedWidthFontRenderer.TYPE.getVertexFormat().setupBufferState( 0L );
|
||||
vbo.draw( matrix, FixedWidthFontRenderer.TYPE.getDrawMode() );
|
||||
VertexBuffer.unbindBuffer();
|
||||
FixedWidthFontRenderer.TYPE.getVertexFormat().clearBufferState();
|
||||
vbo.bind();
|
||||
FixedWidthFontRenderer.TYPE.format().setupBufferState( 0L );
|
||||
vbo.draw( matrix, FixedWidthFontRenderer.TYPE.mode() );
|
||||
VertexBuffer.unbind();
|
||||
FixedWidthFontRenderer.TYPE.format().clearBufferState();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -72,31 +72,31 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render( @Nonnull TileTurtle turtle, float partialTicks, @Nonnull MatrixStack transform, @Nonnull IRenderTypeBuffer renderer, int lightmapCoord, int overlayLight )
|
||||
public void render( @Nonnull TileTurtle turtle, float partialTicks, @Nonnull MatrixStack transform, @Nonnull IRenderTypeBuffer buffers, int lightmapCoord, int overlayLight )
|
||||
{
|
||||
// Render the label
|
||||
String label = turtle.createProxy().getLabel();
|
||||
RayTraceResult hit = renderDispatcher.cameraHitResult;
|
||||
if( label != null && hit.getType() == RayTraceResult.Type.BLOCK && turtle.getPos().equals( ((BlockRayTraceResult) hit).getPos() ) )
|
||||
RayTraceResult hit = renderer.cameraHitResult;
|
||||
if( label != null && hit.getType() == RayTraceResult.Type.BLOCK && turtle.getBlockPos().equals( ((BlockRayTraceResult) hit).getBlockPos() ) )
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
FontRenderer font = renderDispatcher.fontRenderer;
|
||||
FontRenderer font = renderer.font;
|
||||
|
||||
transform.push();
|
||||
transform.pushPose();
|
||||
transform.translate( 0.5, 1.2, 0.5 );
|
||||
transform.rotate( mc.getRenderManager().getCameraOrientation() );
|
||||
transform.mulPose( mc.getEntityRenderDispatcher().cameraOrientation() );
|
||||
transform.scale( -0.025f, -0.025f, 0.025f );
|
||||
|
||||
Matrix4f matrix = transform.getLast().getMatrix();
|
||||
int opacity = (int) (mc.gameSettings.getTextBackgroundOpacity( 0.25f ) * 255) << 24;
|
||||
float width = -font.getStringWidth( label ) / 2.0f;
|
||||
font.renderString( label, width, (float) 0, 0x20ffffff, false, matrix, renderer, true, opacity, lightmapCoord );
|
||||
font.renderString( label, width, (float) 0, 0xffffffff, false, matrix, renderer, false, 0, lightmapCoord );
|
||||
Matrix4f matrix = transform.last().pose();
|
||||
int opacity = (int) (mc.options.getBackgroundOpacity( 0.25f ) * 255) << 24;
|
||||
float width = -font.width( label ) / 2.0f;
|
||||
font.drawInBatch( label, width, (float) 0, 0x20ffffff, false, matrix, buffers, true, opacity, lightmapCoord );
|
||||
font.drawInBatch( label, width, (float) 0, 0xffffffff, false, matrix, buffers, false, 0, lightmapCoord );
|
||||
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
transform.push();
|
||||
transform.pushPose();
|
||||
|
||||
// Setup the transform.
|
||||
Vec3d offset = turtle.getRenderOffset( partialTicks );
|
||||
@ -104,7 +104,7 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
|
||||
transform.translate( offset.x, offset.y, offset.z );
|
||||
|
||||
transform.translate( 0.5f, 0.5f, 0.5f );
|
||||
transform.rotate( Vector3f.YP.rotationDegrees( 180.0f - yaw ) );
|
||||
transform.mulPose( Vector3f.YP.rotationDegrees( 180.0f - yaw ) );
|
||||
if( label != null && (label.equals( "Dinnerbone" ) || label.equals( "Grumm" )) )
|
||||
{
|
||||
// Flip the model
|
||||
@ -117,7 +117,7 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
|
||||
ComputerFamily family = turtle.getFamily();
|
||||
ResourceLocation overlay = turtle.getOverlay();
|
||||
|
||||
IVertexBuilder buffer = renderer.getBuffer( Atlases.getTranslucentCullBlockType() );
|
||||
IVertexBuilder buffer = buffers.getBuffer( Atlases.translucentCullBlockSheet() );
|
||||
renderModel( transform, buffer, lightmapCoord, overlayLight, getTurtleModel( family, colour != -1 ), colour == -1 ? null : new int[] { colour } );
|
||||
|
||||
// Render the overlay
|
||||
@ -131,31 +131,31 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
|
||||
renderUpgrade( transform, buffer, lightmapCoord, overlayLight, turtle, TurtleSide.LEFT, partialTicks );
|
||||
renderUpgrade( transform, buffer, lightmapCoord, overlayLight, turtle, TurtleSide.RIGHT, partialTicks );
|
||||
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
private void renderUpgrade( @Nonnull MatrixStack transform, @Nonnull IVertexBuilder renderer, int lightmapCoord, int overlayLight, TileTurtle turtle, TurtleSide side, float f )
|
||||
{
|
||||
ITurtleUpgrade upgrade = turtle.getUpgrade( side );
|
||||
if( upgrade == null ) return;
|
||||
transform.push();
|
||||
transform.pushPose();
|
||||
|
||||
float toolAngle = turtle.getToolRenderAngle( side, f );
|
||||
transform.translate( 0.0f, 0.5f, 0.5f );
|
||||
transform.rotate( Vector3f.XN.rotationDegrees( toolAngle ) );
|
||||
transform.mulPose( Vector3f.XN.rotationDegrees( toolAngle ) );
|
||||
transform.translate( 0.0f, -0.5f, -0.5f );
|
||||
|
||||
TransformedModel model = upgrade.getModel( turtle.getAccess(), side );
|
||||
model.getMatrix().push( transform );
|
||||
renderModel( transform, renderer, lightmapCoord, overlayLight, model.getModel(), null );
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
|
||||
transform.pop();
|
||||
transform.popPose();
|
||||
}
|
||||
|
||||
private void renderModel( @Nonnull MatrixStack transform, @Nonnull IVertexBuilder renderer, int lightmapCoord, int overlayLight, ModelResourceLocation modelLocation, int[] tints )
|
||||
{
|
||||
ModelManager modelManager = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getModelManager();
|
||||
ModelManager modelManager = Minecraft.getInstance().getItemRenderer().getItemModelShaper().getModelManager();
|
||||
renderModel( transform, renderer, lightmapCoord, overlayLight, modelManager.getModel( modelLocation ), tints );
|
||||
}
|
||||
|
||||
@ -171,12 +171,12 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
|
||||
|
||||
private static void renderQuads( @Nonnull MatrixStack transform, @Nonnull IVertexBuilder buffer, int lightmapCoord, int overlayLight, List<BakedQuad> quads, int[] tints )
|
||||
{
|
||||
MatrixStack.Entry matrix = transform.getLast();
|
||||
MatrixStack.Entry matrix = transform.last();
|
||||
|
||||
for( BakedQuad bakedquad : quads )
|
||||
{
|
||||
int tint = -1;
|
||||
if( tints != null && bakedquad.hasTintIndex() )
|
||||
if( tints != null && bakedquad.isTinted() )
|
||||
{
|
||||
int idx = bakedquad.getTintIndex();
|
||||
if( idx >= 0 && idx < tints.length ) tint = tints[bakedquad.getTintIndex()];
|
||||
|
@ -43,7 +43,7 @@ public final class TurtleModelLoader implements IModelLoader<TurtleModelLoader.T
|
||||
@Override
|
||||
public TurtleModel read( @Nonnull JsonDeserializationContext deserializationContext, @Nonnull JsonObject modelContents )
|
||||
{
|
||||
ResourceLocation model = new ResourceLocation( JSONUtils.getString( modelContents, "model" ) );
|
||||
ResourceLocation model = new ResourceLocation( JSONUtils.getAsString( modelContents, "model" ) );
|
||||
return new TurtleModel( model );
|
||||
}
|
||||
|
||||
@ -60,8 +60,8 @@ public final class TurtleModelLoader implements IModelLoader<TurtleModelLoader.T
|
||||
public Collection<Material> getTextures( IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors )
|
||||
{
|
||||
Set<Material> materials = new HashSet<>();
|
||||
materials.addAll( modelGetter.apply( family ).getTextures( modelGetter, missingTextureErrors ) );
|
||||
materials.addAll( modelGetter.apply( COLOUR_TURTLE_MODEL ).getTextures( modelGetter, missingTextureErrors ) );
|
||||
materials.addAll( modelGetter.apply( family ).getMaterials( modelGetter, missingTextureErrors ) );
|
||||
materials.addAll( modelGetter.apply( COLOUR_TURTLE_MODEL ).getMaterials( modelGetter, missingTextureErrors ) );
|
||||
return materials;
|
||||
}
|
||||
|
||||
|
@ -90,9 +90,9 @@ public class TurtleMultiModel implements IBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion()
|
||||
public boolean useAmbientOcclusion()
|
||||
{
|
||||
return m_baseModel.isAmbientOcclusion();
|
||||
return m_baseModel.useAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,31 +102,31 @@ public class TurtleMultiModel implements IBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer()
|
||||
public boolean isCustomRenderer()
|
||||
{
|
||||
return m_baseModel.isBuiltInRenderer();
|
||||
return m_baseModel.isCustomRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_230044_c_()
|
||||
public boolean usesBlockLight()
|
||||
{
|
||||
return m_baseModel.func_230044_c_();
|
||||
return m_baseModel.usesBlockLight();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Deprecated
|
||||
public TextureAtlasSprite getParticleTexture()
|
||||
public TextureAtlasSprite getParticleIcon()
|
||||
{
|
||||
return m_baseModel.getParticleTexture();
|
||||
return m_baseModel.getParticleIcon();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Deprecated
|
||||
public net.minecraft.client.renderer.model.ItemCameraTransforms getItemCameraTransforms()
|
||||
public net.minecraft.client.renderer.model.ItemCameraTransforms getTransforms()
|
||||
{
|
||||
return m_baseModel.getItemCameraTransforms();
|
||||
return m_baseModel.getTransforms();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -23,7 +23,7 @@ public class TurtlePlayerRenderer extends EntityRenderer<TurtlePlayer>
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getEntityTexture( @Nonnull TurtlePlayer entity )
|
||||
public ResourceLocation getTextureLocation( @Nonnull TurtlePlayer entity )
|
||||
{
|
||||
return ComputerBorderRenderer.BACKGROUND_NORMAL;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class TurtleSmartItemModel implements IBakedModel
|
||||
stack.translate( 0, 0, 1 );
|
||||
|
||||
identity = TransformationMatrix.identity();
|
||||
flip = new TransformationMatrix( stack.getLast().getMatrix() );
|
||||
flip = new TransformationMatrix( stack.last().pose() );
|
||||
}
|
||||
|
||||
private static class TurtleModelCombination
|
||||
@ -109,7 +109,7 @@ public class TurtleSmartItemModel implements IBakedModel
|
||||
{
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBakedModel getModelWithOverrides( @Nonnull IBakedModel originalModel, @Nonnull ItemStack stack, @Nullable World world, @Nullable LivingEntity entity )
|
||||
public IBakedModel resolve( @Nonnull IBakedModel originalModel, @Nonnull ItemStack stack, @Nullable World world, @Nullable LivingEntity entity )
|
||||
{
|
||||
ItemTurtle turtle = (ItemTurtle) stack.getItem();
|
||||
int colour = turtle.getColour( stack );
|
||||
@ -138,7 +138,7 @@ public class TurtleSmartItemModel implements IBakedModel
|
||||
private IBakedModel buildModel( TurtleModelCombination combo )
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ModelManager modelManager = mc.getItemRenderer().getItemModelMesher().getModelManager();
|
||||
ModelManager modelManager = mc.getItemRenderer().getItemModelShaper().getModelManager();
|
||||
ModelResourceLocation overlayModelLocation = TileEntityTurtleRenderer.getTurtleOverlayModel( combo.m_overlay, combo.m_christmas );
|
||||
|
||||
IBakedModel baseModel = combo.m_colour ? colourModel : familyModel;
|
||||
@ -166,9 +166,9 @@ public class TurtleSmartItemModel implements IBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion()
|
||||
public boolean useAmbientOcclusion()
|
||||
{
|
||||
return familyModel.isAmbientOcclusion();
|
||||
return familyModel.useAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -178,31 +178,31 @@ public class TurtleSmartItemModel implements IBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer()
|
||||
public boolean isCustomRenderer()
|
||||
{
|
||||
return familyModel.isBuiltInRenderer();
|
||||
return familyModel.isCustomRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_230044_c_()
|
||||
public boolean usesBlockLight()
|
||||
{
|
||||
return familyModel.func_230044_c_();
|
||||
return familyModel.usesBlockLight();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Deprecated
|
||||
public TextureAtlasSprite getParticleTexture()
|
||||
public TextureAtlasSprite getParticleIcon()
|
||||
{
|
||||
return familyModel.getParticleTexture();
|
||||
return familyModel.getParticleIcon();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Deprecated
|
||||
public ItemCameraTransforms getItemCameraTransforms()
|
||||
public ItemCameraTransforms getTransforms()
|
||||
{
|
||||
return familyModel.getItemCameraTransforms();
|
||||
return familyModel.getTransforms();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import dan200.computercraft.core.apis.IAPIEnvironment.IPeripheralChangeListener;
|
||||
|
||||
/**
|
||||
* Represents the "environment" that a {@link Computer} exists in.
|
||||
*
|
||||
|
@ -104,7 +104,7 @@ public final class ResourceMount implements IMount
|
||||
{
|
||||
boolean hasAny = false;
|
||||
FileEntry newRoot = new FileEntry( new ResourceLocation( namespace, subPath ) );
|
||||
for( ResourceLocation file : manager.getAllResourceLocations( subPath, s -> true ) )
|
||||
for( ResourceLocation file : manager.listResources( subPath, s -> true ) )
|
||||
{
|
||||
if( !file.getNamespace().equals( namespace ) ) continue;
|
||||
|
||||
@ -297,7 +297,7 @@ public final class ResourceMount implements IMount
|
||||
|
||||
synchronized void add( IReloadableResourceManager manager, ResourceMount mount )
|
||||
{
|
||||
if( managers.add( manager ) ) manager.addReloadListener( this );
|
||||
if( managers.add( manager ) ) manager.registerReloadListener( this );
|
||||
mounts.add( mount );
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class BlockModelProvider extends BlockStateProvider
|
||||
private void registerComputer( BlockComputer block )
|
||||
{
|
||||
VariantBlockStateBuilder builder = getVariantBuilder( block );
|
||||
for( ComputerState state : BlockComputer.STATE.getAllowedValues() )
|
||||
for( ComputerState state : BlockComputer.STATE.getPossibleValues() )
|
||||
{
|
||||
BlockModelBuilder model = models()
|
||||
.getBuilder( suffix( block, "_" + state ) )
|
||||
@ -61,7 +61,7 @@ public class BlockModelProvider extends BlockStateProvider
|
||||
.texture( "side", suffix( block, "_side" ) )
|
||||
.texture( "front", suffix( block, "_front" + toSuffix( state ) ) );
|
||||
|
||||
for( Direction facing : BlockComputer.FACING.getAllowedValues() )
|
||||
for( Direction facing : BlockComputer.FACING.getPossibleValues() )
|
||||
{
|
||||
builder.partialState()
|
||||
.with( BlockComputer.STATE, state )
|
||||
@ -92,14 +92,14 @@ public class BlockModelProvider extends BlockStateProvider
|
||||
registerMonitorModel( name, "_ud", 21, 6, 0, 37 );
|
||||
|
||||
VariantBlockStateBuilder builder = getVariantBuilder( block );
|
||||
for( MonitorEdgeState edge : BlockMonitor.STATE.getAllowedValues() )
|
||||
for( MonitorEdgeState edge : BlockMonitor.STATE.getPossibleValues() )
|
||||
{
|
||||
String suffix = edge == MonitorEdgeState.NONE ? "" : "_" + edge.getName();
|
||||
String suffix = edge == MonitorEdgeState.NONE ? "" : "_" + edge.getSerializedName();
|
||||
ModelFile model = models().getBuilder( suffix( block, suffix ) );
|
||||
|
||||
for( Direction facing : BlockMonitor.FACING.getAllowedValues() )
|
||||
for( Direction facing : BlockMonitor.FACING.getPossibleValues() )
|
||||
{
|
||||
for( Direction orientation : BlockMonitor.ORIENTATION.getAllowedValues() )
|
||||
for( Direction orientation : BlockMonitor.ORIENTATION.getPossibleValues() )
|
||||
{
|
||||
builder.partialState()
|
||||
.with( BlockMonitor.STATE, edge )
|
||||
@ -137,7 +137,7 @@ public class BlockModelProvider extends BlockStateProvider
|
||||
|
||||
private static int toYAngle( Direction direction )
|
||||
{
|
||||
return ((int) direction.getHorizontalAngle() + 180) % 360;
|
||||
return ((int) direction.toYRot() + 180) % 360;
|
||||
}
|
||||
|
||||
private static String toSuffix( ComputerState state )
|
||||
|
@ -40,17 +40,17 @@ public abstract class LootTableProvider implements IDataProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act( @Nonnull DirectoryCache cache )
|
||||
public void run( @Nonnull DirectoryCache cache )
|
||||
{
|
||||
Map<ResourceLocation, LootTable> tables = new HashMap<>();
|
||||
ValidationTracker validation = new ValidationTracker( LootParameterSets.GENERIC, x -> null, tables::get );
|
||||
ValidationTracker validation = new ValidationTracker( LootParameterSets.ALL_PARAMS, x -> null, tables::get );
|
||||
|
||||
registerLoot( ( id, table ) -> {
|
||||
if( tables.containsKey( id ) ) validation.addProblem( "Duplicate loot tables for " + id );
|
||||
if( tables.containsKey( id ) ) validation.reportProblem( "Duplicate loot tables for " + id );
|
||||
tables.put( id, table );
|
||||
} );
|
||||
|
||||
tables.forEach( ( key, value ) -> LootTableManager.func_227508_a_( validation, key, value ) );
|
||||
tables.forEach( ( key, value ) -> LootTableManager.validate( validation, key, value ) );
|
||||
|
||||
Multimap<String, String> problems = validation.getProblems();
|
||||
if( !problems.isEmpty() )
|
||||
@ -64,7 +64,7 @@ public abstract class LootTableProvider implements IDataProvider
|
||||
Path path = getPath( key );
|
||||
try
|
||||
{
|
||||
IDataProvider.save( GSON, cache, LootTableManager.toJson( value ), path );
|
||||
IDataProvider.save( GSON, cache, LootTableManager.serialize( value ), path );
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
|
@ -47,8 +47,8 @@ public class LootTables extends LootTableProvider
|
||||
computerDrop( add, Registry.ModBlocks.TURTLE_ADVANCED );
|
||||
|
||||
add.accept( ComputerCraftProxyCommon.ForgeHandlers.LOOT_TREASURE_DISK, LootTable
|
||||
.builder()
|
||||
.setParameterSet( LootParameterSets.GENERIC )
|
||||
.lootTable()
|
||||
.setParamSet( LootParameterSets.ALL_PARAMS )
|
||||
.build() );
|
||||
}
|
||||
|
||||
@ -56,13 +56,13 @@ public class LootTables extends LootTableProvider
|
||||
{
|
||||
Block block = wrapper.get();
|
||||
add.accept( block.getLootTable(), LootTable
|
||||
.builder()
|
||||
.setParameterSet( LootParameterSets.BLOCK )
|
||||
.addLootPool( LootPool.builder()
|
||||
.lootTable()
|
||||
.setParamSet( LootParameterSets.BLOCK )
|
||||
.withPool( LootPool.lootPool()
|
||||
.name( "main" )
|
||||
.rolls( ConstantRange.of( 1 ) )
|
||||
.addEntry( ItemLootEntry.builder( block ) )
|
||||
.acceptCondition( SurvivesExplosion.builder() )
|
||||
.setRolls( ConstantRange.exactly( 1 ) )
|
||||
.add( ItemLootEntry.lootTableItem( block ) )
|
||||
.when( SurvivesExplosion.survivesExplosion() )
|
||||
).build() );
|
||||
}
|
||||
|
||||
@ -70,16 +70,16 @@ public class LootTables extends LootTableProvider
|
||||
{
|
||||
Block block = wrapper.get();
|
||||
add.accept( block.getLootTable(), LootTable
|
||||
.builder()
|
||||
.setParameterSet( LootParameterSets.BLOCK )
|
||||
.addLootPool( LootPool.builder()
|
||||
.lootTable()
|
||||
.setParamSet( LootParameterSets.BLOCK )
|
||||
.withPool( LootPool.lootPool()
|
||||
.name( "main" )
|
||||
.rolls( ConstantRange.of( 1 ) )
|
||||
.addEntry( DynamicLootEntry.func_216162_a( new ResourceLocation( ComputerCraft.MOD_ID, "computer" ) ) )
|
||||
.acceptCondition( Alternative.builder(
|
||||
.setRolls( ConstantRange.exactly( 1 ) )
|
||||
.add( DynamicLootEntry.dynamicEntry( new ResourceLocation( ComputerCraft.MOD_ID, "computer" ) ) )
|
||||
.when( Alternative.alternative(
|
||||
BlockNamedEntityLootCondition.builder(),
|
||||
HasComputerIdLootCondition.builder(),
|
||||
PlayerCreativeLootCondition.builder().inverted()
|
||||
PlayerCreativeLootCondition.builder().invert()
|
||||
) )
|
||||
).build() );
|
||||
}
|
||||
|
@ -50,42 +50,42 @@ public final class RecipeWrapper implements IFinishedRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize( @Nonnull JsonObject jsonObject )
|
||||
public void serializeRecipeData( @Nonnull JsonObject jsonObject )
|
||||
{
|
||||
recipe.serialize( jsonObject );
|
||||
recipe.serializeRecipeData( jsonObject );
|
||||
|
||||
if( resultData != null )
|
||||
{
|
||||
JsonObject object = JSONUtils.getJsonObject( jsonObject, "result" );
|
||||
JsonObject object = JSONUtils.getAsJsonObject( jsonObject, "result" );
|
||||
object.addProperty( "nbt", resultData.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getID()
|
||||
public ResourceLocation getId()
|
||||
{
|
||||
return recipe.getID();
|
||||
return recipe.getId();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer()
|
||||
public IRecipeSerializer<?> getType()
|
||||
{
|
||||
return serializer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JsonObject getAdvancementJson()
|
||||
public JsonObject serializeAdvancement()
|
||||
{
|
||||
return recipe.getAdvancementJson();
|
||||
return recipe.serializeAdvancement();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getAdvancementID()
|
||||
public ResourceLocation getAdvancementId()
|
||||
{
|
||||
return recipe.getAdvancementID();
|
||||
return recipe.getAdvancementId();
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class Recipes extends RecipeProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes( @Nonnull Consumer<IFinishedRecipe> add )
|
||||
protected void buildShapelessRecipes( @Nonnull Consumer<IFinishedRecipe> add )
|
||||
{
|
||||
basicRecipes( add );
|
||||
diskColours( add );
|
||||
@ -57,13 +57,13 @@ public class Recipes extends RecipeProvider
|
||||
for( Colour colour : Colour.VALUES )
|
||||
{
|
||||
ShapelessRecipeBuilder
|
||||
.shapelessRecipe( Registry.ModItems.DISK.get() )
|
||||
.addIngredient( Tags.Items.DUSTS_REDSTONE )
|
||||
.addIngredient( Items.PAPER )
|
||||
.addIngredient( DyeItem.getItem( ofColour( colour ) ) )
|
||||
.setGroup( "computercraft:disk" )
|
||||
.addCriterion( "has_drive", inventoryChange( Registry.ModBlocks.DISK_DRIVE.get() ) )
|
||||
.build( RecipeWrapper.wrap(
|
||||
.shapeless( Registry.ModItems.DISK.get() )
|
||||
.requires( Tags.Items.DUSTS_REDSTONE )
|
||||
.requires( Items.PAPER )
|
||||
.requires( DyeItem.byColor( ofColour( colour ) ) )
|
||||
.group( "computercraft:disk" )
|
||||
.unlocks( "has_drive", inventoryChange( Registry.ModBlocks.DISK_DRIVE.get() ) )
|
||||
.save( RecipeWrapper.wrap(
|
||||
ImpostorShapelessRecipe.SERIALIZER, add,
|
||||
x -> x.putInt( IColouredItem.NBT_COLOUR, colour.getHex() )
|
||||
), new ResourceLocation( ComputerCraft.MOD_ID, "disk_" + (colour.ordinal() + 1) ) );
|
||||
@ -87,14 +87,14 @@ public class Recipes extends RecipeProvider
|
||||
TurtleUpgrades.getVanillaUpgrades().forEach( upgrade -> {
|
||||
ItemStack result = TurtleItemFactory.create( -1, null, -1, family, null, upgrade, -1, null );
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( result.getItem() )
|
||||
.setGroup( String.format( "%s:turtle_%s", ComputerCraft.MOD_ID, nameId ) )
|
||||
.patternLine( "#T" )
|
||||
.key( '#', base.getItem() )
|
||||
.key( 'T', upgrade.getCraftingItem().getItem() )
|
||||
.addCriterion( "has_items",
|
||||
.shaped( result.getItem() )
|
||||
.group( String.format( "%s:turtle_%s", ComputerCraft.MOD_ID, nameId ) )
|
||||
.pattern( "#T" )
|
||||
.define( '#', base.getItem() )
|
||||
.define( 'T', upgrade.getCraftingItem().getItem() )
|
||||
.unlocks( "has_items",
|
||||
inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) )
|
||||
.build(
|
||||
.save(
|
||||
RecipeWrapper.wrap( ImpostorRecipe.SERIALIZER, add, result.getTag() ),
|
||||
new ResourceLocation( ComputerCraft.MOD_ID, String.format( "turtle_%s/%s/%s",
|
||||
nameId, upgrade.getUpgradeID().getNamespace(), upgrade.getUpgradeID().getPath()
|
||||
@ -121,15 +121,15 @@ public class Recipes extends RecipeProvider
|
||||
PocketUpgrades.getVanillaUpgrades().forEach( upgrade -> {
|
||||
ItemStack result = PocketComputerItemFactory.create( -1, null, -1, family, null );
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( result.getItem() )
|
||||
.setGroup( String.format( "%s:pocket_%s", ComputerCraft.MOD_ID, nameId ) )
|
||||
.patternLine( "#" )
|
||||
.patternLine( "P" )
|
||||
.key( '#', base.getItem() )
|
||||
.key( 'P', upgrade.getCraftingItem().getItem() )
|
||||
.addCriterion( "has_items",
|
||||
.shaped( result.getItem() )
|
||||
.group( String.format( "%s:pocket_%s", ComputerCraft.MOD_ID, nameId ) )
|
||||
.pattern( "#" )
|
||||
.pattern( "P" )
|
||||
.define( '#', base.getItem() )
|
||||
.define( 'P', upgrade.getCraftingItem().getItem() )
|
||||
.unlocks( "has_items",
|
||||
inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) )
|
||||
.build(
|
||||
.save(
|
||||
RecipeWrapper.wrap( ImpostorRecipe.SERIALIZER, add, result.getTag() ),
|
||||
new ResourceLocation( ComputerCraft.MOD_ID, String.format( "pocket_%s/%s/%s",
|
||||
nameId, upgrade.getUpgradeID().getNamespace(), upgrade.getUpgradeID().getPath()
|
||||
@ -142,167 +142,167 @@ public class Recipes extends RecipeProvider
|
||||
private void basicRecipes( @Nonnull Consumer<IFinishedRecipe> add )
|
||||
{
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModItems.CABLE.get(), 6 )
|
||||
.patternLine( " # " )
|
||||
.patternLine( "#R#" )
|
||||
.patternLine( " # " )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.addCriterion( "has_modem", inventoryChange( CCTags.COMPUTER ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModItems.CABLE.get(), 6 )
|
||||
.pattern( " # " )
|
||||
.pattern( "#R#" )
|
||||
.pattern( " # " )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlocks( "has_modem", inventoryChange( CCTags.COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.COMPUTER_NORMAL.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#R#" )
|
||||
.patternLine( "#G#" )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.key( 'G', Tags.Items.GLASS_PANES )
|
||||
.addCriterion( "has_redstone", inventoryChange( Tags.Items.DUSTS_REDSTONE ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.COMPUTER_NORMAL.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#R#" )
|
||||
.pattern( "#G#" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlocks( "has_redstone", inventoryChange( Tags.Items.DUSTS_REDSTONE ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.COMPUTER_ADVANCED.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#R#" )
|
||||
.patternLine( "#G#" )
|
||||
.key( '#', Tags.Items.INGOTS_GOLD )
|
||||
.key( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.key( 'G', Tags.Items.GLASS_PANES )
|
||||
.addCriterion( "has_components", inventoryChange( Items.REDSTONE, Items.GOLD_INGOT ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.COMPUTER_ADVANCED.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#R#" )
|
||||
.pattern( "#G#" )
|
||||
.define( '#', Tags.Items.INGOTS_GOLD )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlocks( "has_components", inventoryChange( Items.REDSTONE, Items.GOLD_INGOT ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.COMPUTER_COMMAND.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#R#" )
|
||||
.patternLine( "#G#" )
|
||||
.key( '#', Tags.Items.INGOTS_GOLD )
|
||||
.key( 'R', Blocks.COMMAND_BLOCK )
|
||||
.key( 'G', Tags.Items.GLASS_PANES )
|
||||
.addCriterion( "has_components", inventoryChange( Blocks.COMMAND_BLOCK ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.COMPUTER_COMMAND.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#R#" )
|
||||
.pattern( "#G#" )
|
||||
.define( '#', Tags.Items.INGOTS_GOLD )
|
||||
.define( 'R', Blocks.COMMAND_BLOCK )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlocks( "has_components", inventoryChange( Blocks.COMMAND_BLOCK ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.DISK_DRIVE.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#R#" )
|
||||
.patternLine( "#R#" )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.DISK_DRIVE.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#R#" )
|
||||
.pattern( "#R#" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.MONITOR_NORMAL.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#G#" )
|
||||
.patternLine( "###" )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'G', Tags.Items.GLASS_PANES )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.MONITOR_NORMAL.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#G#" )
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.MONITOR_ADVANCED.get(), 4 )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#G#" )
|
||||
.patternLine( "###" )
|
||||
.key( '#', Tags.Items.INGOTS_GOLD )
|
||||
.key( 'G', Tags.Items.GLASS_PANES )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.MONITOR_ADVANCED.get(), 4 )
|
||||
.pattern( "###" )
|
||||
.pattern( "#G#" )
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.INGOTS_GOLD )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModItems.POCKET_COMPUTER_NORMAL.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#A#" )
|
||||
.patternLine( "#G#" )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'A', Items.GOLDEN_APPLE )
|
||||
.key( 'G', Tags.Items.GLASS_PANES )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.addCriterion( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModItems.POCKET_COMPUTER_NORMAL.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#A#" )
|
||||
.pattern( "#G#" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'A', Items.GOLDEN_APPLE )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlocks( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModItems.POCKET_COMPUTER_ADVANCED.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#A#" )
|
||||
.patternLine( "#G#" )
|
||||
.key( '#', Tags.Items.INGOTS_GOLD )
|
||||
.key( 'A', Items.GOLDEN_APPLE )
|
||||
.key( 'G', Tags.Items.GLASS_PANES )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.addCriterion( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModItems.POCKET_COMPUTER_ADVANCED.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#A#" )
|
||||
.pattern( "#G#" )
|
||||
.define( '#', Tags.Items.INGOTS_GOLD )
|
||||
.define( 'A', Items.GOLDEN_APPLE )
|
||||
.define( 'G', Tags.Items.GLASS_PANES )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlocks( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.PRINTER.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#R#" )
|
||||
.patternLine( "#D#" )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.key( 'D', Tags.Items.DYES )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.PRINTER.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#R#" )
|
||||
.pattern( "#D#" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.define( 'D', Tags.Items.DYES )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.SPEAKER.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#N#" )
|
||||
.patternLine( "#R#" )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'N', Blocks.NOTE_BLOCK )
|
||||
.key( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.SPEAKER.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#N#" )
|
||||
.pattern( "#R#" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'N', Blocks.NOTE_BLOCK )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModItems.WIRED_MODEM.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#R#" )
|
||||
.patternLine( "###" )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.addCriterion( "has_cable", inventoryChange( Registry.ModItems.CABLE.get() ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModItems.WIRED_MODEM.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#R#" )
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'R', Tags.Items.DUSTS_REDSTONE )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlocks( "has_cable", inventoryChange( Registry.ModItems.CABLE.get() ) )
|
||||
.save( add );
|
||||
|
||||
ShapelessRecipeBuilder
|
||||
.shapelessRecipe( Registry.ModBlocks.WIRED_MODEM_FULL.get() )
|
||||
.addIngredient( Registry.ModItems.WIRED_MODEM.get() )
|
||||
.addCriterion( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
|
||||
.build( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_from" ) );
|
||||
.shapeless( Registry.ModBlocks.WIRED_MODEM_FULL.get() )
|
||||
.requires( Registry.ModItems.WIRED_MODEM.get() )
|
||||
.unlocks( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
|
||||
.save( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_from" ) );
|
||||
ShapelessRecipeBuilder
|
||||
.shapelessRecipe( Registry.ModItems.WIRED_MODEM.get() )
|
||||
.addIngredient( Registry.ModBlocks.WIRED_MODEM_FULL.get() )
|
||||
.addCriterion( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
|
||||
.build( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_to" ) );
|
||||
.shapeless( Registry.ModItems.WIRED_MODEM.get() )
|
||||
.requires( Registry.ModBlocks.WIRED_MODEM_FULL.get() )
|
||||
.unlocks( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
|
||||
.save( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_to" ) );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#E#" )
|
||||
.patternLine( "###" )
|
||||
.key( '#', Tags.Items.STONE )
|
||||
.key( 'E', Tags.Items.ENDER_PEARLS )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#E#" )
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.STONE )
|
||||
.define( 'E', Tags.Items.ENDER_PEARLS )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.save( add );
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shapedRecipe( Registry.ModBlocks.WIRELESS_MODEM_ADVANCED.get() )
|
||||
.patternLine( "###" )
|
||||
.patternLine( "#E#" )
|
||||
.patternLine( "###" )
|
||||
.key( '#', Tags.Items.INGOTS_GOLD )
|
||||
.key( 'E', Items.ENDER_EYE )
|
||||
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.addCriterion( "has_wireless", inventoryChange( Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get() ) )
|
||||
.build( add );
|
||||
.shaped( Registry.ModBlocks.WIRELESS_MODEM_ADVANCED.get() )
|
||||
.pattern( "###" )
|
||||
.pattern( "#E#" )
|
||||
.pattern( "###" )
|
||||
.define( '#', Tags.Items.INGOTS_GOLD )
|
||||
.define( 'E', Items.ENDER_EYE )
|
||||
.unlocks( "has_computer", inventoryChange( CCTags.COMPUTER ) )
|
||||
.unlocks( "has_wireless", inventoryChange( Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get() ) )
|
||||
.save( add );
|
||||
}
|
||||
|
||||
private static DyeColor ofColour( Colour colour )
|
||||
@ -312,11 +312,11 @@ public class Recipes extends RecipeProvider
|
||||
|
||||
private static InventoryChangeTrigger.Instance inventoryChange( Tag<Item> stack )
|
||||
{
|
||||
return InventoryChangeTrigger.Instance.forItems( ItemPredicate.Builder.create().tag( stack ).build() );
|
||||
return InventoryChangeTrigger.Instance.hasItem( ItemPredicate.Builder.item().of( stack ).build() );
|
||||
}
|
||||
|
||||
private static InventoryChangeTrigger.Instance inventoryChange( IItemProvider... stack )
|
||||
{
|
||||
return InventoryChangeTrigger.Instance.forItems( stack );
|
||||
return InventoryChangeTrigger.Instance.hasItem( stack );
|
||||
}
|
||||
}
|
||||
|
@ -32,15 +32,15 @@ public class Tags extends ItemTagsProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTags()
|
||||
protected void addTags()
|
||||
{
|
||||
getBuilder( COMPUTER )
|
||||
tag( COMPUTER )
|
||||
.add( Registry.ModItems.COMPUTER_NORMAL.get() )
|
||||
.add( Registry.ModItems.COMPUTER_ADVANCED.get() )
|
||||
.add( Registry.ModItems.COMPUTER_COMMAND.get() );
|
||||
getBuilder( TURTLE ).add( Registry.ModItems.TURTLE_NORMAL.get(), Registry.ModItems.TURTLE_ADVANCED.get() );
|
||||
getBuilder( WIRED_MODEM ).add( Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get() );
|
||||
getBuilder( MONITOR )
|
||||
tag( TURTLE ).add( Registry.ModItems.TURTLE_NORMAL.get(), Registry.ModItems.TURTLE_ADVANCED.get() );
|
||||
tag( WIRED_MODEM ).add( Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get() );
|
||||
tag( MONITOR )
|
||||
.add( Registry.ModItems.MONITOR_NORMAL.get() )
|
||||
.add( Registry.ModItems.MONITOR_ADVANCED.get() );
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ public final class BundledRedstone
|
||||
|
||||
public static int getDefaultOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side )
|
||||
{
|
||||
return World.isValid( pos ) ? DefaultBundledRedstoneProvider.getDefaultBundledRedstoneOutput( world, pos, side ) : -1;
|
||||
return World.isInWorldBounds( pos ) ? DefaultBundledRedstoneProvider.getDefaultBundledRedstoneOutput( world, pos, side ) : -1;
|
||||
}
|
||||
|
||||
private static int getUnmaskedOutput( World world, BlockPos pos, Direction side )
|
||||
{
|
||||
if( !World.isValid( pos ) ) return -1;
|
||||
if( !World.isInWorldBounds( pos ) ) return -1;
|
||||
|
||||
// Try the providers in order:
|
||||
int combinedSignal = -1;
|
||||
|
@ -31,6 +31,9 @@ import java.util.stream.Collectors;
|
||||
import static net.minecraftforge.common.ForgeConfigSpec.Builder;
|
||||
import static net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec.Builder;
|
||||
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
||||
|
||||
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD )
|
||||
public final class Config
|
||||
{
|
||||
|
@ -40,13 +40,13 @@ public final class Peripherals
|
||||
@Nullable
|
||||
public static IPeripheral getPeripheral( World world, BlockPos pos, Direction side, NonNullConsumer<LazyOptional<IPeripheral>> invalidate )
|
||||
{
|
||||
return World.isValid( pos ) && !world.isRemote ? getPeripheralAt( world, pos, side, invalidate ) : null;
|
||||
return World.isInWorldBounds( pos ) && !world.isClientSide ? getPeripheralAt( world, pos, side, invalidate ) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static IPeripheral getPeripheralAt( World world, BlockPos pos, Direction side, NonNullConsumer<LazyOptional<IPeripheral>> invalidate )
|
||||
{
|
||||
TileEntity block = world.getTileEntity( pos );
|
||||
TileEntity block = world.getBlockEntity( pos );
|
||||
if( block != null )
|
||||
{
|
||||
LazyOptional<IPeripheral> peripheral = block.getCapability( CAPABILITY_PERIPHERAL, side );
|
||||
|
@ -96,17 +96,17 @@ public final class Registry
|
||||
|
||||
private static Block.Properties properties()
|
||||
{
|
||||
return Block.Properties.create( Material.ROCK ).hardnessAndResistance( 2 );
|
||||
return Block.Properties.of( Material.STONE ).strength( 2 );
|
||||
}
|
||||
|
||||
private static Block.Properties turtleProperties()
|
||||
{
|
||||
return Block.Properties.create( Material.ROCK ).hardnessAndResistance( 2.5f );
|
||||
return Block.Properties.of( Material.STONE ).strength( 2.5f );
|
||||
}
|
||||
|
||||
private static Block.Properties modemProperties()
|
||||
{
|
||||
return Block.Properties.create( Material.ROCK ).hardnessAndResistance( 1.5f );
|
||||
return Block.Properties.of( Material.STONE ).strength( 1.5f );
|
||||
}
|
||||
|
||||
public static final RegistryObject<BlockComputer> COMPUTER_NORMAL = BLOCKS.register( "computer_normal",
|
||||
@ -115,7 +115,7 @@ public final class Registry
|
||||
() -> new BlockComputer( properties(), ComputerFamily.ADVANCED, ModTiles.COMPUTER_ADVANCED ) );
|
||||
|
||||
public static final RegistryObject<BlockComputer> COMPUTER_COMMAND = BLOCKS.register( "computer_command", () -> new BlockComputer(
|
||||
Block.Properties.create( Material.ROCK ).hardnessAndResistance( -1, 6000000.0F ),
|
||||
Block.Properties.of( Material.STONE ).strength( -1, 6000000.0F ),
|
||||
ComputerFamily.COMMAND, ModTiles.COMPUTER_COMMAND
|
||||
) );
|
||||
|
||||
@ -187,7 +187,7 @@ public final class Registry
|
||||
|
||||
private static Item.Properties properties()
|
||||
{
|
||||
return new Item.Properties().group( mainItemGroup );
|
||||
return new Item.Properties().tab( mainItemGroup );
|
||||
}
|
||||
|
||||
private static <B extends Block, I extends Item> RegistryObject<I> ofBlock( RegistryObject<B> parent, BiFunction<B, Item.Properties, I> supplier )
|
||||
@ -200,24 +200,24 @@ public final class Registry
|
||||
public static final RegistryObject<ItemComputer> COMPUTER_COMMAND = ofBlock( ModBlocks.COMPUTER_COMMAND, ItemComputer::new );
|
||||
|
||||
public static final RegistryObject<ItemPocketComputer> POCKET_COMPUTER_NORMAL = ITEMS.register( "pocket_computer_normal",
|
||||
() -> new ItemPocketComputer( properties().maxStackSize( 1 ), ComputerFamily.NORMAL ) );
|
||||
() -> new ItemPocketComputer( properties().stacksTo( 1 ), ComputerFamily.NORMAL ) );
|
||||
public static final RegistryObject<ItemPocketComputer> POCKET_COMPUTER_ADVANCED = ITEMS.register( "pocket_computer_advanced",
|
||||
() -> new ItemPocketComputer( properties().maxStackSize( 1 ), ComputerFamily.ADVANCED ) );
|
||||
() -> new ItemPocketComputer( properties().stacksTo( 1 ), ComputerFamily.ADVANCED ) );
|
||||
|
||||
public static final RegistryObject<ItemTurtle> TURTLE_NORMAL = ofBlock( ModBlocks.TURTLE_NORMAL, ItemTurtle::new );
|
||||
public static final RegistryObject<ItemTurtle> TURTLE_ADVANCED = ofBlock( ModBlocks.TURTLE_ADVANCED, ItemTurtle::new );
|
||||
|
||||
public static final RegistryObject<ItemDisk> DISK =
|
||||
ITEMS.register( "disk", () -> new ItemDisk( properties().maxStackSize( 1 ) ) );
|
||||
ITEMS.register( "disk", () -> new ItemDisk( properties().stacksTo( 1 ) ) );
|
||||
public static final RegistryObject<ItemTreasureDisk> TREASURE_DISK =
|
||||
ITEMS.register( "treasure_disk", () -> new ItemTreasureDisk( properties().maxStackSize( 1 ) ) );
|
||||
ITEMS.register( "treasure_disk", () -> new ItemTreasureDisk( properties().stacksTo( 1 ) ) );
|
||||
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_PAGE = ITEMS.register( "printed_page",
|
||||
() -> new ItemPrintout( properties().maxStackSize( 1 ), ItemPrintout.Type.PAGE ) );
|
||||
() -> new ItemPrintout( properties().stacksTo( 1 ), ItemPrintout.Type.PAGE ) );
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_PAGES = ITEMS.register( "printed_pages",
|
||||
() -> new ItemPrintout( properties().maxStackSize( 1 ), ItemPrintout.Type.PAGES ) );
|
||||
() -> new ItemPrintout( properties().stacksTo( 1 ), ItemPrintout.Type.PAGES ) );
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_BOOK = ITEMS.register( "printed_book",
|
||||
() -> new ItemPrintout( properties().maxStackSize( 1 ), ItemPrintout.Type.BOOK ) );
|
||||
() -> new ItemPrintout( properties().stacksTo( 1 ), ItemPrintout.Type.BOOK ) );
|
||||
|
||||
public static final RegistryObject<BlockItem> SPEAKER = ofBlock( ModBlocks.SPEAKER, BlockItem::new );
|
||||
public static final RegistryObject<BlockItem> DISK_DRIVE = ofBlock( ModBlocks.DISK_DRIVE, BlockItem::new );
|
||||
@ -284,10 +284,10 @@ public final class Registry
|
||||
static final DeferredRegister<EntityType<?>> ENTITIES = new DeferredRegister<>( ForgeRegistries.ENTITIES, ComputerCraft.MOD_ID );
|
||||
|
||||
public static final RegistryObject<EntityType<TurtlePlayer>> TURTLE_PLAYER = ENTITIES.register( "turtle_player", () ->
|
||||
EntityType.Builder.<TurtlePlayer>create( EntityClassification.MISC )
|
||||
.disableSerialization()
|
||||
.disableSummoning()
|
||||
.size( 0, 0 )
|
||||
EntityType.Builder.<TurtlePlayer>createNothing( EntityClassification.MISC )
|
||||
.noSave()
|
||||
.noSummon()
|
||||
.sized( 0, 0 )
|
||||
.build( ComputerCraft.MOD_ID + ":turtle_player" ) );
|
||||
}
|
||||
|
||||
|
@ -20,13 +20,13 @@ public final class TurtlePermissions
|
||||
public static boolean isBlockEnterable( World world, BlockPos pos, PlayerEntity player )
|
||||
{
|
||||
MinecraftServer server = world.getServer();
|
||||
return server == null || world.isRemote || !server.isBlockProtected( world, pos, player );
|
||||
return server == null || world.isClientSide || !server.isUnderSpawnProtection( world, pos, player );
|
||||
}
|
||||
|
||||
public static boolean isBlockEditable( World world, BlockPos pos, PlayerEntity player )
|
||||
{
|
||||
MinecraftServer server = world.getServer();
|
||||
return server == null || world.isRemote || !server.isBlockProtected( world, pos, player );
|
||||
return server == null || world.isClientSide || !server.isUnderSpawnProtection( world, pos, player );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -75,13 +75,13 @@ public final class CommandComputerCraft
|
||||
List<ServerComputer> computers = new ArrayList<>( ComputerCraft.serverComputerRegistry.getComputers() );
|
||||
|
||||
// Unless we're on a server, limit the number of rows we can send.
|
||||
World world = source.getWorld();
|
||||
BlockPos pos = new BlockPos( source.getPos() );
|
||||
World world = source.getLevel();
|
||||
BlockPos pos = new BlockPos( source.getPosition() );
|
||||
|
||||
computers.sort( ( a, b ) -> {
|
||||
if( a.getWorld() == b.getWorld() && a.getWorld() == world )
|
||||
{
|
||||
return Double.compare( a.getPosition().distanceSq( pos ), b.getPosition().distanceSq( pos ) );
|
||||
return Double.compare( a.getPosition().distSqr( pos ), b.getPosition().distSqr( pos ) );
|
||||
}
|
||||
else if( a.getWorld() == world )
|
||||
{
|
||||
@ -145,7 +145,7 @@ public final class CommandComputerCraft
|
||||
if( computer.isOn() ) shutdown++;
|
||||
computer.shutdown();
|
||||
}
|
||||
context.getSource().sendFeedback( translate( "commands.computercraft.shutdown.done", shutdown, computers.size() ), false );
|
||||
context.getSource().sendSuccess( translate( "commands.computercraft.shutdown.done", shutdown, computers.size() ), false );
|
||||
return shutdown;
|
||||
} ) )
|
||||
|
||||
@ -159,7 +159,7 @@ public final class CommandComputerCraft
|
||||
if( !computer.isOn() ) on++;
|
||||
computer.turnOn();
|
||||
}
|
||||
context.getSource().sendFeedback( translate( "commands.computercraft.turn_on.done", on, computers.size() ), false );
|
||||
context.getSource().sendSuccess( translate( "commands.computercraft.turn_on.done", on, computers.size() ), false );
|
||||
return on;
|
||||
} ) )
|
||||
|
||||
@ -173,20 +173,20 @@ public final class CommandComputerCraft
|
||||
|
||||
if( world == null || pos == null ) throw TP_NOT_THERE.create();
|
||||
|
||||
Entity entity = context.getSource().assertIsEntity();
|
||||
Entity entity = context.getSource().getEntityOrException();
|
||||
if( !(entity instanceof ServerPlayerEntity) ) throw TP_NOT_PLAYER.create();
|
||||
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) entity;
|
||||
if( player.getEntityWorld() == world )
|
||||
if( player.getCommandSenderWorld() == world )
|
||||
{
|
||||
player.connection.setPlayerLocation(
|
||||
player.connection.teleport(
|
||||
pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 0, 0,
|
||||
EnumSet.noneOf( SPlayerPositionLookPacket.Flags.class )
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleport( (ServerWorld) world,
|
||||
player.teleportTo( (ServerWorld) world,
|
||||
pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 0, 0
|
||||
);
|
||||
}
|
||||
@ -219,7 +219,7 @@ public final class CommandComputerCraft
|
||||
.requires( UserLevel.OP )
|
||||
.arg( "computer", oneComputer() )
|
||||
.executes( context -> {
|
||||
ServerPlayerEntity player = context.getSource().asPlayer();
|
||||
ServerPlayerEntity player = context.getSource().getPlayerOrException();
|
||||
ServerComputer computer = getComputerArgument( context, "computer" );
|
||||
new ViewComputerContainerData( computer ).open( player, new INamedContainerProvider()
|
||||
{
|
||||
@ -247,7 +247,7 @@ public final class CommandComputerCraft
|
||||
getTimingContext( context.getSource() ).start();
|
||||
|
||||
String stopCommand = "/computercraft track stop";
|
||||
context.getSource().sendFeedback( translate( "commands.computercraft.track.start.stop",
|
||||
context.getSource().sendSuccess( translate( "commands.computercraft.track.start.stop",
|
||||
link( text( stopCommand ), stopCommand, translate( "commands.computercraft.track.stop.action" ) ) ), false );
|
||||
return 1;
|
||||
} ) )
|
||||
@ -288,11 +288,11 @@ public final class CommandComputerCraft
|
||||
// Append the computer instance
|
||||
if( serverComputer == null )
|
||||
{
|
||||
out.appendSibling( text( "?" ) );
|
||||
out.append( text( "?" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
out.appendSibling( link(
|
||||
out.append( link(
|
||||
text( Integer.toString( serverComputer.getInstanceID() ) ),
|
||||
"/computercraft dump " + serverComputer.getInstanceID(),
|
||||
translate( "commands.computercraft.dump.action" )
|
||||
@ -300,20 +300,20 @@ public final class CommandComputerCraft
|
||||
}
|
||||
|
||||
// And ID
|
||||
out.appendText( " (id " + computerId + ")" );
|
||||
out.append( " (id " + computerId + ")" );
|
||||
|
||||
// And, if we're a player, some useful links
|
||||
if( serverComputer != null && UserLevel.OP.test( source ) && isPlayer( source ) )
|
||||
{
|
||||
out
|
||||
.appendText( " " )
|
||||
.appendSibling( link(
|
||||
.append( " " )
|
||||
.append( link(
|
||||
text( "\u261b" ),
|
||||
"/computercraft tp " + serverComputer.getInstanceID(),
|
||||
translate( "commands.computercraft.tp.action" )
|
||||
) )
|
||||
.appendText( " " )
|
||||
.appendSibling( link(
|
||||
.append( " " )
|
||||
.append( link(
|
||||
text( "\u20e2" ),
|
||||
"/computercraft view " + serverComputer.getInstanceID(),
|
||||
translate( "commands.computercraft.view.action" )
|
||||
@ -343,7 +343,7 @@ public final class CommandComputerCraft
|
||||
private static TrackingContext getTimingContext( CommandSource source )
|
||||
{
|
||||
Entity entity = source.getEntity();
|
||||
return entity instanceof PlayerEntity ? Tracking.getContext( entity.getUniqueID() ) : Tracking.getContext( SYSTEM_UUID );
|
||||
return entity instanceof PlayerEntity ? Tracking.getContext( entity.getUUID() ) : Tracking.getContext( SYSTEM_UUID );
|
||||
}
|
||||
|
||||
private static final List<TrackingField> DEFAULT_FIELDS = Arrays.asList( TrackingField.TASKS, TrackingField.TOTAL_TIME, TrackingField.AVERAGE_TIME, TrackingField.MAX_TIME );
|
||||
|
@ -38,7 +38,7 @@ public final class CommandCopy
|
||||
.then( literal( "copy" ) )
|
||||
.then( argument( "message", StringArgumentType.greedyString() ) )
|
||||
.executes( context -> {
|
||||
Minecraft.getInstance().keyboardListener.setClipboardString( context.getArgument( "message", String.class ) );
|
||||
Minecraft.getInstance().keyboardHandler.setClipboard( context.getArgument( "message", String.class ) );
|
||||
return 1;
|
||||
} )
|
||||
);
|
||||
@ -50,7 +50,7 @@ public final class CommandCopy
|
||||
// Emulate the command on the client side
|
||||
if( event.getMessage().startsWith( PREFIX ) )
|
||||
{
|
||||
Minecraft.getInstance().keyboardListener.setClipboardString( event.getMessage().substring( PREFIX.length() ) );
|
||||
Minecraft.getInstance().keyboardHandler.setClipboard( event.getMessage().substring( PREFIX.length() ) );
|
||||
event.setCanceled( true );
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public final class CommandUtils
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((ISuggestionProvider) source).getSuggestionsFromServer( (CommandContext<ISuggestionProvider>) context, builder );
|
||||
return ((ISuggestionProvider) source).customSuggestion( (CommandContext<ISuggestionProvider>) context, builder );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ public enum UserLevel implements Predicate<CommandSource>
|
||||
MinecraftServer server = source.getServer();
|
||||
Entity sender = source.getEntity();
|
||||
|
||||
if( server.isSinglePlayer() && sender instanceof PlayerEntity &&
|
||||
if( server.isSingleplayer() && sender instanceof PlayerEntity &&
|
||||
((PlayerEntity) sender).getGameProfile().getName().equalsIgnoreCase( server.getServerModName() ) )
|
||||
{
|
||||
if( this == OWNER || this == OWNER_OP ) return true;
|
||||
}
|
||||
|
||||
return source.hasPermissionLevel( toLevel() );
|
||||
return source.hasPermission( toLevel() );
|
||||
}
|
||||
}
|
||||
|
@ -175,20 +175,20 @@ public final class ComputersArgumentType implements ArgumentType<ComputersArgume
|
||||
{
|
||||
|
||||
@Override
|
||||
public void write( @Nonnull ComputersArgumentType arg, @Nonnull PacketBuffer buf )
|
||||
public void serializeToNetwork( @Nonnull ComputersArgumentType arg, @Nonnull PacketBuffer buf )
|
||||
{
|
||||
buf.writeBoolean( arg.requireSome );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ComputersArgumentType read( @Nonnull PacketBuffer buf )
|
||||
public ComputersArgumentType deserializeFromNetwork( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
return buf.readBoolean() ? SOME : MANY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write( @Nonnull ComputersArgumentType arg, @Nonnull JsonObject json )
|
||||
public void serializeToJson( @Nonnull ComputersArgumentType arg, @Nonnull JsonObject json )
|
||||
{
|
||||
json.addProperty( "requireSome", arg.requireSome );
|
||||
}
|
||||
|
@ -128,27 +128,27 @@ public final class RepeatArgumentType<T, U> implements ArgumentType<List<T>>
|
||||
public static class Serializer implements IArgumentSerializer<RepeatArgumentType<?, ?>>
|
||||
{
|
||||
@Override
|
||||
public void write( @Nonnull RepeatArgumentType<?, ?> arg, @Nonnull PacketBuffer buf )
|
||||
public void serializeToNetwork( @Nonnull RepeatArgumentType<?, ?> arg, @Nonnull PacketBuffer buf )
|
||||
{
|
||||
buf.writeBoolean( arg.flatten );
|
||||
ArgumentTypes.serialize( buf, arg.child );
|
||||
buf.writeTextComponent( getMessage( arg ) );
|
||||
buf.writeComponent( getMessage( arg ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SuppressWarnings( { "unchecked", "rawtypes" } )
|
||||
public RepeatArgumentType<?, ?> read( @Nonnull PacketBuffer buf )
|
||||
public RepeatArgumentType<?, ?> deserializeFromNetwork( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
boolean isList = buf.readBoolean();
|
||||
ArgumentType<?> child = ArgumentTypes.deserialize( buf );
|
||||
ITextComponent message = buf.readTextComponent();
|
||||
ITextComponent message = buf.readComponent();
|
||||
BiConsumer<List<Object>, ?> appender = isList ? ( list, x ) -> list.addAll( (Collection) x ) : List::add;
|
||||
return new RepeatArgumentType( child, appender, isList, new SimpleCommandExceptionType( message ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write( @Nonnull RepeatArgumentType<?, ?> arg, @Nonnull JsonObject json )
|
||||
public void serializeToJson( @Nonnull RepeatArgumentType<?, ?> arg, @Nonnull JsonObject json )
|
||||
{
|
||||
json.addProperty( "flatten", arg.flatten );
|
||||
json.addProperty( "child", "<<cannot serialize>>" ); // TODO: Potentially serialize this using reflection.
|
||||
|
@ -151,7 +151,7 @@ public final class HelpingArgumentBuilder extends LiteralArgumentBuilder<Command
|
||||
@Override
|
||||
public int run( CommandContext<CommandSource> context )
|
||||
{
|
||||
context.getSource().sendFeedback( getHelp( context, node, id, command ), false );
|
||||
context.getSource().sendSuccess( getHelp( context, node, id, command ), false );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ public final class HelpingArgumentBuilder extends LiteralArgumentBuilder<Command
|
||||
private static Command<CommandSource> helpForChild( CommandNode<CommandSource> node, String id, String command )
|
||||
{
|
||||
return context -> {
|
||||
context.getSource().sendFeedback( getHelp( context, node, id + "." + node.getName().replace( '-', '_' ), command + " " + node.getName() ), false );
|
||||
context.getSource().sendSuccess( getHelp( context, node, id + "." + node.getName().replace( '-', '_' ), command + " " + node.getName() ), false );
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
@ -168,17 +168,17 @@ public final class HelpingArgumentBuilder extends LiteralArgumentBuilder<Command
|
||||
{
|
||||
// An ugly hack to extract usage information from the dispatcher. We generate a temporary node, generate
|
||||
// the shorthand usage, and emit that.
|
||||
CommandDispatcher<CommandSource> dispatcher = context.getSource().getServer().getCommandManager().getDispatcher();
|
||||
CommandDispatcher<CommandSource> dispatcher = context.getSource().getServer().getCommands().getDispatcher();
|
||||
CommandNode<CommandSource> temp = new LiteralCommandNode<>( "_", null, x -> true, null, null, false );
|
||||
temp.addChild( node );
|
||||
String usage = dispatcher.getSmartUsage( temp, context.getSource() ).get( node ).substring( node.getName().length() );
|
||||
|
||||
ITextComponent output = new StringTextComponent( "" )
|
||||
.appendSibling( coloured( "/" + command + usage, HEADER ) )
|
||||
.appendText( " " )
|
||||
.appendSibling( coloured( translate( "commands." + id + ".synopsis" ), SYNOPSIS ) )
|
||||
.appendText( "\n" )
|
||||
.appendSibling( translate( "commands." + id + ".desc" ) );
|
||||
.append( coloured( "/" + command + usage, HEADER ) )
|
||||
.append( " " )
|
||||
.append( coloured( translate( "commands." + id + ".synopsis" ), SYNOPSIS ) )
|
||||
.append( "\n" )
|
||||
.append( translate( "commands." + id + ".desc" ) );
|
||||
|
||||
for( CommandNode<CommandSource> child : node.getChildren() )
|
||||
{
|
||||
@ -187,16 +187,16 @@ public final class HelpingArgumentBuilder extends LiteralArgumentBuilder<Command
|
||||
continue;
|
||||
}
|
||||
|
||||
output.appendText( "\n" );
|
||||
output.append( "\n" );
|
||||
|
||||
ITextComponent component = coloured( child.getName(), NAME );
|
||||
component.getStyle().setClickEvent( new ClickEvent(
|
||||
ClickEvent.Action.SUGGEST_COMMAND,
|
||||
"/" + command + " " + child.getName()
|
||||
) );
|
||||
output.appendSibling( component );
|
||||
output.append( component );
|
||||
|
||||
output.appendText( " - " ).appendSibling( translate( "commands." + id + "." + child.getName() + ".synopsis" ) );
|
||||
output.append( " - " ).append( translate( "commands." + id + "." + child.getName() + ".synopsis" ) );
|
||||
}
|
||||
|
||||
return output;
|
||||
|
@ -52,7 +52,7 @@ public final class ChatHelpers
|
||||
ITextComponent component = new StringTextComponent( "" );
|
||||
for( ITextComponent child : children )
|
||||
{
|
||||
component.appendSibling( child );
|
||||
component.append( child );
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
@ -45,6 +45,6 @@ public class ServerTableFormatter implements TableFormatter
|
||||
@Override
|
||||
public void writeLine( int id, ITextComponent component )
|
||||
{
|
||||
source.sendFeedback( component, false );
|
||||
source.sendSuccess( component, false );
|
||||
}
|
||||
}
|
||||
|
@ -79,12 +79,12 @@ public interface TableFormatter
|
||||
StringTextComponent line = new StringTextComponent( "" );
|
||||
for( int i = 0; i < columns - 1; i++ )
|
||||
{
|
||||
line.appendSibling( headers[i] );
|
||||
line.append( headers[i] );
|
||||
ITextComponent padding = getPadding( headers[i], maxWidths[i] );
|
||||
if( padding != null ) line.appendSibling( padding );
|
||||
line.appendSibling( SEPARATOR );
|
||||
if( padding != null ) line.append( padding );
|
||||
line.append( SEPARATOR );
|
||||
}
|
||||
line.appendSibling( headers[columns - 1] );
|
||||
line.append( headers[columns - 1] );
|
||||
|
||||
writeLine( rowId++, line );
|
||||
|
||||
@ -100,12 +100,12 @@ public interface TableFormatter
|
||||
StringTextComponent line = new StringTextComponent( "" );
|
||||
for( int i = 0; i < columns - 1; i++ )
|
||||
{
|
||||
line.appendSibling( row[i] );
|
||||
line.append( row[i] );
|
||||
ITextComponent padding = getPadding( row[i], maxWidths[i] );
|
||||
if( padding != null ) line.appendSibling( padding );
|
||||
line.appendSibling( SEPARATOR );
|
||||
if( padding != null ) line.append( padding );
|
||||
line.append( SEPARATOR );
|
||||
}
|
||||
line.appendSibling( row[columns - 1] );
|
||||
line.append( row[columns - 1] );
|
||||
writeLine( rowId++, line );
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block.Properties;
|
||||
|
||||
public abstract class BlockGeneric extends Block
|
||||
{
|
||||
private final RegistryObject<? extends TileEntityType<? extends TileGeneric>> type;
|
||||
@ -36,22 +38,22 @@ public abstract class BlockGeneric extends Block
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final void onReplaced( @Nonnull BlockState block, @Nonnull World world, @Nonnull BlockPos pos, BlockState replace, boolean bool )
|
||||
public final void onRemove( @Nonnull BlockState block, @Nonnull World world, @Nonnull BlockPos pos, BlockState replace, boolean bool )
|
||||
{
|
||||
if( block.getBlock() == replace.getBlock() ) return;
|
||||
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
super.onReplaced( block, world, pos, replace, bool );
|
||||
world.removeTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
super.onRemove( block, world, pos, replace, bool );
|
||||
world.removeBlockEntity( pos );
|
||||
if( tile instanceof TileGeneric ) ((TileGeneric) tile).destroy();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Deprecated
|
||||
public final ActionResultType onBlockActivated( @Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, @Nonnull Hand hand, @Nonnull BlockRayTraceResult hit )
|
||||
public final ActionResultType use( @Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, @Nonnull Hand hand, @Nonnull BlockRayTraceResult hit )
|
||||
{
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
return tile instanceof TileGeneric ? ((TileGeneric) tile).onActivate( player, hand, hit ) : ActionResultType.PASS;
|
||||
}
|
||||
|
||||
@ -59,14 +61,14 @@ public abstract class BlockGeneric extends Block
|
||||
@Deprecated
|
||||
public final void neighborChanged( @Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull Block neighbourBlock, @Nonnull BlockPos neighbourPos, boolean isMoving )
|
||||
{
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( tile instanceof TileGeneric ) ((TileGeneric) tile).onNeighbourChange( neighbourPos );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onNeighborChange( BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbour )
|
||||
{
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( tile instanceof TileGeneric ) ((TileGeneric) tile).onNeighbourTileEntityChange( neighbour );
|
||||
}
|
||||
|
||||
@ -74,7 +76,7 @@ public abstract class BlockGeneric extends Block
|
||||
@Deprecated
|
||||
public void tick( @Nonnull BlockState state, ServerWorld world, @Nonnull BlockPos pos, @Nonnull Random rand )
|
||||
{
|
||||
TileEntity te = world.getTileEntity( pos );
|
||||
TileEntity te = world.getBlockEntity( pos );
|
||||
if( te instanceof TileGeneric ) ((TileGeneric) te).blockTick();
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,9 @@ public final class ColourableRecipe extends SpecialRecipe
|
||||
{
|
||||
boolean hasColourable = false;
|
||||
boolean hasDye = false;
|
||||
for( int i = 0; i < inv.getSizeInventory(); i++ )
|
||||
for( int i = 0; i < inv.getContainerSize(); i++ )
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot( i );
|
||||
ItemStack stack = inv.getItem( i );
|
||||
if( stack.isEmpty() ) continue;
|
||||
|
||||
if( stack.getItem() instanceof IColouredItem )
|
||||
@ -55,15 +55,15 @@ public final class ColourableRecipe extends SpecialRecipe
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult( @Nonnull CraftingInventory inv )
|
||||
public ItemStack assemble( @Nonnull CraftingInventory inv )
|
||||
{
|
||||
ItemStack colourable = ItemStack.EMPTY;
|
||||
|
||||
ColourTracker tracker = new ColourTracker();
|
||||
|
||||
for( int i = 0; i < inv.getSizeInventory(); i++ )
|
||||
for( int i = 0; i < inv.getContainerSize(); i++ )
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot( i );
|
||||
ItemStack stack = inv.getItem( i );
|
||||
|
||||
if( stack.isEmpty() ) continue;
|
||||
|
||||
@ -83,7 +83,7 @@ public final class ColourableRecipe extends SpecialRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit( int x, int y )
|
||||
public boolean canCraftInDimensions( int x, int y )
|
||||
{
|
||||
return x >= 2 && y >= 2;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class ContainerHeldItem extends Container
|
||||
super( type, id );
|
||||
|
||||
this.hand = hand;
|
||||
stack = player.getHeldItem( hand ).copy();
|
||||
stack = player.getItemInHand( hand ).copy();
|
||||
}
|
||||
|
||||
public static ContainerHeldItem createPrintout( int id, PlayerInventory inventory, HeldItemContainerData data )
|
||||
@ -44,11 +44,11 @@ public class ContainerHeldItem extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( @Nonnull PlayerEntity player )
|
||||
public boolean stillValid( @Nonnull PlayerEntity player )
|
||||
{
|
||||
if( !player.isAlive() ) return false;
|
||||
|
||||
ItemStack stack = player.getHeldItem( hand );
|
||||
ItemStack stack = player.getItemInHand( hand );
|
||||
return stack == this.stack || !stack.isEmpty() && !this.stack.isEmpty() && stack.getItem() == this.stack.getItem();
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ public class ContainerHeldItem extends Container
|
||||
public Factory( ContainerType<ContainerHeldItem> type, ItemStack stack, Hand hand )
|
||||
{
|
||||
this.type = type;
|
||||
this.name = stack.getDisplayName();
|
||||
this.name = stack.getHoverName();
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
|
@ -32,10 +32,10 @@ public abstract class TileGeneric extends TileEntity
|
||||
|
||||
public final void updateBlock()
|
||||
{
|
||||
markDirty();
|
||||
BlockPos pos = getPos();
|
||||
setChanged();
|
||||
BlockPos pos = getBlockPos();
|
||||
BlockState state = getBlockState();
|
||||
getWorld().notifyBlockUpdate( pos, state, state, 3 );
|
||||
getLevel().sendBlockUpdated( pos, state, state, 3 );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@ -63,13 +63,13 @@ public abstract class TileGeneric extends TileEntity
|
||||
|
||||
public boolean isUsable( PlayerEntity player, boolean ignoreRange )
|
||||
{
|
||||
if( player == null || !player.isAlive() || getWorld().getTileEntity( getPos() ) != this ) return false;
|
||||
if( player == null || !player.isAlive() || getLevel().getBlockEntity( getBlockPos() ) != this ) return false;
|
||||
if( ignoreRange ) return true;
|
||||
|
||||
double range = getInteractRange( player );
|
||||
BlockPos pos = getPos();
|
||||
return player.getEntityWorld() == getWorld() &&
|
||||
player.getDistanceSq( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 ) <= range * range;
|
||||
BlockPos pos = getBlockPos();
|
||||
return player.getCommandSenderWorld() == getLevel() &&
|
||||
player.distanceToSqr( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 ) <= range * range;
|
||||
}
|
||||
|
||||
protected void writeDescription( @Nonnull CompoundNBT nbt )
|
||||
@ -86,13 +86,13 @@ public abstract class TileGeneric extends TileEntity
|
||||
{
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
writeDescription( nbt );
|
||||
return new SUpdateTileEntityPacket( pos, 0, nbt );
|
||||
return new SUpdateTileEntityPacket( worldPosition, 0, nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onDataPacket( NetworkManager net, SUpdateTileEntityPacket packet )
|
||||
{
|
||||
if( packet.getTileEntityType() == 0 ) readDescription( packet.getNbtCompound() );
|
||||
if( packet.getType() == 0 ) readDescription( packet.getTag() );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -48,18 +48,18 @@ public class CommandAPI implements ILuaAPI
|
||||
|
||||
private Object[] doCommand( String command )
|
||||
{
|
||||
MinecraftServer server = computer.getWorld().getServer();
|
||||
MinecraftServer server = computer.getLevel().getServer();
|
||||
if( server == null || !server.isCommandBlockEnabled() )
|
||||
{
|
||||
return new Object[] { false, createOutput( "Command blocks disabled by server" ) };
|
||||
}
|
||||
|
||||
Commands commandManager = server.getCommandManager();
|
||||
Commands commandManager = server.getCommands();
|
||||
TileCommandComputer.CommandReceiver receiver = computer.getReceiver();
|
||||
try
|
||||
{
|
||||
receiver.clearOutput();
|
||||
int result = commandManager.handleCommand( computer.getSource(), command );
|
||||
int result = commandManager.performCommand( computer.getSource(), command );
|
||||
return new Object[] { result > 0, receiver.copyOutput(), result };
|
||||
}
|
||||
catch( Throwable t )
|
||||
@ -75,8 +75,8 @@ public class CommandAPI implements ILuaAPI
|
||||
BlockState state = world.getBlockState( pos );
|
||||
Map<String, Object> table = BlockData.fill( new HashMap<>(), state );
|
||||
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
if( tile != null ) table.put( "nbt", NBTUtil.toLua( tile.write( new CompoundNBT() ) ) );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( tile != null ) table.put( "nbt", NBTUtil.toLua( tile.save( new CompoundNBT() ) ) );
|
||||
|
||||
return table;
|
||||
}
|
||||
@ -139,10 +139,10 @@ public class CommandAPI implements ILuaAPI
|
||||
@LuaFunction( mainThread = true )
|
||||
public final List<String> list( IArguments args ) throws LuaException
|
||||
{
|
||||
MinecraftServer server = computer.getWorld().getServer();
|
||||
MinecraftServer server = computer.getLevel().getServer();
|
||||
|
||||
if( server == null ) return Collections.emptyList();
|
||||
CommandNode<CommandSource> node = server.getCommandManager().getDispatcher().getRoot();
|
||||
CommandNode<CommandSource> node = server.getCommands().getDispatcher().getRoot();
|
||||
for( int j = 0; j < args.count(); j++ )
|
||||
{
|
||||
String name = args.getString( j );
|
||||
@ -171,7 +171,7 @@ public class CommandAPI implements ILuaAPI
|
||||
public final Object[] getBlockPosition()
|
||||
{
|
||||
// This is probably safe to do on the Lua thread. Probably.
|
||||
BlockPos pos = computer.getPos();
|
||||
BlockPos pos = computer.getBlockPos();
|
||||
return new Object[] { pos.getX(), pos.getY(), pos.getZ() };
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ public class CommandAPI implements ILuaAPI
|
||||
public final List<Map<?, ?>> getBlockInfos( int minX, int minY, int minZ, int maxX, int maxY, int maxZ ) throws LuaException
|
||||
{
|
||||
// Get the details of the block
|
||||
World world = computer.getWorld();
|
||||
World world = computer.getLevel();
|
||||
BlockPos min = new BlockPos(
|
||||
Math.min( minX, maxX ),
|
||||
Math.min( minY, maxY ),
|
||||
@ -209,7 +209,7 @@ public class CommandAPI implements ILuaAPI
|
||||
Math.max( minY, maxY ),
|
||||
Math.max( minZ, maxZ )
|
||||
);
|
||||
if( !World.isValid( min ) || !World.isValid( max ) )
|
||||
if( !World.isInWorldBounds( min ) || !World.isInWorldBounds( max ) )
|
||||
{
|
||||
throw new LuaException( "Co-ordinates out of range" );
|
||||
}
|
||||
@ -250,9 +250,9 @@ public class CommandAPI implements ILuaAPI
|
||||
public final Map<?, ?> getBlockInfo( int x, int y, int z ) throws LuaException
|
||||
{
|
||||
// Get the details of the block
|
||||
World world = computer.getWorld();
|
||||
World world = computer.getLevel();
|
||||
BlockPos position = new BlockPos( x, y, z );
|
||||
if( World.isValid( position ) )
|
||||
if( World.isInWorldBounds( position ) )
|
||||
{
|
||||
return getBlockInfo( world, position );
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ import net.minecraftforge.fml.RegistryObject;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block.Properties;
|
||||
|
||||
public class BlockComputer extends BlockComputerBase<TileComputer>
|
||||
{
|
||||
public static final EnumProperty<ComputerState> STATE = EnumProperty.create( "state", ComputerState.class );
|
||||
@ -31,14 +33,14 @@ public class BlockComputer extends BlockComputerBase<TileComputer>
|
||||
public BlockComputer( Properties settings, ComputerFamily family, RegistryObject<? extends TileEntityType<? extends TileComputer>> type )
|
||||
{
|
||||
super( settings, family, type );
|
||||
setDefaultState( getDefaultState()
|
||||
.with( FACING, Direction.NORTH )
|
||||
.with( STATE, ComputerState.OFF )
|
||||
registerDefaultState( defaultBlockState()
|
||||
.setValue( FACING, Direction.NORTH )
|
||||
.setValue( STATE, ComputerState.OFF )
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer( StateContainer.Builder<Block, BlockState> builder )
|
||||
protected void createBlockStateDefinition( StateContainer.Builder<Block, BlockState> builder )
|
||||
{
|
||||
builder.add( FACING, STATE );
|
||||
}
|
||||
@ -47,7 +49,7 @@ public class BlockComputer extends BlockComputerBase<TileComputer>
|
||||
@Override
|
||||
public BlockState getStateForPlacement( BlockItemUseContext placement )
|
||||
{
|
||||
return getDefaultState().with( FACING, placement.getPlacementHorizontalFacing().getOpposite() );
|
||||
return defaultBlockState().setValue( FACING, placement.getHorizontalDirection().getOpposite() );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -34,6 +34,8 @@ import net.minecraftforge.fml.RegistryObject;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block.Properties;
|
||||
|
||||
public abstract class BlockComputerBase<T extends TileComputerBase> extends BlockGeneric implements IBundledRedstoneBlock
|
||||
{
|
||||
private static final ResourceLocation DROP = new ResourceLocation( ComputerCraft.MOD_ID, "computer" );
|
||||
@ -48,26 +50,26 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void onBlockAdded( @Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState oldState, boolean isMoving )
|
||||
public void onPlace( @Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState oldState, boolean isMoving )
|
||||
{
|
||||
super.onBlockAdded( state, world, pos, oldState, isMoving );
|
||||
super.onPlace( state, world, pos, oldState, isMoving );
|
||||
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( tile instanceof TileComputerBase ) ((TileComputerBase) tile).updateInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean canProvidePower( @Nonnull BlockState state )
|
||||
public boolean isSignalSource( @Nonnull BlockState state )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public int getStrongPower( @Nonnull BlockState state, IBlockReader world, @Nonnull BlockPos pos, @Nonnull Direction incomingSide )
|
||||
public int getDirectSignal( @Nonnull BlockState state, IBlockReader world, @Nonnull BlockPos pos, @Nonnull Direction incomingSide )
|
||||
{
|
||||
TileEntity entity = world.getTileEntity( pos );
|
||||
TileEntity entity = world.getBlockEntity( pos );
|
||||
if( !(entity instanceof TileComputerBase) ) return 0;
|
||||
|
||||
TileComputerBase computerEntity = (TileComputerBase) entity;
|
||||
@ -88,9 +90,9 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public int getWeakPower( @Nonnull BlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull Direction incomingSide )
|
||||
public int getSignal( @Nonnull BlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull Direction incomingSide )
|
||||
{
|
||||
return getStrongPower( state, world, pos, incomingSide );
|
||||
return getDirectSignal( state, world, pos, incomingSide );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,7 +104,7 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
|
||||
@Override
|
||||
public int getBundledRedstoneOutput( World world, BlockPos pos, Direction side )
|
||||
{
|
||||
TileEntity entity = world.getTileEntity( pos );
|
||||
TileEntity entity = world.getBlockEntity( pos );
|
||||
if( !(entity instanceof TileComputerBase) ) return 0;
|
||||
|
||||
TileComputerBase computerEntity = (TileComputerBase) entity;
|
||||
@ -117,7 +119,7 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
|
||||
@Override
|
||||
public ItemStack getPickBlock( BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player )
|
||||
{
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( tile instanceof TileComputerBase )
|
||||
{
|
||||
ItemStack result = getItem( (TileComputerBase) tile );
|
||||
@ -128,48 +130,48 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock( @Nonnull World world, PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable TileEntity tile, @Nonnull ItemStack tool )
|
||||
public void playerDestroy( @Nonnull World world, PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable TileEntity tile, @Nonnull ItemStack tool )
|
||||
{
|
||||
// Don't drop blocks here - see onBlockHarvested.
|
||||
player.addStat( Stats.BLOCK_MINED.get( this ) );
|
||||
player.addExhaustion( 0.005F );
|
||||
player.awardStat( Stats.BLOCK_MINED.get( this ) );
|
||||
player.causeFoodExhaustion( 0.005F );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull PlayerEntity player )
|
||||
public void playerWillDestroy( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull PlayerEntity player )
|
||||
{
|
||||
if( !(world instanceof ServerWorld) ) return;
|
||||
|
||||
// We drop the item here instead of doing it in the harvest method, as we should
|
||||
// drop computers for creative players too.
|
||||
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( tile instanceof TileComputerBase )
|
||||
{
|
||||
TileComputerBase computer = (TileComputerBase) tile;
|
||||
LootContext.Builder context = new LootContext.Builder( (ServerWorld) world )
|
||||
.withRandom( world.rand )
|
||||
.withParameter( LootParameters.POSITION, pos )
|
||||
.withParameter( LootParameters.TOOL, player.getHeldItemMainhand() )
|
||||
.withRandom( world.random )
|
||||
.withParameter( LootParameters.BLOCK_POS, pos )
|
||||
.withParameter( LootParameters.TOOL, player.getMainHandItem() )
|
||||
.withParameter( LootParameters.THIS_ENTITY, player )
|
||||
.withNullableParameter( LootParameters.BLOCK_ENTITY, tile )
|
||||
.withOptionalParameter( LootParameters.BLOCK_ENTITY, tile )
|
||||
.withDynamicDrop( DROP, ( ctx, out ) -> out.accept( getItem( computer ) ) );
|
||||
for( ItemStack item : state.getDrops( context ) )
|
||||
{
|
||||
spawnAsEntity( world, pos, item );
|
||||
popResource( world, pos, item );
|
||||
}
|
||||
|
||||
state.spawnAdditionalDrops( world, pos, player.getHeldItemMainhand() );
|
||||
state.spawnAfterBreak( world, pos, player.getMainHandItem() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, LivingEntity placer, @Nonnull ItemStack stack )
|
||||
public void setPlacedBy( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, LivingEntity placer, @Nonnull ItemStack stack )
|
||||
{
|
||||
super.onBlockPlacedBy( world, pos, state, placer, stack );
|
||||
super.setPlacedBy( world, pos, state, placer, stack );
|
||||
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
if( !world.isRemote && tile instanceof IComputerTile && stack.getItem() instanceof IComputerItem )
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( !world.isClientSide && tile instanceof IComputerTile && stack.getItem() instanceof IComputerItem )
|
||||
{
|
||||
IComputerTile computer = (IComputerTile) tile;
|
||||
IComputerItem item = (IComputerItem) stack.getItem();
|
||||
|
@ -54,21 +54,21 @@ public class TileCommandComputer extends TileComputer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldReceiveFeedback()
|
||||
public boolean acceptsSuccess()
|
||||
{
|
||||
return getWorld().getGameRules().getBoolean( GameRules.SEND_COMMAND_FEEDBACK );
|
||||
return getLevel().getGameRules().getBoolean( GameRules.RULE_SENDCOMMANDFEEDBACK );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldReceiveErrors()
|
||||
public boolean acceptsFailure()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowLogging()
|
||||
public boolean shouldInformAdmins()
|
||||
{
|
||||
return getWorld().getGameRules().getBoolean( GameRules.COMMAND_BLOCK_OUTPUT );
|
||||
return getLevel().getGameRules().getBoolean( GameRules.RULE_COMMANDBLOCKOUTPUT );
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,10 +96,10 @@ public class TileCommandComputer extends TileComputer
|
||||
}
|
||||
|
||||
return new CommandSource( receiver,
|
||||
new Vec3d( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 ), Vec2f.ZERO,
|
||||
(ServerWorld) getWorld(), 2,
|
||||
new Vec3d( worldPosition.getX() + 0.5, worldPosition.getY() + 0.5, worldPosition.getZ() + 0.5 ), Vec2f.ZERO,
|
||||
(ServerWorld) getLevel(), 2,
|
||||
name, new StringTextComponent( name ),
|
||||
getWorld().getServer(), null
|
||||
getLevel().getServer(), null
|
||||
);
|
||||
}
|
||||
|
||||
@ -122,12 +122,12 @@ public class TileCommandComputer extends TileComputer
|
||||
MinecraftServer server = player.getServer();
|
||||
if( server == null || !server.isCommandBlockEnabled() )
|
||||
{
|
||||
player.sendStatusMessage( new TranslationTextComponent( "advMode.notEnabled" ), true );
|
||||
player.displayClientMessage( new TranslationTextComponent( "advMode.notEnabled" ), true );
|
||||
return false;
|
||||
}
|
||||
else if( ComputerCraft.commandRequireCreative ? !player.canUseCommandBlock() : !server.getPlayerList().canSendCommands( player.getGameProfile() ) )
|
||||
else if( ComputerCraft.commandRequireCreative ? !player.canUseGameMasterBlocks() : !server.getPlayerList().isOp( player.getGameProfile() ) )
|
||||
{
|
||||
player.sendStatusMessage( new TranslationTextComponent( "advMode.notAllowed" ), true );
|
||||
player.displayClientMessage( new TranslationTextComponent( "advMode.notAllowed" ), true );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -42,11 +42,11 @@ public class TileComputer extends TileComputerBase
|
||||
{
|
||||
ComputerFamily family = getFamily();
|
||||
ServerComputer computer = new ServerComputer(
|
||||
getWorld(), id, label, instanceID, family,
|
||||
getLevel(), id, label, instanceID, family,
|
||||
ComputerCraft.computerTermWidth,
|
||||
ComputerCraft.computerTermHeight
|
||||
);
|
||||
computer.setPosition( getPos() );
|
||||
computer.setPosition( getBlockPos() );
|
||||
return computer;
|
||||
}
|
||||
|
||||
@ -58,16 +58,16 @@ public class TileComputer extends TileComputerBase
|
||||
@Override
|
||||
public Direction getDirection()
|
||||
{
|
||||
return getBlockState().get( BlockComputer.FACING );
|
||||
return getBlockState().getValue( BlockComputer.FACING );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateBlockState( ComputerState newState )
|
||||
{
|
||||
BlockState existing = getBlockState();
|
||||
if( existing.get( BlockComputer.STATE ) != newState )
|
||||
if( existing.getValue( BlockComputer.STATE ) != newState )
|
||||
{
|
||||
getWorld().setBlockState( getPos(), existing.with( BlockComputer.STATE, newState ), 3 );
|
||||
getLevel().setBlock( getBlockPos(), existing.setValue( BlockComputer.STATE, newState ), 3 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
{
|
||||
if( m_instanceID >= 0 )
|
||||
{
|
||||
if( !getWorld().isRemote ) ComputerCraft.serverComputerRegistry.remove( m_instanceID );
|
||||
if( !getLevel().isClientSide ) ComputerCraft.serverComputerRegistry.remove( m_instanceID );
|
||||
m_instanceID = -1;
|
||||
}
|
||||
}
|
||||
@ -91,7 +91,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
unload();
|
||||
for( Direction dir : DirectionUtil.FACINGS )
|
||||
{
|
||||
RedstoneUtil.propagateRedstoneOutput( getWorld(), getPos(), dir );
|
||||
RedstoneUtil.propagateRedstoneOutput( getLevel(), getBlockPos(), dir );
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,10 +102,10 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
public void setRemoved()
|
||||
{
|
||||
unload();
|
||||
super.remove();
|
||||
super.setRemoved();
|
||||
}
|
||||
|
||||
protected boolean canNameWithTag( PlayerEntity player )
|
||||
@ -117,13 +117,13 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
@Override
|
||||
public ActionResultType onActivate( PlayerEntity player, Hand hand, BlockRayTraceResult hit )
|
||||
{
|
||||
ItemStack currentItem = player.getHeldItem( hand );
|
||||
if( !currentItem.isEmpty() && currentItem.getItem() == Items.NAME_TAG && canNameWithTag( player ) && currentItem.hasDisplayName() )
|
||||
ItemStack currentItem = player.getItemInHand( hand );
|
||||
if( !currentItem.isEmpty() && currentItem.getItem() == Items.NAME_TAG && canNameWithTag( player ) && currentItem.hasCustomHoverName() )
|
||||
{
|
||||
// Label to rename computer
|
||||
if( !getWorld().isRemote )
|
||||
if( !getLevel().isClientSide )
|
||||
{
|
||||
setLabel( currentItem.getDisplayName().getString() );
|
||||
setLabel( currentItem.getHoverName().getString() );
|
||||
currentItem.shrink( 1 );
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
@ -131,7 +131,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
else if( !player.isCrouching() )
|
||||
{
|
||||
// Regular right click to activate computer
|
||||
if( !getWorld().isRemote && isUsable( player, false ) )
|
||||
if( !getLevel().isClientSide && isUsable( player, false ) )
|
||||
{
|
||||
createServerComputer().turnOn();
|
||||
new ComputerContainerData( createServerComputer() ).open( player, this );
|
||||
@ -156,7 +156,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
if( !getWorld().isRemote )
|
||||
if( !getLevel().isClientSide )
|
||||
{
|
||||
ServerComputer computer = createServerComputer();
|
||||
if( computer == null ) return;
|
||||
@ -189,20 +189,20 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundNBT write( @Nonnull CompoundNBT nbt )
|
||||
public CompoundNBT save( @Nonnull CompoundNBT nbt )
|
||||
{
|
||||
// Save ID, label and power state
|
||||
if( m_computerID >= 0 ) nbt.putInt( NBT_ID, m_computerID );
|
||||
if( label != null ) nbt.putString( NBT_LABEL, label );
|
||||
nbt.putBoolean( NBT_ON, m_on );
|
||||
|
||||
return super.write( nbt );
|
||||
return super.save( nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read( @Nonnull CompoundNBT nbt )
|
||||
public void load( @Nonnull CompoundNBT nbt )
|
||||
{
|
||||
super.read( nbt );
|
||||
super.load( nbt );
|
||||
|
||||
// Load ID, label and power state
|
||||
m_computerID = nbt.contains( NBT_ID ) ? nbt.getInt( NBT_ID ) : -1;
|
||||
@ -232,11 +232,11 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
Direction offsetSide = dir.getOpposite();
|
||||
ComputerSide localDir = remapToLocalSide( dir );
|
||||
|
||||
computer.setRedstoneInput( localDir, getRedstoneInput( world, offset, dir ) );
|
||||
computer.setBundledRedstoneInput( localDir, BundledRedstone.getOutput( getWorld(), offset, offsetSide ) );
|
||||
computer.setRedstoneInput( localDir, getRedstoneInput( level, offset, dir ) );
|
||||
computer.setBundledRedstoneInput( localDir, BundledRedstone.getOutput( getLevel(), offset, offsetSide ) );
|
||||
if( !isPeripheralBlockedOnSide( localDir ) )
|
||||
{
|
||||
IPeripheral peripheral = Peripherals.getPeripheral( getWorld(), offset, offsetSide, invalidate[dir.ordinal()] );
|
||||
IPeripheral peripheral = Peripherals.getPeripheral( getLevel(), offset, offsetSide, invalidate[dir.ordinal()] );
|
||||
computer.setPeripheral( localDir, peripheral );
|
||||
}
|
||||
}
|
||||
@ -252,18 +252,18 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
*/
|
||||
protected static int getRedstoneInput( World world, BlockPos pos, Direction side )
|
||||
{
|
||||
int power = world.getRedstonePower( pos, side );
|
||||
int power = world.getSignal( pos, side );
|
||||
if( power >= 15 ) return power;
|
||||
|
||||
BlockState neighbour = world.getBlockState( pos );
|
||||
return neighbour.getBlock() == Blocks.REDSTONE_WIRE
|
||||
? Math.max( power, neighbour.get( RedstoneWireBlock.POWER ) )
|
||||
? Math.max( power, neighbour.getValue( RedstoneWireBlock.POWER ) )
|
||||
: power;
|
||||
}
|
||||
|
||||
public void updateInput()
|
||||
{
|
||||
if( getWorld() == null || getWorld().isRemote ) return;
|
||||
if( getLevel() == null || getLevel().isClientSide ) return;
|
||||
|
||||
// Update all sides
|
||||
ServerComputer computer = getServerComputer();
|
||||
@ -272,20 +272,20 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
BlockPos pos = computer.getPosition();
|
||||
for( Direction dir : DirectionUtil.FACINGS )
|
||||
{
|
||||
updateSideInput( computer, dir, pos.offset( dir ) );
|
||||
updateSideInput( computer, dir, pos.relative( dir ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void updateInput( BlockPos neighbour )
|
||||
{
|
||||
if( getWorld() == null || getWorld().isRemote ) return;
|
||||
if( getLevel() == null || getLevel().isClientSide ) return;
|
||||
|
||||
ServerComputer computer = getServerComputer();
|
||||
if( computer == null ) return;
|
||||
|
||||
for( Direction dir : DirectionUtil.FACINGS )
|
||||
{
|
||||
BlockPos offset = pos.offset( dir );
|
||||
BlockPos offset = worldPosition.relative( dir );
|
||||
if( offset.equals( neighbour ) )
|
||||
{
|
||||
updateSideInput( computer, dir, offset );
|
||||
@ -299,12 +299,12 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
|
||||
private void updateInput( Direction dir )
|
||||
{
|
||||
if( getWorld() == null || getWorld().isRemote ) return;
|
||||
if( getLevel() == null || getLevel().isClientSide ) return;
|
||||
|
||||
ServerComputer computer = getServerComputer();
|
||||
if( computer == null ) return;
|
||||
|
||||
updateSideInput( computer, dir, pos.offset( dir ) );
|
||||
updateSideInput( computer, dir, worldPosition.relative( dir ) );
|
||||
}
|
||||
|
||||
public void updateOutput()
|
||||
@ -313,7 +313,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
updateBlock();
|
||||
for( Direction dir : DirectionUtil.FACINGS )
|
||||
{
|
||||
RedstoneUtil.propagateRedstoneOutput( getWorld(), getPos(), dir );
|
||||
RedstoneUtil.propagateRedstoneOutput( getLevel(), getBlockPos(), dir );
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,23 +334,23 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
@Override
|
||||
public final void setComputerID( int id )
|
||||
{
|
||||
if( getWorld().isRemote || m_computerID == id ) return;
|
||||
if( getLevel().isClientSide || m_computerID == id ) return;
|
||||
|
||||
m_computerID = id;
|
||||
ServerComputer computer = getServerComputer();
|
||||
if( computer != null ) computer.setID( m_computerID );
|
||||
markDirty();
|
||||
setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setLabel( String label )
|
||||
{
|
||||
if( getWorld().isRemote || Objects.equals( this.label, label ) ) return;
|
||||
if( getLevel().isClientSide || Objects.equals( this.label, label ) ) return;
|
||||
|
||||
this.label = label;
|
||||
ServerComputer computer = getServerComputer();
|
||||
if( computer != null ) computer.setLabel( label );
|
||||
markDirty();
|
||||
setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -361,7 +361,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
|
||||
public ServerComputer createServerComputer()
|
||||
{
|
||||
if( getWorld().isRemote ) return null;
|
||||
if( getLevel().isClientSide ) return null;
|
||||
|
||||
boolean changed = false;
|
||||
if( m_instanceID < 0 )
|
||||
@ -386,7 +386,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
|
||||
public ServerComputer getServerComputer()
|
||||
{
|
||||
return getWorld().isRemote ? null : ComputerCraft.serverComputerRegistry.get( m_instanceID );
|
||||
return getLevel().isClientSide ? null : ComputerCraft.serverComputerRegistry.get( m_instanceID );
|
||||
}
|
||||
|
||||
// Networking stuff
|
||||
@ -428,7 +428,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
{
|
||||
return hasCustomName()
|
||||
? new StringTextComponent( label )
|
||||
: new TranslationTextComponent( getBlockState().getBlock().getTranslationKey() );
|
||||
: new TranslationTextComponent( getBlockState().getBlock().getDescriptionId() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ public enum ComputerState implements IStringSerializable
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName()
|
||||
public String getSerializedName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ public class ServerComputer extends ServerTerminal implements IComputer, IComput
|
||||
{
|
||||
if( player == null ) return null;
|
||||
|
||||
Container container = player.openContainer;
|
||||
Container container = player.containerMenu;
|
||||
if( !(container instanceof IContainerComputer) ) return null;
|
||||
|
||||
IContainerComputer computerContainer = (IContainerComputer) container;
|
||||
|
@ -40,7 +40,7 @@ public class ContainerComputerBase extends Container implements IContainerComput
|
||||
protected static IComputer getComputer( PlayerInventory player, ComputerContainerData data )
|
||||
{
|
||||
int id = data.getInstanceId();
|
||||
if( !player.player.world.isRemote ) return ComputerCraft.serverComputerRegistry.get( id );
|
||||
if( !player.player.level.isClientSide ) return ComputerCraft.serverComputerRegistry.get( id );
|
||||
|
||||
ClientComputer computer = ComputerCraft.clientComputerRegistry.get( id );
|
||||
if( computer == null ) ComputerCraft.clientComputerRegistry.add( id, computer = new ClientComputer( id ) );
|
||||
@ -48,7 +48,7 @@ public class ContainerComputerBase extends Container implements IContainerComput
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( @Nonnull PlayerEntity player )
|
||||
public boolean stillValid( @Nonnull PlayerEntity player )
|
||||
{
|
||||
return canUse.test( player );
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class ContainerComputerBase extends Container implements IContainerComput
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed( @Nonnull PlayerEntity player )
|
||||
public void removed( @Nonnull PlayerEntity player )
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
super.removed( player );
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public interface IComputerItem
|
||||
|
||||
default String getLabel( @Nonnull ItemStack stack )
|
||||
{
|
||||
return stack.hasDisplayName() ? stack.getDisplayName().getString() : null;
|
||||
return stack.hasCustomHoverName() ? stack.getHoverName().getString() : null;
|
||||
}
|
||||
|
||||
ComputerFamily getFamily();
|
||||
|
@ -12,6 +12,8 @@ import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.Item.Properties;
|
||||
|
||||
public class ItemComputer extends ItemComputerBase
|
||||
{
|
||||
public ItemComputer( BlockComputer block, Properties settings )
|
||||
@ -23,7 +25,7 @@ public class ItemComputer extends ItemComputerBase
|
||||
{
|
||||
ItemStack result = new ItemStack( this );
|
||||
if( id >= 0 ) result.getOrCreateTag().putInt( NBT_ID, id );
|
||||
if( label != null ) result.setDisplayName( new StringTextComponent( label ) );
|
||||
if( label != null ) result.setHoverName( new StringTextComponent( label ) );
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -31,7 +33,7 @@ public class ItemComputer extends ItemComputerBase
|
||||
public ItemStack withFamily( @Nonnull ItemStack stack, @Nonnull ComputerFamily family )
|
||||
{
|
||||
ItemStack result = ComputerItemFactory.create( getComputerID( stack ), null, family );
|
||||
if( stack.hasDisplayName() ) result.setDisplayName( stack.getDisplayName() );
|
||||
if( stack.hasCustomHoverName() ) result.setHoverName( stack.getHoverName() );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item.Properties;
|
||||
|
||||
public abstract class ItemComputerBase extends BlockItem implements IComputerItem, IMedia
|
||||
{
|
||||
private final ComputerFamily family;
|
||||
@ -35,7 +37,7 @@ public abstract class ItemComputerBase extends BlockItem implements IComputerIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation( @Nonnull ItemStack stack, @Nullable World world, @Nonnull List<ITextComponent> list, @Nonnull ITooltipFlag options )
|
||||
public void appendHoverText( @Nonnull ItemStack stack, @Nullable World world, @Nonnull List<ITextComponent> list, @Nonnull ITooltipFlag options )
|
||||
{
|
||||
if( options.isAdvanced() || getLabel( stack ) == null )
|
||||
{
|
||||
@ -43,7 +45,7 @@ public abstract class ItemComputerBase extends BlockItem implements IComputerIte
|
||||
if( id >= 0 )
|
||||
{
|
||||
list.add( new TranslationTextComponent( "gui.computercraft.tooltip.computer_id", id )
|
||||
.applyTextStyle( TextFormatting.GRAY ) );
|
||||
.withStyle( TextFormatting.GRAY ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -67,11 +69,11 @@ public abstract class ItemComputerBase extends BlockItem implements IComputerIte
|
||||
{
|
||||
if( label != null )
|
||||
{
|
||||
stack.setDisplayName( new StringTextComponent( label ) );
|
||||
stack.setHoverName( new StringTextComponent( label ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
stack.clearCustomName();
|
||||
stack.resetHoverName();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ public abstract class ComputerConvertRecipe extends ShapedRecipe
|
||||
{
|
||||
if( !super.matches( inventory, world ) ) return false;
|
||||
|
||||
for( int i = 0; i < inventory.getSizeInventory(); i++ )
|
||||
for( int i = 0; i < inventory.getContainerSize(); i++ )
|
||||
{
|
||||
if( inventory.getStackInSlot( i ).getItem() instanceof IComputerItem ) return true;
|
||||
if( inventory.getItem( i ).getItem() instanceof IComputerItem ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -47,12 +47,12 @@ public abstract class ComputerConvertRecipe extends ShapedRecipe
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult( @Nonnull CraftingInventory inventory )
|
||||
public ItemStack assemble( @Nonnull CraftingInventory inventory )
|
||||
{
|
||||
// Find our computer item and convert it.
|
||||
for( int i = 0; i < inventory.getSizeInventory(); i++ )
|
||||
for( int i = 0; i < inventory.getContainerSize(); i++ )
|
||||
{
|
||||
ItemStack stack = inventory.getStackInSlot( i );
|
||||
ItemStack stack = inventory.getItem( i );
|
||||
if( stack.getItem() instanceof IComputerItem ) return convert( (IComputerItem) stack.getItem(), stack );
|
||||
}
|
||||
|
||||
|
@ -39,42 +39,42 @@ public abstract class ComputerFamilyRecipe extends ComputerConvertRecipe
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public T read( @Nonnull ResourceLocation identifier, @Nonnull JsonObject json )
|
||||
public T fromJson( @Nonnull ResourceLocation identifier, @Nonnull JsonObject json )
|
||||
{
|
||||
String group = JSONUtils.getString( json, "group", "" );
|
||||
String group = JSONUtils.getAsString( json, "group", "" );
|
||||
ComputerFamily family = RecipeUtil.getFamily( json, "family" );
|
||||
|
||||
RecipeUtil.ShapedTemplate template = RecipeUtil.getTemplate( json );
|
||||
ItemStack result = deserializeItem( JSONUtils.getJsonObject( json, "result" ) );
|
||||
ItemStack result = itemFromJson( JSONUtils.getAsJsonObject( json, "result" ) );
|
||||
|
||||
return create( identifier, group, template.width, template.height, template.ingredients, result, family );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public T read( @Nonnull ResourceLocation identifier, @Nonnull PacketBuffer buf )
|
||||
public T fromNetwork( @Nonnull ResourceLocation identifier, @Nonnull PacketBuffer buf )
|
||||
{
|
||||
int width = buf.readVarInt();
|
||||
int height = buf.readVarInt();
|
||||
String group = buf.readString( Short.MAX_VALUE );
|
||||
String group = buf.readUtf( Short.MAX_VALUE );
|
||||
|
||||
NonNullList<Ingredient> ingredients = NonNullList.withSize( width * height, Ingredient.EMPTY );
|
||||
for( int i = 0; i < ingredients.size(); i++ ) ingredients.set( i, Ingredient.read( buf ) );
|
||||
for( int i = 0; i < ingredients.size(); i++ ) ingredients.set( i, Ingredient.fromNetwork( buf ) );
|
||||
|
||||
ItemStack result = buf.readItemStack();
|
||||
ComputerFamily family = buf.readEnumValue( ComputerFamily.class );
|
||||
ItemStack result = buf.readItem();
|
||||
ComputerFamily family = buf.readEnum( ComputerFamily.class );
|
||||
return create( identifier, group, width, height, ingredients, result, family );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write( @Nonnull PacketBuffer buf, @Nonnull T recipe )
|
||||
public void toNetwork( @Nonnull PacketBuffer buf, @Nonnull T recipe )
|
||||
{
|
||||
buf.writeVarInt( recipe.getWidth() );
|
||||
buf.writeVarInt( recipe.getHeight() );
|
||||
buf.writeString( recipe.getGroup() );
|
||||
for( Ingredient ingredient : recipe.getIngredients() ) ingredient.write( buf );
|
||||
buf.writeItemStack( recipe.getRecipeOutput() );
|
||||
buf.writeEnumValue( recipe.getFamily() );
|
||||
buf.writeUtf( recipe.getGroup() );
|
||||
for( Ingredient ingredient : recipe.getIngredients() ) ingredient.toNetwork( buf );
|
||||
buf.writeItem( recipe.getResultItem() );
|
||||
buf.writeEnum( recipe.getFamily() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import dan200.computercraft.shared.computer.recipe.ComputerFamilyRecipe.Serializer;
|
||||
|
||||
public class ComputerUpgradeRecipe extends ComputerFamilyRecipe
|
||||
{
|
||||
public ComputerUpgradeRecipe( ResourceLocation identifier, String group, int width, int height, NonNullList<Ingredient> ingredients, ItemStack result, ComputerFamily family )
|
||||
|
@ -16,6 +16,8 @@ import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.world.storage.loot.conditions.ILootCondition.IBuilder;
|
||||
|
||||
/**
|
||||
* A loot condition which checks if the tile entity has a name.
|
||||
*/
|
||||
@ -30,13 +32,13 @@ public final class BlockNamedEntityLootCondition implements ILootCondition
|
||||
@Override
|
||||
public boolean test( LootContext lootContext )
|
||||
{
|
||||
TileEntity tile = lootContext.get( LootParameters.BLOCK_ENTITY );
|
||||
TileEntity tile = lootContext.getParamOrNull( LootParameters.BLOCK_ENTITY );
|
||||
return tile instanceof INameable && ((INameable) tile).hasCustomName();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<LootParameter<?>> getRequiredParameters()
|
||||
public Set<LootParameter<?>> getReferencedContextParams()
|
||||
{
|
||||
return Collections.singleton( LootParameters.BLOCK_ENTITY );
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.world.storage.loot.conditions.ILootCondition.IBuilder;
|
||||
|
||||
/**
|
||||
* A loot condition which checks if the tile entity has has a non-0 ID.
|
||||
*/
|
||||
@ -30,13 +32,13 @@ public final class HasComputerIdLootCondition implements ILootCondition
|
||||
@Override
|
||||
public boolean test( LootContext lootContext )
|
||||
{
|
||||
TileEntity tile = lootContext.get( LootParameters.BLOCK_ENTITY );
|
||||
TileEntity tile = lootContext.getParamOrNull( LootParameters.BLOCK_ENTITY );
|
||||
return tile instanceof IComputerTile && ((IComputerTile) tile).getComputerID() >= 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<LootParameter<?>> getRequiredParameters()
|
||||
public Set<LootParameter<?>> getReferencedContextParams()
|
||||
{
|
||||
return Collections.singleton( LootParameters.BLOCK_ENTITY );
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.world.storage.loot.conditions.ILootCondition.IBuilder;
|
||||
|
||||
/**
|
||||
* A loot condition which checks if the entity is in creative mode.
|
||||
*/
|
||||
@ -30,13 +32,13 @@ public final class PlayerCreativeLootCondition implements ILootCondition
|
||||
@Override
|
||||
public boolean test( LootContext lootContext )
|
||||
{
|
||||
Entity entity = lootContext.get( LootParameters.THIS_ENTITY );
|
||||
return entity instanceof PlayerEntity && ((PlayerEntity) entity).abilities.isCreativeMode;
|
||||
Entity entity = lootContext.getParamOrNull( LootParameters.THIS_ENTITY );
|
||||
return entity instanceof PlayerEntity && ((PlayerEntity) entity).abilities.instabuild;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<LootParameter<?>> getRequiredParameters()
|
||||
public Set<LootParameter<?>> getReferencedContextParams()
|
||||
{
|
||||
return Collections.singleton( LootParameters.THIS_ENTITY );
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ import net.minecraft.util.ResourceLocation;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
|
||||
import static net.minecraft.item.crafting.Ingredient.fromStacks;
|
||||
import static net.minecraft.util.NonNullList.from;
|
||||
import static net.minecraft.item.crafting.Ingredient.of;
|
||||
import static net.minecraft.util.NonNullList.of;
|
||||
|
||||
class RecipeResolver implements IRecipeManagerPlugin
|
||||
{
|
||||
@ -158,18 +158,18 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
if( left != null && right != null ) return Collections.emptyList();
|
||||
|
||||
List<Shaped> recipes = new ArrayList<>();
|
||||
Ingredient ingredient = fromStacks( stack );
|
||||
Ingredient ingredient = of( stack );
|
||||
for( UpgradeInfo upgrade : turtleUpgrades )
|
||||
{
|
||||
// The turtle is facing towards us, so upgrades on the left are actually crafted on the right.
|
||||
if( left == null )
|
||||
{
|
||||
recipes.add( horizontal( from( Ingredient.EMPTY, ingredient, upgrade.ingredient ), turtleWith( stack, upgrade.turtle, right ) ) );
|
||||
recipes.add( horizontal( of( Ingredient.EMPTY, ingredient, upgrade.ingredient ), turtleWith( stack, upgrade.turtle, right ) ) );
|
||||
}
|
||||
|
||||
if( right == null )
|
||||
{
|
||||
recipes.add( horizontal( from( Ingredient.EMPTY, upgrade.ingredient, ingredient ), turtleWith( stack, left, upgrade.turtle ) ) );
|
||||
recipes.add( horizontal( of( Ingredient.EMPTY, upgrade.ingredient, ingredient ), turtleWith( stack, left, upgrade.turtle ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,10 +182,10 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
if( back != null ) return Collections.emptyList();
|
||||
|
||||
List<Shaped> recipes = new ArrayList<>();
|
||||
Ingredient ingredient = fromStacks( stack );
|
||||
Ingredient ingredient = of( stack );
|
||||
for( UpgradeInfo upgrade : pocketUpgrades )
|
||||
{
|
||||
recipes.add( vertical( from( Ingredient.EMPTY, ingredient, upgrade.ingredient ), pocketWith( stack, upgrade.pocket ) ) );
|
||||
recipes.add( vertical( of( Ingredient.EMPTY, ingredient, upgrade.ingredient ), pocketWith( stack, upgrade.pocket ) ) );
|
||||
}
|
||||
|
||||
return recipes;
|
||||
@ -240,7 +240,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
if( left != null )
|
||||
{
|
||||
recipes.add( horizontal(
|
||||
from( Ingredient.EMPTY, fromStacks( turtleWith( stack, null, right ) ), fromStacks( left.getCraftingItem() ) ),
|
||||
of( Ingredient.EMPTY, of( turtleWith( stack, null, right ) ), of( left.getCraftingItem() ) ),
|
||||
stack
|
||||
) );
|
||||
}
|
||||
@ -248,7 +248,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
if( right != null )
|
||||
{
|
||||
recipes.add( horizontal(
|
||||
from( Ingredient.EMPTY, fromStacks( right.getCraftingItem() ), fromStacks( turtleWith( stack, left, null ) ) ),
|
||||
of( Ingredient.EMPTY, of( right.getCraftingItem() ), of( turtleWith( stack, left, null ) ) ),
|
||||
stack
|
||||
) );
|
||||
}
|
||||
@ -263,7 +263,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
if( back != null )
|
||||
{
|
||||
recipes.add( vertical(
|
||||
from( Ingredient.EMPTY, fromStacks( back.getCraftingItem() ), fromStacks( pocketWith( stack, null ) ) ),
|
||||
of( Ingredient.EMPTY, of( back.getCraftingItem() ), of( pocketWith( stack, null ) ) ),
|
||||
stack
|
||||
) );
|
||||
}
|
||||
@ -346,7 +346,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
UpgradeInfo( ItemStack stack, ITurtleUpgrade turtle )
|
||||
{
|
||||
this.stack = stack;
|
||||
this.ingredient = fromStacks( stack );
|
||||
this.ingredient = of( stack );
|
||||
this.upgrade = this.turtle = turtle;
|
||||
this.pocket = null;
|
||||
}
|
||||
@ -354,7 +354,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
UpgradeInfo( ItemStack stack, IPocketUpgrade pocket )
|
||||
{
|
||||
this.stack = stack;
|
||||
this.ingredient = fromStacks( stack );
|
||||
this.ingredient = of( stack );
|
||||
this.turtle = null;
|
||||
this.upgrade = this.pocket = pocket;
|
||||
}
|
||||
@ -370,7 +370,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
if( turtle != null && TurtleUpgrades.suitableForFamily( family, turtle ) )
|
||||
{
|
||||
recipes.add( horizontal(
|
||||
from( Ingredient.EMPTY, ingredient, fromStacks( TurtleItemFactory.create( -1, null, -1, family, null, null, 0, null ) ) ),
|
||||
of( Ingredient.EMPTY, ingredient, of( TurtleItemFactory.create( -1, null, -1, family, null, null, 0, null ) ) ),
|
||||
TurtleItemFactory.create( -1, null, -1, family, null, turtle, 0, null )
|
||||
) );
|
||||
}
|
||||
@ -378,7 +378,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
if( pocket != null )
|
||||
{
|
||||
recipes.add( vertical(
|
||||
from( Ingredient.EMPTY, ingredient, fromStacks( PocketComputerItemFactory.create( -1, null, -1, family, null ) ) ),
|
||||
of( Ingredient.EMPTY, ingredient, of( PocketComputerItemFactory.create( -1, null, -1, family, null ) ) ),
|
||||
PocketComputerItemFactory.create( -1, null, -1, family, pocket )
|
||||
) );
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item.Properties;
|
||||
|
||||
public class ItemDisk extends Item implements IMedia, IColouredItem
|
||||
{
|
||||
private static final String NBT_ID = "DiskId";
|
||||
@ -51,9 +53,9 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup( @Nonnull ItemGroup tabs, @Nonnull NonNullList<ItemStack> list )
|
||||
public void fillItemCategory( @Nonnull ItemGroup tabs, @Nonnull NonNullList<ItemStack> list )
|
||||
{
|
||||
if( !isInGroup( tabs ) ) return;
|
||||
if( !allowdedIn( tabs ) ) return;
|
||||
for( int colour = 0; colour < 16; colour++ )
|
||||
{
|
||||
list.add( createFromIDAndColour( -1, null, Colour.VALUES[colour].getHex() ) );
|
||||
@ -61,7 +63,7 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation( @Nonnull ItemStack stack, @Nullable World world, @Nonnull List<ITextComponent> list, ITooltipFlag options )
|
||||
public void appendHoverText( @Nonnull ItemStack stack, @Nullable World world, @Nonnull List<ITextComponent> list, ITooltipFlag options )
|
||||
{
|
||||
if( options.isAdvanced() )
|
||||
{
|
||||
@ -69,7 +71,7 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
|
||||
if( id >= 0 )
|
||||
{
|
||||
list.add( new TranslationTextComponent( "gui.computercraft.tooltip.disk_id", id )
|
||||
.applyTextStyle( TextFormatting.GRAY ) );
|
||||
.withStyle( TextFormatting.GRAY ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,7 +85,7 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
|
||||
@Override
|
||||
public String getLabel( @Nonnull ItemStack stack )
|
||||
{
|
||||
return stack.hasDisplayName() ? stack.getDisplayName().getString() : null;
|
||||
return stack.hasCustomHoverName() ? stack.getHoverName().getString() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,11 +93,11 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
|
||||
{
|
||||
if( label != null )
|
||||
{
|
||||
stack.setDisplayName( new StringTextComponent( label ) );
|
||||
stack.setHoverName( new StringTextComponent( label ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
stack.clearCustomName();
|
||||
stack.resetHoverName();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ import net.minecraft.world.World;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item.Properties;
|
||||
|
||||
public class ItemPrintout extends Item
|
||||
{
|
||||
private static final String NBT_TITLE = "Title";
|
||||
@ -50,7 +52,7 @@ public class ItemPrintout extends Item
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation( @Nonnull ItemStack stack, World world, @Nonnull List<ITextComponent> list, @Nonnull ITooltipFlag options )
|
||||
public void appendHoverText( @Nonnull ItemStack stack, World world, @Nonnull List<ITextComponent> list, @Nonnull ITooltipFlag options )
|
||||
{
|
||||
String title = getTitle( stack );
|
||||
if( title != null && !title.isEmpty() ) list.add( new StringTextComponent( title ) );
|
||||
@ -58,14 +60,14 @@ public class ItemPrintout extends Item
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( World world, @Nonnull PlayerEntity player, @Nonnull Hand hand )
|
||||
public ActionResult<ItemStack> use( World world, @Nonnull PlayerEntity player, @Nonnull Hand hand )
|
||||
{
|
||||
if( !world.isRemote )
|
||||
if( !world.isClientSide )
|
||||
{
|
||||
new HeldItemContainerData( hand )
|
||||
.open( player, new ContainerHeldItem.Factory( Registry.ModContainers.PRINTOUT.get(), player.getHeldItem( hand ), hand ) );
|
||||
.open( player, new ContainerHeldItem.Factory( Registry.ModContainers.PRINTOUT.get(), player.getItemInHand( hand ), hand ) );
|
||||
}
|
||||
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
|
||||
return new ActionResult<>( ActionResultType.SUCCESS, player.getItemInHand( hand ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -29,6 +29,8 @@ import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item.Properties;
|
||||
|
||||
public class ItemTreasureDisk extends Item implements IMedia
|
||||
{
|
||||
private static final String NBT_TITLE = "Title";
|
||||
@ -41,12 +43,12 @@ public class ItemTreasureDisk extends Item implements IMedia
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup( @Nonnull ItemGroup group, @Nonnull NonNullList<ItemStack> stacks )
|
||||
public void fillItemCategory( @Nonnull ItemGroup group, @Nonnull NonNullList<ItemStack> stacks )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation( @Nonnull ItemStack stack, @Nullable World world, @Nonnull List<ITextComponent> list, @Nonnull ITooltipFlag tooltipOptions )
|
||||
public void appendHoverText( @Nonnull ItemStack stack, @Nullable World world, @Nonnull List<ITextComponent> list, @Nonnull ITooltipFlag tooltipOptions )
|
||||
{
|
||||
String label = getTitle( stack );
|
||||
if( !label.isEmpty() ) list.add( new StringTextComponent( label ) );
|
||||
|
@ -41,7 +41,7 @@ public final class RecordMedia implements IMedia
|
||||
Item item = stack.getItem();
|
||||
if( !(item instanceof MusicDiscItem) ) return null;
|
||||
|
||||
return new TranslationTextComponent( item.getTranslationKey() + ".desc" ).getString();
|
||||
return new TranslationTextComponent( item.getDescriptionId() + ".desc" ).getString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,7 +52,7 @@ public final class RecordMedia implements IMedia
|
||||
|
||||
try
|
||||
{
|
||||
return ObfuscationReflectionHelper.getPrivateValue( MusicDiscItem.class, (MusicDiscItem) item, "field_185076_b" );
|
||||
return ObfuscationReflectionHelper.getPrivateValue( MusicDiscItem.class, (MusicDiscItem) item, "sound" );
|
||||
}
|
||||
catch( UnableToAccessFieldException | UnableToFindFieldException e )
|
||||
{
|
||||
|
@ -25,8 +25,8 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class DiskRecipe extends SpecialRecipe
|
||||
{
|
||||
private final Ingredient paper = Ingredient.fromItems( Items.PAPER );
|
||||
private final Ingredient redstone = Ingredient.fromTag( Tags.Items.DUSTS_REDSTONE );
|
||||
private final Ingredient paper = Ingredient.of( Items.PAPER );
|
||||
private final Ingredient redstone = Ingredient.of( Tags.Items.DUSTS_REDSTONE );
|
||||
|
||||
public DiskRecipe( ResourceLocation id )
|
||||
{
|
||||
@ -39,9 +39,9 @@ public class DiskRecipe extends SpecialRecipe
|
||||
boolean paperFound = false;
|
||||
boolean redstoneFound = false;
|
||||
|
||||
for( int i = 0; i < inv.getSizeInventory(); i++ )
|
||||
for( int i = 0; i < inv.getContainerSize(); i++ )
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot( i );
|
||||
ItemStack stack = inv.getItem( i );
|
||||
|
||||
if( !stack.isEmpty() )
|
||||
{
|
||||
@ -67,13 +67,13 @@ public class DiskRecipe extends SpecialRecipe
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult( @Nonnull CraftingInventory inv )
|
||||
public ItemStack assemble( @Nonnull CraftingInventory inv )
|
||||
{
|
||||
ColourTracker tracker = new ColourTracker();
|
||||
|
||||
for( int i = 0; i < inv.getSizeInventory(); i++ )
|
||||
for( int i = 0; i < inv.getContainerSize(); i++ )
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot( i );
|
||||
ItemStack stack = inv.getItem( i );
|
||||
|
||||
if( stack.isEmpty() ) continue;
|
||||
|
||||
@ -88,14 +88,14 @@ public class DiskRecipe extends SpecialRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit( int x, int y )
|
||||
public boolean canCraftInDimensions( int x, int y )
|
||||
{
|
||||
return x >= 2 && y >= 2;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
public ItemStack getResultItem()
|
||||
{
|
||||
return ItemDisk.createFromIDAndColour( -1, null, Colour.BLUE.getHex() );
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public final class PrintoutRecipe extends SpecialRecipe
|
||||
{
|
||||
private final Ingredient paper = Ingredient.fromItems( net.minecraft.item.Items.PAPER );
|
||||
private final Ingredient leather = Ingredient.fromItems( net.minecraft.item.Items.LEATHER );
|
||||
private final Ingredient string = Ingredient.fromItems( Items.STRING );
|
||||
private final Ingredient paper = Ingredient.of( net.minecraft.item.Items.PAPER );
|
||||
private final Ingredient leather = Ingredient.of( net.minecraft.item.Items.LEATHER );
|
||||
private final Ingredient string = Ingredient.of( Items.STRING );
|
||||
|
||||
private PrintoutRecipe( ResourceLocation id )
|
||||
{
|
||||
@ -30,14 +30,14 @@ public final class PrintoutRecipe extends SpecialRecipe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit( int x, int y )
|
||||
public boolean canCraftInDimensions( int x, int y )
|
||||
{
|
||||
return x >= 3 && y >= 3;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
public ItemStack getResultItem()
|
||||
{
|
||||
return ItemPrintout.createMultipleFromTitleAndText( null, null, null );
|
||||
}
|
||||
@ -45,12 +45,12 @@ public final class PrintoutRecipe extends SpecialRecipe
|
||||
@Override
|
||||
public boolean matches( @Nonnull CraftingInventory inventory, @Nonnull World world )
|
||||
{
|
||||
return !getCraftingResult( inventory ).isEmpty();
|
||||
return !assemble( inventory ).isEmpty();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult( @Nonnull CraftingInventory inventory )
|
||||
public ItemStack assemble( @Nonnull CraftingInventory inventory )
|
||||
{
|
||||
// See if we match the recipe, and extract the input disk ID and dye colour
|
||||
int numPages = 0;
|
||||
@ -63,7 +63,7 @@ public final class PrintoutRecipe extends SpecialRecipe
|
||||
{
|
||||
for( int x = 0; x < inventory.getWidth(); x++ )
|
||||
{
|
||||
ItemStack stack = inventory.getStackInSlot( x + y * inventory.getWidth() );
|
||||
ItemStack stack = inventory.getItem( x + y * inventory.getWidth() );
|
||||
if( !stack.isEmpty() )
|
||||
{
|
||||
if( stack.getItem() instanceof ItemPrintout && ((ItemPrintout) stack.getItem()).getType() != ItemPrintout.Type.BOOK )
|
||||
|
@ -60,7 +60,7 @@ public final class NetworkHandler
|
||||
|
||||
public static void sendToPlayer( PlayerEntity player, NetworkMessage packet )
|
||||
{
|
||||
network.sendTo( packet, ((ServerPlayerEntity) player).connection.netManager, NetworkDirection.PLAY_TO_CLIENT );
|
||||
network.sendTo( packet, ((ServerPlayerEntity) player).connection.connection, NetworkDirection.PLAY_TO_CLIENT );
|
||||
}
|
||||
|
||||
public static void sendToAllPlayers( NetworkMessage packet )
|
||||
|
@ -38,13 +38,13 @@ public class ChatTableClientMessage implements NetworkMessage
|
||||
buf.writeBoolean( table.getHeaders() != null );
|
||||
if( table.getHeaders() != null )
|
||||
{
|
||||
for( ITextComponent header : table.getHeaders() ) buf.writeTextComponent( header );
|
||||
for( ITextComponent header : table.getHeaders() ) buf.writeComponent( header );
|
||||
}
|
||||
|
||||
buf.writeVarInt( table.getRows().size() );
|
||||
for( ITextComponent[] row : table.getRows() )
|
||||
{
|
||||
for( ITextComponent column : row ) buf.writeTextComponent( column );
|
||||
for( ITextComponent column : row ) buf.writeComponent( column );
|
||||
}
|
||||
|
||||
buf.writeVarInt( table.getAdditional() );
|
||||
@ -59,7 +59,7 @@ public class ChatTableClientMessage implements NetworkMessage
|
||||
if( buf.readBoolean() )
|
||||
{
|
||||
ITextComponent[] headers = new ITextComponent[columns];
|
||||
for( int i = 0; i < columns; i++ ) headers[i] = buf.readTextComponent();
|
||||
for( int i = 0; i < columns; i++ ) headers[i] = buf.readComponent();
|
||||
table = new TableBuilder( id, headers );
|
||||
}
|
||||
else
|
||||
@ -71,7 +71,7 @@ public class ChatTableClientMessage implements NetworkMessage
|
||||
for( int i = 0; i < rows; i++ )
|
||||
{
|
||||
ITextComponent[] row = new ITextComponent[columns];
|
||||
for( int j = 0; j < columns; j++ ) row[j] = buf.readTextComponent();
|
||||
for( int j = 0; j < columns; j++ ) row[j] = buf.readComponent();
|
||||
table.row( row );
|
||||
}
|
||||
|
||||
|
@ -36,16 +36,16 @@ public class ComputerDataClientMessage extends ComputerClientMessage
|
||||
public void toBytes( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
super.toBytes( buf );
|
||||
buf.writeEnumValue( state );
|
||||
buf.writeCompoundTag( userData );
|
||||
buf.writeEnum( state );
|
||||
buf.writeNbt( userData );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
super.fromBytes( buf );
|
||||
state = buf.readEnumValue( ComputerState.class );
|
||||
userData = buf.readCompoundTag();
|
||||
state = buf.readEnum( ComputerState.class );
|
||||
userData = buf.readNbt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,9 +44,9 @@ public class MonitorClientMessage implements NetworkMessage
|
||||
public void handle( NetworkEvent.Context context )
|
||||
{
|
||||
ClientPlayerEntity player = Minecraft.getInstance().player;
|
||||
if( player == null || player.world == null ) return;
|
||||
if( player == null || player.level == null ) return;
|
||||
|
||||
TileEntity te = player.world.getTileEntity( pos );
|
||||
TileEntity te = player.level.getBlockEntity( pos );
|
||||
if( !(te instanceof TileMonitor) ) return;
|
||||
|
||||
((TileMonitor) te).read( state );
|
||||
|
@ -48,7 +48,7 @@ public class PlayRecordClientMessage implements NetworkMessage
|
||||
pos = buf.readBlockPos();
|
||||
if( buf.readBoolean() )
|
||||
{
|
||||
name = buf.readString( Short.MAX_VALUE );
|
||||
name = buf.readUtf( Short.MAX_VALUE );
|
||||
soundEvent = buf.readRegistryIdSafe( SoundEvent.class );
|
||||
}
|
||||
else
|
||||
@ -69,7 +69,7 @@ public class PlayRecordClientMessage implements NetworkMessage
|
||||
else
|
||||
{
|
||||
buf.writeBoolean( true );
|
||||
buf.writeString( name );
|
||||
buf.writeUtf( name );
|
||||
buf.writeRegistryId( soundEvent );
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ public class PlayRecordClientMessage implements NetworkMessage
|
||||
public void handle( NetworkEvent.Context context )
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
mc.worldRenderer.playRecord( soundEvent, pos );
|
||||
if( name != null ) mc.ingameGUI.setRecordPlayingMessage( name );
|
||||
mc.levelRenderer.playStreamingMusic( soundEvent, pos );
|
||||
if( name != null ) mc.gui.setNowPlaying( name );
|
||||
}
|
||||
}
|
||||
|
@ -23,14 +23,14 @@ public class ComputerContainerData implements ContainerData
|
||||
public ComputerContainerData( PacketBuffer buf )
|
||||
{
|
||||
this.id = buf.readInt();
|
||||
this.family = buf.readEnumValue( ComputerFamily.class );
|
||||
this.family = buf.readEnum( ComputerFamily.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes( PacketBuffer buf )
|
||||
{
|
||||
buf.writeInt( id );
|
||||
buf.writeEnumValue( family );
|
||||
buf.writeEnum( family );
|
||||
}
|
||||
|
||||
public int getInstanceId()
|
||||
|
@ -28,13 +28,13 @@ public class HeldItemContainerData implements ContainerData
|
||||
|
||||
public HeldItemContainerData( PacketBuffer buffer )
|
||||
{
|
||||
hand = buffer.readEnumValue( Hand.class );
|
||||
hand = buffer.readEnum( Hand.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes( PacketBuffer buf )
|
||||
{
|
||||
buf.writeEnumValue( hand );
|
||||
buf.writeEnum( hand );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -29,14 +29,14 @@ public class ComputerActionServerMessage extends ComputerServerMessage
|
||||
public void toBytes( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
super.toBytes( buf );
|
||||
buf.writeEnumValue( action );
|
||||
buf.writeEnum( action );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
super.fromBytes( buf );
|
||||
action = buf.readEnumValue( Action.class );
|
||||
action = buf.readEnum( Action.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,17 +40,17 @@ public class QueueEventServerMessage extends ComputerServerMessage
|
||||
public void toBytes( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
super.toBytes( buf );
|
||||
buf.writeString( event );
|
||||
buf.writeCompoundTag( args == null ? null : NBTUtil.encodeObjects( args ) );
|
||||
buf.writeUtf( event );
|
||||
buf.writeNbt( args == null ? null : NBTUtil.encodeObjects( args ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
super.fromBytes( buf );
|
||||
event = buf.readString( Short.MAX_VALUE );
|
||||
event = buf.readUtf( Short.MAX_VALUE );
|
||||
|
||||
CompoundNBT args = buf.readCompoundTag();
|
||||
CompoundNBT args = buf.readNbt();
|
||||
this.args = args == null ? null : NBTUtil.decodeObjects( args );
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class CommandBlockPeripheral implements IPeripheral, ICapabilityProvider
|
||||
@LuaFunction( mainThread = true )
|
||||
public final String getCommand()
|
||||
{
|
||||
return commandBlock.getCommandBlockLogic().getCommand();
|
||||
return commandBlock.getCommandBlock().getCommand();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,8 +75,8 @@ public class CommandBlockPeripheral implements IPeripheral, ICapabilityProvider
|
||||
@LuaFunction( mainThread = true )
|
||||
public final void setCommand( String command )
|
||||
{
|
||||
commandBlock.getCommandBlockLogic().setCommand( command );
|
||||
commandBlock.getCommandBlockLogic().updateCommand();
|
||||
commandBlock.getCommandBlock().setCommand( command );
|
||||
commandBlock.getCommandBlock().onUpdated();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,8 +89,8 @@ public class CommandBlockPeripheral implements IPeripheral, ICapabilityProvider
|
||||
@LuaFunction( mainThread = true )
|
||||
public final Object[] runCommand()
|
||||
{
|
||||
commandBlock.getCommandBlockLogic().trigger( commandBlock.getWorld() );
|
||||
int result = commandBlock.getCommandBlockLogic().getSuccessCount();
|
||||
commandBlock.getCommandBlock().performCommand( commandBlock.getLevel() );
|
||||
int result = commandBlock.getCommandBlock().getSuccessCount();
|
||||
return result > 0 ? new Object[] { true } : new Object[] { false, "Command failed" };
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@ import net.minecraft.world.World;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block.Properties;
|
||||
|
||||
public class BlockDiskDrive extends BlockGeneric
|
||||
{
|
||||
static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||
@ -35,14 +37,14 @@ public class BlockDiskDrive extends BlockGeneric
|
||||
public BlockDiskDrive( Properties settings )
|
||||
{
|
||||
super( settings, Registry.ModTiles.DISK_DRIVE );
|
||||
setDefaultState( getStateContainer().getBaseState()
|
||||
.with( FACING, Direction.NORTH )
|
||||
.with( STATE, DiskDriveState.EMPTY ) );
|
||||
registerDefaultState( getStateDefinition().any()
|
||||
.setValue( FACING, Direction.NORTH )
|
||||
.setValue( STATE, DiskDriveState.EMPTY ) );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer( StateContainer.Builder<Block, BlockState> properties )
|
||||
protected void createBlockStateDefinition( StateContainer.Builder<Block, BlockState> properties )
|
||||
{
|
||||
properties.add( FACING, STATE );
|
||||
}
|
||||
@ -51,34 +53,34 @@ public class BlockDiskDrive extends BlockGeneric
|
||||
@Override
|
||||
public BlockState getStateForPlacement( BlockItemUseContext placement )
|
||||
{
|
||||
return getDefaultState().with( FACING, placement.getPlacementHorizontalFacing().getOpposite() );
|
||||
return defaultBlockState().setValue( FACING, placement.getHorizontalDirection().getOpposite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock( @Nonnull World world, @Nonnull PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack )
|
||||
public void playerDestroy( @Nonnull World world, @Nonnull PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable TileEntity te, @Nonnull ItemStack stack )
|
||||
{
|
||||
if( te instanceof INameable && ((INameable) te).hasCustomName() )
|
||||
{
|
||||
player.addStat( Stats.BLOCK_MINED.get( this ) );
|
||||
player.addExhaustion( 0.005F );
|
||||
player.awardStat( Stats.BLOCK_MINED.get( this ) );
|
||||
player.causeFoodExhaustion( 0.005F );
|
||||
|
||||
ItemStack result = new ItemStack( this );
|
||||
result.setDisplayName( ((INameable) te).getCustomName() );
|
||||
spawnAsEntity( world, pos, result );
|
||||
result.setHoverName( ((INameable) te).getCustomName() );
|
||||
popResource( world, pos, result );
|
||||
}
|
||||
else
|
||||
{
|
||||
super.harvestBlock( world, player, pos, state, te, stack );
|
||||
super.playerDestroy( world, player, pos, state, te, stack );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, LivingEntity placer, ItemStack stack )
|
||||
public void setPlacedBy( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, LivingEntity placer, ItemStack stack )
|
||||
{
|
||||
if( stack.hasDisplayName() )
|
||||
if( stack.hasCustomHoverName() )
|
||||
{
|
||||
TileEntity tileentity = world.getTileEntity( pos );
|
||||
if( tileentity instanceof TileDiskDrive ) ((TileDiskDrive) tileentity).customName = stack.getDisplayName();
|
||||
TileEntity tileentity = world.getBlockEntity( pos );
|
||||
if( tileentity instanceof TileDiskDrive ) ((TileDiskDrive) tileentity).customName = stack.getHoverName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,38 +48,38 @@ public class ContainerDiskDrive extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( @Nonnull PlayerEntity player )
|
||||
public boolean stillValid( @Nonnull PlayerEntity player )
|
||||
{
|
||||
return inventory.isUsableByPlayer( player );
|
||||
return inventory.stillValid( player );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack transferStackInSlot( @Nonnull PlayerEntity player, int slotIndex )
|
||||
public ItemStack quickMoveStack( @Nonnull PlayerEntity player, int slotIndex )
|
||||
{
|
||||
Slot slot = inventorySlots.get( slotIndex );
|
||||
if( slot == null || !slot.getHasStack() ) return ItemStack.EMPTY;
|
||||
Slot slot = slots.get( slotIndex );
|
||||
if( slot == null || !slot.hasItem() ) return ItemStack.EMPTY;
|
||||
|
||||
ItemStack existing = slot.getStack().copy();
|
||||
ItemStack existing = slot.getItem().copy();
|
||||
ItemStack result = existing.copy();
|
||||
if( slotIndex == 0 )
|
||||
{
|
||||
// Insert into player inventory
|
||||
if( !mergeItemStack( existing, 1, 37, true ) ) return ItemStack.EMPTY;
|
||||
if( !moveItemStackTo( existing, 1, 37, true ) ) return ItemStack.EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Insert into drive inventory
|
||||
if( !mergeItemStack( existing, 0, 1, false ) ) return ItemStack.EMPTY;
|
||||
if( !moveItemStackTo( existing, 0, 1, false ) ) return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if( existing.isEmpty() )
|
||||
{
|
||||
slot.putStack( ItemStack.EMPTY );
|
||||
slot.set( ItemStack.EMPTY );
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
slot.setChanged();
|
||||
}
|
||||
|
||||
if( existing.getCount() == result.getCount() ) return ItemStack.EMPTY;
|
||||
|
@ -24,7 +24,7 @@ public enum DiskDriveState implements IStringSerializable
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public String getName()
|
||||
public String getSerializedName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
@ -99,54 +99,54 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
if( player.isCrouching() )
|
||||
{
|
||||
// Try to put a disk into the drive
|
||||
ItemStack disk = player.getHeldItem( hand );
|
||||
ItemStack disk = player.getItemInHand( hand );
|
||||
if( disk.isEmpty() ) return ActionResultType.PASS;
|
||||
if( !getWorld().isRemote && getStackInSlot( 0 ).isEmpty() && MediaProviders.get( disk ) != null )
|
||||
if( !getLevel().isClientSide && getItem( 0 ).isEmpty() && MediaProviders.get( disk ) != null )
|
||||
{
|
||||
setDiskStack( disk );
|
||||
player.setHeldItem( hand, ItemStack.EMPTY );
|
||||
player.setItemInHand( hand, ItemStack.EMPTY );
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Open the GUI
|
||||
if( !getWorld().isRemote ) NetworkHooks.openGui( (ServerPlayerEntity) player, this );
|
||||
if( !getLevel().isClientSide ) NetworkHooks.openGui( (ServerPlayerEntity) player, this );
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
public Direction getDirection()
|
||||
{
|
||||
return getBlockState().get( BlockDiskDrive.FACING );
|
||||
return getBlockState().getValue( BlockDiskDrive.FACING );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read( @Nonnull CompoundNBT nbt )
|
||||
public void load( @Nonnull CompoundNBT nbt )
|
||||
{
|
||||
super.read( nbt );
|
||||
super.load( nbt );
|
||||
customName = nbt.contains( NBT_NAME ) ? ITextComponent.Serializer.fromJson( nbt.getString( NBT_NAME ) ) : null;
|
||||
if( nbt.contains( NBT_ITEM ) )
|
||||
{
|
||||
CompoundNBT item = nbt.getCompound( NBT_ITEM );
|
||||
m_diskStack = ItemStack.read( item );
|
||||
m_diskStack = ItemStack.of( item );
|
||||
m_diskMount = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CompoundNBT write( @Nonnull CompoundNBT nbt )
|
||||
public CompoundNBT save( @Nonnull CompoundNBT nbt )
|
||||
{
|
||||
if( customName != null ) nbt.putString( NBT_NAME, ITextComponent.Serializer.toJson( customName ) );
|
||||
|
||||
if( !m_diskStack.isEmpty() )
|
||||
{
|
||||
CompoundNBT item = new CompoundNBT();
|
||||
m_diskStack.write( item );
|
||||
m_diskStack.save( item );
|
||||
nbt.put( NBT_ITEM, item );
|
||||
}
|
||||
return super.write( nbt );
|
||||
return super.save( nbt );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -162,7 +162,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
// Music
|
||||
synchronized( this )
|
||||
{
|
||||
if( !world.isRemote && m_recordPlaying != m_recordQueued || m_restartRecord )
|
||||
if( !level.isClientSide && m_recordPlaying != m_recordQueued || m_restartRecord )
|
||||
{
|
||||
m_restartRecord = false;
|
||||
if( m_recordQueued )
|
||||
@ -191,7 +191,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
// IInventory implementation
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
public int getContainerSize()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -204,14 +204,14 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getStackInSlot( int slot )
|
||||
public ItemStack getItem( int slot )
|
||||
{
|
||||
return m_diskStack;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot( int slot )
|
||||
public ItemStack removeItemNoUpdate( int slot )
|
||||
{
|
||||
ItemStack result = m_diskStack;
|
||||
m_diskStack = ItemStack.EMPTY;
|
||||
@ -222,30 +222,30 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack decrStackSize( int slot, int count )
|
||||
public ItemStack removeItem( int slot, int count )
|
||||
{
|
||||
if( m_diskStack.isEmpty() ) return ItemStack.EMPTY;
|
||||
|
||||
if( m_diskStack.getCount() <= count )
|
||||
{
|
||||
ItemStack disk = m_diskStack;
|
||||
setInventorySlotContents( slot, ItemStack.EMPTY );
|
||||
setItem( slot, ItemStack.EMPTY );
|
||||
return disk;
|
||||
}
|
||||
|
||||
ItemStack part = m_diskStack.split( count );
|
||||
setInventorySlotContents( slot, m_diskStack.isEmpty() ? ItemStack.EMPTY : m_diskStack );
|
||||
setItem( slot, m_diskStack.isEmpty() ? ItemStack.EMPTY : m_diskStack );
|
||||
return part;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents( int slot, @Nonnull ItemStack stack )
|
||||
public void setItem( int slot, @Nonnull ItemStack stack )
|
||||
{
|
||||
if( getWorld().isRemote )
|
||||
if( getLevel().isClientSide )
|
||||
{
|
||||
m_diskStack = stack;
|
||||
m_diskMount = null;
|
||||
markDirty();
|
||||
setChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
// Swap disk over
|
||||
m_diskStack = stack;
|
||||
m_diskMount = null;
|
||||
markDirty();
|
||||
setChanged();
|
||||
|
||||
// Mount new disk
|
||||
if( !m_diskStack.isEmpty() )
|
||||
@ -288,33 +288,33 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
public void setChanged()
|
||||
{
|
||||
if( !world.isRemote ) updateBlockState();
|
||||
super.markDirty();
|
||||
if( !level.isClientSide ) updateBlockState();
|
||||
super.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsableByPlayer( @Nonnull PlayerEntity player )
|
||||
public boolean stillValid( @Nonnull PlayerEntity player )
|
||||
{
|
||||
return isUsable( player, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
public void clearContent()
|
||||
{
|
||||
setInventorySlotContents( 0, ItemStack.EMPTY );
|
||||
setItem( 0, ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
ItemStack getDiskStack()
|
||||
{
|
||||
return getStackInSlot( 0 );
|
||||
return getItem( 0 );
|
||||
}
|
||||
|
||||
void setDiskStack( @Nonnull ItemStack stack )
|
||||
{
|
||||
setInventorySlotContents( 0, stack );
|
||||
setItem( 0, stack );
|
||||
}
|
||||
|
||||
private IMedia getDiskMedia()
|
||||
@ -391,7 +391,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
{
|
||||
if( m_diskMount == null )
|
||||
{
|
||||
m_diskMount = contents.createDataMount( m_diskStack, getWorld() );
|
||||
m_diskMount = contents.createDataMount( m_diskStack, getLevel() );
|
||||
}
|
||||
if( m_diskMount != null )
|
||||
{
|
||||
@ -442,7 +442,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
|
||||
private void updateBlockState()
|
||||
{
|
||||
if( removed ) return;
|
||||
if( remove ) return;
|
||||
|
||||
if( !m_diskStack.isEmpty() )
|
||||
{
|
||||
@ -458,14 +458,14 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
private void updateBlockState( DiskDriveState state )
|
||||
{
|
||||
BlockState blockState = getBlockState();
|
||||
if( blockState.get( BlockDiskDrive.STATE ) == state ) return;
|
||||
if( blockState.getValue( BlockDiskDrive.STATE ) == state ) return;
|
||||
|
||||
getWorld().setBlockState( getPos(), blockState.with( BlockDiskDrive.STATE, state ) );
|
||||
getLevel().setBlockAndUpdate( getBlockPos(), blockState.setValue( BlockDiskDrive.STATE, state ) );
|
||||
}
|
||||
|
||||
private synchronized void ejectContents( boolean destroyed )
|
||||
{
|
||||
if( getWorld().isRemote || m_diskStack.isEmpty() ) return;
|
||||
if( getLevel().isClientSide || m_diskStack.isEmpty() ) return;
|
||||
|
||||
// Remove the disks from the inventory
|
||||
ItemStack disks = m_diskStack;
|
||||
@ -477,19 +477,19 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
if( !destroyed )
|
||||
{
|
||||
Direction dir = getDirection();
|
||||
xOff = dir.getXOffset();
|
||||
zOff = dir.getZOffset();
|
||||
xOff = dir.getStepX();
|
||||
zOff = dir.getStepZ();
|
||||
}
|
||||
|
||||
BlockPos pos = getPos();
|
||||
BlockPos pos = getBlockPos();
|
||||
double x = pos.getX() + 0.5 + xOff * 0.5;
|
||||
double y = pos.getY() + 0.75;
|
||||
double z = pos.getZ() + 0.5 + zOff * 0.5;
|
||||
ItemEntity entityitem = new ItemEntity( getWorld(), x, y, z, disks );
|
||||
entityitem.setMotion( xOff * 0.15, 0, zOff * 0.15 );
|
||||
ItemEntity entityitem = new ItemEntity( getLevel(), x, y, z, disks );
|
||||
entityitem.setDeltaMovement( xOff * 0.15, 0, zOff * 0.15 );
|
||||
|
||||
getWorld().addEntity( entityitem );
|
||||
if( !destroyed ) getWorld().playBroadcastSound( 1000, getPos(), 0 );
|
||||
getLevel().addFreshEntity( entityitem );
|
||||
if( !destroyed ) getLevel().globalLevelEvent( 1000, getBlockPos(), 0 );
|
||||
}
|
||||
|
||||
// Private methods
|
||||
@ -500,17 +500,17 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
SoundEvent record = contents != null ? contents.getAudio( m_diskStack ) : null;
|
||||
if( record != null )
|
||||
{
|
||||
RecordUtil.playRecord( record, contents.getAudioTitle( m_diskStack ), getWorld(), getPos() );
|
||||
RecordUtil.playRecord( record, contents.getAudioTitle( m_diskStack ), getLevel(), getBlockPos() );
|
||||
}
|
||||
else
|
||||
{
|
||||
RecordUtil.playRecord( null, null, getWorld(), getPos() );
|
||||
RecordUtil.playRecord( null, null, getLevel(), getBlockPos() );
|
||||
}
|
||||
}
|
||||
|
||||
private void stopRecord()
|
||||
{
|
||||
RecordUtil.playRecord( null, null, getWorld(), getPos() );
|
||||
RecordUtil.playRecord( null, null, getLevel(), getBlockPos() );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@ -549,7 +549,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
@Override
|
||||
public ITextComponent getName()
|
||||
{
|
||||
return customName != null ? customName : new TranslationTextComponent( getBlockState().getBlock().getTranslationKey() );
|
||||
return customName != null ? customName : new TranslationTextComponent( getBlockState().getBlock().getDescriptionId() );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -35,7 +35,7 @@ public class GenericPeripheralProvider
|
||||
@Nullable
|
||||
public static IPeripheral getPeripheral( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side, NonNullConsumer<LazyOptional<IPeripheral>> invalidate )
|
||||
{
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
TileEntity tile = world.getBlockEntity( pos );
|
||||
if( tile == null ) return null;
|
||||
|
||||
ArrayList<SaturatedMethod> saturated = new ArrayList<>( 0 );
|
||||
|
@ -5,7 +5,6 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.peripheral.generic.data;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.IProperty;
|
||||
|
||||
@ -21,7 +20,7 @@ public class BlockData
|
||||
data.put( "name", DataHelpers.getId( state.getBlock() ) );
|
||||
|
||||
Map<Object, Object> stateTable = new HashMap<>();
|
||||
for( ImmutableMap.Entry<IProperty<?>, ? extends Comparable<?>> entry : state.getValues().entrySet() )
|
||||
for( Map.Entry<IProperty<?>, ? extends Comparable<?>> entry : state.getValues().entrySet() )
|
||||
{
|
||||
IProperty<?> property = entry.getKey();
|
||||
stateTable.put( property.getName(), getPropertyValue( property, entry.getValue() ) );
|
||||
|
@ -52,12 +52,12 @@ public class ItemData
|
||||
|
||||
fillBasic( data, stack );
|
||||
|
||||
data.put( "displayName", stack.getDisplayName().getString() );
|
||||
data.put( "displayName", stack.getHoverName().getString() );
|
||||
data.put( "maxCount", stack.getMaxStackSize() );
|
||||
|
||||
if( stack.isDamageable() )
|
||||
if( stack.isDamageableItem() )
|
||||
{
|
||||
data.put( "damage", stack.getDamage() );
|
||||
data.put( "damage", stack.getDamageValue() );
|
||||
data.put( "maxDamage", stack.getMaxDamage() );
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ public class ItemData
|
||||
{
|
||||
try
|
||||
{
|
||||
return ITextComponent.Serializer.fromJson( x.getString() );
|
||||
return ITextComponent.Serializer.fromJson( x.getAsString() );
|
||||
}
|
||||
catch( JsonParseException e )
|
||||
{
|
||||
@ -138,7 +138,7 @@ public class ItemData
|
||||
* I'll do that to have the same data than ones displayed in tooltip.
|
||||
* @see EnchantmentHelper.getEnchantments(ItemStack stack)
|
||||
*/
|
||||
addEnchantments( stack.getEnchantmentTagList(), enchants );
|
||||
addEnchantments( stack.getEnchantmentTags(), enchants );
|
||||
}
|
||||
|
||||
return enchants;
|
||||
@ -157,14 +157,14 @@ public class ItemData
|
||||
|
||||
enchants.ensureCapacity( enchants.size() + rawEnchants.size() );
|
||||
|
||||
for( Map.Entry<Enchantment, Integer> entry : EnchantmentHelper.func_226652_a_( rawEnchants ).entrySet() )
|
||||
for( Map.Entry<Enchantment, Integer> entry : EnchantmentHelper.deserializeEnchantments( rawEnchants ).entrySet() )
|
||||
{
|
||||
Enchantment enchantment = entry.getKey();
|
||||
Integer level = entry.getValue();
|
||||
HashMap<String, Object> enchant = new HashMap<>( 3 );
|
||||
enchant.put( "name", DataHelpers.getId( enchantment ) );
|
||||
enchant.put( "level", level );
|
||||
enchant.put( "displayName", enchantment.getDisplayName( level ).getString() );
|
||||
enchant.put( "displayName", enchantment.getFullname( level ).getString() );
|
||||
enchants.add( enchant );
|
||||
}
|
||||
}
|
||||
|
@ -14,18 +14,18 @@ import javax.annotation.Nonnull;
|
||||
public final class ModemShapes
|
||||
{
|
||||
private static final VoxelShape[] BOXES = new VoxelShape[] {
|
||||
VoxelShapes.create( 0.125, 0.0, 0.125, 0.875, 0.1875, 0.875 ), // Down
|
||||
VoxelShapes.create( 0.125, 0.8125, 0.125, 0.875, 1.0, 0.875 ), // Up
|
||||
VoxelShapes.create( 0.125, 0.125, 0.0, 0.875, 0.875, 0.1875 ), // North
|
||||
VoxelShapes.create( 0.125, 0.125, 0.8125, 0.875, 0.875, 1.0 ), // South
|
||||
VoxelShapes.create( 0.0, 0.125, 0.125, 0.1875, 0.875, 0.875 ), // West
|
||||
VoxelShapes.create( 0.8125, 0.125, 0.125, 1.0, 0.875, 0.875 ), // East
|
||||
VoxelShapes.box( 0.125, 0.0, 0.125, 0.875, 0.1875, 0.875 ), // Down
|
||||
VoxelShapes.box( 0.125, 0.8125, 0.125, 0.875, 1.0, 0.875 ), // Up
|
||||
VoxelShapes.box( 0.125, 0.125, 0.0, 0.875, 0.875, 0.1875 ), // North
|
||||
VoxelShapes.box( 0.125, 0.125, 0.8125, 0.875, 0.875, 1.0 ), // South
|
||||
VoxelShapes.box( 0.0, 0.125, 0.125, 0.1875, 0.875, 0.875 ), // West
|
||||
VoxelShapes.box( 0.8125, 0.125, 0.125, 1.0, 0.875, 0.875 ), // East
|
||||
};
|
||||
|
||||
@Nonnull
|
||||
public static VoxelShape getBounds( Direction facing )
|
||||
{
|
||||
int direction = facing.ordinal();
|
||||
return direction < BOXES.length ? BOXES[direction] : VoxelShapes.fullCube();
|
||||
return direction < BOXES.length ? BOXES[direction] : VoxelShapes.block();
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user