1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-15 22:17:39 +00:00

Compare commits

...

29 Commits

Author SHA1 Message Date
Merith
ed9e823f3f update version number for new release 2021-11-17 13:19:25 -08:00
Merith
2b8fea5b35 Merge pull request #20 from Wiggles1305/Wiggles1305-patch-1
Recipe parity with CC: Tweaked
2021-11-11 18:30:31 -08:00
Zachbutwithak
b3e6b4c29a Recipe parity with CC: Tweaked 2021-11-11 18:08:09 -08:00
Merith
c94ff68e7f Merge pull request #19 from Wiggles1305/1.17.1
Fix en_us.json
2021-11-11 17:19:22 -08:00
Wiggles1305
3fb96a3438 Added to en_us.json
Added "upgrade.minecraft.netherite_pickaxe.adjective": "Netherite Mining", because apparently there is a netherite pickaxe mining turtle
2021-11-11 14:53:17 -08:00
Merith
7a2b7c0701 Merge pull request #13 from 3prm3/1.17.1
Added links to ever instance of Fabric.
2021-10-31 12:47:28 -07:00
Merith
fa7a731ad1 Merge pull request #14 from joecharamut/1.17.1
Fix drag-and-drop file uploading
2021-10-31 12:45:18 -07:00
Joseph Charamut
8be48ebcf0 Fix drag-and-drop file uploading 2021-10-31 10:55:50 -04:00
ƐqɿmƐ
123f3abcaa Added links to ever instance of Fabric.
Also capitalized the word "Forge".
2021-10-30 11:21:58 -07:00
Merith
9f2e43f00a Merge pull request #9 from joecharamut/1.17.1
Force Jitpack to actually use Java 16 instead of Java 8
2021-10-28 10:22:25 -07:00
Merith
9fb35b2799 Merge pull request #11 from ga2mer/1.17.1
Wired Modem/Cable breaking and creative picking of sided modem and cable
2021-10-28 10:10:36 -07:00
Nikita Savyolov
272572dbf2 fix: creative picking sided modem/cable 2021-10-28 01:10:47 +03:00
Nikita Savyolov
702e4fc787 fix: correct (maybe) modem properties
something changed in 1.17 and the modem now slowly breaks with hand or pickaxe, so we set this manually
2021-10-28 01:08:31 +03:00
Merith
511327effe Merge pull request #10 from 3prm3/1.17.1
Fixed grammar errors like your/you're added a link.
2021-10-27 08:44:12 -07:00
ƐqɿmƐ
940e35caea Fixed grammar errors like your/you're added a link. 2021-10-26 19:14:04 -07:00
Joseph Charamut
fca01693dd Update jitpack.yml 2021-10-26 21:21:31 -04:00
Joseph Charamut
8846a3f36f Create jitpack.yml 2021-10-26 21:19:36 -04:00
Merith
8002c9e932 Merge pull request #2 from ga2mer/1.17.1
Mainly WiredModem/Cable fixes
2021-10-26 13:29:33 -07:00
Nikita Savyolov
6fd8331e94 fix: BlockCable removedByPlayer 2021-10-18 21:47:43 +03:00
Nikita Savyolov
7a667b9028 fix: correct cable with wired modem highlight
The right thing would be to fix Mixin, just like it is done in Forge, but I think that's enough for now
2021-10-18 21:45:33 +03:00
Nikita Savyolov
67b7cd7a14 fix: wired modem direction 2021-10-17 21:10:10 +03:00
Nikita Savyolov
960d79803d fix: MixinWorld more correct height check
I think this Mixin need to be revisiting
2021-10-17 21:08:48 +03:00
Merith-TK
43ef36fa15 Update links to repo 2021-10-15 16:08:55 -07:00
Merith
f037d9539e update to beta-1 2021-10-14 06:35:57 +00:00
Merith
a3b2f7b5bd please the linter
fix excess whitespace in readme
2021-10-13 23:25:52 -07:00
Merith
0859145d18 Merge pull request #80 from joecharamut/1.17.1
Fix NPE when activating piston
2021-10-13 23:25:14 -07:00
Joseph Charamut
f6e4122f7f Fix NPE when activating piston 2021-10-14 01:33:12 -04:00
Merith
8e4023fdbc please the linter
pleasing the linter
2021-10-13 17:40:28 -07:00
Merith
f10818ec6b update readme 2021-10-13 19:35:37 +00:00
18 changed files with 166 additions and 157 deletions

View File

@@ -1,14 +1,14 @@
<img src="logo.png" alt="CC: Restitched" width="100%"/>
[![Current build status](https://github.com/Merith-TK/cc-restitched/workflows/Build/badge.svg)](https://github.com/Merith-TK/cc-restitched/actions "Current build status")
[![Current build status](https://github.com/cc-tweaked/cc-restitched/workflows/Build/badge.svg)](https://github.com/cc-tweaked/cc-restitched/actions "Current build status")
[![Download CC: Restitched on CurseForge](https://camo.githubusercontent.com/07622e6662ef5ead080c4840ef6514a34e079d63015f7e51c977a55b1881dfb9/687474703a2f2f63662e776179326d7563686e6f6973652e65752f7469746c652f63632d726573746974636865642e737667)](https://www.curseforge.com/minecraft/mc-mods/cc-restitched "Download CC: Restitched on CurseForge")
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/Merith-TK/cc-restitched/tree/1.17-alpha)
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/cc-tweaked/cc-restitched/tree/1.17-alpha)
# CC: R Version VS CC: T Version
CC: R Strives to maintain perfect pairity with CC: T, however in some cases this is not possible, so CC: R might have a "newer" version than what CC: T has, these newer versions will be primarily bugfixes and the like because fabric is "weird" when porting a forge mod.
CC: R Strives to maintain perfect pairity with CC: T, however in some cases this is not possible, so CC: R might have a "newer" version than what CC: T has, these newer versions will be primarily bugfixes and the like because [Fabric](https://fabricmc.net/) is "weird" when porting a Forge mod.
## What is CC: Restiched
This is an fork of [Zundrel/cc-tweaked-fabric](https://github.com/Zundrel/cc-tweaked-fabric) who's goal was to port [SquidDev-CC/CC-Tweaked](https://github.com/SquidDev-CC/CC-Tweaked) to the [Fabric](https://fabricmc.net/) modloader. I picked up maintaining the mod because the team working on Zundrel's fork can no longer mantain it so I picked it up to make it as equal as possible with CC: T.
This is an fork of [Zundrel/cc-tweaked-fabric](https://github.com/Zundrel/cc-tweaked-fabric) who's goal was to port [SquidDev-CC/CC-Tweaked](https://github.com/SquidDev-CC/CC-Tweaked) to the [Fabric](https://fabricmc.net/) modloader. I picked up maintaining the mod because the team working on Zundrel's fork can no longer mantain it so, I picked it up to make it as equal as possible with CC: T.
## Resource Packs
This mod includes textures that are more in-line with the style of Mojang's new texture-artist, Jappa. If you prefer the original textures, enable the "Classic" resource pack.
@@ -16,56 +16,59 @@ This mod includes textures that are more in-line with the style of Mojang's new
<img src="https://raw.githubusercontent.com/3prm3/cc-pack/main/pack.png" alt="CC: Restitched" width="16" height="16"/> [3prm3/cc-pack](https://github.com/3prm3/cc-pack/)
We also have a second resourcepack made by [3prm3](https://github.com/3prm3), it features a complete overhaul and can be enabled by enabling the `overhaul` resource pack, go check out his resource pack over here!
# Conflicts
Currently Iris and Canvas Shaders are Incompatible with this mod,
- Iris has transparent monitors, and when a computer displays something on the monitor, the face becomes black.
- Canvas... uhm...
- Computer Terminals are 100% unusable and scuffed
<img src="https://user-images.githubusercontent.com/16393543/120464345-ab619b00-c351-11eb-9dfb-e68ddc93de5e.png">
- Monitors break with either rendering option.
- TBO
- Just crashes on world load.
- VBO
<img src="https://user-images.githubusercontent.com/16393543/120475933-d999a780-c35e-11eb-9d94-ef4e5988ad5f.png">
# Does this work with shaders/[Sodium?](https://github.com/CaffeineMC/sodium-fabric)
* [ YES ] Sodium
* [ YES ] Optifine
* Works with VBO Rendering (automatically set)
* No issues
* [ EHH ] Iris Shaders
* "Works" with TBO Rendering (Default)
* Crashes with VBO Rendering
* <details>
<summary>Shaders are broken</summary>
* Shaders will cause varrying results ranging from monitors being invisible, to straight up crashing.
* Not using shaders will result in odd Z-Fighting of the monitor display and the transparent texture
- ![](https://user-images.githubusercontent.com/10422110/136869483-91824c5f-841f-4316-bfb1-2412477a29ee.png)
- ![](https://user-images.githubusercontent.com/10422110/136869535-a16581a3-5e0a-4632-923f-c8de8cc8a6ea.png)
</details>
* [ YES ] Canvas
* Works with TBO Rendering (Default)
* Scuffed with VBO Rendering
* <details>
<summary>VBO is broken</summary>
Monitors are just... scuffed beyond belief.
- ![](https://i.imgur.com/JVNZ2Pn.png)
- ![](https://i.imgur.com/SXXpr54.png)
* The content to the left is supposed to be on the monitors to the right, also the bottom one is supposed to `black/white` not colored.
* Turtle Texture for some reason?
- ![](https://i.imgur.com/OEmZXsx.png)
</details>
## Contributing
Any contribution is welcome, be that using the mod, reporting bugs or contributing code. In order to start helping develop CC: R there are a few rules;
1) Any updates that port commits from CC: T, ***MUST*** follow the format defined in [patchwork.md](patchwork.md) otherwise they will not be accepted,
* Commit Message must be the same as it is in CC: T ,
* patchwork.md must be updated in the following format.
> Comments, optional but useful if you had to do something differently than in CC: T outside of [Fabric](https://fabricmc.net/)/[Forge](https://mcforge.readthedocs.io/en/1.16.x/) differences.
>
> \`\`\`
>
>commitID
>
> commit title
>
> commit desc
>
> \`\`\`
2) Follow the [Fabric](https://fabricmc.net/) programming guidelines as close as possible. This means you have to use [`loom`](https://fabricmc.net/wiki/tutorial:mappings) mappings,
3) You cannot intentionally implement bugs and security vulnerabilities.
4) Unless the commit is a ["patchwork"](https://github.com/Merith-TK/cc-restitched/blob/fabric/patchwork.md) compliant commit, (IE: taken from CC: T), the lua code is off limits.
1) Follow the [Fabric](https://fabricmc.net/) programming guidelines as close as possible. This means you have to use [`loom`](https://fabricmc.net/wiki/tutorial:mappings) mappings, if you use anything else, your code will be rejected.
2) You cannot intentionally implement bugs and security vulnerabilities.
3) Unless the code is taken directly from CC: Tweaked, `lua` code is offlimits from alteration.
## Bleeding Edge Builds
Bleeding edge builds can be found [here](https://github.com/Merith-TK/cc-restitched/actions) at Github Actions.
Bleeding edge builds can be found [here](https://github.com/cc-tweaked/cc-restitched/actions) at Github Actions.
## Community
If you need help getting started with CC: Restitched, want to show off your latest project, or just want to chat about ComputerCraft, here is the [Forum](https://forums.computercraft.cc/) and the [Discord](https://discord.gg/H2UyJXe).
## Known Issues
## Known Bugs/Issues
Main Known issue
* Mods that add blocks that can be used as peripherals for CC: T on forge, don't work with CC: R.
* This is because of the differences between forge and fabric, and that mod devs, to my knowledge have not agreed upon a standard method in which to implement cross compatibility between mods,
* [Fixed (d10f297c): please report if bug persists]</br> ~~Storage Peripherals throw a java "StackOverflowError" when using `pushItems()`,~~
* ~~Work around, you are probably using `pushItems(chest, 1)` or similar. please use `pushItems(chest, 1, nil, 1)`.~~
* Computers will not run built in commands, saying "File not found".
* This is a know bug, dont know what causes it, but just restart the computer (`ctrl+r` for one second) and it will work again.
* Occurs when server runs `/reload` or a datapack is updated.
* Mods that add blocks that can be used as peripherals for CC: T on Forge, don't work with CC: R.
* This is because of the differences between Forge and [Fabric](https://fabricmc.net/), and that mod devs, to my knowledge have not agreed upon a standard method in which to implement cross compatibility between mods,
* Occasionally a computer will say "File not found" when running a built in program, this is normal just hold `crtl+r` to reboot it.
* We do not know what causes it directly, however it happens when the world is `/reload`ed, and currently running programs are not affected so nothing *should break*
## Perpherals
Unfortunately, unlike the original CC: Tweaked project, CC: Restitched, does not have any actual peripheral mods, currently the only one we have is an example for mod devs to get started with making/adding the peripheral API to their mods!
If your a mod dev made a mod with CC: R peripheral support, OR if your a player who found a mod with CC: R support, please open an [issue here](https://github.com/Merith-TK/cc-restitched/issues/new?assignees=&labels=peripheralShoutout&template=peripheral_shoutout.md) to let us know so we can add it to the list!
If you're a mod dev, made a mod with CC: R peripheral support OR if you're a player who found a mod with CC: R support, please open an [issue here](https://github.com/cc-tweaked/cc-restitched/issues/new?assignees=&labels=peripheralShoutout&template=peripheral_shoutout.md) to let us know so we can add it to the list!
* ![icon](https://raw.githubusercontent.com/Toad-Dev/cc-peripheral-test/master/src/main/resources/assets/cc_test/textures/block/test_peripheral.png) [CC Peripheral Test](https://github.com/Toad-Dev/cc-peripheral-test)
* ![icon](https://raw.githubusercontent.com/Toad-Dev/cc-peripheral-test/master/src/main/resources/assets/cc_test/textures/block/test_peripheral.png) [CC Peripheral Test [1.16.5]](https://github.com/Toad-Dev/cc-peripheral-test)
* This is an example mod for how to make peripherals that work as a block, or as a turtle upgrade!

View File

@@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx1G
# Mod properties
mod_version=1.97.1-beta
mod_version=1.97.2
# Minecraft properties
mc_version=1.17.1

5
jitpack.yml Normal file
View File

@@ -0,0 +1,5 @@
before_install:
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
- source ./install-jdk.sh --feature 16 --license GPL
jdk:
- openjdk16

View File

@@ -44,7 +44,6 @@ import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static dan200.computercraft.shared.ComputerCraftRegistry.ModBlocks;
import static dan200.computercraft.shared.ComputerCraftRegistry.init;
public final class ComputerCraft implements ModInitializer

View File

@@ -117,8 +117,6 @@ public abstract class ComputerScreenBase<T extends ContainerComputerBase> extend
@Override
public void filesDragged( @Nonnull List<Path> files )
{
// TODO: this thing doesn't work in Tweaked at this moment
if ( true ) return;
if( files.isEmpty() ) return;
if( computer == null || !computer.isOn() )

View File

@@ -18,6 +18,7 @@ import net.minecraft.client.render.Camera;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.*;
import net.minecraft.util.shape.VoxelShape;
@@ -40,8 +41,12 @@ public final class CableHighlightRenderer
return false;
}
HitResult hitResult = MinecraftClient.getInstance().crosshairTarget;
Vec3d hitPos = hitResult != null ? hitResult.getPos() : new Vec3d( d, e, f );
VoxelShape shape = WorldUtil.isVecInside( CableShapes.getModemShape( state ),
new Vec3d( d, e, f ).subtract( pos.getX(),
hitPos.subtract( pos.getX(),
pos.getY(),
pos.getZ() ) ) ? CableShapes.getModemShape( state ) : CableShapes.getCableShape(
state );

View File

@@ -7,6 +7,7 @@ package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.common.TileGeneric;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -26,12 +27,18 @@ import java.util.Collection;
public class MixinWorld
{
@Shadow
protected boolean iteratingTickingBlockEntities;
private boolean iteratingTickingBlockEntities;
@Shadow
public boolean isInBuildLimit( BlockPos pos )
{
return false;
}
@Inject( method = "addBlockEntity", at = @At( "HEAD" ) )
public void addBlockEntity( @Nullable BlockEntity entity, CallbackInfo info )
{
if( entity != null && !entity.isRemoved() && entity.getWorld().isInBuildLimit( entity.getPos() ) && iteratingTickingBlockEntities )
if( entity != null && !entity.isRemoved() && this.isInBuildLimit( entity.getPos() ) && iteratingTickingBlockEntities )
{
setWorld( entity, this );
}
@@ -41,7 +48,7 @@ public class MixinWorld
{
if( entity.getWorld() != world && entity instanceof TileGeneric )
{
entity.setWorld( (World) world ); //TODO why?
entity.setWorld( (World) world );
}
}

View File

@@ -49,6 +49,7 @@ import dan200.computercraft.shared.turtle.upgrades.*;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
@@ -114,8 +115,8 @@ public final class ComputerCraftRegistry
public static final BlockWirelessModem WIRELESS_MODEM_ADVANCED = register( "wireless_modem_advanced",
new BlockWirelessModem( properties(), ComputerCraftRegistry.ModTiles.WIRELESS_MODEM_ADVANCED, ComputerFamily.ADVANCED ) );
public static final BlockWiredModemFull WIRED_MODEM_FULL = register( "wired_modem_full",
new BlockWiredModemFull( emProperties(), ComputerCraftRegistry.ModTiles.WIRED_MODEM_FULL ) );
public static final BlockCable CABLE = register( "cable", new BlockCable( emProperties() ) );
new BlockWiredModemFull( modemProperties(), ComputerCraftRegistry.ModTiles.WIRED_MODEM_FULL ) );
public static final BlockCable CABLE = register( "cable", new BlockCable( modemProperties() ) );
private static Block.Settings properties()
{
@@ -133,9 +134,11 @@ public final class ComputerCraftRegistry
.strength( 2.5f );
}
private static Block.Settings emProperties()
private static Block.Settings modemProperties()
{
return FabricBlockSettings.copyOf( Blocks.STONE )
.breakByHand( true )
.breakByTool( FabricToolTags.PICKAXES )
.strength( 1.5f );
}

View File

@@ -213,6 +213,7 @@ public abstract class ContainerComputerBase extends ScreenHandler implements ICo
{
try( FileSystemWrapper<WritableByteChannel> channel = fs.openForWrite( file.getName(), false, Function.identity() ) )
{
file.getBytes().rewind();
channel.get().write( file.getBytes() );
}
}

View File

@@ -10,25 +10,27 @@ import com.google.common.collect.ImmutableMap;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
import dan200.computercraft.shared.util.WorldUtil;
import net.fabricmc.fabric.api.block.BlockPickInteractionAware;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.block.Waterloggable;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -36,7 +38,7 @@ import java.util.EnumMap;
import static dan200.computercraft.shared.util.WaterloggableHelpers.*;
public class BlockCable extends BlockGeneric implements Waterloggable
public class BlockCable extends BlockGeneric implements Waterloggable, BlockPickInteractionAware
{
public static final EnumProperty<CableModemVariant> MODEM = EnumProperty.of( "modem", CableModemVariant.class );
public static final BooleanProperty CABLE = BooleanProperty.of( "cable" );
@@ -122,68 +124,66 @@ public class BlockCable extends BlockGeneric implements Waterloggable
return getWaterloggedFluidState( state );
}
// @Override
// public boolean removedByPlayer( BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid )
// {
// if( state.get( CABLE ) && state.get( MODEM ).getFacing() != null )
// {
// BlockHitResult hit = world.raycast( new RaycastContext(
// WorldUtil.getRayStart( player ), WorldUtil.getRayEnd( player ),
// RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, player
// ) );
// if( hit.getType() == HitResult.Type.BLOCK )
// {
// BlockEntity tile = world.getBlockEntity( pos );
// if( tile instanceof TileCable && tile.hasWorld() )
// {
// TileCable cable = (TileCable) tile;
//
// ItemStack item;
// BlockState newState;
//
// if( WorldUtil.isVecInside( CableShapes.getModemShape( state ), hit.getPos().subtract( pos.getX(), pos.getY(), pos.getZ() ) ) )
// {
// newState = state.with( MODEM, CableModemVariant.None );
// item = new ItemStack( ComputerCraftRegistry.ModItems.WIRED_MODEM.get() );
// }
// else
// {
// newState = state.with( CABLE, false );
// item = new ItemStack( ComputerCraftRegistry.ModItems.CABLE.get() );
// }
//
// world.setBlockState( pos, correctConnections( world, pos, newState ), 3 );
//
// cable.modemChanged();
// cable.connectionsChanged();
// if( !world.isClient && !player.abilities.creativeMode )
// {
// Block.dropStack( world, pos, item );
// }
//
// return false;
// }
// }
// }
//
// return super.removedByPlayer( state, world, pos, player, willHarvest, fluid );
// }
public boolean removedByPlayer( BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid )
{
if( state.get( CABLE ) && state.get( MODEM ).getFacing() != null )
{
BlockHitResult hit = world.raycast( new RaycastContext(
WorldUtil.getRayStart( player ), WorldUtil.getRayEnd( player ),
RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, player
) );
if( hit.getType() == HitResult.Type.BLOCK )
{
BlockEntity tile = world.getBlockEntity( pos );
if( tile instanceof TileCable cable && tile.hasWorld() )
{
// TODO Re-implement, likely will need mixin
// @Override
// public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) {
// Direction modem = state.get( MODEM ).getFacing();
// boolean cable = state.get( CABLE );
//
// // If we've only got one, just use that.
// if( !cable ) return new ItemStack( ComputerCraftRegistry.ModItems.WIRED_MODEM.get() );
// if( modem == null ) return new ItemStack( ComputerCraftRegistry.ModItems.CABLE.get() );
//
// // We've a modem and cable, so try to work out which one we're interacting with
// return hit != null && WorldUtil.isVecInside( CableShapes.getModemShape( state ), hit.getPos().subtract( pos.getX(), pos.getY(), pos.getZ() ) )
// ? new ItemStack( ComputerCraftRegistry.ModItems.WIRED_MODEM.get() )
// : new ItemStack( ComputerCraftRegistry.ModItems.CABLE.get() );
// }
ItemStack item;
BlockState newState;
if( WorldUtil.isVecInside( CableShapes.getModemShape( state ), hit.getPos().subtract( pos.getX(), pos.getY(), pos.getZ() ) ) )
{
newState = state.with( MODEM, CableModemVariant.None );
item = new ItemStack( ComputerCraftRegistry.ModItems.WIRED_MODEM );
}
else
{
newState = state.with( CABLE, false );
item = new ItemStack( ComputerCraftRegistry.ModItems.CABLE );
}
world.setBlockState( pos, correctConnections( world, pos, newState ), 3 );
cable.modemChanged();
cable.connectionsChanged();
if( !world.isClient && !player.getAbilities().creativeMode )
{
Block.dropStack( world, pos, item );
}
return false;
}
}
}
return true;
}
@Override
public ItemStack getPickedStack( BlockState state, BlockView world, BlockPos pos, @Nullable PlayerEntity player, HitResult hit )
{
Direction modem = state.get( MODEM ).getFacing();
boolean cable = state.get( CABLE );
// If we've only got one, just use that.
if( !cable ) return new ItemStack( ComputerCraftRegistry.ModItems.WIRED_MODEM );
if( modem == null ) return new ItemStack( ComputerCraftRegistry.ModItems.CABLE );
// We've a modem and cable, so try to work out which one we're interacting with
return hit != null && WorldUtil.isVecInside( CableShapes.getModemShape( state ), hit.getPos().subtract( pos.getX(), pos.getY(), pos.getZ() ) )
? new ItemStack( ComputerCraftRegistry.ModItems.WIRED_MODEM )
: new ItemStack( ComputerCraftRegistry.ModItems.CABLE );
}
@Override
@Deprecated
@@ -232,9 +232,8 @@ public class BlockCable extends BlockGeneric implements Waterloggable
public void onPlaced( World world, @Nonnull BlockPos pos, @Nonnull BlockState state, LivingEntity placer, @Nonnull ItemStack stack )
{
BlockEntity tile = world.getBlockEntity( pos );
if( tile instanceof TileCable )
if( tile instanceof TileCable cable )
{
TileCable cable = (TileCable) tile;
if( cable.hasCable() )
{
cable.connectionsChanged();

View File

@@ -56,9 +56,8 @@ public abstract class ItemBlockCable extends BlockItem
world.playSound( null, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F );
BlockEntity tile = world.getBlockEntity( pos );
if( tile instanceof TileCable )
if( tile instanceof TileCable cable )
{
TileCable cable = (TileCable) tile;
cable.modemChanged();
cable.connectionsChanged();
}

View File

@@ -46,7 +46,6 @@ public class TileCable extends TileGeneric implements IPeripheralTile
private final IWiredNode node = cable.getNode();
private boolean peripheralAccessAllowed;
private boolean destroyed = false;
private Direction modemDirection = Direction.NORTH;
private final WiredModemPeripheral modem = new WiredModemPeripheral( new ModemState( () -> TickScheduler.schedule( this ) ), cable )
{
@Nonnull
@@ -60,7 +59,7 @@ public class TileCable extends TileGeneric implements IPeripheralTile
@Override
public Vec3d getPosition()
{
BlockPos pos = getPos().offset( modemDirection );
BlockPos pos = getPos().offset( getDirection() );
return new Vec3d( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 );
}
@@ -71,7 +70,6 @@ public class TileCable extends TileGeneric implements IPeripheralTile
return TileCable.this;
}
};
private boolean hasModemDirection = false;
private boolean connectionsFormed = false;
public TileCable( BlockEntityType<? extends TileCable> type, BlockPos pos, BlockState state )
@@ -176,8 +174,8 @@ public class TileCable extends TileGeneric implements IPeripheralTile
@Nonnull
private Direction getDirection()
{
refreshDirection();
return modemDirection == null ? Direction.NORTH : modemDirection;
Direction direction = getMaybeDirection();
return direction == null ? Direction.NORTH : direction;
}
public boolean hasModem()
@@ -312,8 +310,6 @@ public class TileCable extends TileGeneric implements IPeripheralTile
return;
}
refreshDirection();
if( modem.getModemState()
.pollChanged() )
{
@@ -327,7 +323,7 @@ public class TileCable extends TileGeneric implements IPeripheralTile
connectionsChanged();
if( peripheralAccessAllowed )
{
peripheral.attach( world, pos, modemDirection );
peripheral.attach( world, pos, getDirection() );
updateConnectedPeripherals();
}
}
@@ -360,20 +356,7 @@ public class TileCable extends TileGeneric implements IPeripheralTile
@Nullable
private Direction getMaybeDirection()
{
refreshDirection();
return modemDirection;
}
private void refreshDirection()
{
if( hasModemDirection )
{
return;
}
hasModemDirection = true;
modemDirection = getCachedState().get( BlockCable.MODEM )
.getFacing();
return getCachedState().get( BlockCable.MODEM ).getFacing();
}
@Override
@@ -412,7 +395,6 @@ public class TileCable extends TileGeneric implements IPeripheralTile
{
super.setCachedState( state );
if( state != null ) return;
hasModemDirection = false;
if( !world.isClient )
{
world.getBlockTickScheduler()

View File

@@ -25,6 +25,7 @@ import dan200.computercraft.shared.media.items.RecordMedia;
import dan200.computercraft.shared.network.NetworkHandler;
import dan200.computercraft.shared.peripheral.commandblock.CommandBlockPeripheral;
import dan200.computercraft.shared.peripheral.generic.methods.InventoryMethods;
import dan200.computercraft.shared.peripheral.modem.wired.BlockCable;
import dan200.computercraft.shared.peripheral.modem.wireless.WirelessNetwork;
import dan200.computercraft.shared.turtle.FurnaceRefuelHandler;
import dan200.computercraft.shared.turtle.SignInspectHandler;
@@ -34,6 +35,7 @@ import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerBlockEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.CommandBlockBlockEntity;
import net.minecraft.item.Item;
@@ -123,6 +125,11 @@ public final class ComputerCraftProxyCommon
}
} );
PlayerBlockBreakEvents.BEFORE.register( ( world, player, pos, state, blockEntity ) -> {
if ( state.getBlock() instanceof BlockCable blockCable ) return blockCable.removedByPlayer( state, world, pos, player, false, null );
return true;
} );
// Config
ServerLifecycleEvents.SERVER_STARTING.register( Config::serverStarting );
ServerLifecycleEvents.SERVER_STOPPING.register( Config::serverStopping );

View File

@@ -31,6 +31,7 @@
"upgrade.minecraft.diamond_sword.adjective": "Melee",
"upgrade.minecraft.diamond_shovel.adjective": "Digging",
"upgrade.minecraft.diamond_pickaxe.adjective": "Mining",
"upgrade.minecraft.netherite_pickaxe.adjective": "Netherite Mining",
"upgrade.minecraft.diamond_axe.adjective": "Felling",
"upgrade.minecraft.diamond_hoe.adjective": "Farming",
"upgrade.minecraft.crafting_table.adjective": "Crafty",

View File

@@ -1,4 +1,4 @@
View the source code at https://github.com/Merith-TK/cc-restiched
View the source code at https://github.com/cc-tweaked/cc-restiched
View the documentation at https://wiki.computercraft.cc
Visit the forum at https://forums.computercraft.cc
You can disable these messages by running "set motd.enable false"

View File

@@ -1,9 +1,13 @@
{
"replace": false,
"values": [
"minecraft:andesite",
"minecraft:diorite",
"minecraft:granite",
"minecraft:cobblestone",
"minecraft:andesite"
"minecraft:infested_stone",
"minecraft:stone",
"minecraft:polished_andesite",
"minecraft:polished_diorite",
"minecraft:polished_granite"
]
}

View File

@@ -1,4 +1,4 @@
Please report bugs at https://github.com/Merith-TK/cc-restitched/issues. Thanks!
Please report bugs at https://github.com/cc-tweaked/cc-restitched/issues. Thanks!
View the documentation at https://tweaked.cc
Show off your programs or ask for help at our forum: https://forums.computercraft.cc
You can disable these messages by running "set motd.enable false".

View File

@@ -7,8 +7,8 @@
"license": "ComputerCraft Public License",
"icon": "assets/computercraft/pack.png",
"contact": {
"homepage": "https://github.com/Merith-TK/cc-restitched",
"issues": "https://github.com/Merith-TK/cc-restitched/issues"
"homepage": "https://github.com/cc-tweaked/cc-restitched",
"issues": "https://github.com/cc-tweaked/cc-restitched/issues"
},
"authors": [
"Daniel Ratcliffe",
@@ -28,10 +28,6 @@
"suggests": {
"modmenu": "*"
},
"conflicts": {
"canvas": "*",
"iris": "*"
},
"accessWidener": "cc.accesswidener",
"environment": "*",
"entrypoints": {