Skip to content

Commit

Permalink
fix(1.20.1-forged): fix #37 #43
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlimiter committed Feb 16, 2024
1 parent 927f3f9 commit 6704b23
Show file tree
Hide file tree
Showing 13 changed files with 228 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_item": {
"conditions": {
"items": [
{
"items": [
"avaritia:infinity_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "avaritia:infinity_nugget"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"avaritia:infinity_nugget"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_item": {
"conditions": {
"items": [
{
"items": [
"avaritia:neutron_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "avaritia:neutron_gear"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"avaritia:neutron_gear"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_item": {
"conditions": {
"items": [
{
"items": [
"avaritia:infinity_catalyst"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "avaritia:star_fuel"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"avaritia:star_fuel"
]
},
"sends_telemetry_event": false
}
13 changes: 13 additions & 0 deletions src/generated/resources/data/avaritia/recipes/infinity_nugget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "avaritia:infinity_ingot"
}
],
"result": {
"count": 9,
"item": "avaritia:infinity_nugget"
}
}
21 changes: 21 additions & 0 deletions src/generated/resources/data/avaritia/recipes/neutron_gear.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"c": {
"item": "avaritia:crystal_matrix_ingot"
},
"n": {
"item": "avaritia:neutron_ingot"
}
},
"pattern": [
" n ",
"ncn",
" n "
],
"result": {
"item": "avaritia:neutron_gear"
},
"show_notification": true
}
21 changes: 21 additions & 0 deletions src/generated/resources/data/avaritia/recipes/star_fuel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"c": {
"tag": "forge:ores/coal"
},
"x": {
"item": "avaritia:infinity_catalyst"
}
},
"pattern": [
"ccc",
"cxc",
"ccc"
],
"result": {
"item": "avaritia:star_fuel"
},
"show_notification": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void readAdditionalSaveData(@NotNull CompoundTag compound) {


@Override
public Packet<ClientGamePacketListener> getAddEntityPacket() {
public @NotNull Packet<ClientGamePacketListener> getAddEntityPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.pattern("xyx")
.define('x', ModItems.diamond_lattice.get())
.define('y', Items.NETHER_STAR)

.unlockedBy("has_item", has(ModItems.diamond_lattice.get())).save(consumer);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.extreme_crafting_table.get())
Expand All @@ -81,6 +81,22 @@ protected void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.define('e', ModItems.infinity_ingot.get())
.unlockedBy("has_item", has(Items.DRAGON_EGG)).save(consumer);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.neutron_gear.get())
.pattern(" n ")
.pattern("ncn")
.pattern(" n ")
.define('n', ModItems.neutron_ingot.get())
.define('c', ModItems.crystal_matrix_ingot.get())
.unlockedBy("has_item", has(ModItems.neutron_ingot.get())).save(consumer);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.star_fuel.get())
.pattern("ccc")
.pattern("cxc")
.pattern("ccc")
.define('c', Tags.Items.ORES_COAL)
.define('x', ModItems.infinity_catalyst.get())
.unlockedBy("has_item", has(ModItems.infinity_catalyst.get())).save(consumer);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.dense_neutron_collector.get())
.pattern("aaa")
.pattern("aga")
Expand All @@ -103,7 +119,9 @@ protected void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.unlockedBy("has_item", has(ModItems.record_fragment.get()))
.save(consumer);


ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.infinity_nugget.get(), 9)
.requires(ModItems.infinity_ingot.get())
.unlockedBy("has_item", has(ModItems.infinity_ingot.get())).save(consumer);


ModShapelessRecipeBuilder.shapeless(RecipeCategory.TOOLS, ModItems.cosmic_meatballs.get())
Expand Down Expand Up @@ -404,7 +422,7 @@ protected void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.define('N', ModItems.neutron_ingot.get())
.define('C', ModItems.crystal_matrix_ingot.get())
.define('X', ModItems.infinity_catalyst.get())

.unlockedBy("has_item", has(ModItems.neutron_ingot.get())).save(consumer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public static void updateAbilities(LivingEvent.LivingTickEvent event) {
if (hasChest) {
handleChestStateChange(entity);
} else {
// if (!entity.isCreative()) {
// entity.getAbilities().mayfly = false;
// entity.getAbilities().flying = false;
// }
if (!entity.isCreative()) {
entity.getAbilities().mayfly = false;
entity.getAbilities().flying = false;
}
entitiesWithChest.remove(key);
}
} else {
Expand Down Expand Up @@ -143,7 +143,6 @@ private static void handleHelmetStateChange(LivingEntity entity) {
private static void handleChestStateChange(LivingEntity entity) {
if (entity instanceof Player player) {
player.getAbilities().mayfly = true;
player.getAbilities().flying = true;
List<MobEffectInstance> effects = Lists.newArrayList(player.getActiveEffects());
for (MobEffectInstance potion : Collections2.filter(effects, potion -> !potion.getEffect().isBeneficial())) {
player.removeEffect(potion.getEffect());
Expand Down Expand Up @@ -220,41 +219,41 @@ public static void onDeath(LivingDeathEvent event) {

//跳跃增强
@SubscribeEvent
public void jumpBoost(LivingEvent.LivingJumpEvent event) {
public static void jumpBoost(LivingEvent.LivingJumpEvent event) {
LivingEntity entity = event.getEntity();
if (entity instanceof Player player && entitiesWithBoots.contains(player.getGameProfile().getName() + ":" + entity.level().isClientSide))
player.setDeltaMovement(0, 2.0f, 0);
}

@SubscribeEvent
public void onPlayerDimensionChange(PlayerEvent.PlayerChangedDimensionEvent event) {
public static void onPlayerDimensionChange(PlayerEvent.PlayerChangedDimensionEvent event) {
stripAbilities(event.getEntity());
}

@SubscribeEvent
public void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) {
public static void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) {
stripAbilities(event.getEntity());
}

@SubscribeEvent
public void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) {
public static void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) {
stripAbilities(event.getEntity());
}

@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
public static void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
stripAbilities(event.getEntity());
}

@SubscribeEvent
public void entityConstructEvent(EntityEvent.EntityConstructing event) {
if (event.getEntity() instanceof Player entity) {
stripAbilities(entity);
}
}
// @SubscribeEvent
// public static void entityConstructEvent(EntityEvent.EntityConstructing event) {
// if (event.getEntity() instanceof Player entity) {
// stripAbilities(entity);
// }
// }

@SubscribeEvent
public void onEntityDeath(LivingDeathEvent event) {
public static void onEntityDeath(LivingDeathEvent event) {
if (event.getEntity() instanceof Player entity) {
stripAbilities(entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public DamageSourceRandomMessages(Holder<DamageType> p_270475_) {
int type = attacked.getRandom().nextInt(3);
LivingEntity livingentity = attacked.getKillCredit();
String s = "death.attack." + this.getMsgId() + "." + type;
String s1 = s + ".player";
String s1 = "death.attack." + this.getMsgId() + ".player." + type;
return livingentity != null ? Component.translatable(s1, attacked.getDisplayName(), livingentity.getDisplayName()) : Component.translatable(s, attacked.getDisplayName());
}
}
Expand Down
14 changes: 9 additions & 5 deletions src/main/resources/assets/avaritia/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@
"crafting.extreme.shapeless": "Extreme Crafting Shapeless",
"death.attack.infinity": "%1$s was obliterated by %2$s",
"death.attack.infinity.item": "%1$s was obliterated by %2$s",
"death.attack.infinity.1": "%1$s was sliced to ribbons by %2$s",
"death.attack.infinity.2": "%1$s was excised from existence by %2$s",
"death.attack.infinity.3": "%1$s was overkilled by %2$s",
"death.attack.infinity.4": "%1$s was annihilated by %2$s",
"death.attack.infinity.1": "%1$s was sliced to ribbons",
"death.attack.infinity.player.1": "%1$s was sliced to ribbons by %2$s",
"death.attack.infinity.2": "%1$s was excised from existence",
"death.attack.infinity.player.2": "%1$s was excised from existence by %2$s",
"death.attack.infinity.3": "%1$s was overkilled",
"death.attack.infinity.player.3": "%1$s was overkilled by %2$s",
"death.attack.infinity.4": "%1$s was annihilated",
"death.attack.infinity.player.4": "%1$s was annihilated by %2$s",
"singularity.avaritia.aluminum": "Aluminum",
"singularity.avaritia.bronze": "Bronze",
"singularity.avaritia.copper": "Copper",
Expand Down Expand Up @@ -158,4 +162,4 @@
"advancements.avaritia.singularity.desc": "Compress minerals to get singularity",
"advancements.avaritia.star_fuel.title": "Stellar Energy",
"advancements.avaritia.star_fuel.desc": "Get stellar fuel"
}
}
14 changes: 9 additions & 5 deletions src/main/resources/assets/avaritia/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@
"crafting.extreme.shapeless": "Extreme Crafting Shapeless",
"death.attack.infinity": "%1$s был уничтожен %2$s",
"death.attack.infinity.item": "%1$s был уничтожен %2$s",
"death.attack.infinity.1": "%1$s был разрезан на ленточки %2$s",
"death.attack.infinity.2": "%1$s был исключен из существования %2$s",
"death.attack.infinity.3": "%1$s был убит %2$s",
"death.attack.infinity.4": "%1$s был аннигилирован %2$s",
"death.attack.infinity.1": "%1$s был разрезан на ленточки",
"death.attack.infinity.player.1": "%1$s был разрезан на ленточки %2$s",
"death.attack.infinity.2": "%1$s был исключен из существования",
"death.attack.infinity.player.2": "%1$s был исключен из существования %2$s",
"death.attack.infinity.3": "%1$s был убит",
"death.attack.infinity.player.3": "%1$s был убит %2$s",
"death.attack.infinity.4": "%1$s был аннигилирован",
"death.attack.infinity.player.4": "%1$s был аннигилирован %2$s",
"singularity.avaritia.aluminum": "Алюминиевая",
"singularity.avaritia.bronze": "Бронзовая",
"singularity.avaritia.copper": "Медная",
Expand Down Expand Up @@ -158,4 +162,4 @@
"advancements.avaritia.singularity.desc": "Сожмите минералы, чтобы получить сингулярность",
"advancements.avaritia.star_fuel.title": "Звёздная энергия",
"advancements.avaritia.star_fuel.desc": "Получите звёздное топливо"
}
}
Loading

0 comments on commit 6704b23

Please sign in to comment.