Skip to content

Commit

Permalink
Removed unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Edivad99 committed Jan 6, 2024
1 parent 345c682 commit 9d9587d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -704,21 +704,13 @@ private void land() {
this.minecart.setDragAir(AbstractMinecart.DEFAULT_AIR_DRAG);
}

/**
* Returns the optimal distance between two linked carts that the LinkageHandler will attempt to
* maintain at all times.
*
* @param cart1 AbstractMinecartEntity
* @param cart2 AbstractMinecartEntity
* @return The optimal distance
*/
private float getOptimalDistance(RollingStock cart2) {
private float getOptimalDistance(RollingStock rollingStock) {
float dist = 0;
if (this.minecart instanceof Linkable handler)
dist += handler.getOptimalDistance(cart2);
dist += handler.getOptimalDistance(rollingStock);
else
dist += OPTIMAL_LINK_DISTANCE;
if (cart2.entity() instanceof Linkable handler)
if (rollingStock.entity() instanceof Linkable handler)
dist += handler.getOptimalDistance(this);
else
dist += OPTIMAL_LINK_DISTANCE;
Expand All @@ -729,21 +721,14 @@ private static double limitForce(double force) {
return Math.copySign(Math.min(Math.abs(force), FORCE_LIMITER), force);
}

/**
* Returns the square of the max distance two carts can be and still be linkable.
*
* @param cart1 First Cart
* @param cart2 Second Cart
* @return The square of the linkage distance
*/
private float getLinkageDistanceSq(RollingStock cart2) {
private float getLinkageDistanceSq(RollingStock rollingStock) {
float dist = 0;
if (this.minecart instanceof Linkable handler) {
dist += handler.getLinkageDistance(cart2);
dist += handler.getLinkageDistance(rollingStock);
} else {
dist += MAX_LINK_DISTANCE;
}
if (cart2.entity() instanceof Linkable handler) {
if (rollingStock.entity() instanceof Linkable handler) {
dist += handler.getLinkageDistance(this);
} else {
dist += MAX_LINK_DISTANCE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import mods.railcraft.util.container.ContainerTools;
import mods.railcraft.world.entity.FirestoneItemEntity;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerLevel;
Expand All @@ -30,7 +28,6 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;

public class RefinedFirestoneItem extends FirestoneItem {

Expand Down Expand Up @@ -101,7 +98,7 @@ public InteractionResult useOn(UseOnContext context) {
var blockState = level.getBlockState(pos);
var random = level.getRandom();

if (level.isClientSide())
if (!(level instanceof ServerLevel serverLevel))
return InteractionResult.sidedSuccess(level.isClientSide());
if (stack.getDamageValue() == stack.getMaxDamage())
return InteractionResult.PASS;
Expand All @@ -110,7 +107,7 @@ public InteractionResult useOn(UseOnContext context) {

if (player.mayUseItemAt(pos, side, stack)) {
if (blockState.getBlock() != Blocks.STONE) {
var drops = Block.getDrops(blockState, (ServerLevel) level, pos, level.getBlockEntity(pos));
var drops = Block.getDrops(blockState, serverLevel, pos, level.getBlockEntity(pos));
if (drops.size() == 1 && !drops.get(0).isEmpty()
&& drops.get(0).getItem() instanceof BlockItem) {
var cooked = cookedItem(level, drops.get(0));
Expand Down

0 comments on commit 9d9587d

Please sign in to comment.