mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-19 05:32:55 +00:00
Bump mappings and Forge versions
Things are shaping up nicely!
This commit is contained in:
parent
39a9ad0ce7
commit
15d4a55cd8
@ -3,5 +3,5 @@ mod_version=1.83.1
|
||||
|
||||
# Minecraft properties
|
||||
mc_version=1.14.2
|
||||
forge_version=26.0.5
|
||||
mappings_version=20190608-1.14.2
|
||||
forge_version=26.0.10
|
||||
mappings_version=20190609-1.14.2
|
||||
|
@ -65,7 +65,7 @@ public class ClientTableFormatter implements TableFormatter
|
||||
public void writeLine( int id, ITextComponent component )
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
NewChatGui chat = mc.field_71456_v.getChatGUI(); // ingameGUI
|
||||
NewChatGui chat = mc.ingameGUI.getChatGUI();
|
||||
|
||||
// Trim the text if it goes over the allowed length
|
||||
int maxWidth = MathHelper.floor( chat.getChatWidth() / chat.getScale() );
|
||||
@ -76,7 +76,7 @@ public class ClientTableFormatter implements TableFormatter
|
||||
@Override
|
||||
public int display( TableBuilder table )
|
||||
{
|
||||
NewChatGui chat = Minecraft.getInstance().field_71456_v.getChatGUI();
|
||||
NewChatGui chat = Minecraft.getInstance().ingameGUI.getChatGUI();
|
||||
|
||||
int lastHeight = lastHeights.get( table.getId() );
|
||||
|
||||
|
@ -10,14 +10,17 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.client.gui.widgets.WidgetTerminal;
|
||||
import dan200.computercraft.client.gui.widgets.WidgetWrapper;
|
||||
import dan200.computercraft.shared.computer.blocks.TileComputer;
|
||||
import dan200.computercraft.shared.computer.core.ClientComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
|
||||
import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
@ -49,17 +52,39 @@ public class GuiComputer<T extends Container & IContainerComputer> extends Conta
|
||||
terminal = null;
|
||||
}
|
||||
|
||||
public static GuiComputer<ContainerComputer> create( int id, TileComputer computer, PlayerInventory inventory, ITextComponent component )
|
||||
public static GuiComputer<ContainerComputer> create( ContainerComputer container, PlayerInventory inventory, ITextComponent component )
|
||||
{
|
||||
return new GuiComputer<>(
|
||||
new ContainerComputer( id, computer ), inventory, component,
|
||||
computer.getFamily(),
|
||||
computer.createClientComputer(),
|
||||
container, inventory, component,
|
||||
container.getFamily(),
|
||||
(ClientComputer) container.getComputer(),
|
||||
ComputerCraft.terminalWidth_computer,
|
||||
ComputerCraft.terminalHeight_computer
|
||||
);
|
||||
}
|
||||
|
||||
public static GuiComputer<ContainerPocketComputer> createPocket( ContainerPocketComputer container, PlayerInventory inventory, ITextComponent component )
|
||||
{
|
||||
Item item = container.getStack().getItem();
|
||||
return new GuiComputer<>(
|
||||
container, inventory, component,
|
||||
item instanceof ItemPocketComputer ? ((ItemPocketComputer) item).getFamily() : ComputerFamily.Normal,
|
||||
(ClientComputer) container.getComputer(),
|
||||
ComputerCraft.terminalWidth_computer,
|
||||
ComputerCraft.terminalHeight_computer
|
||||
);
|
||||
}
|
||||
|
||||
public static GuiComputer<ContainerViewComputer> createView( ContainerViewComputer container, PlayerInventory inventory, ITextComponent component )
|
||||
{
|
||||
return new GuiComputer<>(
|
||||
container, inventory, component,
|
||||
// TODO: Waiting to see how Forge handles this before implementing anything else.
|
||||
null, (ClientComputer) container.getComputer(), 0, 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void init()
|
||||
{
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
|
||||
package dan200.computercraft.client.gui;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public class GuiPocketComputer extends GuiComputer<ContainerPocketComputer>
|
||||
{
|
||||
public GuiPocketComputer( ContainerPocketComputer container, PlayerInventory player, ITextComponent title )
|
||||
{
|
||||
super(
|
||||
container, player, title,
|
||||
getFamily( container.getStack() ),
|
||||
ItemPocketComputer.createClientComputer( container.getStack() ),
|
||||
ComputerCraft.terminalWidth_pocketComputer,
|
||||
ComputerCraft.terminalHeight_pocketComputer
|
||||
);
|
||||
}
|
||||
|
||||
private static ComputerFamily getFamily( ItemStack stack )
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
return item instanceof ItemPocketComputer ? ((ItemPocketComputer) item).getFamily() : ComputerFamily.Normal;
|
||||
}
|
||||
}
|
@ -12,7 +12,6 @@ import dan200.computercraft.client.gui.widgets.WidgetTerminal;
|
||||
import dan200.computercraft.client.gui.widgets.WidgetWrapper;
|
||||
import dan200.computercraft.shared.computer.core.ClientComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
||||
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
@ -32,13 +31,13 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
private WidgetTerminal terminal;
|
||||
private WidgetWrapper terminalWrapper;
|
||||
|
||||
public GuiTurtle( TileTurtle turtle, ContainerTurtle container, PlayerInventory player, ITextComponent title )
|
||||
public GuiTurtle( ContainerTurtle container, PlayerInventory player, ITextComponent title )
|
||||
{
|
||||
super( container, player, title );
|
||||
|
||||
m_container = container;
|
||||
m_family = turtle.getFamily();
|
||||
m_computer = turtle.getClientComputer();
|
||||
m_family = null; // TODO
|
||||
m_computer = (ClientComputer) container.getComputer();
|
||||
|
||||
xSize = 254;
|
||||
ySize = 217;
|
||||
|
@ -7,14 +7,13 @@
|
||||
package dan200.computercraft.client.proxy;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.client.gui.GuiDiskDrive;
|
||||
import dan200.computercraft.client.gui.GuiPocketComputer;
|
||||
import dan200.computercraft.client.gui.GuiPrinter;
|
||||
import dan200.computercraft.client.gui.GuiPrintout;
|
||||
import dan200.computercraft.client.gui.*;
|
||||
import dan200.computercraft.client.render.TileEntityCableRenderer;
|
||||
import dan200.computercraft.client.render.TileEntityMonitorRenderer;
|
||||
import dan200.computercraft.client.render.TileEntityTurtleRenderer;
|
||||
import dan200.computercraft.shared.common.ContainerHeldItem;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
|
||||
import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.TileCable;
|
||||
import dan200.computercraft.shared.peripheral.monitor.ClientMonitor;
|
||||
@ -22,6 +21,7 @@ import dan200.computercraft.shared.peripheral.monitor.TileMonitor;
|
||||
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
|
||||
import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer;
|
||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
||||
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
|
||||
import net.minecraft.client.gui.ScreenManager;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
@ -46,11 +46,17 @@ public final class ComputerCraftProxyClient
|
||||
|
||||
private static void registerContainers()
|
||||
{
|
||||
// My IDE doesn't think so, but we do actually need these generics.
|
||||
|
||||
ScreenManager.<ContainerComputer, GuiComputer<ContainerComputer>>registerFactory( ContainerComputer.TYPE, GuiComputer::create );
|
||||
ScreenManager.<ContainerPocketComputer, GuiComputer<ContainerPocketComputer>>registerFactory( ContainerPocketComputer.TYPE, GuiComputer::createPocket );
|
||||
ScreenManager.registerFactory( ContainerTurtle.TYPE, GuiTurtle::new );
|
||||
|
||||
ScreenManager.registerFactory( ContainerPrinter.TYPE, GuiPrinter::new );
|
||||
ScreenManager.registerFactory( ContainerDiskDrive.TYPE, GuiDiskDrive::new );
|
||||
ScreenManager.registerFactory( ContainerPocketComputer.TYPE, GuiPocketComputer::new );
|
||||
ScreenManager.registerFactory( ContainerHeldItem.PRINTOUT_TYPE, GuiPrintout::new );
|
||||
// TODO: ScreenManager.registerFactory( ContainerViewComputer.TYPE, GuiComputer::new );
|
||||
|
||||
ScreenManager.<ContainerViewComputer, GuiComputer<ContainerViewComputer>>registerFactory( ContainerViewComputer.TYPE, GuiComputer::createView );
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, value = Dist.CLIENT )
|
||||
|
@ -91,7 +91,7 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
|
||||
if( label != null && hit.getType() == RayTraceResult.Type.BLOCK && turtle.getPos().equals( ((BlockRayTraceResult) hit).getPos() ) )
|
||||
{
|
||||
setLightmapDisabled( true );
|
||||
GameRenderer.func_215307_a(
|
||||
GameRenderer.drawNameplate(
|
||||
getFontRenderer(), label,
|
||||
(float) posX + 0.5F, (float) posY + 1.2F, (float) posZ + 0.5F, 0,
|
||||
rendererDispatcher.field_217666_g.func_216778_f(), rendererDispatcher.field_217666_g.func_216777_e(), false
|
||||
|
@ -267,7 +267,7 @@ public class ResourceMount implements IMount
|
||||
|
||||
synchronized void add( IReloadableResourceManager manager, ResourceMount mount )
|
||||
{
|
||||
if( managers.add( manager ) ) manager.func_219534_a( this ); // addReloadListener
|
||||
if( managers.add( manager ) ) manager.addReloadListener( this );
|
||||
mounts.add( mount );
|
||||
}
|
||||
}
|
||||
|
@ -8,15 +8,19 @@ package dan200.computercraft.shared;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.shared.common.ContainerHeldItem;
|
||||
import dan200.computercraft.shared.computer.blocks.BlockComputer;
|
||||
import dan200.computercraft.shared.computer.blocks.TileCommandComputer;
|
||||
import dan200.computercraft.shared.computer.blocks.TileComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
|
||||
import dan200.computercraft.shared.computer.items.ItemComputer;
|
||||
import dan200.computercraft.shared.media.items.ItemDisk;
|
||||
import dan200.computercraft.shared.media.items.ItemPrintout;
|
||||
import dan200.computercraft.shared.media.items.ItemTreasureDisk;
|
||||
import dan200.computercraft.shared.peripheral.diskdrive.BlockDiskDrive;
|
||||
import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive;
|
||||
import dan200.computercraft.shared.peripheral.diskdrive.TileDiskDrive;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.*;
|
||||
import dan200.computercraft.shared.peripheral.modem.wireless.BlockWirelessModem;
|
||||
@ -24,21 +28,25 @@ import dan200.computercraft.shared.peripheral.modem.wireless.TileWirelessModem;
|
||||
import dan200.computercraft.shared.peripheral.monitor.BlockMonitor;
|
||||
import dan200.computercraft.shared.peripheral.monitor.TileMonitor;
|
||||
import dan200.computercraft.shared.peripheral.printer.BlockPrinter;
|
||||
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
|
||||
import dan200.computercraft.shared.peripheral.printer.TilePrinter;
|
||||
import dan200.computercraft.shared.peripheral.speaker.BlockSpeaker;
|
||||
import dan200.computercraft.shared.peripheral.speaker.TileSpeaker;
|
||||
import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.peripherals.PocketModem;
|
||||
import dan200.computercraft.shared.pocket.peripherals.PocketSpeaker;
|
||||
import dan200.computercraft.shared.turtle.blocks.BlockTurtle;
|
||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
||||
import dan200.computercraft.shared.turtle.core.TurtlePlayer;
|
||||
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
|
||||
import dan200.computercraft.shared.turtle.items.ItemTurtle;
|
||||
import dan200.computercraft.shared.turtle.upgrades.*;
|
||||
import dan200.computercraft.shared.util.CreativeTabMain;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
@ -311,4 +319,20 @@ public final class Registry
|
||||
{
|
||||
registry.getRegistry().register( TurtlePlayer.TYPE.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "turtle_player" ) ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerContainers( RegistryEvent.Register<ContainerType<?>> event )
|
||||
{
|
||||
event.getRegistry().registerAll(
|
||||
ContainerComputer.TYPE.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "computer" ) ),
|
||||
ContainerPocketComputer.TYPE.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "pocket_computer" ) ),
|
||||
ContainerTurtle.TYPE.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "turtle" ) ),
|
||||
|
||||
ContainerDiskDrive.TYPE.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "disk_drive" ) ),
|
||||
ContainerPrinter.TYPE.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "printer" ) ),
|
||||
ContainerHeldItem.PRINTOUT_TYPE.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "printout" ) ),
|
||||
|
||||
ContainerViewComputer.TYPE.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "view_computer" ) )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,12 @@ public final class ArgumentSerializers
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private static <T extends ArgumentType<?>> void registerUnsafe( ResourceLocation id, Class<T> type, IArgumentSerializer<?> serializer )
|
||||
{
|
||||
ArgumentTypes.func_218136_a( id.toString(), type, (IArgumentSerializer<T>) serializer );
|
||||
ArgumentTypes.register( id.toString(), type, (IArgumentSerializer<T>) serializer );
|
||||
}
|
||||
|
||||
private static <T extends ArgumentType<?>> void register( ResourceLocation id, Class<T> type, IArgumentSerializer<T> serializer )
|
||||
{
|
||||
ArgumentTypes.func_218136_a( id.toString(), type, serializer );
|
||||
ArgumentTypes.register( id.toString(), type, serializer );
|
||||
}
|
||||
|
||||
private static <T extends ArgumentType<?>> void register( ResourceLocation id, T instance )
|
||||
|
@ -20,7 +20,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ColourableRecipe extends SpecialRecipe
|
||||
public final class ColourableRecipe extends SpecialRecipe
|
||||
{
|
||||
private ColourableRecipe( ResourceLocation id )
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
|
||||
if( tile instanceof TileComputerBase )
|
||||
{
|
||||
TileComputerBase computer = (TileComputerBase) tile;
|
||||
if( !player.playerAbilities.isCreativeMode || computer.getLabel() != null )
|
||||
if( !player.abilities.isCreativeMode || computer.getLabel() != null )
|
||||
{
|
||||
spawnAsEntity( world, pos, getItem( computer ) );
|
||||
}
|
||||
|
@ -7,23 +7,27 @@
|
||||
package dan200.computercraft.shared.computer.inventory;
|
||||
|
||||
import dan200.computercraft.shared.computer.blocks.TileComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.IComputer;
|
||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
|
||||
import dan200.computercraft.shared.computer.core.InputState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ContainerComputer extends Container implements IContainerComputer
|
||||
{
|
||||
public static final ContainerType<ContainerComputer> TYPE = new ContainerType<>( ( id, player ) -> null );
|
||||
|
||||
private final TileComputer computer;
|
||||
private final InputState input = new InputState( this );
|
||||
|
||||
public ContainerComputer( int id, TileComputer computer )
|
||||
{
|
||||
super( null, id );
|
||||
super( TYPE, id );
|
||||
this.computer = computer;
|
||||
}
|
||||
|
||||
@ -33,6 +37,12 @@ public class ContainerComputer extends Container implements IContainerComputer
|
||||
return computer.isUsableByPlayer( player );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ComputerFamily getFamily()
|
||||
{
|
||||
return computer.getFamily();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IComputer getComputer()
|
||||
|
@ -83,6 +83,6 @@ public class PlayRecordClientMessage implements NetworkMessage
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
mc.worldRenderer.playRecord( soundEvent, pos );
|
||||
if( name != null ) mc.field_71456_v.setRecordPlayingMessage( name );
|
||||
if( name != null ) mc.ingameGUI.setRecordPlayingMessage( name );
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
ItemEntity entityitem = new ItemEntity( getWorld(), x, y, z, disks );
|
||||
entityitem.setVelocity( xOff * 0.15, 0, zOff * 0.15 );
|
||||
|
||||
getWorld().func_217376_c( entityitem );
|
||||
getWorld().addEntity( entityitem );
|
||||
if( !destroyed ) getWorld().playBroadcastSound( 1000, getPos(), 0 );
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class BlockCable extends BlockGeneric implements IWaterLoggable
|
||||
{
|
||||
if( state.get( CABLE ) && state.get( MODEM ).getFacing() != null )
|
||||
{
|
||||
BlockRayTraceResult hit = world.func_217299_a( new RayTraceContext(
|
||||
BlockRayTraceResult hit = world.rayTraceBlocks( new RayTraceContext(
|
||||
WorldUtil.getRayStart( player ), WorldUtil.getRayEnd( player ),
|
||||
RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, player
|
||||
) );
|
||||
@ -134,7 +134,7 @@ public class BlockCable extends BlockGeneric implements IWaterLoggable
|
||||
|
||||
cable.modemChanged();
|
||||
cable.connectionsChanged();
|
||||
if( !world.isRemote && !player.playerAbilities.isCreativeMode )
|
||||
if( !world.isRemote && !player.abilities.isCreativeMode )
|
||||
{
|
||||
Block.spawnAsEntity( world, pos, item );
|
||||
}
|
||||
@ -210,7 +210,7 @@ public class BlockCable extends BlockGeneric implements IWaterLoggable
|
||||
|
||||
BlockPos offsetPos = pos.offset( facing );
|
||||
BlockState offsetState = world.getBlockState( offsetPos );
|
||||
return Block.func_220056_d( offsetState, world, offsetPos, facing.getOpposite() ); // hasSolidTop ??
|
||||
return Block.hasSolidSide( offsetState, world, offsetPos, facing.getOpposite() );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -85,7 +85,7 @@ public class BlockWirelessModem extends BlockGeneric implements IWaterLoggable
|
||||
Direction facing = state.get( FACING );
|
||||
BlockPos offsetPos = pos.offset( facing );
|
||||
BlockState offsetState = world.getBlockState( offsetPos );
|
||||
return func_220056_d( offsetState, world, offsetPos, facing.getOpposite() );
|
||||
return hasSolidSide( offsetState, world, offsetPos, facing.getOpposite() );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -51,7 +51,7 @@ public abstract class WirelessModemPeripheral extends ModemPeripheral
|
||||
}
|
||||
if( position.y > 96.0 && maxRange > minRange )
|
||||
{
|
||||
return minRange + (position.y - 96.0) * ((maxRange - minRange) / ((world.func_217301_I() - 1) - 96.0));
|
||||
return minRange + (position.y - 96.0) * ((maxRange - minRange) / ((world.getHeight() - 1) - 96.0));
|
||||
}
|
||||
return minRange;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class ContainerPrinter extends Container
|
||||
|
||||
private ContainerPrinter( int id, PlayerInventory player )
|
||||
{
|
||||
this( id, player, new Inventory( TilePrinter.SLOTS ), new IntArray( TilePrinter.PROPERTIES ) );
|
||||
this( id, player, new Inventory( TilePrinter.SLOTS ), new IntArray( 1 ) );
|
||||
}
|
||||
|
||||
public ContainerPrinter( int id, PlayerInventory player, TilePrinter printer )
|
||||
@ -73,7 +73,7 @@ public class ContainerPrinter extends Container
|
||||
|
||||
public boolean isPrinting()
|
||||
{
|
||||
return properties.func_221476_a( 0 ) != 0;
|
||||
return properties.get( 0 ) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,7 +53,6 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
private static final String NBT_PAGE_TITLE = "PageTitle";
|
||||
|
||||
static final int SLOTS = 13;
|
||||
static final int PROPERTIES = 1;
|
||||
|
||||
private static final int[] BOTTOM_SLOTS = new int[] { 7, 8, 9, 10, 11, 12 };
|
||||
private static final int[] TOP_SLOTS = new int[] { 1, 2, 3, 4, 5, 6 };
|
||||
|
@ -16,22 +16,17 @@ import dan200.computercraft.shared.Config;
|
||||
import dan200.computercraft.shared.command.CommandComputerCraft;
|
||||
import dan200.computercraft.shared.command.arguments.ArgumentSerializers;
|
||||
import dan200.computercraft.shared.common.ColourableRecipe;
|
||||
import dan200.computercraft.shared.common.ContainerHeldItem;
|
||||
import dan200.computercraft.shared.common.DefaultBundledRedstoneProvider;
|
||||
import dan200.computercraft.shared.computer.core.IComputer;
|
||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
|
||||
import dan200.computercraft.shared.computer.recipe.ComputerUpgradeRecipe;
|
||||
import dan200.computercraft.shared.media.items.RecordMedia;
|
||||
import dan200.computercraft.shared.media.recipes.DiskRecipe;
|
||||
import dan200.computercraft.shared.media.recipes.PrintoutRecipe;
|
||||
import dan200.computercraft.shared.network.NetworkHandler;
|
||||
import dan200.computercraft.shared.peripheral.commandblock.CommandBlockPeripheral;
|
||||
import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive;
|
||||
import dan200.computercraft.shared.peripheral.modem.wireless.WirelessNetwork;
|
||||
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
|
||||
import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.recipes.PocketComputerUpgradeRecipe;
|
||||
import dan200.computercraft.shared.turtle.recipes.TurtleRecipe;
|
||||
import dan200.computercraft.shared.turtle.recipes.TurtleUpgradeRecipe;
|
||||
@ -44,7 +39,6 @@ import net.minecraft.item.MusicDiscItem;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.tileentity.CommandBlockTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
@ -66,21 +60,15 @@ public final class ComputerCraftProxyCommon
|
||||
registerProviders();
|
||||
|
||||
// Eww, eww, eww - can we move this to an event?
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":colour", ColourableRecipe.SERIALIZER );
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":computer_upgrade", ComputerUpgradeRecipe.SERIALIZER );
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":pocket_computer_upgrade", PocketComputerUpgradeRecipe.SERIALIZER );
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":disk", DiskRecipe.SERIALIZER );
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":printout", PrintoutRecipe.SERIALIZER );
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":turtle", TurtleRecipe.SERIALIZER );
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":turtle_upgrade", TurtleUpgradeRecipe.SERIALIZER );
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":impostor_shapeless", ImpostorShapelessRecipe.SERIALIZER );
|
||||
IRecipeSerializer.func_222156_a( ComputerCraft.MOD_ID + ":impostor_shaped", ImpostorRecipe.SERIALIZER );
|
||||
|
||||
Registry.register( Registry.field_218366_G, ComputerCraft.MOD_ID + ":printer", ContainerPrinter.TYPE );
|
||||
Registry.register( Registry.field_218366_G, ComputerCraft.MOD_ID + ":disk_drive", ContainerDiskDrive.TYPE );
|
||||
Registry.register( Registry.field_218366_G, ComputerCraft.MOD_ID + ":pocket_computer", ContainerPocketComputer.TYPE );
|
||||
Registry.register( Registry.field_218366_G, ComputerCraft.MOD_ID + ":printout", ContainerHeldItem.PRINTOUT_TYPE );
|
||||
Registry.register( Registry.field_218366_G, ComputerCraft.MOD_ID + ":view_computer", ContainerViewComputer.TYPE );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":colour", ColourableRecipe.SERIALIZER );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":computer_upgrade", ComputerUpgradeRecipe.SERIALIZER );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":pocket_computer_upgrade", PocketComputerUpgradeRecipe.SERIALIZER );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":disk", DiskRecipe.SERIALIZER );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":printout", PrintoutRecipe.SERIALIZER );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":turtle", TurtleRecipe.SERIALIZER );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":turtle_upgrade", TurtleUpgradeRecipe.SERIALIZER );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":impostor_shapeless", ImpostorShapelessRecipe.SERIALIZER );
|
||||
IRecipeSerializer.register( ComputerCraft.MOD_ID + ":impostor_shaped", ImpostorRecipe.SERIALIZER );
|
||||
|
||||
ArgumentSerializers.register();
|
||||
|
||||
|
@ -54,7 +54,7 @@ public final class FurnaceRefuelHandler implements TurtleRefuelEvent.Handler
|
||||
int basicBurnTime = stack.getBurnTime();
|
||||
int burnTime = ForgeEventFactory.getItemBurnTime(
|
||||
stack,
|
||||
basicBurnTime == -1 ? FurnaceTileEntity.func_214001_f().getOrDefault( stack.getItem(), 0 ) : basicBurnTime
|
||||
basicBurnTime == -1 ? FurnaceTileEntity.getBurnTimes().getOrDefault( stack.getItem(), 0 ) : basicBurnTime
|
||||
);
|
||||
return (burnTime * 5) / 100;
|
||||
}
|
||||
|
@ -6,47 +6,53 @@
|
||||
|
||||
package dan200.computercraft.shared.turtle.inventory;
|
||||
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import dan200.computercraft.shared.computer.core.IComputer;
|
||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
|
||||
import dan200.computercraft.shared.computer.core.InputState;
|
||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
||||
import dan200.computercraft.shared.turtle.core.TurtleBrain;
|
||||
import dan200.computercraft.shared.util.SingleIntArray;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIntArray;
|
||||
import net.minecraft.util.IntArray;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ContainerTurtle extends Container implements IContainerComputer
|
||||
{
|
||||
public static final ContainerType<ContainerTurtle> TYPE = null;
|
||||
public static final ContainerType<ContainerTurtle> TYPE = new ContainerType<>( ContainerTurtle::new );
|
||||
|
||||
public static final int PLAYER_START_Y = 134;
|
||||
public static final int TURTLE_START_X = 175;
|
||||
|
||||
private final ITurtleAccess m_turtle;
|
||||
private IComputer m_computer;
|
||||
private final InputState input = new InputState( this );
|
||||
private int selectedSlot;
|
||||
private final IIntArray properties;
|
||||
|
||||
protected ContainerTurtle( int id, PlayerInventory playerInventory, ITurtleAccess turtle )
|
||||
private IComputer computer;
|
||||
private TurtleBrain turtle;
|
||||
|
||||
private final InputState input = new InputState( this );
|
||||
|
||||
protected ContainerTurtle( int id, PlayerInventory playerInventory, IInventory inventory, IIntArray properties )
|
||||
{
|
||||
super( TYPE, id );
|
||||
this.properties = properties;
|
||||
|
||||
m_turtle = turtle;
|
||||
selectedSlot = m_turtle.getWorld().isRemote ? 0 : m_turtle.getSelectedSlot();
|
||||
func_216961_a( properties );
|
||||
|
||||
// Turtle inventory
|
||||
for( int y = 0; y < 4; y++ )
|
||||
{
|
||||
for( int x = 0; x < 4; x++ )
|
||||
{
|
||||
addSlot( new Slot( m_turtle.getInventory(), x + y * 4, TURTLE_START_X + 1 + x * 18, PLAYER_START_Y + 1 + y * 18 ) );
|
||||
addSlot( new Slot( inventory, x + y * 4, TURTLE_START_X + 1 + x * 18, PLAYER_START_Y + 1 + y * 18 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,22 +72,28 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
||||
}
|
||||
}
|
||||
|
||||
public ContainerTurtle( int id, PlayerInventory playerInventory, ITurtleAccess turtle, IComputer computer )
|
||||
public ContainerTurtle( int id, PlayerInventory playerInventory, TurtleBrain turtle, IComputer computer )
|
||||
{
|
||||
this( id, playerInventory, turtle );
|
||||
m_computer = computer;
|
||||
this( id, playerInventory, turtle.getInventory(), (SingleIntArray) turtle::getSelectedSlot );
|
||||
this.turtle = turtle;
|
||||
this.computer = computer;
|
||||
}
|
||||
|
||||
private ContainerTurtle( int id, PlayerInventory playerInventory )
|
||||
{
|
||||
this( id, playerInventory, new Inventory( TileTurtle.INVENTORY_SIZE ), new IntArray( 1 ) );
|
||||
}
|
||||
|
||||
public int getSelectedSlot()
|
||||
{
|
||||
return selectedSlot;
|
||||
return properties.get( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( @Nonnull PlayerEntity player )
|
||||
{
|
||||
TileTurtle turtle = ((TurtleBrain) m_turtle).getOwner();
|
||||
return turtle != null && turtle.isUsableByPlayer( player );
|
||||
// If we've no turtle, we'll be on the client.
|
||||
return turtle == null || (turtle.getOwner() != null && turtle.getOwner().isUsableByPlayer( player ));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@ -138,7 +150,7 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
||||
@Override
|
||||
public IComputer getComputer()
|
||||
{
|
||||
return m_computer;
|
||||
return computer;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -66,7 +66,7 @@ public class TurtleInventoryCrafting extends CraftingInventory
|
||||
}
|
||||
|
||||
// Check the actual crafting
|
||||
return m_turtle.getWorld().getRecipeManager().func_215371_a( IRecipeType.field_222149_a, this, m_turtle.getWorld() ).orElse( null );
|
||||
return m_turtle.getWorld().getRecipeManager().getRecipe( IRecipeType.CRAFTING, this, m_turtle.getWorld() ).orElse( null );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -43,7 +43,7 @@ public final class IDAssigner
|
||||
public static File getDir()
|
||||
{
|
||||
MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
|
||||
File worldDirectory = server.getWorld( DimensionType.OVERWORLD ).func_217485_w().getWorldDirectory(); // getSaveHandler
|
||||
File worldDirectory = server.getWorld( DimensionType.OVERWORLD ).getSaveHandler().getWorldDirectory();
|
||||
return new File( worldDirectory, ComputerCraft.MOD_ID );
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public final class ImpostorRecipe extends ShapedRecipe
|
||||
public ImpostorRecipe read( @Nonnull ResourceLocation identifier, @Nonnull JsonObject json )
|
||||
{
|
||||
String group = JSONUtils.getString( json, "group", "" );
|
||||
ShapedRecipe recipe = IRecipeSerializer.field_222157_a.read( identifier, json );
|
||||
ShapedRecipe recipe = IRecipeSerializer.CRAFTING_SHAPED.read( identifier, json );
|
||||
ItemStack result = CraftingHelper.getItemStack( JSONUtils.getJsonObject( json, "result" ), true );
|
||||
return new ImpostorRecipe( identifier, group, recipe.getWidth(), recipe.getHeight(), recipe.getIngredients(), result );
|
||||
}
|
||||
|
@ -14,19 +14,18 @@ public interface SingleIntArray extends IIntArray
|
||||
int get();
|
||||
|
||||
@Override
|
||||
default int func_221476_a( int property )
|
||||
default int get( int property )
|
||||
{
|
||||
return property == 0 ? get() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
default void func_221477_a( int i, int i1 )
|
||||
default void set( int property, int value )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
default int func_221478_a()
|
||||
default int size()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public final class WorldUtil
|
||||
// Raycast for blocks
|
||||
ENTITY.setPosition( vecStart.x, vecStart.y, vecStart.z );
|
||||
RayTraceContext context = new RayTraceContext( vecStart, vecEnd, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, ENTITY );
|
||||
RayTraceResult result = world.func_217299_a( context );
|
||||
RayTraceResult result = world.rayTraceBlocks( context );
|
||||
if( result != null && result.getType() == RayTraceResult.Type.BLOCK )
|
||||
{
|
||||
distance = vecStart.distanceTo( result.getHitVec() );
|
||||
@ -96,7 +96,7 @@ public final class WorldUtil
|
||||
continue;
|
||||
}
|
||||
|
||||
Vec3d littleBoxResult = littleBox.func_216365_b( vecStart, vecEnd ).orElse( null ); // rayTrace
|
||||
Vec3d littleBoxResult = littleBox.rayTrace( vecStart, vecEnd ).orElse( null );
|
||||
if( littleBoxResult != null )
|
||||
{
|
||||
double dist = vecStart.distanceTo( littleBoxResult );
|
||||
@ -178,6 +178,6 @@ public final class WorldUtil
|
||||
zDir * 0.7 + world.getRandom().nextFloat() * 0.2 - 0.1
|
||||
);
|
||||
item.setDefaultPickupDelay();
|
||||
world.func_217376_c( item );
|
||||
world.addEntity( item );
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,3 @@
|
||||
public net.minecraft.client.renderer.FirstPersonRenderer func_187466_c()V # renderArms
|
||||
public net.minecraft.client.renderer.FirstPersonRenderer func_178100_c(F)F # getMapAngleFromPitch
|
||||
public net.minecraft.client.renderer.FirstPersonRenderer func_187456_a(FFLnet/minecraft/util/HandSide;)V # renderArmFirstPerson
|
||||
|
||||
# Containers
|
||||
public net.minecraft.inventory.container.ContainerType$IFactory
|
||||
public net.minecraft.inventory.container.ContainerType <init>(Lnet/minecraft/inventory/container/ContainerType$IFactory;)V
|
||||
public net.minecraft.client.gui.ScreenManager$IScreenFactory
|
||||
public net.minecraft.client.gui.ScreenManager func_216911_a(Lnet/minecraft/inventory/container/ContainerType;Lnet/minecraft/client/gui/ScreenManager$IScreenFactory;)V # registerFactory
|
||||
|
Loading…
Reference in New Issue
Block a user