Skip to content

Commit

Permalink
Changed sentinel value for invisible platforms to Barrier block
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealWormbo committed May 3, 2024
1 parent bbb022b commit cd548b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;

import vazkii.botania.common.block.BotaniaBlocks;
import vazkii.botania.common.block.PlatformBlock;
import vazkii.botania.common.block.block_entity.PlatformBlockEntity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.BakedModelWrapper;
import net.minecraftforge.client.model.data.ModelData;
Expand All @@ -17,11 +16,9 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import vazkii.botania.common.block.BotaniaBlocks;
import vazkii.botania.common.block.PlatformBlock;
import vazkii.botania.common.block.block_entity.PlatformBlockEntity;

import java.util.Collections;
import java.util.List;

public class ForgePlatformModel extends BakedModelWrapper<BakedModel> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -81,7 +80,7 @@ public Variant getVariant() {
@Override
public VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos, @NotNull CollisionContext context) {
BlockEntity te = world.getBlockEntity(pos);
if (te instanceof PlatformBlockEntity platform && platform.getCamoState() != null && !platform.getCamoState().isAir()) {
if (te instanceof PlatformBlockEntity platform && platform.getCamoState() != null) {
return platform.getCamoState().getShape(world, pos);
} else {
return super.getShape(state, world, pos, context);
Expand Down Expand Up @@ -158,12 +157,11 @@ public InteractionResult use(BlockState state, Level world, BlockPos pos, Player

return InteractionResult.sidedSuccess(world.isClientSide());
}
}
else if (!currentStack.isEmpty()
} else if (!currentStack.isEmpty()
&& currentStack.is(BotaniaItems.phantomInk)
&& tile instanceof PlatformBlockEntity camo ) {
&& tile instanceof PlatformBlockEntity camo) {
if (!world.isClientSide) {
camo.setCamoState(Blocks.AIR.defaultBlockState()); //Air is being used as a sentinel value here
camo.setCamoState(Blocks.BARRIER.defaultBlockState()); //Barrier block is being used as a sentinel value here
}

return InteractionResult.sidedSuccess(world.isClientSide());
Expand Down

0 comments on commit cd548b5

Please sign in to comment.