Skip to content

Commit

Permalink
Merge branch 'refs/heads/multiloader' into 1.19.2/multiloader
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
  • Loading branch information
hlysine committed Jul 21, 2024
2 parents 214b259 + ceae2c7 commit 4ff577c
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 43 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 2.0.5 - 2024-07-21

### Fixed

- Copycat Slabs not having connected textures when using Fusion CT
- Crash/issues with train disassembly when certain complex blocks are put inside copycats on Forge
- Crash when simple copycats are put near enchanting tables on Fabric
- Bookshelves in copycats not contributing to enchanting power on Fabric
- Incorrect block mirroring for Copycat Slabs, Vertical Stairs and various other copycats
- Incorrect block shape for upside-down Copycat Half Layers
- Incompatibility with Continuity (not available until next Continuity release)

## 2.0.4 - 2024-07-20

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.5.+" apply false
id "dev.architectury.loom" version "1.7.+" apply false
}

boolean ci = System.getenv("CI") != null ? System.getenv("CI").toBoolean() : false
Expand Down Expand Up @@ -179,3 +179,7 @@ allprojects {
withSourcesJar()
}
}

wrapper {
gradleVersion = "8.8"
}
12 changes: 6 additions & 6 deletions common/src/main/java/com/copycatsplus/copycats/CCShapes.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ public class CCShapes {
aabb(layer * 2, 16, layer * 2).move(16 - layer * 2, 0, 16 - layer * 2)
)
));
public static final Map<Axis, Map<Integer, MutableShape>> HALF_LAYER_BOTTOM =
forHorizontalAxes(forAll(CopycatHalfLayerBlock.NEGATIVE_LAYERS,
public static final Map<Axis, Map<Half, Map<Integer, MutableShape>>> HALF_LAYER_BOTTOM =
forHorizontalAxes(forHalves(forAll(CopycatHalfLayerBlock.NEGATIVE_LAYERS,
layer -> shape(
aabb(16, layer * 2, 8)
)
));
public static final Map<Axis, Map<Integer, MutableShape>> HALF_LAYER_TOP =
forHorizontalAxes(forAll(CopycatHalfLayerBlock.POSITIVE_LAYERS,
)));
public static final Map<Axis, Map<Half, Map<Integer, MutableShape>>> HALF_LAYER_TOP =
forHorizontalAxes(forHalves(forAll(CopycatHalfLayerBlock.POSITIVE_LAYERS,
layer -> shape(
aabb(16, layer * 2, 8).move(0, 0, 8)
)
));
)));
public static final Map<Direction, Map<Side, Map<VerticalStairShape, MutableShape>>> VERTICAL_STAIR =
forHorizontalDirections(forAll(CopycatVerticalStairBlock.SIDE, CopycatVerticalStairBlock.SHAPE,
(side, shape) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.copycatsplus.copycats.foundation.copycat.model.ScaledBlockAndTintGetter;
import com.copycatsplus.copycats.foundation.copycat.multistate.WaterloggedMultiStateCopycatBlock;
import com.google.common.collect.ImmutableMap;
import com.mojang.math.OctahedralGroup;
import com.simibubi.create.content.contraptions.StructureTransform;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -278,8 +279,10 @@ public void transformStorage(BlockState state, IMultiStateCopycatBlockEntity be,
be.getMaterialItemStorage().remapStorage(s -> s.equals(POSITIVE_LAYERS.getName()) ? NEGATIVE_LAYERS.getName() : POSITIVE_LAYERS.getName());
}
}
if (transform.mirror == Mirror.FRONT_BACK && axis == Axis.Z || transform.mirror == Mirror.LEFT_RIGHT && axis == Axis.X) {
be.getMaterialItemStorage().remapStorage(s -> s.equals(POSITIVE_LAYERS.getName()) ? NEGATIVE_LAYERS.getName() : POSITIVE_LAYERS.getName());
if (transform.mirror != null) {
if (transform.mirror.rotation() == OctahedralGroup.INVERT_Z && axis == Axis.Z || transform.mirror.rotation() == OctahedralGroup.INVERT_X && axis == Axis.X) {
be.getMaterialItemStorage().remapStorage(s -> s.equals(POSITIVE_LAYERS.getName()) ? NEGATIVE_LAYERS.getName() : POSITIVE_LAYERS.getName());
}
}
}

Expand All @@ -296,8 +299,8 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt

private static VoxelShape calculateMultiFaceShape(BlockState pState) {
VoxelShape shape = Shapes.empty();
shape = Shapes.joinUnoptimized(shape, CCShapes.HALF_LAYER_BOTTOM.get(pState.getValue(AXIS)).get(pState.getValue(NEGATIVE_LAYERS)).toShape(), BooleanOp.OR);
shape = Shapes.joinUnoptimized(shape, CCShapes.HALF_LAYER_TOP.get(pState.getValue(AXIS)).get(pState.getValue(POSITIVE_LAYERS)).toShape(), BooleanOp.OR);
shape = Shapes.joinUnoptimized(shape, CCShapes.HALF_LAYER_BOTTOM.get(pState.getValue(AXIS)).get(pState.getValue(HALF)).get(pState.getValue(NEGATIVE_LAYERS)).toShape(), BooleanOp.OR);
shape = Shapes.joinUnoptimized(shape, CCShapes.HALF_LAYER_TOP.get(pState.getValue(AXIS)).get(pState.getValue(HALF)).get(pState.getValue(POSITIVE_LAYERS)).toShape(), BooleanOp.OR);
return shape.optimize();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public boolean hidesNeighborFace(BlockGetter level,
}
}
if (mirrorAxis == null) {
return super.mirror(pState, pMirror);
return pState;
}
Direction facing = pState.getValue(FACING);
Direction offset = pState.getValue(OFFSET);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.copycatsplus.copycats.foundation.copycat.model.ScaledBlockAndTintGetter;
import com.copycatsplus.copycats.foundation.copycat.multistate.WaterloggedMultiStateCopycatBlock;
import com.copycatsplus.copycats.utility.InteractionUtils;
import com.mojang.math.OctahedralGroup;
import com.simibubi.create.content.contraptions.StructureTransform;
import com.simibubi.create.foundation.placement.IPlacementHelper;
import com.simibubi.create.foundation.placement.PlacementHelpers;
Expand Down Expand Up @@ -153,6 +154,7 @@ public InteractionResult onSneakWrenched(BlockState state, UseOnContext context)

@Override
public boolean isIgnoredConnectivitySide(String property, BlockAndTintGetter reader, BlockState state, Direction face, BlockPos fromPos, BlockPos toPos) {
if (fromPos.equals(toPos)) return false; // Compat with Fusion CT: allow connection to self
BlockState toState = reader.getBlockState(toPos);
if (reader instanceof ScaledBlockAndTintGetter scaledReader) {
BlockPos fromTruePos = scaledReader.getTruePos(fromPos);
Expand All @@ -164,6 +166,7 @@ public boolean isIgnoredConnectivitySide(String property, BlockAndTintGetter rea

@Override
public boolean canConnectTexturesToward(String property, BlockAndTintGetter reader, BlockPos fromPos, BlockPos toPos, BlockState state) {
if (fromPos.equals(toPos)) return true; // Compat with Fusion CT: allow connection to self
BlockState toState = reader.getBlockState(toPos);
if (reader instanceof ScaledBlockAndTintGetter scaledReader) {
BlockPos fromTruePos = scaledReader.getTruePos(fromPos);
Expand Down Expand Up @@ -280,8 +283,10 @@ public void transformStorage(BlockState state, IMultiStateCopycatBlockEntity be,
}
}
if (axis == Axis.Y) return;
if (transform.mirror == Mirror.FRONT_BACK && axis == Axis.Z || transform.mirror == Mirror.LEFT_RIGHT && axis == Axis.X) {
be.getMaterialItemStorage().remapStorage(s -> s.equals(Half.BOTTOM.getSerializedName()) ? Half.TOP.getSerializedName() : Half.BOTTOM.getSerializedName());
if (transform.mirror != null) {
if (transform.mirror.rotation() == OctahedralGroup.INVERT_Z && axis == Axis.Z || transform.mirror.rotation() == OctahedralGroup.INVERT_X && axis == Axis.X) {
be.getMaterialItemStorage().remapStorage(s -> s.equals(Half.BOTTOM.getSerializedName()) ? Half.TOP.getSerializedName() : Half.BOTTOM.getSerializedName());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public boolean hidesNeighborFace(BlockGetter level,
}
}
if (mirrorAxis == null || mirrorAxis.isVertical()) {
return super.mirror(pState, pMirror);
return pState;
}
Direction facing = pState.getValue(FACING);
if (facing.getAxis() != mirrorAxis) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public boolean hidesNeighborFace(BlockGetter level, BlockPos pos, BlockState sta
}
}
if (mirrorAxis == null || mirrorAxis.isVertical()) {
return super.mirror(pState, pMirror);
return pState;
}
Direction facing = pState.getValue(FACING);
if (facing.getAxis() != mirrorAxis) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ public static boolean isStairs(BlockState state) {
public @NotNull BlockState mirror(@NotNull BlockState state, @NotNull Mirror mirror) {
Direction facing = state.getValue(FACING);
Side side = state.getValue(SIDE);
Axis axis = switch (mirror) {
case LEFT_RIGHT -> Axis.X;
case FRONT_BACK -> Axis.Z;
Axis axis = switch (mirror.rotation()) {
case INVERT_X -> Axis.X;
case INVERT_Z -> Axis.Z;
default -> Axis.Y;
};
if (axis == Axis.Y) return state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public boolean hidesNeighborFace(BlockGetter level,
}
}
if (mirrorAxis == null || mirrorAxis.isVertical()) {
return super.mirror(pState, pMirror);
return pState;
}
Direction facing = pState.getValue(FACING);
if (facing.getAxis() != mirrorAxis) {
Expand Down
12 changes: 6 additions & 6 deletions common/src/main/resources/assets/copycats/lang/hu_hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"block.copycats.copycat_base": "Imitátor-alap",
"block.copycats.copycat_beam": "Imitátor-oszlop",
"block.copycats.copycat_block": "Imitátor-blokk",
"block.copycats.copycat_board": "Imitátor-lap",
"block.copycats.copycat_board": "Imitátor-tábla",
"block.copycats.copycat_byte": "Imitátor-darabka",
"block.copycats.copycat_cogwheel": "Imitátor-fogaskerék",
"block.copycats.copycat_door": "Imitátor-ajtó",
"block.copycats.copycat_fence": "Imitátor-kerítés",
"block.copycats.copycat_fence_gate": "Imitátor-kerítéskapu",
"block.copycats.copycat_fluid_pipe": "Imitátor-csőszakasz",
"block.copycats.copycat_ghost_block": "Imitátor-fantomblokk",
"block.copycats.copycat_glass_fluid_pipe": "Üveg imitátor-csőszakasz",
"block.copycats.copycat_glass_fluid_pipe": "Imitátor-csőszakasz ablakkal",
"block.copycats.copycat_half_layer": "Imitátor-félréteg",
"block.copycats.copycat_half_panel": "Imitátor-félpanel",
"block.copycats.copycat_heavy_weighted_pressure_plate": "Nehéz súlymérő imitátor-nyomólap",
Expand Down Expand Up @@ -38,7 +38,7 @@
"block.copycats.copycat_wooden_pressure_plate": "Fa imitátor-nyomólap",
"block.copycats.wrapped_copycat": "Becsomagolt imitátor-blokk",
"item.copycats.copycat_box": "Imitátor-doboz",
"item.copycats.copycat_catwalk": "Imitátor-szervízjárat",
"item.copycats.copycat_catwalk": "Imitátor-szervizjárat",
"itemGroup.copycats.functional": "Create: Copycats+ | Használati",
"itemGroup.copycats.main": "Create: Copycats+ | Dekorációs",
"keyinfo.copycats.fill_copycat": "Imitátor kitöltése",
Expand All @@ -47,15 +47,15 @@
"tooltip.copycats.characteristics.copycat.description": "Jobb-kattintás anyaggal: kinézet _megadása_ és _forgatása_; csavarkulccsal: _kinézet törlése_.",
"tooltip.copycats.characteristics.copycat.title": "Imitátor",
"tooltip.copycats.characteristics.ct_toggle.description": "Shift + Jobb-kattintás üres kézzel: _összekapcsolódó textúrák állítása_.",
"tooltip.copycats.characteristics.ct_toggle.title": "Ök. textúra állítás",
"tooltip.copycats.characteristics.ct_toggle.title": "Összekapcsolódó textúrák állítása",
"tooltip.copycats.characteristics.functional.description": "_Ugyan az_ a használat, mint a nem imitátor megfelelőknél.",
"tooltip.copycats.characteristics.functional.title": "Használati",
"tooltip.copycats.characteristics.ghost.description": "_Nincs_ entitásokkal való _ütközés_.",
"tooltip.copycats.characteristics.ghost.title": "Fantom",
"tooltip.copycats.characteristics.multi_state.description": "_Több másolat_ elhelyezése különböző anyagokkal egy blokk helyén.",
"tooltip.copycats.characteristics.multi_state.description": "_Több másolat_ elhelyezése különböző anyagokkal egy blokk helyén. Tartsd lenyomva a _%s_-t az összes rész kitöltéséhez.",
"tooltip.copycats.characteristics.multi_state.title": "Több állapotú",
"tooltip.copycats.characteristics.pre_assembled.description": "_Egyedi darabok_ lebontása lehelyezés után.",
"tooltip.copycats.characteristics.pre_assembled.title": "Előre összeállított",
"tooltip.copycats.characteristics.stackable.description": "Ugyanazzal a imitátor-blokkal jobbkattintás: nagyítás.",
"tooltip.copycats.characteristics.stackable.description": "Ugyanazzal a imitátor-blokkal jobb kattintás: nagyítás.",
"tooltip.copycats.characteristics.stackable.title": "Halmozható"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
Expand Down Expand Up @@ -142,7 +143,7 @@ public float getEnchantPowerBonus(BlockState state, LevelReader level, BlockPos
return maybeMaterialAs(
level, pos, EnchantmentBonusBlock.class,
(material, block) -> block.getEnchantPowerBonus(material, level, pos),
material -> EnchantmentBonusBlock.super.getEnchantPowerBonus(material, level, pos)
material -> material.is(BlockTags.ENCHANTMENT_POWER_PROVIDER) ? 1f : 0f
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
Expand Down Expand Up @@ -185,7 +186,7 @@ public float getEnchantPowerBonus(BlockState state, LevelReader level, BlockPos
bonus.accumulateAndGet(
maybeMaterialAs(level, pos, EnchantmentBonusBlock.class, mat,
(material, enchantmentBlock) -> enchantmentBlock.getEnchantPowerBonus(material, level, pos),
(material) -> 0f
(material) -> material.is(BlockTags.ENCHANTMENT_POWER_PROVIDER) ? 1f : 0f
),
Float::max
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public CopycatModelFabric(BakedModel originalModel, CopycatModelCore core, boole
core.registerModels(entries);
}

@Override
public boolean isCustomRenderer() {
return true; // Stops Continuity from trying to wrap this model
}

private void gatherOcclusionData(BlockAndTintGetter world, BlockPos pos, BlockState state, BlockState material,
OcclusionData occlusionData, ICopycatBlock copycatBlock) {
if (VirtualEmptyBlockGetter.is(world))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public CopycatModelForge(BakedModel originalModel, CopycatModelCore core, boolea
core.registerModels(entries);
}

@Override
public boolean isCustomRenderer() {
return true;
}

@Override
public boolean useAmbientOcclusion() {
return !disableAO && super.useAmbientOcclusion();
Expand Down Expand Up @@ -86,7 +91,12 @@ public boolean useAmbientOcclusion(@NotNull BlockState state, @NotNull RenderTyp
BakedModel model = getModelForEntry(entry, state, material);
if (model == null)
continue;
renderTypes = ChunkRenderTypeSet.union(renderTypes, model.getRenderTypes(state, rand, data));
if (entry.type().useCopycatLogic()) {
if (material != null)
renderTypes = ChunkRenderTypeSet.union(renderTypes, model.getRenderTypes(material, rand, data));
} else {
renderTypes = ChunkRenderTypeSet.union(renderTypes, model.getRenderTypes(state, rand, data));
}
}
return renderTypes;
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
6 changes: 3 additions & 3 deletions update.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"homepage": "https://github.com/copycats-plus/copycats/",
"promos": {
"1.20.1-recommended": "1.20.1-2.0.4",
"1.19.2-recommended": "1.19.2-2.0.4",
"1.18.2-recommended": "1.18.2-2.0.4"
"1.20.1-recommended": "1.20.1-2.0.5",
"1.19.2-recommended": "1.19.2-2.0.5",
"1.18.2-recommended": "1.18.2-2.0.5"
}
}

0 comments on commit 4ff577c

Please sign in to comment.