Skip to content

Commit 4eb3d80

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 411f047 commit 4eb3d80

File tree

9 files changed

+24
-9
lines changed

9 files changed

+24
-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 {

NeoForge/src/main/java/vazkii/botania/neoforge/client/ForgePlatformModel.java

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

1919
import vazkii.botania.common.block.PlatformBlock;
2020
import vazkii.botania.common.block.block_entity.PlatformBlockEntity;
21+
import vazkii.botania.common.lib.BotaniaTags;
2122

2223
import java.util.List;
2324

@@ -49,7 +50,7 @@ public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction
4950

5051
BlockState heldState = data.state();
5152

52-
if (heldState == null) {
53+
if (heldState == null || heldState.is(BotaniaTags.Blocks.UNSUPPORTED_PLATFORM_DISGUISE)) {
5354
// No camo
5455
return super.getQuads(state, side, rand, extraData, renderType);
5556
} 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/block/unsupported_platform_disguise.json

Lines changed: 3 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
@@ -35,6 +35,7 @@
3535

3636
import vazkii.botania.api.mana.ManaCollisionGhost;
3737
import vazkii.botania.common.block.block_entity.PlatformBlockEntity;
38+
import vazkii.botania.common.lib.BotaniaTags;
3839

3940
import java.util.List;
4041

@@ -91,10 +92,6 @@ public Behaviour getGhostBehaviour() {
9192
return Behaviour.SKIP_ALL;
9293
}
9394

94-
public static boolean isValidBlock(@Nullable BlockState state, Level world, BlockPos pos) {
95-
return state != null && (state.isSolidRender(world, pos) || state.getRenderShape() == RenderShape.MODEL);
96-
}
97-
9895
@Override
9996
public void appendHoverText(ItemStack stack, @Nullable Item.TooltipContext context, List<Component> tooltip, TooltipFlag flagIn) {
10097
if (requireCreativeInteractions()) {
@@ -115,7 +112,8 @@ public ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level
115112
BlockPlaceContext ctx = new BlockPlaceContext(player, hand, currentStack, hit);
116113
BlockState changeState = Block.byItem(currentStack.getItem()).getStateForPlacement(ctx);
117114

118-
if (isValidBlock(changeState, world, pos)
115+
if (changeState != null && !changeState.is(BotaniaTags.Blocks.UNSUPPORTED_PLATFORM_DISGUISE)
116+
&& (changeState.isSolidRender(world, pos) || changeState.getRenderShape() == RenderShape.MODEL)
119117
&& !(changeState.getBlock() instanceof PlatformBlock)
120118
&& !changeState.isAir()) {
121119
if (!world.isClientSide) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import net.minecraft.world.level.Level;
3535
import net.minecraft.world.level.block.Block;
3636
import net.minecraft.world.level.block.IronBarsBlock;
37+
import net.minecraft.world.level.block.RenderShape;
3738
import net.minecraft.world.level.block.TransparentBlock;
3839
import net.minecraft.world.level.block.state.BlockState;
3940
import net.minecraft.world.level.redstone.NeighborUpdater;
@@ -47,7 +48,6 @@
4748
import vazkii.botania.api.mana.ManaItemHandler;
4849
import vazkii.botania.client.gui.ItemsRemainingRenderHandler;
4950
import vazkii.botania.common.CollectingNeighborUpdaterAccess;
50-
import vazkii.botania.common.block.PlatformBlock;
5151
import vazkii.botania.common.component.BotaniaDataComponents;
5252
import vazkii.botania.common.helper.DataComponentHelper;
5353
import vazkii.botania.common.helper.PlayerHelper;
@@ -78,7 +78,7 @@ public InteractionResult useOn(UseOnContext ctx) {
7878

7979
if (player != null && player.isSecondaryUseActive()) {
8080
if (world.getBlockEntity(pos) == null && block.asItem() != Items.AIR
81-
&& PlatformBlock.isValidBlock(wstate, world, pos)
81+
&& (wstate.isSolidRender(world, pos) || wstate.getRenderShape() == RenderShape.MODEL)
8282
&& (wstate.canOcclude() || block instanceof TransparentBlock || block instanceof IronBarsBlock)
8383
&& block.asItem() instanceof BlockItem) {
8484
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
@@ -328,6 +328,13 @@ public static class Blocks {
328328
*/
329329
public static final TagKey<Block> MUNCHDEW_CONSUMABLE = tag("munchdew_consumable");
330330

331+
/**
332+
* Blocks in this tag work are likely to cause major issues when used with Abstruse/Spectral Platform blocks.
333+
* This tag can only be a last resort option, as it is likely an error in Botania or the block's origin mod
334+
* that causes the issues, which should be fixed properly.
335+
*/
336+
public static final TagKey<Block> UNSUPPORTED_PLATFORM_DISGUISE = tag("unsupported_platform_disguise");
337+
331338
private static TagKey<Block> tag(String name) {
332339
return TagKey.create(Registries.BLOCK, botaniaRL(name));
333340
}

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

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

289289
tag(BotaniaTags.Blocks.SINGLE_ITEM_INSERT).add(Blocks.CRAFTER);
290290

291+
tag(BotaniaTags.Blocks.UNSUPPORTED_PLATFORM_DISGUISE);
292+
291293
tag(BlockTags.FLOWER_POTS)
292294
.add(ColorHelper.supportedColors()
293295
.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)