Creative pattern drive

This commit is contained in:
DBotThePony 2021-08-17 19:40:53 +07:00
parent ac3204b2f3
commit ed1d9b150c
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 19 additions and 2 deletions

View File

@ -58,6 +58,7 @@ public class Registry {
public static final ResourceLocation MATTER_CAPACITOR_CREATIVE = new ResourceLocation(OverdriveThatMatters.MOD_ID, "matter_capacitor_creative");
public static final ResourceLocation PATTERN_DRIVE_NORMAL = new ResourceLocation(OverdriveThatMatters.MOD_ID, "pattern_drive_normal");
public static final ResourceLocation PATTERN_DRIVE_CREATIVE = new ResourceLocation(OverdriveThatMatters.MOD_ID, "pattern_drive_creative");
}
public static class Blocks {
@ -123,6 +124,7 @@ public class Registry {
public static final ItemMatterCapacitor MATTER_CAPACITOR_CREATIVE = new ItemMatterCapacitor();
public static final ItemPatternStorage PATTERN_DRIVE_NORMAL = new ItemPatternStorage(4);
public static final ItemPatternStorage PATTERN_DRIVE_CREATIVE = new ItemPatternStorage();
static {
ANDROID_STATION.setRegistryName(Names.ANDROID_STATION);
@ -148,6 +150,7 @@ public class Registry {
MATTER_CAPACITOR_CREATIVE.setRegistryName(Names.MATTER_CAPACITOR_CREATIVE);
PATTERN_DRIVE_NORMAL.setRegistryName(Names.PATTERN_DRIVE_NORMAL);
PATTERN_DRIVE_CREATIVE.setRegistryName(Names.PATTERN_DRIVE_CREATIVE);
}
public static void register(final RegistryEvent.Register<Item> event) {
@ -174,6 +177,7 @@ public class Registry {
event.getRegistry().register(MATTER_CAPACITOR_CREATIVE);
event.getRegistry().register(PATTERN_DRIVE_NORMAL);
event.getRegistry().register(PATTERN_DRIVE_CREATIVE);
// OverdriveThatMatters.LOGGER.info("Registered items");
}

View File

@ -28,10 +28,18 @@ import java.util.*;
public class ItemPatternStorage extends Item {
public final int capacity;
public boolean is_creative;
public ItemPatternStorage(int capacity) {
super(new Properties().tab(OverdriveThatMatters.CREATIVE_TAB).stacksTo(1));
this.capacity = capacity;
is_creative = false;
}
public ItemPatternStorage() {
super(new Properties().tab(OverdriveThatMatters.CREATIVE_TAB).stacksTo(1));
is_creative = true;
capacity = Integer.MAX_VALUE;
}
@Nullable
@ -43,6 +51,9 @@ public class ItemPatternStorage extends Item {
@Override
public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> list, TooltipFlag p_41424_) {
p_41421_.getCapability(MatteryCapability.PATTERN).ifPresent(capability -> {
if (is_creative)
list.add(new TranslatableComponent("otm.item.pattern.infinite.stored", capability.getStored()).withStyle(ChatFormatting.GRAY));
else
list.add(new TranslatableComponent("otm.item.pattern.stored", capability.getStored(), capability.getCapacity()).withStyle(ChatFormatting.GRAY));
for (PatternState state : capability.getStoredPatterns()) {

View File

@ -22,6 +22,7 @@
"otm.item.power.normal.throughput": "Max I/O %s / %s",
"otm.item.pattern.stored": "Stored patterns: %s / %s",
"otm.item.pattern.infinite.stored": "Stored patterns %s",
"otm.item.pattern.line": "%s [%s%%]",
"otm.item.pattern.research": "Researched: %s%%",
@ -81,5 +82,6 @@
"item.overdrive_that_matters.matter_capacitor_normal": "Matter capacitor",
"item.overdrive_that_matters.matter_capacitor_creative": "Creative matter capacitor",
"item.overdrive_that_matters.pattern_drive_normal": "Pattern drive"
"item.overdrive_that_matters.pattern_drive_normal": "Pattern drive",
"item.overdrive_that_matters.pattern_drive_creative": "Creative Pattern drive"
}