Skip to content

Commit

Permalink
优化注册,移除重复和多余的代码。
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyceryl6 committed Aug 18, 2024
1 parent 2f229fb commit 1ba5a57
Show file tree
Hide file tree
Showing 33 changed files with 201 additions and 691 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class WhisperGrove {

public WhisperGrove(IEventBus modEventBus, ModContainer modContainer) {
WGBlock.BLOCKS.register(modEventBus);
WGBlockItem.ITEMS.register(modEventBus);
WGItem.ITEMS.register(modEventBus);
WGTab.TABS.register(modEventBus);
WGAttachment.ATTACHMENTS.register(modEventBus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public boolean stillValid(Player player) {
return ItemStack.EMPTY;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public class SpringingBlockEntity extends RandomizableContainerBlockEntity implements WorldlyContainer {

private NonNullList<ItemStack> stacks = NonNullList.<ItemStack>withSize(10, ItemStack.EMPTY);
private NonNullList<ItemStack> stacks = NonNullList.withSize(10, ItemStack.EMPTY);
private final SidedInvWrapper handler = new SidedInvWrapper(this, null);

public SpringingBlockEntity(BlockPos position, BlockState state) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
Expand All @@ -16,31 +17,32 @@
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.hiedacamellia.whispergrove.core.entry.BaseBlock;
import org.hiedacamellia.whispergrove.core.recipe.generalherbprocess.GeneralHerbProcessApplier;

import java.util.Arrays;
import java.util.List;

public class RollerBlock extends BaseBlock {
public RollerBlock(String regname) {
public class RollerBlock extends Block {

public RollerBlock() {
super(BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_GRAY)
.sound(SoundType.STONE)
.destroyTime(2.5f)
.explosionResistance(6.0f)
.noOcclusion(),
regname);
.noOcclusion());
}


@Override
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
return Shapes.join(box(4, 0, 0, 12, 6, 16), box(7, 4, 10, 9, 10, 16).move(0,0,0), BooleanOp.OR);
return Shapes.join(box(4, 0, 0, 12, 6, 16),
box(7, 4, 10, 9, 10, 16)
.move(0,0,0), BooleanOp.OR);
}

@Override
public ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
public ItemInteractionResult useItemOn(
ItemStack stack, BlockState state, Level level, BlockPos pos,
Player player, InteractionHand hand, BlockHitResult hitResult) {
GeneralHerbProcessApplier.apply(state, List.of(stack), level, pos);
return ItemInteractionResult.SUCCESS;
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1ba5a57

Please sign in to comment.