Skip to content

Commit

Permalink
chores: optimise imports
Browse files Browse the repository at this point in the history
  • Loading branch information
IWareQ committed Oct 19, 2024
1 parent df51a0c commit 4bab303
Show file tree
Hide file tree
Showing 51 changed files with 339 additions and 3,105 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.allaymc.server;

import org.allaymc.api.MissingImplementationException;
import org.allaymc.api.block.property.enums.MinecraftFacingDirection;
import org.allaymc.api.block.property.type.BlockPropertyTypes;
import org.allaymc.api.block.type.BlockState;
import org.allaymc.api.block.type.BlockTypes;
import org.allaymc.api.MissingImplementationException;
import org.openjdk.jmh.annotations.*;

import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.allaymc.server;

import org.allaymc.api.MissingImplementationException;
import org.allaymc.api.block.property.enums.TorchFacingDirection;
import org.allaymc.api.block.property.type.BlockPropertyType;
import org.allaymc.api.block.property.type.BlockPropertyTypes;
import org.allaymc.api.MissingImplementationException;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;

Expand Down
4 changes: 2 additions & 2 deletions server/src/main/java/org/allaymc/server/Allay.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.extern.slf4j.Slf4j;
import org.allaymc.api.AllayAPI;
import org.allaymc.api.MissingImplementationException;
import org.allaymc.api.block.property.BlockPropertyProcessor;
import org.allaymc.api.block.type.BlockType;
import org.allaymc.api.blockentity.type.BlockEntityType;
Expand All @@ -26,7 +27,6 @@
import org.allaymc.api.scheduler.Scheduler;
import org.allaymc.api.server.Server;
import org.allaymc.api.utils.Identifier;
import org.allaymc.api.MissingImplementationException;
import org.allaymc.api.world.generator.WorldGenerator;
import org.allaymc.server.bossbar.AllayBossBar;
import org.allaymc.server.command.selector.AllayEntitySelectorAPI;
Expand Down Expand Up @@ -59,7 +59,7 @@
public final class Allay {

public static final DynamicURLClassLoader EXTRA_RESOURCE_CLASS_LOADER = new DynamicURLClassLoader(Allay.class.getClassLoader());
private static final ExtensionManager EXTENSION_MANAGER =new ExtensionManager(Path.of("extensions"));
private static final ExtensionManager EXTENSION_MANAGER = new ExtensionManager(Path.of("extensions"));

public static Dashboard DASHBOARD;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @author daoge_cmd
*/
public class BlockHayBlockBaseComponentImpl extends BlockBaseComponentImpl{
public class BlockHayBlockBaseComponentImpl extends BlockBaseComponentImpl {
public BlockHayBlockBaseComponentImpl(BlockType<? extends BlockBehavior> blockType) {
super(blockType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author daoge_cmd
*/
public class BlockLiquidBaseComponentImpl extends BlockBaseComponentImpl {
public BlockLiquidBaseComponentImpl(BlockType<? extends BlockBehavior> blockType) {
public BlockLiquidBaseComponentImpl(BlockType<? extends BlockBehavior> blockType) {
super(blockType);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
package org.allaymc.server.block.component.crops;

import org.allaymc.api.block.BlockBehavior;
import org.allaymc.api.block.data.BlockFace;
import org.allaymc.api.block.dto.BlockStateWithPos;
import org.allaymc.api.block.dto.PlayerInteractInfo;
import org.allaymc.api.block.type.BlockType;
import org.allaymc.api.item.ItemStack;
import org.allaymc.api.item.interfaces.ItemBoneMealStack;
import org.allaymc.api.world.Dimension;
import org.allaymc.server.block.component.BlockBaseComponentImpl;
import org.joml.Vector3ic;

import java.util.concurrent.ThreadLocalRandom;

import static org.allaymc.api.block.property.type.BlockPropertyTypes.GROWTH;
import static org.allaymc.api.block.type.BlockTypes.FARMLAND;

/**
* @author Dhaiven
Expand All @@ -25,45 +13,45 @@ public BlockCropsBaseComponentImpl(BlockType<? extends BlockBehavior> blockType)
super(blockType);
}

// @Override
// public boolean canKeepExisting(BlockStateWithPos current, BlockStateWithPos neighbor, BlockFace face) {
// if (face != BlockFace.DOWN) return true;
// return neighbor.blockState().getBlockType() == FARMLAND;
// }
//
// @Override
// public void onRandomUpdate(BlockStateWithPos blockState) {
// if (blockState.pos().dimension().getInternalLightLevel(blockState.pos()) < 9) return;
// if (ThreadLocalRandom.current().nextInt(2) != 1) return;
//
// var oldGrowth = blockState.blockState().getPropertyValue(GROWTH);
// if (oldGrowth < GROWTH.getMax()) {
// grow(blockState.pos().dimension(), blockState.pos(), oldGrowth + 1);
// }
// }
//
// @Override
// public boolean onInteract(ItemStack itemStack, Dimension dimension, PlayerInteractInfo interactInfo) {
// if (super.onInteract(itemStack, dimension, interactInfo)) return true;
//
// if (itemStack instanceof ItemBoneMealStack) {
// var blockState = dimension.getBlockState(interactInfo.clickBlockPos());
// if (blockState.getPropertyValue(GROWTH) < GROWTH.getMax()) {
// int newAge = ThreadLocalRandom.current().nextInt(3) + 2; //Between 2 and 5
// grow(dimension, interactInfo.clickBlockPos(), newAge);
// //TODO: BoneMeal particle
// interactInfo.player().tryConsumeItemInHand();
// }
// }
//
// return true;
// }
//
// public void grow(Dimension dimension, Vector3ic pos, Integer newAge) {
// if (newAge < GROWTH.getMin()) newAge = GROWTH.getMin();
// if (newAge > GROWTH.getMax()) newAge = GROWTH.getMax();
//
// //TODO: event
// dimension.updateBlockProperty(GROWTH, newAge, pos);
// }
/*@Override
public boolean canKeepExisting(BlockStateWithPos current, BlockStateWithPos neighbor, BlockFace face) {
if (face != BlockFace.DOWN) return true;
return neighbor.blockState().getBlockType() == FARMLAND;
}
@Override
public void onRandomUpdate(BlockStateWithPos blockState) {
if (blockState.pos().dimension().getInternalLightLevel(blockState.pos()) < 9) return;
if (ThreadLocalRandom.current().nextInt(2) != 1) return;
var oldGrowth = blockState.blockState().getPropertyValue(GROWTH);
if (oldGrowth < GROWTH.getMax()) {
grow(blockState.pos().dimension(), blockState.pos(), oldGrowth + 1);
}
}
@Override
public boolean onInteract(ItemStack itemStack, Dimension dimension, PlayerInteractInfo interactInfo) {
if (super.onInteract(itemStack, dimension, interactInfo)) return true;
if (itemStack instanceof ItemBoneMealStack) {
var blockState = dimension.getBlockState(interactInfo.clickBlockPos());
if (blockState.getPropertyValue(GROWTH) < GROWTH.getMax()) {
int newAge = ThreadLocalRandom.current().nextInt(3) + 2; //Between 2 and 5
grow(dimension, interactInfo.clickBlockPos(), newAge);
//TODO: BoneMeal particle
interactInfo.player().tryConsumeItemInHand();
}
}
return true;
}
public void grow(Dimension dimension, Vector3ic pos, Integer newAge) {
if (newAge < GROWTH.getMin()) newAge = GROWTH.getMin();
if (newAge > GROWTH.getMax()) newAge = GROWTH.getMax();
//TODO: event
dimension.updateBlockProperty(GROWTH, newAge, pos);
}*/
}
Loading

0 comments on commit 4bab303

Please sign in to comment.