• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / CyclopsCore / #479033547

17 Mar 2024 09:56AM UTC coverage: 22.398% (+0.2%) from 22.159%
#479033547

push

github

rubensworks
Update to NeoForge 1.20.4

5 of 635 new or added lines in 138 files covered. (0.79%)

39 existing lines in 26 files now uncovered.

2300 of 10269 relevant lines covered (22.4%)

0.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/cyclopscore/metadata/IRegistryExportable.java
1
package org.cyclops.cyclopscore.metadata;
2

3
import com.google.gson.JsonObject;
4
import net.minecraft.core.registries.BuiltInRegistries;
5
import net.minecraft.world.item.ItemStack;
6
import net.neoforged.neoforge.fluids.FluidStack;
7

8
/**
9
 * A registry export handler.
10
 */
11
public interface IRegistryExportable {
12

13
    /**
14
     * @return A JSON representation of the registry.
15
     */
16
    public JsonObject export();
17

18
    /**
19
     * @return The unique name of this registry (to be used in file names).
20
     */
21
    public String getName();
22

23
    public static JsonObject serializeItemStack(ItemStack itemStack) {
24
        JsonObject object = new JsonObject();
×
25

NEW
26
        object.addProperty("item", BuiltInRegistries.ITEM.getKey(itemStack.getItem()).toString());
×
27
        object.addProperty("count", itemStack.getCount());
×
28
        if (itemStack.hasTag()) {
×
29
            object.addProperty("nbt", itemStack.getTag().toString());
×
30
        }
31

32
        return object;
×
33
    }
34

35
    public static JsonObject serializeFluidStack(FluidStack fluidStack) {
36
        JsonObject object = new JsonObject();
×
37

NEW
38
        object.addProperty("fluid", BuiltInRegistries.FLUID.getKey(fluidStack.getFluid()).toString());
×
39
        object.addProperty("amount", fluidStack.getAmount());
×
40
        if (fluidStack.hasTag()) {
×
41
            object.addProperty("nbt", fluidStack.getTag().toString());
×
42
        }
43

44
        return object;
×
45
    }
46

47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc