mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-15 22:17:39 +00:00
Compare commits
29 Commits
V1.97.1-be
...
v1.97.2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ed9e823f3f | ||
![]() |
2b8fea5b35 | ||
![]() |
b3e6b4c29a | ||
![]() |
c94ff68e7f | ||
![]() |
3fb96a3438 | ||
![]() |
7a2b7c0701 | ||
![]() |
fa7a731ad1 | ||
![]() |
8be48ebcf0 | ||
![]() |
123f3abcaa | ||
![]() |
9f2e43f00a | ||
![]() |
9fb35b2799 | ||
![]() |
272572dbf2 | ||
![]() |
702e4fc787 | ||
![]() |
511327effe | ||
![]() |
940e35caea | ||
![]() |
fca01693dd | ||
![]() |
8846a3f36f | ||
![]() |
8002c9e932 | ||
![]() |
6fd8331e94 | ||
![]() |
7a667b9028 | ||
![]() |
67b7cd7a14 | ||
![]() |
960d79803d | ||
![]() |
43ef36fa15 | ||
![]() |
f037d9539e | ||
![]() |
a3b2f7b5bd | ||
![]() |
0859145d18 | ||
![]() |
f6e4122f7f | ||
![]() |
8e4023fdbc | ||
![]() |
f10818ec6b |
89
README.md
89
README.md
@@ -1,14 +1,14 @@
|
||||
<img src="logo.png" alt="CC: Restitched" width="100%"/>
|
||||
|
||||
[](https://github.com/Merith-TK/cc-restitched/actions "Current build status")
|
||||
[](https://github.com/cc-tweaked/cc-restitched/actions "Current build status")
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/cc-restitched "Download CC: Restitched on CurseForge")
|
||||
[](https://gitpod.io/#https://github.com/Merith-TK/cc-restitched/tree/1.17-alpha)
|
||||
[](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
|
||||
- 
|
||||
- 
|
||||
</details>
|
||||
* [ YES ] Canvas
|
||||
* Works with TBO Rendering (Default)
|
||||
* Scuffed with VBO Rendering
|
||||
* <details>
|
||||
<summary>VBO is broken</summary>
|
||||
|
||||
Monitors are just... scuffed beyond belief.
|
||||
- 
|
||||
- 
|
||||
* 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?
|
||||
- 
|
||||
</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!
|
||||
|
||||
*  [CC Peripheral Test](https://github.com/Toad-Dev/cc-peripheral-test)
|
||||
*  [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!
|
||||
|
@@ -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
5
jitpack.yml
Normal 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
|
@@ -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
|
||||
|
@@ -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() )
|
||||
|
@@ -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 );
|
||||
|
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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 );
|
||||
}
|
||||
|
||||
|
@@ -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() );
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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()
|
||||
|
@@ -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 );
|
||||
|
@@ -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",
|
||||
|
@@ -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"
|
||||
|
@@ -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"
|
||||
]
|
||||
}
|
||||
|
@@ -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".
|
||||
|
@@ -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": {
|
||||
|
Reference in New Issue
Block a user