Skip to content

Commit

Permalink
Merge branch 'Anvil-Dev:releases/1.21' into dev/1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuRuoLing authored Dec 20, 2024
2 parents feb247a + ff4bf67 commit 92c23f8
Show file tree
Hide file tree
Showing 56 changed files with 869 additions and 1,399 deletions.
16 changes: 12 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
dependencies {
// Registrate
api("com.tterrag.registrate:Registrate:${libs.versions.registrate.get()}")
jarJar("com.tterrag.registrate:Registrate:${libs.versions.registrate.get()}")

// Anvil Lib
implementation(libs.anvillib)
jarJar(libs.anvillib)

// Cloth Config
implementation(libs.clothConfig)
jarJar(libs.clothConfig)

// Curios API
implementation(libs.curios)

// JEI
compileOnlyApi(libs.jeiCommonApi) { transitive = false }
Expand All @@ -22,15 +32,13 @@ dependencies {
compileOnlyApi("vazkii.patchouli:Patchouli:${libs.versions.patchouli.get()}:api")
runtimeOnly(libs.patchouli)

// Sodium, Iris, Embeddium
compileOnly("maven.modrinth:sodium:mc1.21.1-0.6.3-neoforge")
compileOnly("maven.modrinth:embeddium:1.0.11+mc1.21.1")
compileOnly("maven.modrinth:iris:1.8.1+1.21.1-neoforge")

// Jade, The One Probe, KubeJS
implementation(libs.jade)
implementation(libs.theoneprobe)
implementation(libs.kubejs)
}

// compileOnly("maven.modrinth:sodium:mc1.21.1-0.6.0-beta.4-neoforge")
// compileOnly("maven.modrinth:iris:1.8.0-beta.5+1.21-neoforge")
// compileOnly("maven.modrinth:embeddium:1.0.11+mc1.21.1")
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ modDevGradle = "2.0.34-beta"
spotless = "7.0.0.BETA2"
lombok = "8.7.1"
machete = "1.+"
anvillib = "1.1.0+build.97"
curios = "9.0.15+1.21.1"

[libraries]
neoForge = { group = "net.neoforged", name = "neoforge", version.ref = "neoForge" }
Expand All @@ -31,6 +33,8 @@ jade = { group = "maven.modrinth", name = "jade", version.ref = "jade" }
theoneprobe = { group = "mcjty.theoneprobe", name = "theoneprobe", version.ref = "theoneprobe" }
kubejs = { group = "dev.latvian.mods", name = "kubejs-neoforge", version.ref = "kubejs" }
patchouli = { group = "vazkii.patchouli", name = "Patchouli", version.ref = "patchouli" }
anvillib = { group = "dev.anvilcraft.lib", name = "anvillib-neoforge-1.21.1", version.ref = "anvillib" }
curios = { group = "top.theillusivec4.curios", name = "curios-neoforge", version.ref = "curios" }


[plugins]
Expand Down
46 changes: 33 additions & 13 deletions gradle/scripts/repositories.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,54 @@
repositories {
mavenLocal()
mavenCentral()
maven { url = "https://server.cjsah.net:1002/maven/" }
maven { url = "https://api.modrinth.com/maven" } // LazyDFU, Jade
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu, EMI
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven {
maven { // Anvil Lib
name = "Cjsah Maven"
url = "https://server.cjsah.net:1002/maven/"
}
maven { // Modrinth File, LazyDFU, Jade
name = "Modrinth Maven"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
maven { // Mod Menu, EMI
name = "TerraformersMC Maven"
url = "https://maven.terraformersmc.com/releases/"
}
maven { // Cloth Config, REI
name = "Shedaniel Maven"
url = "https://maven.shedaniel.me/"
}
maven { // CurseForge File
name = "CurseForge Maven"
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
} // Curse Forge File
maven {
}
maven { // Patchouli
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven {
url = "https://dvs1.progwml6.com/files/maven/"
maven { // Registrate Fork
name = "Ithundxr Maven"
url = "https://maven.ithundxr.dev/snapshots"
}
maven { url = "https://maven.ithundxr.dev/snapshots" } // Registrate Fork
maven { url = "https://mvn.devos.one/snapshots/" }
maven {
// saps.dev Maven (KubeJS and Rhino)
maven { // KubeJS, Rhino
name = "Saps Maven"
url = "https://maven.saps.dev/minecraft"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.latvian.apps"
}
}
maven { // TOP
name = "k-4u Maven"
url "https://maven.k-4u.nl"
}
maven { // Curios API
name = "OctoStudios Maven"
url = uri("https://maven.octo-studios.com/releases")
}
}
3 changes: 3 additions & 0 deletions src/generated/resources/assets/anvilcraft/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,11 @@
"death.attack.anvilcraft.laser": "ɹǝsɐן ʎq pǝɔɹǝıd sɐʍ %1$s",
"death.attack.anvilcraft.lost_in_time": "ǝɯıʇ ɟo ɹǝʌıɹ ǝɥʇ uı ʇsoן sɐʍ %1$s",
"enchantment.anvilcraft.beheading": "buıpɐǝɥǝᗺ",
"enchantment.anvilcraft.beheading.desc": "˙os op oʇ spɐǝɥ ɹıǝɥʇ doɹp oʇ ǝןqɐun ʎןsnoıʌǝɹd ǝɹǝʍ ʇɐɥʇ )sɹǝʎɐןd buıpnןɔuı( sqoɯ ǝsnɐɔ puɐ buıddoɹp ןןnʞS uoʇǝןǝʞS ɹǝɥʇıM ǝɥʇ ɟo ʎʇıןıqɐqoɹd ǝɥʇ ǝɔuɐɥuƎ",
"enchantment.anvilcraft.felling": "buıןןǝℲ",
"enchantment.anvilcraft.felling.desc": "˙ןǝʌǝן ɹǝd ǝןɔɹıɔ ǝuo buıpuɐdxǝ 'ㄥ * ㄥ sı ןǝʌǝן pɹıɥʇ ǝɥʇ puɐ 'ϛ * ϛ sı ןǝʌǝן puoɔǝs ǝɥʇ 'Ɛ * Ɛ sı ǝbuɐɹ ןǝʌǝן ʇsɹıɟ ǝɥ⟘ ˙ɯǝɥʇ ʇuɐןdǝɹ puɐ ǝbuɐɹ uıɐʇɹǝɔ ɐ uıɥʇıʍ sdoɹɔ ǝɹnʇɐɯ ʇsǝʌɹɐH",
"enchantment.anvilcraft.harvest": "ʇsǝʌɹɐH",
"enchantment.anvilcraft.harvest.desc": "˙ǝɯıʇ ɐ ʇɐ sʞɔoןq uᄅ+Ɩ oʇ dn ʇɔǝןןoɔ uıɐɥɔ uɐɔ 'u ןǝʌǝן ʇuǝɯʇuɐɥɔuǝ ɟo uoıʇɐɹnbıɟuoɔ ʇןnɐɟǝp ɐ ɥʇıʍ 'sʇuɐıɹɐʌ ɹıǝɥʇ puɐ sboן ɟo uoıʇɔǝןןoɔ uıɐɥƆ",
"entity.anvilcraft.animate_ascending_block": "ʞɔoןᗺ buıpuǝɔsⱯ ǝʇɐɯıuⱯ",
"entity.anvilcraft.falling_giant_anvil": "ןıʌuⱯ ʇuɐı⅁ buıןןɐℲ",
"entity.anvilcraft.falling_spectral_block": "ʞɔoןᗺ ןɐɹʇɔǝdS buıןןɐℲ",
Expand Down
3 changes: 3 additions & 0 deletions src/generated/resources/assets/anvilcraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,11 @@
"death.attack.anvilcraft.laser": "%1$s was pierced by laser",
"death.attack.anvilcraft.lost_in_time": "%1$s was lost in the river of time",
"enchantment.anvilcraft.beheading": "Beheading",
"enchantment.anvilcraft.beheading.desc": "Enhance the probability of the Wither Skeleton Skull dropping and cause mobs (including players) that were previously unable to drop their heads to do so.",
"enchantment.anvilcraft.felling": "Felling",
"enchantment.anvilcraft.felling.desc": "Harvest mature crops within a certain range and replant them. The first level range is 3 * 3, the second level is 5 * 5, and the third level is 7 * 7, expanding one circle per level.",
"enchantment.anvilcraft.harvest": "Harvest",
"enchantment.anvilcraft.harvest.desc": "Chain collection of logs and their variants, with a default configuration of enchantment level n, can chain collect up to 1+2n blocks at a time.",
"entity.anvilcraft.animate_ascending_block": "Animate Ascending Block",
"entity.anvilcraft.falling_giant_anvil": "Falling Giant Anvil",
"entity.anvilcraft.falling_spectral_block": "Falling Spectral Block",
Expand Down

This file was deleted.

This file was deleted.

3 changes: 2 additions & 1 deletion src/generated/resources/data/c/tags/item/tools/wrench.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"values": [
"anvilcraft:anvil_hammer",
"anvilcraft:royal_anvil_hammer"
"anvilcraft:royal_anvil_hammer",
"anvilcraft:ember_anvil_hammer"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 电力元件
*/
@SuppressWarnings("unused")
public interface IPowerComponent {
public interface IPowerComponent extends Comparable<IPowerComponent> {
BooleanProperty OVERLOAD = BooleanProperty.create("overload");
EnumProperty<Switch> SWITCH = EnumProperty.create("switch", Switch.class);

Expand Down Expand Up @@ -105,4 +105,11 @@ default void flushState(@NotNull Level level, @NotNull BlockPos pos) {
level.setBlockAndUpdate(pos, state.setValue(OVERLOAD, true));
}
}

@Override
default int compareTo(@NotNull IPowerComponent iPowerComponent) {
if (this.equals(iPowerComponent)) return 0;
int i = getComponentType().compareTo(iPowerComponent.getComponentType());
return i == 0 ? 1 : i;
}
}
3 changes: 2 additions & 1 deletion src/main/java/dev/dubhe/anvilcraft/api/power/PowerGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.TreeSet;

/**
* 电网
Expand Down Expand Up @@ -134,7 +135,7 @@ protected void tick() {
}

private void gridTick() {
Set<IPowerComponent> components = Collections.synchronizedSet(new HashSet<>());
Set<IPowerComponent> components = Collections.synchronizedSet(new TreeSet<>());
components.addAll(this.transmitters);
components.addAll(this.consumers);
components.addAll(this.storages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(
(level1, blockPos, blockState, blockEntity) -> blockEntity.clientTick()
);
}
return createTickerHelper(
type,
ModBlockEntities.CHARGE_COLLECTOR.get(),
(level1, blockPos, blockState, blockEntity) -> blockEntity.tick()
);
return super.getTicker(level, state, type);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
import org.jetbrains.annotations.Nullable;

public class ChargeCollectorBlockEntity extends BlockEntity implements IPowerProducer, IHasAffectRange {

private static final double MAX_POWER_PER_INCOMING = 128;
private static final int COOLDOWN = 40;
private static final int COOLDOWN = 2;

private int cooldownCount = 40;
private int cooldownCount = 2;
private double chargeCount = 0;
private PowerGrid grid = null;
private int power = 0;
Expand Down Expand Up @@ -82,26 +81,24 @@ public int getOutputPower() {
}

@Override
public void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
public void loadAdditional(@NotNull CompoundTag tag, HolderLookup.@NotNull Provider registries) {
super.loadAdditional(tag, registries);
this.cooldownCount = tag.getInt("cooldownCount");
this.chargeCount = tag.getDouble("chargeCount");
this.power = tag.getInt("power");
}

@Override
public void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) {
public void saveAdditional(@NotNull CompoundTag tag, HolderLookup.@NotNull Provider registries) {
super.loadAdditional(tag, registries);
tag.putInt("cooldownCount", this.cooldownCount);
tag.putDouble("chargeCount", this.chargeCount);
tag.putInt("power", this.power);
}

/**
* 方块实体tick
*/
public void tick() {
if (this.cooldownCount > 1) {
@Override
public void gridTick() {
if (this.cooldownCount >= 1) {
this.cooldownCount -= 1;
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void onRegister(RegisterGuiLayersEvent event) {
screenHeight
);
}
if (!(minecraft.player.getItemBySlot(EquipmentSlot.HEAD).getItem() instanceof IEngineerGoggles)) return;
if (!IEngineerGoggles.hasGoggles(minecraft.player)) return;
HitResult hit = minecraft.hitResult;
if (hit == null || hit.getType() != HitResult.Type.BLOCK) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.BlockHitResult;
Expand Down Expand Up @@ -67,15 +68,8 @@ public static void onRender(RenderLevelStageEvent event) {
handItem, event.getPoseStack(), vertexConsumer3, camX, camY, camZ);
}
}
if (!(entity instanceof LivingEntity le)) return;
boolean bl = true;
for (ItemStack slot : le.getArmorSlots()) {
if (slot.getItem() instanceof IEngineerGoggles) {
bl = false;
break;
}
}
if (bl) return;
if (!(entity instanceof Player player)) return;
if (!IEngineerGoggles.hasGoggles(player)) return;
PowerGridRenderer.render(event.getPoseStack(), bufferSource, vec3);
HitResult hit = Minecraft.getInstance().hitResult;
if (hit == null || hit.getType() != HitResult.Type.BLOCK) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package dev.dubhe.anvilcraft.data.lang;

import com.tterrag.registrate.providers.RegistrateLangProvider;
import org.jetbrains.annotations.NotNull;

public class EnchantmentDescriptionsLang {
/**
* @param provider 提供器
*/
public static void init(@NotNull RegistrateLangProvider provider) {
provider.add("enchantment.anvilcraft.harvest.desc", "Chain collection of logs and their variants, with a default configuration of enchantment level n, can chain collect up to 1+2n blocks at a time.");
provider.add("enchantment.anvilcraft.felling.desc", "Harvest mature crops within a certain range and replant them. The first level range is 3 * 3, the second level is 5 * 5, and the third level is 7 * 7, expanding one circle per level.");
provider.add("enchantment.anvilcraft.beheading.desc", "Enhance the probability of the Wither Skeleton Skull dropping and cause mobs (including players) that were previously unable to drop their heads to do so.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public static void init(RegistrateLangProvider provider) {
PatchouliLang.init(provider);
ScreenLang.init(provider);
JeiLang.init(provider);
EnchantmentDescriptionsLang.init(provider);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public static void init(@NotNull RegistrateTagsProvider<Item> provider) {
.add(findResourceKey(Items.GLOW_BERRIES));
provider.addTag(ModItemTags.WRENCH)
.add(findResourceKey(ModItems.ANVIL_HAMMER.get()))
.add(findResourceKey(ModItems.ROYAL_ANVIL_HAMMER.get()));
.add(findResourceKey(ModItems.ROYAL_ANVIL_HAMMER.get()))
.add(findResourceKey(ModItems.EMBER_ANVIL_HAMMER.get()));
provider.addTag(ModItemTags.FIRE_STARTER)
.add(findResourceKey(Items.TORCH))
.add(findResourceKey(Items.SOUL_TORCH))
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/dev/dubhe/anvilcraft/init/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,14 @@ public class ModItems {
.register();
public static final ItemEntry<CapacitorItem> CAPACITOR = REGISTRATE
.item("capacitor", CapacitorItem::new)
.model((ctx, provider) -> {
})
.tag(ModItemTags.CAPACITOR)
.register();
public static final ItemEntry<EmptyCapacitorItem> CAPACITOR_EMPTY = REGISTRATE
.item("capacitor_empty", EmptyCapacitorItem::new)
.model((ctx, provider) -> {
})
.tag(ModItemTags.CAPACITOR)
.register();
public static final ItemEntry<Item> CHOCOLATE = REGISTRATE
Expand Down
Loading

0 comments on commit 92c23f8

Please sign in to comment.