0.0.4
EnergonRelics/pipeline/head This commit looks good Details

Improve REI Plugin
This commit is contained in:
TheBrokenRail 2020-08-07 17:34:55 -04:00
parent 80f41be450
commit f68bb1d96d
9 changed files with 71 additions and 22 deletions

View File

@ -1,5 +1,8 @@
# Changelog
**Beta 0.0.4**
* Improve REI Plugin
**Beta 0.0.3**
* Performance Improvements

10
Jenkinsfile vendored
View File

@ -7,7 +7,7 @@ pipeline {
stages {
stage('Build') {
steps {
sh './gradlew build javadoc publish'
sh './gradlew build javadoc'
}
post {
success {
@ -24,5 +24,13 @@ pipeline {
}
}
}
stage('Publish') {
when {
buildingTag()
}
steps {
sh './gradlew publish'
}
}
}
}

View File

@ -3,19 +3,19 @@ org.gradle.jvmargs = -Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version = 1.16.2-pre3
minecraft_version = 1.16.2-rc1
curseforge_id = 398250
simple_minecraft_version = 1.16-Snapshot
yarn_build = 2
yarn_build = 4
fabric_loader_version = 0.9.0+build.204
# Mod Properties
mod_version = 0.0.3
mod_version = 0.0.4
maven_group = com.thebrokenrail
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_api_version = 0.16.4+build.392-1.16
fabric_api_version = 0.17.0+build.393-1.16
modmenu_version = 1.14.6+build.31
cloth_config_version = 4.7.0-unstable
autoconfig_version = 3.2.0-unstable

View File

@ -12,7 +12,7 @@ import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public final class EnergonRelicsPlugin implements REIPluginV0 {
public static final Identifier INFUSER = new Identifier(EnergonRelics.NAMESPACE, "plugin/infuser");
public static final Identifier INFUSING = new Identifier(EnergonRelics.NAMESPACE, "plugin/infusing");
public static final Identifier REACTOR_FUEL = new Identifier(EnergonRelics.NAMESPACE, "plugin/reactor_fuel");
@Override
@ -22,8 +22,11 @@ public final class EnergonRelicsPlugin implements REIPluginV0 {
@Override
public void registerOthers(RecipeHelper recipeHelper) {
recipeHelper.registerWorkingStations(INFUSER, EntryStack.create(EnergonRelics.INFUSER_BLOCK));
recipeHelper.registerWorkingStations(INFUSING, EntryStack.create(EnergonRelics.INFUSER_BLOCK));
recipeHelper.registerWorkingStations(REACTOR_FUEL, EntryStack.create(EnergonRelics.REACTOR_INPUT_BLOCK));
recipeHelper.removeAutoCraftButton(INFUSING);
recipeHelper.removeAutoCraftButton(REACTOR_FUEL);
}
@Override

View File

@ -36,8 +36,8 @@ public class InfuserCategory implements RecipeCategory<InfuserDisplay> {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
List<Widget> widgets = new ArrayList<>();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width / 2, bounds.y + 9), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.chance", new DecimalFormat("###.##").format(display.successChance * 100d))).noShadow().centered().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width / 2, bounds.y + 18), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.cost", display.cost)).noShadow().centered().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width / 2, bounds.y + 9), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infusing.chance", new DecimalFormat("###.##").format(display.successChance * 100d))).noShadow().centered().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width / 2, bounds.y + 18), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infusing.cost", display.cost)).noShadow().centered().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 25)).animationDurationTicks(HardcodedConfig.INFUSER_TIME));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 26)).entries(display.getInputEntries().get(0)).markInput());
@ -47,8 +47,8 @@ public class InfuserCategory implements RecipeCategory<InfuserDisplay> {
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 26)));
widgets.add(Widgets.createSlot(new Point(outputX, outputY)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
} else {
Identifier outputID = Registry.ITEM.getId(display.getResultingEntries().get(0).get(0).getItem());
Text text = new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.display_item." + outputID.getNamespace() + "." + outputID.getPath());
Identifier outputID = Registry.ITEM.getId(display.output.getItem());
Text text = new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infusing.display_item." + outputID.getNamespace() + "." + outputID.getPath());
widgets.add(Widgets.createLabel(new Point(outputX - 7, outputY + 3), text).noShadow().leftAligned().color(0xFF404040, 0xFFBBBBBB));
}
return widgets;
@ -61,7 +61,7 @@ public class InfuserCategory implements RecipeCategory<InfuserDisplay> {
@Override
public Identifier getIdentifier() {
return EnergonRelicsPlugin.INFUSER;
return EnergonRelicsPlugin.INFUSING;
}
@Override
@ -71,7 +71,7 @@ public class InfuserCategory implements RecipeCategory<InfuserDisplay> {
@Override
public String getCategoryName() {
return I18n.translate("category.rei." + EnergonRelics.NAMESPACE + ".infuser.name");
return I18n.translate("category.rei." + EnergonRelics.NAMESPACE + ".infusing.name");
}
public static void register(RecipeHelper recipeHelper) {

View File

@ -15,7 +15,7 @@ import java.util.List;
@Environment(EnvType.CLIENT)
public class InfuserDisplay implements RecipeDisplay {
private final EntryStack input;
private final EntryStack output;
public final EntryStack output;
public final boolean outputsItem;
public final double successChance;
public final long cost;
@ -35,12 +35,16 @@ public class InfuserDisplay implements RecipeDisplay {
@Override
public List<List<EntryStack>> getResultingEntries() {
return Collections.singletonList(Collections.singletonList(output));
if (outputsItem) {
return Collections.singletonList(Collections.singletonList(output));
} else {
return Collections.emptyList();
}
}
@Override
public Identifier getRecipeCategory() {
return EnergonRelicsPlugin.INFUSER;
return EnergonRelicsPlugin.INFUSING;
}
@Override

View File

@ -8,11 +8,15 @@ import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeCategory;
import me.shedaniel.rei.api.RecipeHelper;
import me.shedaniel.rei.api.widgets.Slot;
import me.shedaniel.rei.api.widgets.Tooltip;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
@ -58,6 +62,33 @@ public class ReactorFuelCategory implements RecipeCategory<ReactorFuelDisplay> {
return I18n.translate("category.rei." + EnergonRelics.NAMESPACE + ".reactor_fuel.name");
}
@Override
public RecipeEntry getSimpleRenderer(ReactorFuelDisplay recipe) {
Slot slot = Widgets.createSlot(new Point(0, 0)).entries(recipe.getInputEntries().get(0)).disableBackground().disableHighlight();
return new RecipeEntry() {
@Override
public int getHeight() {
return 22;
}
@Override
public Tooltip getTooltip(Point point) {
if (slot.containsMouse(point)) {
return slot.getCurrentTooltip(point);
} else {
return null;
}
}
@Override
public void render(MatrixStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
slot.setZ(getZ() + 50);
slot.getBounds().setLocation(bounds.x + bounds.width / 2 - 10, bounds.y + 2);
slot.render(matrices, mouseX, mouseY, delta);
}
};
}
public static void register(RecipeHelper recipeHelper) {
for (Map.Entry<Item, Float> entry : ReactorFuelRegistry.entrySet()) {
recipeHelper.registerDisplay(new ReactorFuelDisplay(new ItemStack(entry.getKey()), entry.getValue()));

View File

@ -50,16 +50,16 @@
"text.energonrelics.infuser_progress": "Infusion Progress: %s%%",
"text.energonrelics.battery_core_tooltip": "%s Energon",
"text.energonrelics.multimeter_separator": ", ",
"category.rei.energonrelics.infuser.chance": "%s%% Chance",
"category.rei.energonrelics.infuser.cost": "%s Energon",
"category.rei.energonrelics.infuser.name": "Infusing",
"category.rei.energonrelics.infusing.chance": "%s%% Chance",
"category.rei.energonrelics.infusing.cost": "%s Energon",
"category.rei.energonrelics.infusing.name": "Infusing",
"item.energonrelics.veridium_orb": "Veridium Orb",
"block.energonrelics.energy_projector": "Energy Projector",
"block.energonrelics.energy_beam": "Energy Beam",
"block.energonrelics.energy_portal": "Energy Portal",
"block.energonrelics.energized_obsidian": "Energized Obsidian",
"category.rei.energonrelics.infuser.display_item.minecraft.tnt": "Explosion",
"category.rei.energonrelics.infuser.display_item.minecraft.fire_charge": "Nothing",
"category.rei.energonrelics.infusing.display_item.minecraft.tnt": "Explosion",
"category.rei.energonrelics.infusing.display_item.minecraft.fire_charge": "Nothing",
"category.rei.energonrelics.reactor_fuel.name": "Reactor Fuel",
"category.rei.energonrelics.reactor_fuel.multiplier": "%sx Reaction"
}

View File

@ -10,7 +10,7 @@
"item": "energonrelics:circuit_board"
},
"I": {
"item": "minecraft:iron_ingot"
"item": "minecraft:iron_nugget"
},
"G": {
"item": "minecraft:gold_ingot"