Skip to content

Commit

Permalink
Revert "Merge pull request #316 from SquidDev-CC/feature/minecraft-1.…
Browse files Browse the repository at this point in the history
…12.2"

This reverts commit 61ff91f, reversing
changes made to bde9ac9.
  • Loading branch information
SquidDev committed Sep 16, 2017
1 parent 7c89222 commit d242f30
Show file tree
Hide file tree
Showing 146 changed files with 1,318 additions and 2,279 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Expand Up @@ -9,6 +9,3 @@ cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/s

jdk:
- oraclejdk8
6 changes: 3 additions & 3 deletions build.gradle
Expand Up @@ -9,7 +9,7 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'org.ajoberstar:gradle-git:1.6.0'
}
}
Expand All @@ -28,7 +28,7 @@ group = "dan200.computercraft"
archivesBaseName = "ComputerCraft"

minecraft {
version = "1.12-14.21.1.2387"
version = "1.11.2-13.20.0.2294"
runDir = "run"
replace '${version}', project.version

Expand All @@ -37,7 +37,7 @@ minecraft {
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not allways work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20170629"
mappings = "snapshot_20161227"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

Expand Down
22 changes: 15 additions & 7 deletions src/main/java/dan200/computercraft/ComputerCraft.java
Expand Up @@ -239,11 +239,11 @@ public static class Config {
public static Logger log;

// API users
private static List<IPeripheralProvider> peripheralProviders = new ArrayList<>();
private static List<IBundledRedstoneProvider> bundledRedstoneProviders = new ArrayList<>();
private static List<IMediaProvider> mediaProviders = new ArrayList<>();
private static List<ITurtlePermissionProvider> permissionProviders = new ArrayList<>();
private static final Map<String, IPocketUpgrade> pocketUpgrades = new HashMap<>();
private static List<IPeripheralProvider> peripheralProviders = new ArrayList<IPeripheralProvider>();
private static List<IBundledRedstoneProvider> bundledRedstoneProviders = new ArrayList<IBundledRedstoneProvider>();
private static List<IMediaProvider> mediaProviders = new ArrayList<IMediaProvider>();
private static List<ITurtlePermissionProvider> permissionProviders = new ArrayList<ITurtlePermissionProvider>();
private static final Map<String, IPocketUpgrade> pocketUpgrades = new HashMap<String, IPocketUpgrade>();

// Implementation
@Mod.Instance( value = ComputerCraft.MOD_ID )
Expand Down Expand Up @@ -397,6 +397,14 @@ public void init( FMLInitializationEvent event )
turtleProxy.init();
}


@Mod.EventHandler
public void onMissingMappings( FMLMissingMappingsEvent event )
{
proxy.remap( event );
turtleProxy.remap( event );
}

@Mod.EventHandler
public void onServerStarting( FMLServerStartingEvent event )
{
Expand Down Expand Up @@ -756,7 +764,7 @@ public static IPocketUpgrade getPocketUpgrade( @Nonnull ItemStack stack )
}

public static Iterable<IPocketUpgrade> getVanillaPocketUpgrades() {
List<IPocketUpgrade> upgrades = new ArrayList<>();
List<IPocketUpgrade> upgrades = new ArrayList<IPocketUpgrade>();
for(IPocketUpgrade upgrade : pocketUpgrades.values()) {
if(upgrade instanceof PocketModem || upgrade instanceof PocketSpeaker) {
upgrades.add( upgrade );
Expand Down Expand Up @@ -791,7 +799,7 @@ public static IWritableMount createSaveDirMount( World world, String subPath, lo
public static IMount createResourceMount( Class<?> modClass, String domain, String subPath )
{
// Start building list of mounts
List<IMount> mounts = new ArrayList<>();
List<IMount> mounts = new ArrayList<IMount>();
subPath = "assets/" + domain + "/" + subPath;

// Mount from debug dir
Expand Down
1 change: 0 additions & 1 deletion src/main/java/dan200/computercraft/api/lua/ILuaTask.java
Expand Up @@ -16,7 +16,6 @@
* @see ILuaContext#executeMainThreadTask(ILuaTask)
* @see ILuaContext#issueMainThreadTask(ILuaTask)
*/
@FunctionalInterface
public interface ILuaTask
{
/**
Expand Down
Expand Up @@ -16,7 +16,6 @@
*
* @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider)
*/
@FunctionalInterface
public interface IMediaProvider
{
/**
Expand Down
Expand Up @@ -91,9 +91,7 @@ public interface IPeripheral
* computers can be attached to a peripheral at once.
* @see #detach
*/
default void attach( @Nonnull IComputerAccess computer )
{
}
void attach( @Nonnull IComputerAccess computer );

/**
* Is called when a computer is detaching from the peripheral.
Expand All @@ -110,9 +108,7 @@ default void attach( @Nonnull IComputerAccess computer )
* computers can be attached to a peripheral at once.
* @see #detach
*/
default void detach( @Nonnull IComputerAccess computer )
{
}
void detach( @Nonnull IComputerAccess computer );

/**
* Determine whether this peripheral is equivalent to another one.
Expand Down
Expand Up @@ -18,7 +18,6 @@
*
* @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider)
*/
@FunctionalInterface
public interface IPeripheralProvider
{
/**
Expand Down
Expand Up @@ -74,9 +74,7 @@ public interface IPocketUpgrade
* @param peripheral The peripheral for this upgrade.
* @see #createPeripheral(IPocketAccess)
*/
default void update( @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral )
{
}
void update( @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral );

/**
* Called when the pocket computer is right clicked.
Expand All @@ -89,8 +87,5 @@ default void update( @Nonnull IPocketAccess access, @Nullable IPeripheral periph
* access the GUI.
* @see #createPeripheral(IPocketAccess)
*/
default boolean onRightClick( @Nonnull World world, @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral )
{
return false;
}
boolean onRightClick( @Nonnull World world, @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral );
}
Expand Up @@ -17,7 +17,6 @@
*
* @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider)
*/
@FunctionalInterface
public interface IBundledRedstoneProvider
{
/**
Expand Down
Expand Up @@ -15,7 +15,6 @@
*
* @see ITurtleAccess#executeCommand(ILuaContext, ITurtleCommand)
*/
@FunctionalInterface
public interface ITurtleCommand
{
/**
Expand Down
Expand Up @@ -136,7 +136,5 @@ public interface ITurtleUpgrade
* @param turtle Access to the turtle that the upgrade resides on.
* @param side Which side of the turtle (left or right) the upgrade resides on.
*/
default void update( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side )
{
}
void update( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side );
}
Expand Up @@ -8,9 +8,9 @@

import dan200.computercraft.core.terminal.TextBuffer;
import dan200.computercraft.shared.util.Palette;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -38,7 +38,7 @@ private static void greyscaleify( double[] rgb )
Arrays.fill( rgb, ( rgb[0] + rgb[1] + rgb[2] ) / 3.0f );
}

private void drawChar( BufferBuilder renderer, double x, double y, int index, int color, Palette p, boolean greyscale )
private void drawChar( VertexBuffer renderer, double x, double y, int index, int color, Palette p, boolean greyscale )
{
int column = index % 16;
int row = index / 16;
Expand All @@ -63,7 +63,7 @@ private void drawChar( BufferBuilder renderer, double x, double y, int index, in
renderer.pos( x + FONT_WIDTH, y + FONT_HEIGHT, 0.0 ).tex( (xStart + FONT_WIDTH) / 256.0, (yStart + FONT_HEIGHT) / 256.0 ).color( r, g, b, 1.0f ).endVertex();
}

private void drawQuad( BufferBuilder renderer, double x, double y, int color, double width, Palette p, boolean greyscale )
private void drawQuad( VertexBuffer renderer, double x, double y, int color, double width, Palette p, boolean greyscale )
{
double[] colour = p.getColour( 15 - color );
if(greyscale)
Expand Down Expand Up @@ -91,7 +91,7 @@ public void drawStringBackgroundPart( int x, int y, TextBuffer backgroundColour,
{
// Draw the quads
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuffer();
VertexBuffer renderer = tessellator.getBuffer();
renderer.begin( GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR );
if( leftMarginSize > 0.0 )
{
Expand Down Expand Up @@ -129,7 +129,7 @@ public void drawStringTextPart( int x, int y, TextBuffer s, TextBuffer textColou
{
// Draw the quads
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuffer();
VertexBuffer renderer = tessellator.getBuffer();
renderer.begin( GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX_COLOR );
for( int i = 0; i < s.length(); i++ )
{
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/dan200/computercraft/client/gui/GuiComputer.java
Expand Up @@ -11,6 +11,7 @@
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.IComputerContainer;
import dan200.computercraft.shared.computer.inventory.ContainerComputer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
Expand Down Expand Up @@ -60,7 +61,14 @@ public void initGui()
super.initGui();
Keyboard.enableRepeatEvents( true );

m_terminal = new WidgetTerminal( 0, 0, m_termWidth, m_termHeight, () -> m_computer, 2, 2, 2, 2 );
m_terminal = new WidgetTerminal( 0, 0, m_termWidth, m_termHeight, new IComputerContainer()
{
@Override
public IComputer getComputer()
{
return m_computer;
}
}, 2, 2, 2, 2 );
m_terminal.setAllowFocusLoss( false );
xSize = m_terminal.getWidth() + 24;
ySize = m_terminal.getHeight() + 24;
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/dan200/computercraft/client/gui/GuiConfigCC.java
Expand Up @@ -23,7 +23,7 @@ public GuiConfigCC( GuiScreen parentScreen )

private static List<IConfigElement> getConfigElements()
{
ArrayList<IConfigElement> elements = new ArrayList<>();
ArrayList<IConfigElement> elements = new ArrayList<IConfigElement>();
for (Property property : ComputerCraft.Config.config.getCategory( Configuration.CATEGORY_GENERAL ).getOrderedValues())
{
elements.add( new ConfigElement( property ) );
Expand Down Expand Up @@ -52,10 +52,24 @@ public GuiScreen createConfigGui( GuiScreen parentScreen )
return new GuiConfigCC( parentScreen );
}

@Override
@Deprecated
public Class<? extends GuiScreen> mainConfigGuiClass()
{
return GuiConfigCC.class;
}

@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
{
return null;
}

@Override
@Deprecated
public RuntimeOptionGuiHandler getHandlerFor( RuntimeOptionCategoryElement runtimeOptionCategoryElement )
{
return null;
}
}
}
Expand Up @@ -30,8 +30,8 @@ public GuiDiskDrive( InventoryPlayer inventoryplayer, TileDiskDrive diskDrive )
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
String title = m_diskDrive.getDisplayName().getUnformattedText();
fontRenderer.drawString( title, (xSize - fontRenderer.getStringWidth(title)) / 2, 6, 0x404040 );
fontRenderer.drawString( I18n.format("container.inventory"), 8, (ySize - 96) + 2, 0x404040 );
fontRendererObj.drawString( title, (xSize - fontRendererObj.getStringWidth(title)) / 2, 6, 0x404040 );
fontRendererObj.drawString( I18n.format("container.inventory"), 8, (ySize - 96) + 2, 0x404040 );
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dan200/computercraft/client/gui/GuiPrinter.java
Expand Up @@ -32,8 +32,8 @@ public GuiPrinter(InventoryPlayer inventoryplayer, TilePrinter printer)
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
String title = m_printer.getDisplayName().getUnformattedText();
fontRenderer.drawString( title, (xSize - fontRenderer.getStringWidth(title)) / 2, 6, 0x404040 );
fontRenderer.drawString( I18n.format("container.inventory"), 8, (ySize - 96) + 2, 0x404040 );
fontRendererObj.drawString( title, (xSize - fontRendererObj.getStringWidth(title)) / 2, 6, 0x404040 );
fontRendererObj.drawString( I18n.format("container.inventory"), 8, (ySize - 96) + 2, 0x404040 );
}

@Override
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/dan200/computercraft/client/gui/GuiTurtle.java
Expand Up @@ -11,6 +11,7 @@
import dan200.computercraft.client.gui.widgets.WidgetTerminal;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.computer.core.IComputer;
import dan200.computercraft.shared.computer.core.IComputerContainer;
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -66,7 +67,14 @@ public void initGui()
( height - ySize ) / 2 + 8,
ComputerCraft.terminalWidth_turtle,
ComputerCraft.terminalHeight_turtle,
() -> m_computer,
new IComputerContainer()
{
@Override
public IComputer getComputer()
{
return m_computer;
}
},
2, 2, 2, 2
);
m_terminalGui.setAllowFocusLoss( false );
Expand Down
Expand Up @@ -265,7 +265,7 @@ protected void drawTooltip( String line, int x, int y )
protected void drawTooltip( String[] lines, int x, int y )
{
Minecraft mc = Minecraft.getMinecraft();
FontRenderer fontRenderer = mc.fontRenderer;
FontRenderer fontRenderer = mc.fontRendererObj;

int width = 0;
for( String line : lines )
Expand Down Expand Up @@ -340,7 +340,7 @@ protected void drawItemStack( int x, int y, @Nonnull ItemStack stack )
if( renderItem != null )
{
renderItem.renderItemAndEffectIntoGUI( stack, x, y );
renderItem.renderItemOverlayIntoGUI( mc.fontRenderer, stack, x, y, null );
renderItem.renderItemOverlayIntoGUI( mc.fontRendererObj, stack, x, y, null );
}
}
finally
Expand All @@ -360,7 +360,7 @@ protected void drawString( String s, int x, int y, int color )
Minecraft mc = Minecraft.getMinecraft();
try
{
mc.fontRenderer.drawString( s, x, y, color );
mc.fontRendererObj.drawString( s, x, y, color );
}
finally
{
Expand All @@ -371,7 +371,7 @@ protected void drawString( String s, int x, int y, int color )
protected int getStringWidth( String s )
{
Minecraft mc = Minecraft.getMinecraft();
return mc.fontRenderer.getStringWidth( s );
return mc.fontRendererObj.getStringWidth( s );
}

protected void playClickSound()
Expand Down
Expand Up @@ -21,7 +21,7 @@ public class WidgetContainer extends Widget
public WidgetContainer( int x, int y, int w, int h )
{
super( x, y, w, h );
m_widgets = new ArrayList<>();
m_widgets = new ArrayList<Widget>();
m_modalWidget = null;
}

Expand Down Expand Up @@ -203,8 +203,7 @@ public boolean suppressItemTooltips( Minecraft mc, int xOrigin, int yOrigin, int
return false;
}

@Override
public boolean suppressKeyPress( char c, int k )
public boolean suppressKeyPress( char c, int k )
{
if( m_modalWidget == null )
{
Expand Down
Expand Up @@ -76,7 +76,7 @@ public WidgetTerminal( int x, int y, int termWidth, int termHeight, IComputerCon
m_topMargin = topMargin;
m_bottomMargin = bottomMargin;

m_keysDown = new ArrayList<>();
m_keysDown = new ArrayList<Integer>();
}

public void setAllowFocusLoss( boolean allowFocusLoss )
Expand Down

0 comments on commit d242f30

Please sign in to comment.