Skip to content

Computer Craft integration for Update 6 Logistics Blocks #7883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 92 commits into
base: mc1.20.1/dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
90dbcbe
cherry-pick 1
BirbIrl Mar 2, 2025
ac5a05b
walking around packager's actiavte() since it doesn't return a variable.
BirbIrl Mar 3, 2025
449b634
i forgor to make StockTicker's .request() return an int
BirbIrl Mar 3, 2025
6010323
Made it so names in the enchant filter are optional
BirbIrl Mar 3, 2025
df88af8
Made it so you can check enchantments by displayName (why not), made
BirbIrl Mar 3, 2025
a192be4
Packager now can get the num of items in attached storage
BirbIrl Mar 4, 2025
1e5c4f7
remove old comments because i'm silly
BirbIrl Mar 4, 2025
d246b11
cherry-pick 2
BirbIrl Mar 6, 2025
455c776
cherry-pick 3
BirbIrl Mar 6, 2025
9944205
cherry-pick 4
Karotte128 Mar 6, 2025
b4a06de
cherry-pick 5
Karotte128 Mar 6, 2025
06eda4f
cherry-pick 6
BirbIrl Mar 6, 2025
8b561e3
made the getAddress and setAddress functions consistent accross
BirbIrl Mar 6, 2025
e606850
"why isn't this variable what i told it to be?" - says programmer for…
BirbIrl Mar 6, 2025
de5efa1
Add listPaymentInventory to StockTickerPeripheral
AsterAether Mar 6, 2025
83a0ebc
cherry-pick 7
AsterAether Mar 6, 2025
da31642
Added Configure method
McArctic Mar 6, 2025
16bdf35
Updated Redstone Requester
McArctic Mar 6, 2025
dc5040c
cherry-pick 8
AsterAether Mar 7, 2025
7ce9587
rewrote the configure function, functionally the same (still broken)
BirbIrl Mar 7, 2025
f60c288
Updated Redstone Receiver Peripheral
McArctic Mar 7, 2025
969e6ad
Name = "minecraft:air"? {}? nil? no argument at all? Who needs to throw
BirbIrl Mar 7, 2025
78d1f6c
Lobotomized the requester
BirbIrl Mar 7, 2025
0032629
Update RedstoneRequesterPeripheral.java
McArctic Mar 7, 2025
1a91e72
fix cherry-pick mistake
Karotte128 Mar 7, 2025
12485c5
fix some things
Karotte128 Mar 7, 2025
d4c0aa1
As squid suggested, replaced IArguments with Optional<String> where
BirbIrl Mar 7, 2025
c12b959
repackager peripheral
Karotte128 Mar 8, 2025
e985970
add makePackage to Repackager
Karotte128 Mar 8, 2025
e75a31a
extra tablecloth functionality. half-working .setWares() included
BirbIrl Mar 8, 2025
2f1456e
somehow fix TableCloth item rendering on setWares
Karotte128 Mar 8, 2025
9297d84
Removed a pointless comment and differencaited the .request functions
BirbIrl Mar 8, 2025
737e1a1
made tablecloth setPriceTagItem be a void function like the rest
BirbIrl Mar 8, 2025
2b651f2
So, trying to just get this key but I cant seem to access it without …
McArctic Mar 9, 2025
5c7699d
added the last feature: .getConfiguration() for the redstone requester
BirbIrl Mar 9, 2025
a21c86c
Removed normal TableCloth as peripheral
AsterAether Mar 10, 2025
f20cfdc
Actually send the packet
AsterAether Mar 10, 2025
fcad32f
Actually actually send the packet
AsterAether Mar 10, 2025
4cb5b9e
added back .isShop() because we love changing states
BirbIrl Mar 10, 2025
4117f25
Epic air check that we forgor to pull
BirbIrl Mar 10, 2025
342996b
Persisting addresses
AsterAether Mar 11, 2025
82087ce
Adding `getPackageAddress()` to re-packagers.
lucyamonster Mar 13, 2025
d84fd39
'getPackageAddress()' now returns 'nil' when there's no package.
lucyamonster Mar 13, 2025
3806a72
fixing a couple bad imports in 'RepackagerPeripheral.java'
lucyamonster Mar 13, 2025
58e529f
Merge pull request #1 from BirbIrl/mc1.20.1/review-fixes
BirbIrl Mar 13, 2025
25999cb
Merge pull request #2 from lucyamonster/mc1.20.1/dev
BirbIrl Mar 13, 2025
33e5ab9
Changed "checkPackage" to "getPackageItems" and gave it to the
BirbIrl Mar 13, 2025
937c988
me when i forget about the includes
BirbIrl Mar 13, 2025
1af69c5
`getPackageAddress()` now uses a different way of reading addresses.
lucyamonster Mar 15, 2025
09bcfa4
`setPackageAddress` returns `true` when:
lucyamonster Mar 15, 2025
704ff61
Merge pull request #3 from lucyamonster/mc1.20.1/dev
BirbIrl Mar 15, 2025
00fc744
Merge remote-tracking branch 'origin/mc1.20.1/dev' into cctweaked-log…
aearil Apr 10, 2025
3a2fc7a
Fix redstone requester
aearil Apr 16, 2025
4d38856
[CC:Tweaked] Fix RedstoneRequesterPeripheral crafting metadata
aearil Apr 29, 2025
3b1fee7
RedstoneRequesterPeripheral: add configureCraft for mech crafter compat
Apr 30, 2025
ae09074
Merge pull request #4 from aearil/cctweaked-logistics
BirbIrl Apr 30, 2025
6709aa8
CC Generic API Alignment
MaxOrtGit May 9, 2025
4331945
Everything but count
MaxOrtGit May 11, 2025
5d60a1e
Added max count to stock ticker
MaxOrtGit May 12, 2025
20b5b1e
Added a way to compare lua objects to tables
MaxOrtGit May 13, 2025
a51be79
Merge pull request #7 from MaxOrtGit/mc1.20.1/CCStandardStockTicker
MaxOrtGit May 13, 2025
3515b69
Added custom operators with _op
MaxOrtGit May 18, 2025
dccaa73
Small tweaks
MaxOrtGit May 18, 2025
fa3709e
Merge pull request #9 from MaxOrtGit/mc1.20.1/CCStockTickerOtherOpera…
MaxOrtGit May 18, 2025
19b1eac
Packager Peripheral Update
MaxOrtGit May 5, 2025
29ab520
Package Detail Providers
MaxOrtGit May 5, 2025
8af6af9
Updated API
MaxOrtGit May 6, 2025
8486146
Remove vscode
MaxOrtGit May 6, 2025
4bce7c9
Allow for creating PackageLuaObject without block
MaxOrtGit May 6, 2025
e9723d0
Updated RePackager
MaxOrtGit May 6, 2025
dc5fc1d
Remove getItemCount for API consistency
MaxOrtGit May 6, 2025
5e3c05b
Added more functions for order data
MaxOrtGit May 6, 2025
7e5271a
Package object given in getDetails
MaxOrtGit May 13, 2025
97e02ca
LuaComparable for Packages
MaxOrtGit May 13, 2025
0ded577
Added LuaBigItemStack so count will be accurate
MaxOrtGit May 18, 2025
c6e2909
syncing with upstream
BirbIrl May 22, 2025
7435f7d
Merge pull request #5 from MaxOrtGit/mc1.20.1/packagerExtension
BirbIrl May 22, 2025
be9abec
Merge branch 'mc1.20.1/dev' into mc1.20.1/CCGenericInventory
BirbIrl May 22, 2025
d82c4d7
Merge pull request #6 from MaxOrtGit/mc1.20.1/CCGenericInventory
BirbIrl May 22, 2025
335e35d
pacthes post merge of #5 and #6
BirbIrl May 22, 2025
039ecb2
cleanup after packager rework
BirbIrl May 22, 2025
609a9b7
Fixed a bug that made it so .getAddress() would just lie to you, and
BirbIrl May 22, 2025
e72cc4a
first half of redoing .list and .getItemDetails to be more like CC:T
BirbIrl May 22, 2025
7b250d0
Second part, reverting .list() and .listDetailed() for the stock ticker
BirbIrl May 22, 2025
f94ff6e
whoopsie daisy nixos moment, also simplified PackageLuaObject's code and
BirbIrl May 23, 2025
3a15fd1
updated .gitignore to include nixos weirdness
BirbIrl May 23, 2025
ee778b6
nvm it's not a nixos thing, it's just a universal gradle moment
BirbIrl May 23, 2025
e8729fc
removed an include from PackageLuaObject and linted
BirbIrl May 23, 2025
f24bcd6
added packager getAddress tweak to repackager
BirbIrl May 23, 2025
e8b0e94
formatting + remove unused imports + small fixes
Karotte128 May 23, 2025
07912ef
epic grammar fix
BirbIrl May 24, 2025
5a318ea
configureCraft allows for just string
MaxOrtGit May 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ local.properties
.classpath
.settings/
.loadpath
.factorypath

# External tool builders
.externalToolBuilders/
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/simibubi/create/AllPackets.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import com.simibubi.create.content.logistics.stockTicker.StockKeeperCategoryHidingPacket;
import com.simibubi.create.content.logistics.stockTicker.StockKeeperCategoryRefundPacket;
import com.simibubi.create.content.logistics.stockTicker.StockKeeperLockPacket;
import com.simibubi.create.content.logistics.tableCloth.ShopUpdatePacket;
import com.simibubi.create.content.logistics.tunnel.TunnelFlapPacket;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkConfigurationPacket;
import com.simibubi.create.content.redstone.link.controller.LinkedControllerBindPacket;
Expand Down Expand Up @@ -255,7 +256,8 @@ public enum AllPackets {
REDSTONE_REQUESTER_EFFECT(RedstoneRequesterEffectPacket.class, RedstoneRequesterEffectPacket::new, PLAY_TO_CLIENT),
KNOCKBACK(KnockbackPacket.class, KnockbackPacket::new, PLAY_TO_CLIENT),
TRAIN_MAP_SYNC(TrainMapSyncPacket.class, TrainMapSyncPacket::new, PLAY_TO_CLIENT),
CLIENTBOUND_CHAIN_CONVEYOR(ClientboundChainConveyorRidingPacket.class, ClientboundChainConveyorRidingPacket::new, PLAY_TO_CLIENT);
CLIENTBOUND_CHAIN_CONVEYOR(ClientboundChainConveyorRidingPacket.class, ClientboundChainConveyorRidingPacket::new, PLAY_TO_CLIENT),
SHOP_UPDATE(ShopUpdatePacket.class, ShopUpdatePacket::new, PLAY_TO_CLIENT);

static {
ClientboundSimpleActionPacket.addAction("rainbowDebug", () -> SimpleCreateActions::rainbowDebug);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static void register() {
private static void registerWithDependency() {
/* Comment if computercraft.implementation is not in the source set */
computerFactory = ComputerBehaviour::new;
ComputerBehaviour.registerItemDetailProviders();
}

private static Function<SmartBlockEntity, ? extends AbstractComputerBehaviour> fallbackFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
package com.simibubi.create.compat.computercraft.implementation;

import com.simibubi.create.compat.computercraft.AbstractComputerBehaviour;
import com.simibubi.create.compat.computercraft.implementation.luaObjects.PackageLuaObject;
import com.simibubi.create.compat.computercraft.implementation.luaObjects.PackageOrderLuaObject;
import com.simibubi.create.compat.computercraft.implementation.peripherals.DisplayLinkPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.FrogportPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.PostboxPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.RepackagerPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.SequencedGearshiftPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.SpeedControllerPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.SpeedGaugePeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.StationPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.StressGaugePeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.StockTickerPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.PackagerPeripheral;
import com.simibubi.create.compat.computercraft.implementation.peripherals.TableClothShopPeripheral;
import com.simibubi.create.content.logistics.box.PackageItem;
import com.simibubi.create.content.logistics.packagePort.frogport.FrogportBlockEntity;
import com.simibubi.create.content.logistics.packagePort.postbox.PostboxBlockEntity;
import com.simibubi.create.compat.computercraft.implementation.peripherals.RedstoneRequesterPeripheral;
import com.simibubi.create.content.logistics.packager.repackager.RepackagerBlockEntity;
import com.simibubi.create.content.logistics.redstoneRequester.RedstoneRequesterBlockEntity;
import com.simibubi.create.content.logistics.packager.PackagerBlockEntity;
import com.simibubi.create.content.logistics.stockTicker.PackageOrderWithCrafts;
import com.simibubi.create.content.logistics.stockTicker.StockTickerBlockEntity;
import com.simibubi.create.content.kinetics.gauge.SpeedGaugeBlockEntity;
import com.simibubi.create.content.kinetics.gauge.StressGaugeBlockEntity;
import com.simibubi.create.content.kinetics.speedController.SpeedControllerBlockEntity;
import com.simibubi.create.content.kinetics.transmission.sequencer.SequencedGearshiftBlockEntity;
import com.simibubi.create.content.logistics.tableCloth.TableClothBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkBlockEntity;
import com.simibubi.create.content.trains.station.StationBlockEntity;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;

import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.api.detail.VanillaDetailRegistries;
import dan200.computercraft.api.lua.LuaException;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.CapabilityToken;
Expand All @@ -41,19 +61,44 @@ public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity be)
return () -> new SpeedControllerPeripheral(scbe, scbe.targetSpeed);
if (be instanceof DisplayLinkBlockEntity dlbe)
return () -> new DisplayLinkPeripheral(dlbe);
if (be instanceof FrogportBlockEntity fpbe)
return () -> new FrogportPeripheral(fpbe);
if (be instanceof PostboxBlockEntity pbbe)
return () -> new PostboxPeripheral(pbbe);
if (be instanceof SequencedGearshiftBlockEntity sgbe)
return () -> new SequencedGearshiftPeripheral(sgbe);
if (be instanceof SpeedGaugeBlockEntity sgbe)
return () -> new SpeedGaugePeripheral(sgbe);
if (be instanceof StressGaugeBlockEntity sgbe)
return () -> new StressGaugePeripheral(sgbe);
if (be instanceof StockTickerBlockEntity sgbe)
return () -> new StockTickerPeripheral(sgbe);
// Has to be before PackagerBlockEntity as it's a subclass
if (be instanceof RepackagerBlockEntity rpbe)
return () -> new RepackagerPeripheral(rpbe);
if (be instanceof PackagerBlockEntity pgbe)
return () -> new PackagerPeripheral(pgbe);
if (be instanceof RedstoneRequesterBlockEntity rrbe)
return () -> new RedstoneRequesterPeripheral(rrbe);
if (be instanceof StationBlockEntity sbe)
return () -> new StationPeripheral(sbe);
if (be instanceof TableClothBlockEntity tcbe)
return () -> new TableClothShopPeripheral(tcbe);

throw new IllegalArgumentException(
"No peripheral available for " + ForgeRegistries.BLOCK_ENTITY_TYPES.getKey(be.getType()));
}

public static void registerItemDetailProviders() {
VanillaDetailRegistries.ITEM_STACK.addProvider((out, stack) -> {
if (PackageItem.isPackage(stack))
{
PackageLuaObject packageLuaObject = new PackageLuaObject(null, stack);
out.put("package", packageLuaObject);
}
});
}

@Override
public <T> boolean isPeripheralCap(Capability<T> cap) {
return cap == PERIPHERAL_CAPABILITY;
Expand Down
Loading