-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a CT bug that should exist in all versions but for some reason do…
…esn't happen in 1.20
- Loading branch information
Showing
16 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...n/java/com/copycatsplus/copycats/content/copycat/base/functional/WrappedCopycatBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.copycatsplus.copycats.content.copycat.base.functional; | ||
|
||
import com.simibubi.create.content.decoration.copycat.CopycatBlock; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.level.BlockAndTintGetter; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class WrappedCopycatBlock extends CopycatBlock { | ||
|
||
private final ThreadLocal<IFunctionalCopycatBlock> wrapped = new ThreadLocal<>(); | ||
|
||
public WrappedCopycatBlock(Properties pProperties) { | ||
super(pProperties); | ||
} | ||
|
||
public IFunctionalCopycatBlock getWrapped() { | ||
return wrapped.get(); | ||
} | ||
|
||
public void setWrapped(IFunctionalCopycatBlock wrapped) { | ||
this.wrapped.set(wrapped); | ||
} | ||
|
||
@Override | ||
public boolean isIgnoredConnectivitySide(BlockAndTintGetter reader, BlockState state, Direction face, BlockPos fromPos, BlockPos toPos) { | ||
return wrapped.get().isIgnoredConnectivitySide(reader, state, face, fromPos, toPos); | ||
} | ||
|
||
@Override | ||
public boolean canConnectTexturesToward(BlockAndTintGetter reader, BlockPos fromPos, BlockPos toPos, BlockState state) { | ||
return wrapped.get().canConnectTexturesToward(reader, fromPos, toPos, state); | ||
} | ||
|
||
@Override | ||
public boolean canFaceBeOccluded(BlockState state, Direction face) { | ||
return wrapped.get().canFaceBeOccluded(state, face); | ||
} | ||
|
||
@Override | ||
public boolean shouldFaceAlwaysRender(BlockState state, Direction face) { | ||
return wrapped.get().shouldFaceAlwaysRender(state, face); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...n/src/main/java/com/copycatsplus/copycats/mixin/copycat/base/functional/CTModelMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.copycatsplus.copycats.mixin.copycat.base.functional; | ||
|
||
import com.copycatsplus.copycats.CCBlocks; | ||
import com.copycatsplus.copycats.content.copycat.base.functional.IFunctionalCopycatBlock; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.simibubi.create.foundation.block.connected.CTModel; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(CTModel.class) | ||
public class CTModelMixin { | ||
@WrapOperation( | ||
method = "createCTData", | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;getBlock()Lnet/minecraft/world/level/block/Block;") | ||
) | ||
private Block createCTData(BlockState instance, Operation<Block> original) { | ||
if (instance.getBlock() instanceof IFunctionalCopycatBlock fcb) { | ||
CCBlocks.WRAPPED_COPYCAT.get().setWrapped(fcb); | ||
return CCBlocks.WRAPPED_COPYCAT.get(); | ||
} | ||
return original.call(instance); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
fabric/src/generated/resources/assets/copycats/blockstates/wrapped_copycat.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "minecraft:block/air" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
fabric/src/generated/resources/data/copycats/loot_tables/blocks/wrapped_copycat.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "minecraft:air" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "copycats:blocks/wrapped_copycat" | ||
} |
1 change: 1 addition & 0 deletions
1
fabric/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
fabric/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
forge/src/generated/resources/assets/copycats/blockstates/wrapped_copycat.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "minecraft:block/air" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
forge/src/generated/resources/data/copycats/loot_tables/blocks/wrapped_copycat.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "minecraft:air" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "copycats:blocks/wrapped_copycat" | ||
} |
1 change: 1 addition & 0 deletions
1
forge/src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters