Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
HyCraftHD committed Aug 1, 2024
1 parent e106c31 commit c5c8976
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public InteractionResult useWithoutItem(BlockState state, Level level, BlockPos
if (level.isClientSide()) {
return InteractionResult.SUCCESS;
} else {
if (player instanceof ServerPlayer serverPlayer) {
if (player instanceof final ServerPlayer serverPlayer) {
MenuUtil.openMenu(serverPlayer, state.getMenuProvider(level, pos), data -> {
}, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ public int hashCode() {

@Override
public boolean equals(Object object) {
if (this == object)
if (this == object) {
return true;
if (object == null)
return false;
if (getClass() != object.getClass())
}
if ((object == null) || (getClass() != object.getClass())) {
return false;
}
final ItemFilterComponent other = (ItemFilterComponent) object;
return strict == other.strict && (stack == other.stack || stack != null && other.stack != null && stack.isEmpty() == other.stack.isEmpty() && ItemStack.isSameItemSameComponents(stack, other.stack));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public int hashCode() {

@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
}
if ((obj == null) || (getClass() != obj.getClass())) {
return false;
}
final TagFilterComponent other = (TagFilterComponent) obj;
return Objects.equals(tag, other.tag);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public SimpleContainer getInventory(ServerPlayer player, ItemStack backpackStack

@Override
public void saveInventory(SimpleContainer inventory, ItemStack backpackStack) {
if (inventory instanceof BackpackInventory backpackInventory) {
if (inventory instanceof final BackpackInventory backpackInventory) {
backpackInventory.writeItemStack();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ItemFilterItem extends FilterItem {
@Override
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
final ItemStack stack = player.getItemInHand(hand);
if (!level.isClientSide && player instanceof ServerPlayer serverPlayer) {
if (!level.isClientSide && player instanceof final ServerPlayer serverPlayer) {
if (player.isShiftKeyDown()) {
stack.set(UsefulBackpacksDataComponentTypes.ITEM_FILTER_COMPONENT.get(), ItemFilterComponent.EMPTY);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class TagFilterItem extends FilterItem {
@Override
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
final ItemStack stack = player.getItemInHand(hand);
if (!level.isClientSide && player instanceof ServerPlayer serverPlayer) {
if (!level.isClientSide && player instanceof final ServerPlayer serverPlayer) {
if (player.isShiftKeyDown()) {
stack.set(UsefulBackpacksDataComponentTypes.TAG_FILTER_COMPONENT.get(), TagFilterComponent.EMPTY);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ private OpenBackpackMessage() {
}

public static void handle(OpenBackpackMessage message, NetworkContext context) {
if (!(context.getPlayer() instanceof ServerPlayer player)) {
if (!(context.getPlayer() instanceof final ServerPlayer player)) {
return;
}
context.executeOnMainThread(() -> {
if (!player.isAlive()) {
return;
}
if (player.hasContainerOpen()) {
if (!player.isAlive() || player.hasContainerOpen()) {
return;
}
final Optional<ItemStack> curioBackpack = BackpackSlotModUtil.findBackpack(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ public class TrinketsBackpackRenderer implements TrinketRenderer {

@Override
public void render(ItemStack stack, SlotReference slotReference, EntityModel<? extends LivingEntity> model, PoseStack poseStack, MultiBufferSource bufferSource, int light, LivingEntity livingEntity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
if (livingEntity.hasItemInSlot(EquipmentSlot.CHEST)) {
return;
}
if (!(livingEntity instanceof AbstractClientPlayer player)) {
if (livingEntity.hasItemInSlot(EquipmentSlot.CHEST) || !(livingEntity instanceof final AbstractClientPlayer player)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ private ItemEntityMixin(EntityType<?> type, Level level) {
@Inject(method = "playerTouch", at = @At(value = "HEAD"), cancellable = true)
private void usefulbackpacks$drop(Player player, CallbackInfo info) {
final ItemEntity entity = ((ItemEntity) (Object) this);
if (entity.hasPickUpDelay()) {
return;
}
if (!(player instanceof ServerPlayer serverPlayer)) {
if (entity.hasPickUpDelay() || !(player instanceof final ServerPlayer serverPlayer)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ItemPickupEventHandler {
private static void onEntityItemPickup(EntityItemPickupEvent event) {
final Player player = event.getEntity();

if (!(player instanceof ServerPlayer serverPlayer)) {
if (!(player instanceof final ServerPlayer serverPlayer)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

public class CuriosBackpackSlotModUtil extends BackpackSlotModUtil {

@Override
public Optional<ItemStack> find(LivingEntity livingEntity) {
return CuriosApi.getCuriosInventory(livingEntity).map(handler -> handler.findFirstCurio(stack -> stack.getItem() instanceof Backpack).map(SlotResult::stack)).orElse(Optional.empty());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ItemPickupEventHandler {
private static void onEntityItemPickup(ItemEntityPickupEvent.Pre event) {
final Player player = event.getPlayer();

if (!(player instanceof ServerPlayer serverPlayer)) {
if (!(player instanceof final ServerPlayer serverPlayer)) {
return;
}

Expand Down

0 comments on commit c5c8976

Please sign in to comment.