Skip to content

Commit 84c6050

Browse files
committed
Merge branch 'main' into mc1.19.2/main
# Conflicts: # gradle.properties # src/main/java/com/hlysine/create_connected/compat/CopycatsManager.java
2 parents 04f7fc3 + f04b437 commit 84c6050

File tree

7 files changed

+91
-12
lines changed

7 files changed

+91
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.7.3 - 2024-03-16
9+
10+
### Fixed
11+
12+
- Crash due to Copycat Slabs from C:Dreams and Desires interfering with the copycat migration process (#48)
13+
- Encased Chain Cogwheels not connecting to each other via their cogwheels when they are not in a line (#52)
14+
815
## 0.7.2 - 2024-02-13
916

1017
### Changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ out [Create: Power Loader](https://modrinth.com/mod/create-power-loader)**
2626
All copycats from Create: Connected, Create: More Copycats and Create: Copies and Cats are merged into the ultimate
2727
mod - [**Create: Copycats+**](https://modrinth.com/mod/copycats) !
2828

29-
- Forge/**Fabric** 1.20.1/1.19.2/1.18.2
29+
Copycats+ exclusive features include:
30+
31+
- Forge/**Fabric** 1.20.1/1.19.2/1.18.2 support
3032
- Even more copycats
3133
- Improved copycat model quality
32-
- Toggleable connective textures
34+
- Toggleable connected textures
3335

3436
![Copycats+](https://cdn.modrinth.com/data/UT2M39wf/images/e20c128b7c0e000e904584811d20f753d846af80.png)
3537

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ mod_name=Create: Connected
6262
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
6363
mod_license=GNU Affero General Public License v3.0
6464
# The mod version. See https://semver.org/
65-
mod_version=0.7.2-mc1.19.2
65+
mod_version=0.7.3-mc1.19.2
6666
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
6767
# This should match the base package used for the mod sources.
6868
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

src/main/java/com/hlysine/create_connected/compat/CopycatsManager.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,19 @@ public class CopycatsManager {
4141
}
4242

4343
public static Block convert(Block self) {
44-
BlockEntry<?> result = BLOCK_MAP.get(RegisteredObjects.getKeyOrThrow(self).getPath());
44+
ResourceLocation key = RegisteredObjects.getKeyOrThrow(self);
45+
if (!validateNamespace(key)) return self;
46+
BlockEntry<?> result = BLOCK_MAP.get(key.getPath());
4547
if (result != null) return result.get();
4648
return self;
4749
}
4850

4951
public static Item convert(Item self) {
50-
ItemEntry<?> result = ITEM_MAP.get(RegisteredObjects.getKeyOrThrow(self).getPath());
52+
ResourceLocation key = RegisteredObjects.getKeyOrThrow(self);
53+
if (!validateNamespace(key)) return self;
54+
ItemEntry<?> result = ITEM_MAP.get(key.getPath());
5155
if (result != null) return result.get();
52-
BlockEntry<?> blockResult = BLOCK_MAP.get(RegisteredObjects.getKeyOrThrow(self).getPath());
56+
BlockEntry<?> blockResult = BLOCK_MAP.get(key.getPath());
5357
if (blockResult != null) return blockResult.get().asItem();
5458
return self;
5559
}
@@ -73,24 +77,35 @@ private static <T extends Comparable<T>> BlockState copyProperty(BlockState from
7377
}
7478

7579
public static Block convertIfEnabled(Block block) {
76-
if (isFeatureEnabled(RegisteredObjects.getKeyOrThrow(block)))
80+
ResourceLocation key = RegisteredObjects.getKeyOrThrow(block);
81+
if (!validateNamespace(key)) return block;
82+
if (isFeatureEnabled(key))
7783
return convert(block);
7884
return block;
7985
}
8086

8187
public static BlockState convertIfEnabled(BlockState state) {
82-
if (isFeatureEnabled(RegisteredObjects.getKeyOrThrow(state.getBlock())))
88+
ResourceLocation key = RegisteredObjects.getKeyOrThrow(state.getBlock());
89+
if (!validateNamespace(key)) return state;
90+
if (isFeatureEnabled(key))
8391
return convert(state);
8492
return state;
8593
}
8694

8795
public static ItemLike convertIfEnabled(ItemLike item) {
88-
if (isFeatureEnabled(RegisteredObjects.getKeyOrThrow(item.asItem())))
96+
ResourceLocation key = RegisteredObjects.getKeyOrThrow(item.asItem());
97+
if (!validateNamespace(key)) return item;
98+
if (isFeatureEnabled(key))
8999
return convert(item);
90100
return item;
91101
}
92102

103+
private static boolean validateNamespace(ResourceLocation key) {
104+
return key.getNamespace().equals(CreateConnected.MODID) || key.getNamespace().equals(Mods.COPYCATS.id());
105+
}
106+
93107
public static boolean existsInCopycats(ResourceLocation key) {
108+
if (!validateNamespace(key)) return false;
94109
if (BLOCK_MAP.containsKey(key.getPath())) return true;
95110
if (ITEM_MAP.containsKey(key.getPath())) return true;
96111
return false;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.hlysine.create_connected.mixin.chaincogwheel;
2+
3+
import com.hlysine.create_connected.CCBlocks;
4+
import com.simibubi.create.content.kinetics.RotationPropagator;
5+
import com.simibubi.create.content.kinetics.base.IRotate;
6+
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
7+
import com.simibubi.create.content.kinetics.chainDrive.ChainDriveBlock;
8+
import net.minecraft.core.BlockPos;
9+
import net.minecraft.core.Direction;
10+
import net.minecraft.world.level.block.Block;
11+
import net.minecraft.world.level.block.state.BlockState;
12+
import org.spongepowered.asm.mixin.Mixin;
13+
import org.spongepowered.asm.mixin.injection.At;
14+
import org.spongepowered.asm.mixin.injection.Inject;
15+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
16+
17+
@Mixin(value = RotationPropagator.class, remap = false)
18+
public class RotationPropagatorMixin {
19+
@Inject(
20+
method = "getRotationSpeedModifier(Lcom/simibubi/create/content/kinetics/base/KineticBlockEntity;Lcom/simibubi/create/content/kinetics/base/KineticBlockEntity;)F",
21+
at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/kinetics/chainDrive/ChainDriveBlock;areBlocksConnected(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;)Z"),
22+
cancellable = true
23+
)
24+
private static void handleChainCogwheels(KineticBlockEntity from,
25+
KineticBlockEntity to,
26+
CallbackInfoReturnable<Float> cir) {
27+
final BlockState stateFrom = from.getBlockState();
28+
final BlockState stateTo = to.getBlockState();
29+
Block fromBlock = stateFrom.getBlock();
30+
Block toBlock = stateTo.getBlock();
31+
final IRotate definitionFrom = (IRotate) fromBlock;
32+
final IRotate definitionTo = (IRotate) toBlock;
33+
final BlockPos diff = to.getBlockPos()
34+
.subtract(from.getBlockPos());
35+
final Direction direction = Direction.getNearest(diff.getX(), diff.getY(), diff.getZ());
36+
37+
if (stateFrom.is(CCBlocks.ENCASED_CHAIN_COGWHEEL.get()) && stateTo.is(CCBlocks.ENCASED_CHAIN_COGWHEEL.get())) {
38+
boolean connected = ChainDriveBlock.areBlocksConnected(stateFrom, stateTo, direction);
39+
if (!connected) {
40+
if (diff.distManhattan(BlockPos.ZERO) != 1) {
41+
cir.setReturnValue(0f);
42+
return;
43+
}
44+
if (direction.getAxis() == definitionFrom.getRotationAxis(stateFrom)) {
45+
cir.setReturnValue(0f);
46+
return;
47+
}
48+
if (definitionFrom.getRotationAxis(stateFrom) == definitionTo.getRotationAxis(stateTo)) {
49+
cir.setReturnValue(-1f);
50+
}
51+
}
52+
}
53+
}
54+
}

src/main/resources/create_connected.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"ItemUseOverridesMixin",
1010
"KineticBlockAdvancementMixin",
1111
"ManualApplicationRecipeMixin",
12+
"chaincogwheel.RotationPropagatorMixin",
1213
"compat.CopycatBlockEntityMixin",
1314
"compat.CopycatBlockMixin",
1415
"contraption.AbstractContainerMenuMixin",

update.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"homepage": "https://github.com/hlysine/create_connected/",
33
"promos": {
4-
"1.20.1-recommended": "0.7.2-mc1.20.1",
5-
"1.19.2-recommended": "0.7.2-mc1.19.2",
6-
"1.18.2-recommended": "0.7.2-mc1.18.2"
4+
"1.20.1-recommended": "0.7.3-mc1.20.1",
5+
"1.19.2-recommended": "0.7.3-mc1.19.2",
6+
"1.18.2-recommended": "0.7.3-mc1.18.2"
77
}
88
}

0 commit comments

Comments
 (0)