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())
.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() {
LOGGER.info("Registered bogey styles from " + Create.ID);
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 static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS;
static final List<ResourceLocation> BOGEYS = new ArrayList<>();
public BogeySizes.BogeySize size;
public AbstractBogeyBlock(Properties pProperties) {
public AbstractBogeyBlock(Properties pProperties, BogeySizes.BogeySize size) {
super(pProperties);
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false));
this.size = size;
}
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());
}
public abstract BogeySizes.BogeySize getSize();
public BogeySizes.BogeySize getSize() {
return this.size;
};
public Direction getBogeyUpDirection() {
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,
BlockHitResult hit) {
if (level.isClientSide)
return InteractionResult.CONSUME;
return InteractionResult.PASS;
ItemStack stack = player.getItemInHand(hand);
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();
if (styles.size() <= 1)
return InteractionResult.SUCCESS;
return InteractionResult.PASS;
BlockEntity be = level.getBlockEntity(pos);

View file

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