Skip to content

Commit 5dbbb2c

Browse files
committed
Define block tag botania:unsupported_platform_disguise
Excludes blocks from being used as disguise for Abstruse/Spectral Platform blocks, both for setting the disguise and rendering an existing disguise. (workaround for #4951)
1 parent 7d97a93 commit 5dbbb2c

File tree

9 files changed

+26
-9
lines changed

9 files changed

+26
-9
lines changed

Fabric/src/main/java/vazkii/botania/fabric/client/FabricPlatformModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import vazkii.botania.common.block.PlatformBlock;
2121
import vazkii.botania.common.block.block_entity.PlatformBlockEntity;
22+
import vazkii.botania.common.lib.BotaniaTags;
2223

2324
import java.util.function.Supplier;
2425

@@ -45,7 +46,7 @@ public void emitBlockQuads(BlockAndTintGetter blockView, BlockState state, Block
4546
BlockPos heldPos = ((PlatformBlockEntity.PlatformData) data).pos();
4647
BlockState heldState = ((PlatformBlockEntity.PlatformData) data).state();
4748

48-
if (heldState == null) {
49+
if (heldState == null || heldState.is(BotaniaTags.Blocks.UNSUPPORTED_PLATFORM_DISGUISE)) {
4950
// No camo
5051
super.emitBlockQuads(blockView, state, pos, randomSupplier, context);
5152
} else {

Forge/src/main/java/vazkii/botania/forge/client/ForgePlatformModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import vazkii.botania.common.block.PlatformBlock;
2121
import vazkii.botania.common.block.block_entity.PlatformBlockEntity;
22+
import vazkii.botania.common.lib.BotaniaTags;
2223

2324
import java.util.List;
2425

@@ -52,7 +53,7 @@ public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction
5253

5354
BlockState heldState = data.state();
5455

55-
if (heldState == null) {
56+
if (heldState == null || heldState.is(BotaniaTags.Blocks.UNSUPPORTED_PLATFORM_DISGUISE)) {
5657
// No camo
5758
return super.getQuads(state, side, rand, extraData, renderType);
5859
} else {

Xplat/src/generated/resources/.cache/bfa01a6ca2555c100103725bf5c9e6da285f29c3

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Xplat/src/generated/resources/data/botania/tags/blocks/unsupported_platform_disguise.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Xplat/src/main/java/vazkii/botania/common/block/PlatformBlock.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
import vazkii.botania.api.mana.ManaCollisionGhost;
3939
import vazkii.botania.common.block.block_entity.PlatformBlockEntity;
40+
import vazkii.botania.common.lib.BotaniaTags;
4041

4142
import java.util.List;
4243
import java.util.function.BiPredicate;
@@ -121,10 +122,6 @@ public Behaviour getGhostBehaviour() {
121122
return Behaviour.SKIP_ALL;
122123
}
123124

124-
public static boolean isValidBlock(@Nullable BlockState state, Level world, BlockPos pos) {
125-
return state != null && (state.isSolidRender(world, pos) || state.getRenderShape() == RenderShape.MODEL);
126-
}
127-
128125
@Override
129126
public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List<Component> tooltip, TooltipFlag flagIn) {
130127
if (variant.indestructible) {
@@ -147,7 +144,8 @@ public InteractionResult use(BlockState state, Level world, BlockPos pos, Player
147144
BlockPlaceContext ctx = new BlockPlaceContext(player, hand, currentStack, hit);
148145
BlockState changeState = Block.byItem(currentStack.getItem()).getStateForPlacement(ctx);
149146

150-
if (isValidBlock(changeState, world, pos)
147+
if (changeState != null && !changeState.is(BotaniaTags.Blocks.UNSUPPORTED_PLATFORM_DISGUISE)
148+
&& (changeState.isSolidRender(world, pos) || changeState.getRenderShape() == RenderShape.MODEL)
151149
&& !(changeState.getBlock() instanceof PlatformBlock)
152150
&& !changeState.isAir()) {
153151
if (!world.isClientSide) {

Xplat/src/main/java/vazkii/botania/common/item/rod/ShiftingCrustRodItem.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import net.minecraft.world.level.block.AbstractGlassBlock;
3939
import net.minecraft.world.level.block.Block;
4040
import net.minecraft.world.level.block.IronBarsBlock;
41+
import net.minecraft.world.level.block.RenderShape;
4142
import net.minecraft.world.level.block.entity.BlockEntity;
4243
import net.minecraft.world.level.block.state.BlockState;
4344
import net.minecraft.world.level.redstone.NeighborUpdater;
@@ -53,7 +54,6 @@
5354
import vazkii.botania.api.mana.ManaItemHandler;
5455
import vazkii.botania.client.gui.ItemsRemainingRenderHandler;
5556
import vazkii.botania.common.CollectingNeighborUpdaterAccess;
56-
import vazkii.botania.common.block.PlatformBlock;
5757
import vazkii.botania.common.helper.ItemNBTHelper;
5858
import vazkii.botania.common.helper.PlayerHelper;
5959
import vazkii.botania.common.item.StoneOfTemperanceItem;
@@ -96,7 +96,8 @@ public InteractionResult useOn(UseOnContext ctx) {
9696

9797
if (player != null && player.isSecondaryUseActive()) {
9898
BlockEntity tile = world.getBlockEntity(pos);
99-
if (tile == null && block.asItem() != Items.AIR && PlatformBlock.isValidBlock(wstate, world, pos)
99+
if (tile == null && block.asItem() != Items.AIR
100+
&& (wstate.isSolidRender(world, pos) || wstate.getRenderShape() == RenderShape.MODEL)
100101
&& (wstate.canOcclude() || block instanceof AbstractGlassBlock || block instanceof IronBarsBlock)
101102
&& block.asItem() instanceof BlockItem) {
102103
setItemToPlace(stack, block.asItem());

Xplat/src/main/java/vazkii/botania/common/lib/BotaniaTags.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ public static class Blocks {
288288
*/
289289
public static final TagKey<Block> SINGLE_ITEM_INSERT = tag("single_item_insert");
290290

291+
/**
292+
* Blocks in this tag work are likely to cause major issues when used with Abstruse/Spectral Platform blocks.
293+
* This tag can only be a last resort option, as it is likely an error in Botania or the block's origin mod
294+
* that causes the issues, which should be fixed properly.
295+
*/
296+
public static final TagKey<Block> UNSUPPORTED_PLATFORM_DISGUISE = tag("unsupported_platform_disguise");
297+
291298
private static TagKey<Block> tag(String name) {
292299
return TagKey.create(Registries.BLOCK, prefix(name));
293300
}

Xplat/src/main/java/vazkii/botania/data/BlockTagProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ protected void addTags(HolderLookup.Provider provider) {
231231

232232
tag(BotaniaTags.Blocks.SINGLE_ITEM_INSERT).addOptional(new ResourceLocation("quark:crafter"));
233233

234+
tag(BotaniaTags.Blocks.UNSUPPORTED_PLATFORM_DISGUISE);
235+
234236
tag(BlockTags.FLOWER_POTS)
235237
.add(ColorHelper.supportedColors()
236238
.map(BotaniaBlocks::getPottedFlower)

web/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ of time the maintainers are able to spend on this effort.
2222
In the meantime, Botania for Minecraft 1.20.1 may still receive updates for bug fixes.
2323

2424
* Add: Extrapolated Bucket can void fluids from modded blocks that support draining fluids into items used on them
25+
* Add: Block tag `botania:unsupported_platform_disguise` can be used to explicitly disallow incompatible blocks to be
26+
used as the disguise for Abstruse or Spectral Platforms
2527
* Change: Terra Shatterer activation rules have been adjusted
2628
* With an item in the off-hand that item gets priority, unless sneaking and not aiming at any blocks
2729
* With an empty off-hand, sneak right-click toggles active state, unless at rank D (i.e. no stored mana)

0 commit comments

Comments
 (0)