From 48f4d8c9176ecd7b3f166a3f3f3231c651642233 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 8 Sep 2021 20:44:51 +0700 Subject: [PATCH] Rename IMatteryDrive impl to AbstractMatteryDrive --- .../mc/otm/OverdriveThatMatters.java | 4 ++-- ...ryDrive.java => AbstractMatteryDrive.java} | 6 +++--- .../mc/otm/capability/drive/DrivePool.java | 6 +----- .../capability/drive/ItemMatteryDrive.java | 4 +--- .../item/ItemPortableCondensationDrive.java | 19 ------------------- 5 files changed, 7 insertions(+), 32 deletions(-) rename src/main/java/ru/dbotthepony/mc/otm/capability/drive/{MatteryDrive.java => AbstractMatteryDrive.java} (96%) diff --git a/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java b/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java index 2e8317ce7..8f63d36e1 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java +++ b/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java @@ -23,7 +23,7 @@ import ru.dbotthepony.mc.otm.capability.AndroidCapability; import ru.dbotthepony.mc.otm.capability.AndroidCapabilityPlayer; import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.drive.DrivePool; -import ru.dbotthepony.mc.otm.capability.drive.MatteryDrive; +import ru.dbotthepony.mc.otm.capability.drive.AbstractMatteryDrive; import ru.dbotthepony.mc.otm.client.AndroidGui; import ru.dbotthepony.mc.otm.client.EventHandler; import ru.dbotthepony.mc.otm.item.ItemPortableCondensationDrive; @@ -156,7 +156,7 @@ public class OverdriveThatMatters { }; } - private static MatteryDrive drive; + private static AbstractMatteryDrive drive; private void setup(final FMLCommonSetupEvent event) { // some preinit code diff --git a/src/main/java/ru/dbotthepony/mc/otm/capability/drive/MatteryDrive.java b/src/main/java/ru/dbotthepony/mc/otm/capability/drive/AbstractMatteryDrive.java similarity index 96% rename from src/main/java/ru/dbotthepony/mc/otm/capability/drive/MatteryDrive.java rename to src/main/java/ru/dbotthepony/mc/otm/capability/drive/AbstractMatteryDrive.java index 83693f767..3ef9497a7 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/capability/drive/MatteryDrive.java +++ b/src/main/java/ru/dbotthepony/mc/otm/capability/drive/AbstractMatteryDrive.java @@ -14,7 +14,7 @@ import java.util.*; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -abstract public class MatteryDrive implements IMatteryDrive { +abstract public class AbstractMatteryDrive implements IMatteryDrive { protected final HashMap>> items = new HashMap<>(); protected final HashMap> items_by_id = new HashMap<>(); @@ -26,12 +26,12 @@ abstract public class MatteryDrive implements IMatteryD protected int max_different_stacks; protected BigDecimal capacity; - public MatteryDrive(BigDecimal capacity, int max_different_stacks) { + public AbstractMatteryDrive(BigDecimal capacity, int max_different_stacks) { this.capacity = capacity; this.max_different_stacks = max_different_stacks; } - public MatteryDrive(BigDecimal capacity) { + public AbstractMatteryDrive(BigDecimal capacity) { this(capacity, 0xFFFF); } diff --git a/src/main/java/ru/dbotthepony/mc/otm/capability/drive/DrivePool.java b/src/main/java/ru/dbotthepony/mc/otm/capability/drive/DrivePool.java index 5b010b3bb..3289f1fd7 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/capability/drive/DrivePool.java +++ b/src/main/java/ru/dbotthepony/mc/otm/capability/drive/DrivePool.java @@ -2,7 +2,6 @@ package ru.dbotthepony.mc.otm.capability.drive; import net.minecraft.CrashReport; import net.minecraft.ReportedException; -import net.minecraft.Util; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtIo; import net.minecraft.server.MinecraftServer; @@ -13,12 +12,9 @@ import net.minecraftforge.fmlserverevents.FMLServerStartedEvent; import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import ru.dbotthepony.mc.otm.OverdriveThatMatters; import javax.annotation.Nullable; import java.io.File; -import java.lang.reflect.Array; -import java.security.Provider; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -256,7 +252,7 @@ public class DrivePool { category.setDetail("Stored item count", entry.drive.getStoredCount()); category.setDetail("Capacity", entry.drive.getCapacity()); - if (entry.drive instanceof MatteryDrive drive) { + if (entry.drive instanceof AbstractMatteryDrive drive) { category.setDetail("Amount of different stacks", drive.different_stacks); category.setDetail("Max amount of different stacks", drive.max_different_stacks); } diff --git a/src/main/java/ru/dbotthepony/mc/otm/capability/drive/ItemMatteryDrive.java b/src/main/java/ru/dbotthepony/mc/otm/capability/drive/ItemMatteryDrive.java index 4f586ef76..ec92a8d23 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/capability/drive/ItemMatteryDrive.java +++ b/src/main/java/ru/dbotthepony/mc/otm/capability/drive/ItemMatteryDrive.java @@ -2,7 +2,6 @@ package ru.dbotthepony.mc.otm.capability.drive; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -13,7 +12,6 @@ import ru.dbotthepony.mc.otm.storage.ItemStackWrapper; import ru.dbotthepony.mc.otm.storage.StorageObjectRegistry; import ru.dbotthepony.mc.otm.storage.StorageObjectTuple; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import java.math.BigDecimal; @@ -23,7 +21,7 @@ import java.util.Objects; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class ItemMatteryDrive extends MatteryDrive implements IItemMatteryDrive { +public class ItemMatteryDrive extends AbstractMatteryDrive implements IItemMatteryDrive { private static StorageObjectTuple identity; public ItemMatteryDrive(BigDecimal capacity, int max_different_stacks) { diff --git a/src/main/java/ru/dbotthepony/mc/otm/item/ItemPortableCondensationDrive.java b/src/main/java/ru/dbotthepony/mc/otm/item/ItemPortableCondensationDrive.java index 477da6657..efb43ecc5 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/item/ItemPortableCondensationDrive.java +++ b/src/main/java/ru/dbotthepony/mc/otm/item/ItemPortableCondensationDrive.java @@ -1,53 +1,34 @@ package ru.dbotthepony.mc.otm.item; import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; import net.minecraft.stats.Stats; -import net.minecraft.tags.ItemTags; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.MenuProvider; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; -import net.minecraftforge.event.entity.player.PlayerEvent; -import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fmllegacy.network.NetworkEvent; -import net.minecraftforge.registries.RegistryManager; import ru.dbotthepony.mc.otm.OverdriveThatMatters; import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.drive.DrivePool; import ru.dbotthepony.mc.otm.capability.drive.IMatteryDrive; import ru.dbotthepony.mc.otm.capability.drive.ItemMatteryDrive; -import ru.dbotthepony.mc.otm.capability.drive.MatteryDrive; -import ru.dbotthepony.mc.otm.menu.DriveViewerMenu; -import ru.dbotthepony.mc.otm.storage.ItemStackWrapper; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; -import java.util.function.Supplier; public class ItemPortableCondensationDrive extends Item { public final BigDecimal capacity;