Skip to content

Commit

Permalink
Initial pass of 1.18 update
Browse files Browse the repository at this point in the history
This cleans up most of the not-worldgen related errors from the direct update
  • Loading branch information
Thutmose committed Dec 2, 2021
1 parent 36d63e0 commit 5cc8f1c
Show file tree
Hide file tree
Showing 163 changed files with 660 additions and 639 deletions.
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ version = "${version_minecraft}-${VERSION_COMPILE}"
group = 'thut'
archivesBaseName = "${compile_name}"

java.toolchain.languageVersion = JavaLanguageVersion.of(16)
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
mappings channel: "${channel_mappings}", version: "${version_mappings}"
Expand Down Expand Up @@ -158,28 +158,28 @@ repositories {

dependencies {
minecraft "net.minecraftforge:forge:${version_minecraft}-${version_forge}"
annotationProcessor 'org.spongepowered:mixin:0.8.4:processor'
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

//Computer Craft Support.
implementation fg.deobf("org.squiddev:cc-tweaked-${version_cct_mc}:${version_cct}")
//implementation fg.deobf("org.squiddev:cc-tweaked-${version_cct_mc}:${version_cct}")

//Lost Cities
//implementation "blank:lostcities-1.16-4.0.7-beta"

//Thut Essentials
implementation "${depstr_thutessentials}"
//implementation "${depstr_thutessentials}"

//JEI
// compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-${version_jei_mc}:${version_jei}:api")
//compileOnly fg.deobf("mezz.jei:jei-${version_jei_mc}:${version_jei}:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-${version_jei_mc}:${version_jei}")
//runtimeOnly fg.deobf("mezz.jei:jei-${version_jei_mc}:${version_jei}")

//WHYLA
implementation fg.deobf("curse.maven:Jade-${version_jade}")
//implementation fg.deobf("curse.maven:Jade-${version_jade}")

//Minecolonies
implementation "blank:minecolonies-1.17.1-1.0.23-ALPHA-api"
//implementation "blank:minecolonies-1.17.1-1.0.23-ALPHA-api"

//Immersive Enginnering
//implementation "blusunrize:ImmersiveEngineering:0.15-+"
Expand All @@ -189,7 +189,7 @@ dependencies {
//implementation "blank:LibVulpes-1.16.5-1.0.1-6-api"

// Curios - Wearables Support
implementation fg.deobf("curse.maven:curios-${version_curios}")
//implementation fg.deobf("curse.maven:curios-${version_curios}")
}

sourceSets {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

version_forge=37.1.0
version_minecraft=1.17.1
version_mcsupport=[1.17.1,1.18)
version_mappings=1.17.1
version_forge=38.0.8
version_minecraft=1.18
version_mcsupport=[1.18,1.19)
version_mappings=1.18
channel_mappings=official

# Internal thutcore version for modloading purposes
Expand Down
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.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions src/main/java/pokecube/adventures/PokecubeAdv.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fmllegacy.RegistryObject;
import net.minecraftforge.fmllegacy.network.IContainerFactory;
import net.minecraftforge.network.IContainerFactory;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import pokecube.adventures.advancements.Triggers;
import pokecube.adventures.ai.brain.MemoryTypes;
import pokecube.adventures.ai.poi.PointsOfInterest;
Expand All @@ -61,11 +61,11 @@
import pokecube.adventures.blocks.genetics.splicer.SplicerTile;
import pokecube.adventures.blocks.siphon.SiphonBlock;
import pokecube.adventures.blocks.siphon.SiphonTile;
import pokecube.adventures.blocks.warp_pad.WarpPadBlock;
import pokecube.adventures.blocks.warp_pad.WarpPadTile;
import pokecube.adventures.blocks.statue.PokemobStatue;
import pokecube.adventures.blocks.statue.StatueEntity;
import pokecube.adventures.blocks.statue.StatueItem;
import pokecube.adventures.blocks.warp_pad.WarpPadBlock;
import pokecube.adventures.blocks.warp_pad.WarpPadTile;
import pokecube.adventures.entity.trainer.LeaderNpc;
import pokecube.adventures.entity.trainer.TrainerNpc;
import pokecube.adventures.init.SetupHandler;
Expand Down Expand Up @@ -148,7 +148,7 @@ public static void registerProfessions(final RegistryEvent.Register<VillagerProf
@SubscribeEvent
public static void textureStitch(final TextureStitchEvent.Pre event)
{
if (!event.getMap().location().toString().equals("minecraft:textures/atlas/blocks.png")) return;
if (!event.getAtlas().location().toString().equals("minecraft:textures/atlas/blocks.png")) return;
event.addSprite(new ResourceLocation(PokecubeAdv.MODID, "items/slot_dna"));
event.addSprite(new ResourceLocation(PokecubeAdv.MODID, "items/slot_egg"));
event.addSprite(new ResourceLocation(PokecubeAdv.MODID, "items/slot_bottle"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import net.minecraft.world.entity.ai.village.poi.PoiType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.fmllegacy.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import pokecube.adventures.PokecubeAdv;

public class PointsOfInterest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package pokecube.adventures.ai.tasks.battle.agro;

import java.util.List;
import java.util.Map;
import java.util.function.Predicate;

Expand All @@ -12,6 +11,7 @@
import net.minecraft.world.entity.ai.behavior.BehaviorUtils;
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import net.minecraft.world.entity.ai.memory.MemoryStatus;
import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3;
Expand Down Expand Up @@ -48,8 +48,7 @@ public BaseAgroTask(final LivingEntity trainer, final float agressionProbability
}

@Override
protected boolean canStillUse(final ServerLevel worldIn, final LivingEntity entityIn,
final long gameTimeIn)
protected boolean canStillUse(final ServerLevel worldIn, final LivingEntity entityIn, final long gameTimeIn)
{
final Brain<?> brain = this.entity.getBrain();
if (!brain.hasMemoryValue(MemoryTypes.BATTLETARGET)) return false;
Expand All @@ -73,7 +72,8 @@ protected void start(final ServerLevel worldIn, final LivingEntity entityIn, fin
{
if (this.trainer.getCooldown() > gameTimeIn) return;
if (worldIn.getRandom().nextDouble() > this.chance) return;
final List<LivingEntity> mobs = this.entity.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES).get();
final NearestVisibleLivingEntities mobs = this.entity.getBrain().getMemory(
MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES).get();

// Count tame mobs as their owners, rather than seperately mobs
final Predicate<LivingEntity> tameChecker = mob ->
Expand All @@ -94,37 +94,36 @@ protected void start(final ServerLevel worldIn, final LivingEntity entityIn, fin
final int rep_cap = PokecubeAdv.config.trainer_max_rep;
final int drep = rep_cap - rep_base;

for (LivingEntity mob : mobs)
if (this.isValidTarget(mob) && tameChecker.test(mob))
for (LivingEntity mob : mobs.findAll(mob -> this.isValidTarget(mob) && tameChecker.test(mob)))
{
if (mob instanceof Player && this.entity instanceof Villager)
{
final Villager villager = (Villager) this.entity;
final int rep = villager.getPlayerReputation((Player) mob) + rep_base;
double s1 = s;
if (rep > rep_cap) s1 = 0;
else if (rep < rep_base) s1 *= 2;
else s1 *= (rep_cap - rep) / drep;
line = entityIn.getViewVector(1).multiply(s1, s1, s1);
end = start.add(line);
}

final boolean lookingAt = mob.getBoundingBox().clip(start, end).isPresent();
if (!lookingAt)
{
if (mob instanceof Player && this.entity instanceof Villager)
{
final Villager villager = (Villager) this.entity;
final int rep = villager.getPlayerReputation((Player) mob) + rep_base;
double s1 = s;
if (rep > rep_cap) s1 = 0;
else if (rep < rep_base) s1 *= 2;
else s1 *= (rep_cap - rep) / drep;
line = entityIn.getViewVector(1).multiply(s1, s1, s1);
end = start.add(line);
}

final boolean lookingAt = mob.getBoundingBox().clip(start, end).isPresent();
if (!lookingAt)
{
BehaviorUtils.lookAtEntity(this.entity, mob);
return;
}
final IOwnable owned = OwnableCaps.getOwnable(mob);
LivingEntity owner;
// Agro the owner of the mob, instead of the mob itself in this
// case.
if (owned != null && (owner = owned.getOwner(worldIn)) != null) mob = owner;
this.timer = 0;
this.target = mob;
this.trainer.onSetTarget(mob);
BehaviorUtils.lookAtEntity(this.entity, mob);
return;
}
final IOwnable owned = OwnableCaps.getOwnable(mob);
LivingEntity owner;
// Agro the owner of the mob, instead of the mob itself in this
// case.
if (owned != null && (owner = owned.getOwner(worldIn)) != null) mob = owner;
this.timer = 0;
this.target = mob;
this.trainer.onSetTarget(mob);
return;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import net.minecraftforge.eventbus.api.SubscribeEvent;
import pokecube.adventures.PokecubeAdv;
import pokecube.adventures.blocks.siphon.SiphonTile;
import pokecube.adventures.blocks.warp_pad.WarpPadTile;
import pokecube.adventures.blocks.statue.StatueEntity;
import pokecube.adventures.blocks.warp_pad.WarpPadTile;
import thut.api.IOwnable;
import thut.api.LinkableCaps.ILinkStorage;
import thut.api.LinkableCaps.Linkable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public BlockState getStateForPlacement(final BlockPlaceContext context)
public BlockState updateShape(final BlockState state, final Direction facing, final BlockState facingState,
final LevelAccessor world, final BlockPos currentPos, final BlockPos facingPos)
{
if (state.getValue(ClonerBlock.WATERLOGGED)) world.getLiquidTicks().scheduleTick(currentPos, Fluids.WATER,
if (state.getValue(ClonerBlock.WATERLOGGED)) world.scheduleTick(currentPos, Fluids.WATER,
Fluids.WATER.getTickDelay(world));
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public BlockState getStateForPlacement(final BlockPlaceContext context)
public BlockState updateShape(final BlockState state, final Direction facing, final BlockState facingState,
final LevelAccessor world, final BlockPos currentPos, final BlockPos facingPos)
{
if (state.getValue(ExtractorBlock.WATERLOGGED)) world.getLiquidTicks().scheduleTick(currentPos, Fluids.WATER,
if (state.getValue(ExtractorBlock.WATERLOGGED)) world.scheduleTick(currentPos, Fluids.WATER,
Fluids.WATER.getTickDelay(world));
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public BlockState getStateForPlacement(final BlockPlaceContext context)
public BlockState updateShape(final BlockState state, final Direction facing, final BlockState facingState, final LevelAccessor world, final BlockPos currentPos,
final BlockPos facingPos)
{
if (state.getValue(SplicerBlock.WATERLOGGED)) world.getLiquidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
if (state.getValue(SplicerBlock.WATERLOGGED)) world.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public BlockState getStateForPlacement(final BlockPlaceContext context)
public BlockState updateShape(final BlockState state, final Direction facing, final BlockState facingState,
final LevelAccessor world, final BlockPos currentPos, final BlockPos facingPos)
{
if (state.getValue(SiphonBlock.WATERLOGGED)) world.getLiquidTicks().scheduleTick(currentPos, Fluids.WATER,
if (state.getValue(SiphonBlock.WATERLOGGED)) world.scheduleTick(currentPos, Fluids.WATER,
Fluids.WATER.getTickDelay(world));
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public VoxelShape getShape(final BlockState state, final BlockGetter worldIn, fi
public BlockState updateShape(final BlockState state, final Direction facing, final BlockState facingState,
final LevelAccessor world, final BlockPos currentPos, final BlockPos facingPos)
{
if (state.getValue(BlockStateProperties.WATERLOGGED)) world.getLiquidTicks().scheduleTick(currentPos,
if (state.getValue(BlockStateProperties.WATERLOGGED)) world.scheduleTick(currentPos,
Fluids.WATER, Fluids.WATER.getTickDelay(world));
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void checkMob()
public ClientboundBlockEntityDataPacket getUpdatePacket()
{
this.checkMob();
return new ClientboundBlockEntityDataPacket(this.worldPosition, 6, this.getUpdateTag());
return ClientboundBlockEntityDataPacket.create(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.SimpleMenuProvider;
import net.minecraft.world.entity.Entity;
import net.minecraftforge.fmllegacy.network.NetworkHooks;
import net.minecraftforge.network.NetworkHooks;
import pokecube.adventures.capabilities.CapabilityHasPokemobs.IHasPokemobs;
import pokecube.adventures.capabilities.TrainerCaps;
import pokecube.adventures.inventory.trainer.ContainerTrainer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.trading.MerchantOffer;
import net.minecraft.world.level.Level;
import net.minecraftforge.fmllegacy.common.registry.IEntityAdditionalSpawnData;
import net.minecraftforge.entity.IEntityAdditionalSpawnData;
import pokecube.adventures.PokecubeAdv;
import pokecube.adventures.capabilities.CapabilityHasPokemobs.IHasPokemobs;
import pokecube.adventures.capabilities.CapabilityNPCAIStates.IHasNPCAIStates;
Expand Down
Loading

0 comments on commit 5cc8f1c

Please sign in to comment.