Creative pattern drive
This commit is contained in:
parent
ac3204b2f3
commit
ed1d9b150c
@ -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 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_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 {
|
public static class Blocks {
|
||||||
@ -123,6 +124,7 @@ public class Registry {
|
|||||||
public static final ItemMatterCapacitor MATTER_CAPACITOR_CREATIVE = new ItemMatterCapacitor();
|
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_NORMAL = new ItemPatternStorage(4);
|
||||||
|
public static final ItemPatternStorage PATTERN_DRIVE_CREATIVE = new ItemPatternStorage();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ANDROID_STATION.setRegistryName(Names.ANDROID_STATION);
|
ANDROID_STATION.setRegistryName(Names.ANDROID_STATION);
|
||||||
@ -148,6 +150,7 @@ public class Registry {
|
|||||||
MATTER_CAPACITOR_CREATIVE.setRegistryName(Names.MATTER_CAPACITOR_CREATIVE);
|
MATTER_CAPACITOR_CREATIVE.setRegistryName(Names.MATTER_CAPACITOR_CREATIVE);
|
||||||
|
|
||||||
PATTERN_DRIVE_NORMAL.setRegistryName(Names.PATTERN_DRIVE_NORMAL);
|
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) {
|
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(MATTER_CAPACITOR_CREATIVE);
|
||||||
|
|
||||||
event.getRegistry().register(PATTERN_DRIVE_NORMAL);
|
event.getRegistry().register(PATTERN_DRIVE_NORMAL);
|
||||||
|
event.getRegistry().register(PATTERN_DRIVE_CREATIVE);
|
||||||
|
|
||||||
// OverdriveThatMatters.LOGGER.info("Registered items");
|
// OverdriveThatMatters.LOGGER.info("Registered items");
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,18 @@ import java.util.*;
|
|||||||
|
|
||||||
public class ItemPatternStorage extends Item {
|
public class ItemPatternStorage extends Item {
|
||||||
public final int capacity;
|
public final int capacity;
|
||||||
|
public boolean is_creative;
|
||||||
|
|
||||||
public ItemPatternStorage(int capacity) {
|
public ItemPatternStorage(int capacity) {
|
||||||
super(new Properties().tab(OverdriveThatMatters.CREATIVE_TAB).stacksTo(1));
|
super(new Properties().tab(OverdriveThatMatters.CREATIVE_TAB).stacksTo(1));
|
||||||
this.capacity = capacity;
|
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
|
@Nullable
|
||||||
@ -43,7 +51,10 @@ public class ItemPatternStorage extends Item {
|
|||||||
@Override
|
@Override
|
||||||
public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> list, TooltipFlag p_41424_) {
|
public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> list, TooltipFlag p_41424_) {
|
||||||
p_41421_.getCapability(MatteryCapability.PATTERN).ifPresent(capability -> {
|
p_41421_.getCapability(MatteryCapability.PATTERN).ifPresent(capability -> {
|
||||||
list.add(new TranslatableComponent("otm.item.pattern.stored", capability.getStored(), capability.getCapacity()).withStyle(ChatFormatting.GRAY));
|
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()) {
|
for (PatternState state : capability.getStoredPatterns()) {
|
||||||
list.add(new TranslatableComponent("otm.item.pattern.line", state.item().getName(new ItemStack(state.item(), 1)), String.format("%.2f", state.research_percent() * 100d)).withStyle(ChatFormatting.AQUA));
|
list.add(new TranslatableComponent("otm.item.pattern.line", state.item().getName(new ItemStack(state.item(), 1)), String.format("%.2f", state.research_percent() * 100d)).withStyle(ChatFormatting.AQUA));
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
"otm.item.power.normal.throughput": "Max I/O %s / %s",
|
"otm.item.power.normal.throughput": "Max I/O %s / %s",
|
||||||
|
|
||||||
"otm.item.pattern.stored": "Stored patterns: %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.line": "%s [%s%%]",
|
||||||
"otm.item.pattern.research": "Researched: %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_normal": "Matter capacitor",
|
||||||
"item.overdrive_that_matters.matter_capacitor_creative": "Creative 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"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user