Skip to content

Commit

Permalink
Merge branch 'SlimefunGuguProject:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
shixinzia authored Mar 19, 2023
2 parents dd347cc + 95150d0 commit 07e5df9
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>com.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>2c4f886fe4</version>
<version>RC-33</version>
<scope>provided</scope>
</dependency>

Expand Down
12 changes: 5 additions & 7 deletions src/main/java/dev/j3fftw/litexpansion/ItemSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import dev.j3fftw.litexpansion.items.MagThor;
import dev.j3fftw.litexpansion.items.MiningDrill;
import dev.j3fftw.litexpansion.items.Thorium;
import dev.j3fftw.litexpansion.machine.Converter;
import dev.j3fftw.litexpansion.machine.Macerator;
import dev.j3fftw.litexpansion.machine.MassFabricator;
import dev.j3fftw.litexpansion.machine.MultiFunctionalElectricStorageUnit;
Expand Down Expand Up @@ -83,6 +84,7 @@ private void registerMachines() {
new ManualMill().register(plugin);
new Macerator().register(plugin);
new UUCrafter().register(plugin);
new Converter().register(plugin);
}

//Disable when SlimyTreeTaps exists
Expand Down Expand Up @@ -222,13 +224,9 @@ Items.TIN_ITEM_CASING, new ItemStack(Material.REDSTONE), Items.TIN_ITEM_CASING
RecipeType.SMELTERY.register(new ItemStack[] {Items.QUARTZ_DUST},
new ItemStack(Material.QUARTZ)
);

// 1.16
if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
RecipeType.SMELTERY.register(new ItemStack[] {Items.ANCIENT_DEBRIS_DUST},
new ItemStack(Material.NETHERITE_INGOT)
);
}
RecipeType.SMELTERY.register(new ItemStack[] {Items.ANCIENT_DEBRIS_DUST},
new ItemStack(Material.NETHERITE_INGOT)
);

// Resources
new MagThor().register(plugin);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/dev/j3fftw/litexpansion/Items.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,12 @@ public final class Items {
"&7UU合成机"
);

public static final SlimefunItemStack CONVERTER = new SlimefunItemStack(
"CONVER",
Material.COAL_BLOCK,
"&7转换机"
);

private static final Enchantment glowEnchant = Enchantment.getByKey(Constants.GLOW_ENCHANT);

static {
Expand Down
90 changes: 90 additions & 0 deletions src/main/java/dev/j3fftw/litexpansion/machine/Converter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package dev.j3fftw.litexpansion.machine;

import dev.j3fftw.litexpansion.Items;
import dev.j3fftw.litexpansion.machine.api.PoweredMachine;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

import javax.annotation.Nonnull;

public class Converter extends AContainer implements PoweredMachine {

public static final int TIME = 5;

public Converter() {
super(Items.LITEXPANSION, Items.CONVERTER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {
new ItemStack(Material.REDSTONE), new ItemStack(Material.REDSTONE), new ItemStack(Material.REDSTONE),
new ItemStack(Material.COBBLESTONE), Items.ADVANCED_MACHINE_BLOCK, new ItemStack(Material.COBBLESTONE),
null, Items.ADVANCED_CIRCUIT, null
});
}

@Override
protected void registerDefaultRecipes() {
if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) {
addRecipe(new ItemStack(Material.COPPER_INGOT), new ItemStack(SlimefunItems.COPPER_INGOT));
addRecipe(new ItemStack(SlimefunItems.COPPER_INGOT), new ItemStack(Material.COPPER_INGOT));
}

addRecipe(new ItemStack(Material.GOLD_INGOT), new ItemStack(SlimefunItems.GOLD_4K));
addRecipe(new ItemStack(SlimefunItems.GOLD_4K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_6K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_8K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_10K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_12K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_14K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_16K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_20K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_22K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_24K), new ItemStack(Material.GOLD_INGOT));
addRecipe(new ItemStack(SlimefunItems.GOLD_24K_BLOCK), new ItemStack(Material.GOLD_BLOCK));
}

private void addRecipe(ItemStack input, ItemStack output) {
registerRecipe(Converter.TIME, new ItemStack[] {input}, new ItemStack[] {output});
}

@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.FIRE_CHARGE);
}

@Nonnull
@Override
public String getInventoryTitle() {
return "&6转换机";
}

@Nonnull
@Override
public String getMachineIdentifier() {
return "CONVERTER";
}

@Override
public int getCapacity() {
return getDefaultEnergyConsumption() * 5;
}

@Override
public int getDefaultEnergyConsumption() {
return 20_000 / 26;
}

@Override
public int getEnergyConsumption() {
return this.getFinalEnergyConsumption();
}

@Override
public int getSpeed() {
return 1;
}

}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: LiteXpansion
description: Description
version: ${project.version}
api-version: 1.14
api-version: 1.16
author: j3fftw
depend: [Slimefun, GuizhanLibPlugin]
softdepend: [SlimyTreeTaps]
Expand Down

0 comments on commit 07e5df9

Please sign in to comment.