1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-29 18:34:47 +00:00

Merge branch 'mc-1.16.x' into mc-1.17.x

This commit is contained in:
Jonathan Coates 2021-08-08 12:40:00 +01:00
commit 6eec9ba1a3
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
5 changed files with 30 additions and 10 deletions

View File

@ -10,6 +10,7 @@ body:
options: options:
- 1.15.x - 1.15.x
- 1.16.x - 1.16.x
- 1.17.x
validations: validations:
required: true required: true
- type: input - type: input

View File

@ -72,6 +72,7 @@ public class RedstoneAPI implements ILuaAPI
* "back". * "back".
* *
* @return A table of valid sides. * @return A table of valid sides.
* @cc.since 1.2
*/ */
@LuaFunction @LuaFunction
public final String[] getSides() public final String[] getSides()
@ -122,6 +123,7 @@ public class RedstoneAPI implements ILuaAPI
* @param side The side to set. * @param side The side to set.
* @param value The signal strength between 0 and 15. * @param value The signal strength between 0 and 15.
* @throws LuaException If {@code value} is not betwene 0 and 15. * @throws LuaException If {@code value} is not betwene 0 and 15.
* @cc.since 1.51
*/ */
@LuaFunction( { "setAnalogOutput", "setAnalogueOutput" } ) @LuaFunction( { "setAnalogOutput", "setAnalogueOutput" } )
public final void setAnalogOutput( ComputerSide side, int value ) throws LuaException public final void setAnalogOutput( ComputerSide side, int value ) throws LuaException
@ -136,6 +138,7 @@ public class RedstoneAPI implements ILuaAPI
* @param side The side to get. * @param side The side to get.
* @return The output signal strength, between 0 and 15. * @return The output signal strength, between 0 and 15.
* @see #setAnalogOutput * @see #setAnalogOutput
* @cc.since 1.51
*/ */
@LuaFunction( { "getAnalogOutput", "getAnalogueOutput" } ) @LuaFunction( { "getAnalogOutput", "getAnalogueOutput" } )
public final int getAnalogOutput( ComputerSide side ) public final int getAnalogOutput( ComputerSide side )
@ -148,6 +151,7 @@ public class RedstoneAPI implements ILuaAPI
* *
* @param side The side to get. * @param side The side to get.
* @return The input signal strength, between 0 and 15. * @return The input signal strength, between 0 and 15.
* @cc.since 1.51
*/ */
@LuaFunction( { "getAnalogInput", "getAnalogueInput" } ) @LuaFunction( { "getAnalogInput", "getAnalogueInput" } )
public final int getAnalogInput( ComputerSide side ) public final int getAnalogInput( ComputerSide side )

View File

@ -515,8 +515,8 @@ public class TurtleAPI implements ILuaAPI
/** /**
* Refuel this turtle. * Refuel this turtle.
* *
* While most actions a turtle can perform (such as digging or placing blocks), moving consumes fuel from the * While most actions a turtle can perform (such as digging or placing blocks) are free, moving consumes fuel from
* turtle's internal buffer. If a turtle has no fuel, it will not move. * the turtle's internal buffer. If a turtle has no fuel, it will not move.
* *
* {@link #refuel} refuels the turtle, consuming fuel items (such as coal or lava buckets) from the currently * {@link #refuel} refuels the turtle, consuming fuel items (such as coal or lava buckets) from the currently
* selected slot and converting them into energy. This finishes once the turtle is fully refuelled or all items have * selected slot and converting them into energy. This finishes once the turtle is fully refuelled or all items have

View File

@ -91,14 +91,7 @@ public class TurtleTool extends AbstractTurtleUpgrade
@OnlyIn( Dist.CLIENT ) @OnlyIn( Dist.CLIENT )
public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side ) public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
{ {
float xOffset = side == TurtleSide.LEFT ? -0.40625f : 0.40625f; return TransformedModel.of( getCraftingItem(), side == TurtleSide.LEFT ? Transforms.leftTransform : Transforms.rightTransform );
Matrix4f transform = new Matrix4f( new float[] {
0.0f, 0.0f, -1.0f, 1.0f + xOffset,
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f, 1.0f,
0.0f, 0.0f, 0.0f, 1.0f,
} );
return TransformedModel.of( getCraftingItem(), new Transformation( transform ) );
} }
@Nonnull @Nonnull
@ -293,4 +286,20 @@ public class TurtleTool extends AbstractTurtleUpgrade
Direction direction = tile.isRemoved() ? null : turtle.getDirection().getOpposite(); Direction direction = tile.isRemoved() ? null : turtle.getDirection().getOpposite();
DropConsumer.clearAndDrop( turtle.getLevel(), turtle.getPosition(), direction ); DropConsumer.clearAndDrop( turtle.getLevel(), turtle.getPosition(), direction );
} }
private static class Transforms
{
static final Transformation leftTransform = getMatrixFor( -0.40625f );
static final Transformation rightTransform = getMatrixFor( 0.40625f );
private static Transformation getMatrixFor( float offset )
{
return new Transformation( new Matrix4f( new float[] {
0.0f, 0.0f, -1.0f, 1.0f + offset,
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f, 1.0f,
0.0f, 0.0f, 0.0f, 1.0f,
} ) );
}
}
} }

View File

@ -11,6 +11,8 @@
-- Peripheral functions are called *methods*, a term borrowed from Java. -- Peripheral functions are called *methods*, a term borrowed from Java.
-- --
-- @module peripheral -- @module peripheral
-- @since 1.3
-- @changed 1.51 Add support for wired modems.
local expect = dofile("rom/modules/main/cc/expect.lua").expect local expect = dofile("rom/modules/main/cc/expect.lua").expect
@ -24,6 +26,7 @@ local sides = rs.getSides()
-- Modem, then it'll be reported according to its name on the wired network. -- Modem, then it'll be reported according to its name on the wired network.
-- --
-- @treturn { string... } A list of the names of all attached peripherals. -- @treturn { string... } A list of the names of all attached peripherals.
-- @since 1.51
function getNames() function getNames()
local results = {} local results = {}
for n = 1, #sides do for n = 1, #sides do
@ -69,6 +72,7 @@ end
-- @tparam string|table peripheral The name of the peripheral to find, or a -- @tparam string|table peripheral The name of the peripheral to find, or a
-- wrapped peripheral instance. -- wrapped peripheral instance.
-- @treturn string|nil The peripheral's type, or `nil` if it is not present. -- @treturn string|nil The peripheral's type, or `nil` if it is not present.
-- @changed 1.88.0 Accepts a wrapped peripheral as an argument.
function getType(peripheral) function getType(peripheral)
expect(1, peripheral, "string", "table") expect(1, peripheral, "string", "table")
if type(peripheral) == "string" then -- Peripheral name passed if type(peripheral) == "string" then -- Peripheral name passed
@ -118,6 +122,7 @@ end
-- --
-- @tparam table peripheral The peripheral to get the name of. -- @tparam table peripheral The peripheral to get the name of.
-- @treturn string The name of the given peripheral. -- @treturn string The name of the given peripheral.
-- @since 1.88.0
function getName(peripheral) function getName(peripheral)
expect(1, peripheral, "table") expect(1, peripheral, "table")
local mt = getmetatable(peripheral) local mt = getmetatable(peripheral)
@ -209,6 +214,7 @@ and returns if it should be included in the result.
@usage This abuses the `filter` argument to call @{rednet.open} on every modem. @usage This abuses the `filter` argument to call @{rednet.open} on every modem.
peripheral.find("modem", rednet.open) peripheral.find("modem", rednet.open)
@since 1.6
]] ]]
function find(ty, filter) function find(ty, filter)
expect(1, ty, "string") expect(1, ty, "string")