Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to 1.20.1 #11

Open
wants to merge 2 commits into
base: 1.19.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.+', changing: true
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
classpath 'org.parchmentmc:librarian:1.+'
}
Expand Down Expand Up @@ -91,22 +91,25 @@ repositories {
name 'Theillusivec4 Maven'
url = "https://maven.theillusivec4.top/"
}
maven{
name 'CurseMaven'
url = "https://cursemaven.com"
}
}

dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"

implementation fg.deobf("top.theillusivec4.caelus:caelus-forge:${mc_version}-${caelus_version}")
implementation fg.deobf("io.github.edwinmindcraft:calio-forge:${mc_version}-${calio_version}")
implementation fg.deobf("io.github.edwinmindcraft:apoli-forge:${mc_version}-${apoli_version}")
implementation fg.deobf("io.github.edwinmindcraft:origins-forge:${mc_version}-${origins_version}")
implementation fg.deobf("curse.maven:caelus-308989:5281700")
implementation fg.deobf("curse.maven:calio-977891:5404005")
implementation fg.deobf("curse.maven:apoli-forge-975561:5404008")
implementation fg.deobf("curse.maven:origins-forge-474438:5314209")

runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${mc_version}-${curios_version}:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${mc_version}-${curios_version}")
runtimeOnly fg.deobf("curse.maven:jei-238222:5846810")
implementation fg.deobf("curse.maven:curios-309927:5843594")
runtimeOnly fg.deobf("com.jozufozu.flywheel:flywheel-forge-${mc_version}:${flywheel_version}")
runtimeOnly fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
implementation fg.deobf("com.simibubi.create:create-${mc_version}:${create_version}:slim")
implementation fg.deobf("curse.maven:create-328085:5838779")

annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}
Expand Down
32 changes: 16 additions & 16 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ org.gradle.daemon=false

# Dependency Properties
mappings_channel=parchment
mappings_version=2022.08.21
mc_version=1.19.2
forge_version=43.1.1
caelus_version=3.0.0.6
calio_version=1.6.0.3
apoli_version=2.3.4.4
origins_version=1.5.0.6
jei_version=11.2.0.254
curios_version=5.1.1.0
flywheel_version=0.6.5-3
registrate_version=MC1.19-1.1.5
create_version=0.5.0.d-6
mappings_version=2023.09.03
mc_version=1.20.1
forge_version=47.3.0
caelus_version=3.2.0
calio_version=1.11.0.5
apoli_version=2.9.0.8
origins_version=1.10.0.9
jei_version=15.20.0.105
curios_version=5.11.0
flywheel_version=1.0.0-beta-88
registrate_version=MC1.20-1.3.11
create_version=0.5.1j-55

# Mod Properties
maven_group=dev.limonblaze.oriacs
archives_base_name=origins-accessbilities
mod_version=1.1.1
mod_id=oriacs
mod_author=LimonBlaze
fml_requirements = [43,)
forge_requirements=[43.1,)
mc_requirements=[1.19.2,1.20)
origins_requirements=[1.19.2-1.5,)
fml_requirements = [47,)
forge_requirements=[47.1,)
mc_requirements=[1.20.1,1.21)
origins_requirements=[1.20.1-1.10,)
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
17 changes: 17 additions & 0 deletions src/main/java/dev/limonblaze/oriacs/common/Oriacs.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import dev.limonblaze.oriacs.client.OriacsClient;
import dev.limonblaze.oriacs.common.registry.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModList;
Expand All @@ -28,6 +30,7 @@ public Oriacs() {
OriacsEnchantments.REGISTRY.register(modBus);
OriacsItemConditions.REGISTRY.register(modBus);
OriacsEntityConditions.REGISTRY.register(modBus);
modBus.addListener(this::addCreative);
ModLoadingContext modLoadingContext = ModLoadingContext.get();
modLoadingContext.registerConfig(ModConfig.Type.SERVER, OriacsServerConfig.SPEC);
CURIOS_LOADED = ModList.get().isLoaded("curios");
Expand All @@ -39,4 +42,18 @@ public static ResourceLocation asResource(String path) {
return new ResourceLocation(ID, path);
}

public void addCreative(BuildCreativeModeTabContentsEvent event) {
if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) {
event.accept(OriacsItems.UMBRELLA);
}

if (event.getTabKey() == CreativeModeTabs.COMBAT) {
event.accept(OriacsItems.DIVING_HELMET);
event.accept(OriacsItems.LANDWALKING_HELMET);
event.accept(OriacsItems.CHAINMEMBRANE_HELMET);
event.accept(OriacsItems.CHAINMEMBRANE_CHESTPLATE);
event.accept(OriacsItems.CHAINMEMBRANE_LEGGINGS);
event.accept(OriacsItems.CHAINMEMBRANE_BOOTS);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected boolean check(Configuration configuration, Entity entity) {
for(int slot = 0; slot < curioStacksHandler.getSlots(); ++slot) {
if(ConfiguredItemCondition.check(
configuration.condition,
entity.level,
entity.level(),
curioStacksHandler.getStacks().getStackInSlot(slot))
) return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.limonblaze.oriacs.common.enchantment;

import net.minecraft.tags.DamageTypeTags;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
Expand All @@ -23,10 +24,10 @@ public boolean canApplyAtEnchantingTable(ItemStack stack) {
public boolean isTreasureOnly() {
return true;
}

@Override
public int getDamageProtection(int level, DamageSource source) {
if(!source.isBypassInvul() && source.getMsgId().contains("flyIntoWall")) {
if(!source.is(DamageTypeTags.BYPASSES_INVULNERABILITY) && source.getMsgId().contains("flyIntoWall")) {
return level * 3;
}
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
public class DivingHelmetItem extends OriacsArmorItem {

public DivingHelmetItem(Properties properties) {
super(OriacsArmorMaterials.DIVING, EquipmentSlot.HEAD, properties);
super(OriacsArmorMaterials.DIVING, Type.HELMET, properties);
CauldronInteraction.WATER.put(this, this::waterCauldronInteraction);
}

Expand Down Expand Up @@ -98,7 +98,7 @@ public boolean overrideOtherStackedOnMe(ItemStack stack, ItemStack other, Slot s
handler.drain(bucket, IFluidHandler.FluidAction.EXECUTE);
slot.set(this.transformToLandwalking(stack));
access.set(handler.getContainer());
player.level.playLocalSound(player.getX(), player.getY(), player.getZ(), SoundEvents.BUCKET_EMPTY, SoundSource.PLAYERS, 1.0F, 1.0F, false);
player.level().playLocalSound(player.getX(), player.getY(), player.getZ(), SoundEvents.BUCKET_EMPTY, SoundSource.PLAYERS, 1.0F, 1.0F, false);
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
public class LandwalkingHelmetItem extends OriacsArmorItem {

public LandwalkingHelmetItem(Properties properties) {
super(OriacsArmorMaterials.DIVING, EquipmentSlot.HEAD, properties);
super(OriacsArmorMaterials.DIVING, Type.HELMET, properties);
CauldronInteraction.EMPTY.put(this, this::emptyCauldronInteraction);
}

Expand Down Expand Up @@ -125,7 +125,7 @@ public boolean overrideOtherStackedOnMe(ItemStack stack, ItemStack other, Slot s
handler.fill(bucket, IFluidHandler.FluidAction.EXECUTE);
slot.set(this.transformToDiving(stack));
access.set(handler.getContainer());
player.level.playLocalSound(player.getX(), player.getY(), player.getZ(), SoundEvents.BUCKET_FILL, SoundSource.PLAYERS, 1.0F, 1.0F, false);
player.level().playLocalSound(player.getX(), player.getY(), player.getZ(), SoundEvents.BUCKET_FILL, SoundSource.PLAYERS, 1.0F, 1.0F, false);
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class OriacsArmorItem extends ArmorItem {
public static final String TRANSFORM_PROGRESS = "TransformProgress";

public OriacsArmorItem(ArmorMaterial material, EquipmentSlot slot, Properties properties) {
public OriacsArmorItem(ArmorMaterial material, Type slot, Properties properties) {
super(material, slot, properties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
Expand Down Expand Up @@ -66,15 +67,15 @@ public enum OriacsArmorMaterials implements ArmorMaterial {
11 * durabilityMultiplier
}, armorValues, toughness, knockbackResistance, enchantmentValue, equipSound);
}

@Override
public int getDurabilityForSlot(EquipmentSlot slot) {
return durabilities[slot.getIndex()];
public int getDurabilityForType(ArmorItem.Type type) {
return durabilities[type.getSlot().getIndex()];
}

@Override
public int getDefenseForSlot(EquipmentSlot slot) {
return armorValues[slot.getIndex()];
public int getDefenseForType(ArmorItem.Type type) {
return armorValues[type.getSlot().getIndex()];
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
import net.minecraft.world.item.Vanishable;
import net.minecraft.world.level.Level;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.living.MobSpawnEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

import javax.annotation.ParametersAreNonnullByDefault;
import java.util.Random;

@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
Expand Down Expand Up @@ -93,21 +92,21 @@ public int getMaxDamage(ItemStack stack) {

@Override
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
return ItemStack.isSameIgnoreDurability(oldStack, newStack);
return ItemStack.isSameItem(oldStack, newStack);
}

@SubscribeEvent
public static void onLivingUpdate(LivingEvent.LivingTickEvent event) {
LivingEntity entity = event.getEntity();
if(entity.tickCount % 20 != 0) return;
Level level = entity.level;
Level level = entity.level();
BlockPos pos = entity.blockPosition();
boolean isInRain = level.isRainingAt(pos) || level.isRainingAt(new BlockPos(pos.getX(), entity.getBoundingBox().maxY, pos.getZ()));
boolean isInRain = level.isRainingAt(pos) || level.isRainingAt(new BlockPos(pos.getX(), (int) entity.getBoundingBox().maxY, pos.getZ()));
for(ItemStack stack : entity.getHandSlots()) {
if(stack.getItem() instanceof UmbrellaItem) {
if(isInRain) {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() + 1, 0, stack.getMaxDamage()));
} else if(level.getBiome(pos).value().shouldSnowGolemBurn(pos)) {
} else if(level.getBiome(pos).value().getTemperature(pos) > 1.0F) {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() - 2, 0, stack.getMaxDamage()));
} else {
stack.setDamageValue(Mth.clamp(stack.getDamageValue() - 1, 0, stack.getMaxDamage()));
Expand All @@ -117,10 +116,10 @@ public static void onLivingUpdate(LivingEvent.LivingTickEvent event) {
}

@SubscribeEvent
public static void onLivingSpawn(LivingSpawnEvent.SpecialSpawn event) {
public static void onLivingSpawn(MobSpawnEvent.FinalizeSpawn event) {
if(event.getEntity() instanceof Zombie zombie) {
RandomSource random = zombie.getRandom();
if(zombie.level.getDifficulty() == Difficulty.HARD &&
if(zombie.level().getDifficulty() == Difficulty.HARD &&
random.nextFloat() < OriacsServerConfig.CONFIG.UMBRELLA_SPAWN_WITH_ZOMBIE_CHANCE.get() &&
zombie.getItemInHand(InteractionHand.OFF_HAND).isEmpty()
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.limonblaze.oriacs.common.Oriacs;
import dev.limonblaze.oriacs.common.item.*;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.DeferredRegister;
Expand All @@ -14,40 +15,40 @@ public class OriacsItems {
public static final DeferredRegister<Item> REGISTRY = DeferredRegister.create(ForgeRegistries.ITEMS, Oriacs.ID);

public static final RegistryObject<UmbrellaItem> UMBRELLA = REGISTRY.register("umbrella",
() -> new UmbrellaItem(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS)));
() -> new UmbrellaItem(new Item.Properties()));

public static final RegistryObject<DivingHelmetItem> DIVING_HELMET = REGISTRY.register("diving_helmet",
() -> new DivingHelmetItem(new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)));
() -> new DivingHelmetItem(new Item.Properties()));

public static final RegistryObject<LandwalkingHelmetItem> LANDWALKING_HELMET = REGISTRY.register("landwalking_helmet",
() -> new LandwalkingHelmetItem(new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)));
() -> new LandwalkingHelmetItem(new Item.Properties()));

public static final RegistryObject<OriacsArmorItem> CHAINMEMBRANE_HELMET = REGISTRY.register("chainmembrane_helmet",
() -> new OriacsArmorItem(
OriacsArmorMaterials.CHAINMEMBRANE,
EquipmentSlot.HEAD,
new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)
ArmorItem.Type.HELMET,
new Item.Properties()
));

public static final RegistryObject<OriacsArmorItem> CHAINMEMBRANE_CHESTPLATE = REGISTRY.register("chainmembrane_chestplate",
() -> new OriacsArmorItem(
OriacsArmorMaterials.CHAINMEMBRANE,
EquipmentSlot.CHEST,
new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)
ArmorItem.Type.CHESTPLATE,
new Item.Properties()
));

public static final RegistryObject<OriacsArmorItem> CHAINMEMBRANE_LEGGINGS = REGISTRY.register("chainmembrane_leggings",
() -> new OriacsArmorItem(
OriacsArmorMaterials.CHAINMEMBRANE,
EquipmentSlot.LEGS,
new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)
ArmorItem.Type.LEGGINGS,
new Item.Properties()
));

public static final RegistryObject<OriacsArmorItem> CHAINMEMBRANE_BOOTS = REGISTRY.register("chainmembrane_boots",
() -> new OriacsArmorItem(
OriacsArmorMaterials.CHAINMEMBRANE,
EquipmentSlot.FEET,
new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)
ArmorItem.Type.BOOTS,
new Item.Properties()
));

}
28 changes: 14 additions & 14 deletions src/main/java/dev/limonblaze/oriacs/core/mixin/AirCurrentMixin.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package dev.limonblaze.oriacs.core.mixin;

import com.simibubi.create.content.contraptions.components.fan.IAirCurrentSource;
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
import com.simibubi.create.content.kinetics.fan.IAirCurrentSource;
import com.simibubi.create.content.kinetics.fan.processing.AllFanProcessingTypes;
import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType;
import com.simibubi.create.foundation.utility.VecHelper;
import dev.limonblaze.oriacs.common.registry.OriacsMobEffects;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -15,26 +16,25 @@
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Pseudo
@Mixin(targets = "com.simibubi.create.content.contraptions.components.fan.AirCurrent", remap = false)
@Mixin(targets = "com.simibubi.create.content.kinetics.fan.AirCurrent", remap = false)
public abstract class AirCurrentMixin {
@Shadow public abstract InWorldProcessing.Type getSegmentAt(float offset);

@Shadow public abstract FanProcessingType getTypeAt(float offset);

@Shadow @Final public IAirCurrentSource source;

@ModifyVariable(
method = "tickAffectedEntities",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V", remap = true),
name = "entity"
method = "tickAffectedEntities",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V", remap = true),
name = "entity"
)
private Entity oriacs$applyFreshAirEffect(Entity entity) {
if(entity.tickCount % 20 == 0 && entity instanceof LivingEntity living) {
InWorldProcessing.Type type = getSegmentAt((float) entity.position().distanceTo(VecHelper.getCenterOf(this.source.getAirCurrentPos())) - 0.5F);
if(type == null || type == InWorldProcessing.Type.NONE) {
FanProcessingType type = getTypeAt((float) entity.position().distanceTo(VecHelper.getCenterOf(this.source.getAirCurrentPos())) - 0.5F);
if(type == null || type == AllFanProcessingTypes.NONE) {
living.addEffect(new MobEffectInstance(OriacsMobEffects.FRESH_AIR.get(), 30, 0, true, false, true));
}
}
return entity;
}

}
}
Loading