Corrected Bogey InteractionResult To Pass

This commit is contained in:
Rabbitminers 2023-04-03 21:42:29 +01:00
parent 69326e361a
commit 53240bd42f
3 changed files with 10 additions and 27 deletions

View File

@ -20,21 +20,6 @@ public class AllBogeyStyles {
.renderer(new StandardBogeyRenderer()) .renderer(new StandardBogeyRenderer())
.register(); .register();
/*
public static final RegistryEntry<BogeyStyle> TEST = REGISTRATE
.bogeyStyle("test", new BogeyStyle())
.block(BogeySizes.LARGE, AllBlocks.LARGE_BOGEY)
.renderer(new TestBogeyRenderer())
.register();
public static final RegistryEntry<BogeyStyle> TEST_TWO = REGISTRATE
.bogeyStyle("test_two", new BogeyStyle())
.block(BogeySizes.SMALL, AllBlocks.SMALL_BOGEY)
.renderer(new TestBogeyRenderer())
.register();
*/
public static void register() { public static void register() {
LOGGER.info("Registered bogey styles from " + Create.ID); LOGGER.info("Registered bogey styles from " + Create.ID);
AllRegistries.DEFERRED_BOGEY_REGISTRY.register(FMLJavaModLoadingContext.get().getModEventBus()); AllRegistries.DEFERRED_BOGEY_REGISTRY.register(FMLJavaModLoadingContext.get().getModEventBus());

View File

@ -59,10 +59,13 @@ import org.jetbrains.annotations.NotNull;
public abstract class AbstractBogeyBlock extends Block implements ITE<StandardBogeyTileEntity>, ProperWaterloggedBlock, ISpecialBlockItemRequirement, IWrenchable { public abstract class AbstractBogeyBlock extends Block implements ITE<StandardBogeyTileEntity>, ProperWaterloggedBlock, ISpecialBlockItemRequirement, IWrenchable {
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS; public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS;
static final List<ResourceLocation> BOGEYS = new ArrayList<>(); static final List<ResourceLocation> BOGEYS = new ArrayList<>();
public BogeySizes.BogeySize size;
public AbstractBogeyBlock(Properties pProperties) {
public AbstractBogeyBlock(Properties pProperties, BogeySizes.BogeySize size) {
super(pProperties); super(pProperties);
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)); registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false));
this.size = size;
} }
public static void register(ResourceLocation block) { public static void register(ResourceLocation block) {
@ -118,7 +121,9 @@ public abstract class AbstractBogeyBlock extends Block implements ITE<StandardBo
renderer.render(sbte.getBogeyData(), wheelAngle, ms, light, vb, getSize()); renderer.render(sbte.getBogeyData(), wheelAngle, ms, light, vb, getSize());
} }
public abstract BogeySizes.BogeySize getSize(); public BogeySizes.BogeySize getSize() {
return this.size;
};
public Direction getBogeyUpDirection() { public Direction getBogeyUpDirection() {
return Direction.UP; return Direction.UP;
@ -139,7 +144,7 @@ public abstract class AbstractBogeyBlock extends Block implements ITE<StandardBo
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (level.isClientSide) if (level.isClientSide)
return InteractionResult.CONSUME; return InteractionResult.PASS;
ItemStack stack = player.getItemInHand(hand); ItemStack stack = player.getItemInHand(hand);
if (!player.isShiftKeyDown() && stack.is(AllItems.WRENCH.get()) && !player.getCooldowns().isOnCooldown(stack.getItem()) if (!player.isShiftKeyDown() && stack.is(AllItems.WRENCH.get()) && !player.getCooldowns().isOnCooldown(stack.getItem())
@ -147,7 +152,7 @@ public abstract class AbstractBogeyBlock extends Block implements ITE<StandardBo
Collection<BogeyStyle> styles = AllRegistries.BOGEY_REGISTRY.get().getValues(); Collection<BogeyStyle> styles = AllRegistries.BOGEY_REGISTRY.get().getValues();
if (styles.size() <= 1) if (styles.size() <= 1)
return InteractionResult.SUCCESS; return InteractionResult.PASS;
BlockEntity be = level.getBlockEntity(pos); BlockEntity be = level.getBlockEntity(pos);

View File

@ -19,11 +19,9 @@ import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
public class StandardBogeyBlock extends AbstractBogeyBlock implements ITE<StandardBogeyTileEntity>, ProperWaterloggedBlock, ISpecialBlockItemRequirement { public class StandardBogeyBlock extends AbstractBogeyBlock implements ITE<StandardBogeyTileEntity>, ProperWaterloggedBlock, ISpecialBlockItemRequirement {
private final BogeySizes.BogeySize size;
public StandardBogeyBlock(Properties props, BogeySizes.BogeySize size) { public StandardBogeyBlock(Properties props, BogeySizes.BogeySize size) {
super(props); super(props, size);
this.size = size;
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)); registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false));
} }
@ -42,11 +40,6 @@ public class StandardBogeyBlock extends AbstractBogeyBlock implements ITE<Standa
return new Vec3(0, 7 / 32f, 1); return new Vec3(0, 7 / 32f, 1);
} }
@Override
public BogeySizes.BogeySize getSize() {
return size;
}
@Override @Override
public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos,
Player player) { Player player) {