Skip to content

Commit

Permalink
1.20 changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanishisherewithhh committed Jul 15, 2023
1 parent dd84758 commit 8a50fed
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ modrinth {
versionNumber = project.version // will fail if it already exists
versionType = "release" // "alpha" "beta" or "release"
uploadFile = remapJar // loom = "remapJar" (else "jar")
gameVersions = ["1.19.4"] // array
gameVersions = ["1.20","1.20.1"] // array
loaders = ["fabric"]
dependencies {
required.project "fabric-api"
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.19
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.1
loader_version=0.14.21

# Mod Properties
mod_version = 2.0.0
maven_group = com.lumaa
archives_base_name = act

# Dependencies
fabric_version=0.81.1+1.19.4
fabric_version=0.83.1+1.20.1
#libu_version=1.3.2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions src/main/java/com/lumaa/act/ActorData.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void onInitialize() {
// Add the actors to the world and send S2C packets
for (ActorEntity actor : actors) {
Movement.stopMoving(actor);
ServerWorld actorWorld = server.getWorld(actor.world.getRegistryKey());
ServerWorld actorWorld = server.getWorld(actor.getWorld().getRegistryKey());
assert actorWorld != null;
actor.networkHandler = new ServerPlayNetworkHandler(server, new ClientConnection(NetworkSide.CLIENTBOUND), actor);
actor.sendProfileUpdatePacket();
Expand Down Expand Up @@ -114,7 +114,7 @@ private void saveActorEntities(List<ActorEntity> actors, NbtCompound nbt,String
actorNbt.putFloat("Yaw", actor.getYaw());
actorNbt.putFloat("Health", actor.getHealth());
actorNbt.putString("World", actor.getWorld().toString());
actorNbt.putString("Dimension",actor.world.getRegistryKey().getValue().toString());
actorNbt.putString("Dimension",actor.getWorld().getRegistryKey().getValue().toString());
actorNbt.putString("Name", actor.gameProfile.getName());
actorNbt.putUuid("UUID", actor.getUuid());
actorNbt.putBoolean("OnFire",actor.isOnFire());
Expand Down Expand Up @@ -175,7 +175,7 @@ private List<ActorEntity> loadActorEntities(NbtCompound nbt, MinecraftServer ser
actor.setOnFire(onfire);

//Check for world and Dimension
if (!Objects.equals(ActorDimension, actor.world.getRegistryKey().getValue().toString())) continue;
if (!Objects.equals(ActorDimension, actor.getWorld().getRegistryKey().getValue().toString())) continue;

// Load the inventory
NbtList inventoryList = actorNtb.getList("Inventory", 10);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/lumaa/act/ai/Pathfinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Pathfinder(ActorAI ai) {
this.actor = ai.actor;
this.movement = ai.movement;
this.action = ai.action;
this.world = ai.actor.world;
this.world = ai.actor.getWorld();
}

public void setPositions(BlockPos origin, BlockPos destination) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/lumaa/act/entity/ActorEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void setAllPartsVisible(boolean visible) {
}
public void checkAndTeleport(PlayerEntity player) {
// Check if the actor is in the Nether or the End
if (this.world.getRegistryKey() == World.OVERWORLD||this.world.getRegistryKey() == World.NETHER || this.world.getRegistryKey() == World.END) {
if (this.getWorld().getRegistryKey() == World.OVERWORLD||this.getWorld().getRegistryKey() == World.NETHER || this.getWorld().getRegistryKey() == World.END) {
// Get the actor's position
BlockPos actorPos = this.getBlockPos();
// Search for Nether and End portal blocks in a 2x2x2 area around the actor
Expand All @@ -83,7 +83,7 @@ public void checkAndTeleport(PlayerEntity player) {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
BlockPos pos = actorPos.add(x, y, z);
BlockState state = world.getBlockState(pos);
BlockState state = getWorld().getBlockState(pos);
if (state.isOf(Blocks.NETHER_PORTAL) || state.isOf(Blocks.END_PORTAL)) {
// Found a Nether or End portal block
portalPos = pos;
Expand All @@ -92,9 +92,9 @@ public void checkAndTeleport(PlayerEntity player) {
}
}
}
if (portalPos != null && player.world.getRegistryKey() != this.world.getRegistryKey()) {
if (portalPos != null && player.getWorld().getRegistryKey() != this.getWorld().getRegistryKey()) {
// There is a portal nearby and the player is in a different dimension, teleport the actor to the player's position
ServerWorld targetWorld = this.getServer().getWorld(player.world.getRegistryKey());
ServerWorld targetWorld = this.getServer().getWorld(player.getWorld().getRegistryKey());
this.teleport(targetWorld, player.getBlockPos());
}
}
Expand Down Expand Up @@ -164,7 +164,7 @@ public void teleport(ServerWorld world, BlockPos pos) {
}

public void teleport(BlockPos pos) {
teleport(this.getWorld().toServerWorld(), pos.getX() + 0.5d, pos.getY(), pos.getZ() + 0.5d, 0, 0);
teleport(this.getServerWorld(), pos.getX() + 0.5d, pos.getY(), pos.getZ() + 0.5d, 0, 0);
}

public void teleport(Vec3d movement) {
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/lumaa/act/item/ActItems.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.lumaa.act.item;

import com.lumaa.act.ActMod;
import com.lumaa.act.entity.ActorEntity;
import com.lumaa.act.item.stick.*;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.minecraft.item.*;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;

import java.util.List;
Expand All @@ -20,7 +19,7 @@ public class ActItems {
public static final Item SPEEDMANAGER_STICK = registerItem("speedmanager_stick", new SpeedManagerStick(new Item.Settings()), ItemGroups.FUNCTIONAL);
// public static final Item TEST_STICK = registerItem("test_stick", new TestStick(new Item.Settings()), ItemGroups.OPERATOR);

public static Item registerItem(String name, Item item, ItemGroup group) {
public static Item registerItem(String name, Item item, RegistryKey<ItemGroup> group) {
Item newItem = Registry.register(Registries.ITEM, new Identifier(ActMod.MODID, name), item);

// put in item group
Expand All @@ -30,7 +29,7 @@ public static Item registerItem(String name, Item item, ItemGroup group) {
}

// can be used for new 1.19.3+ creative inventory system
private static Item registerItem(String name, Item item, List<ItemGroup> tabs) {
private static Item registerItem(String name, Item item, List<RegistryKey<ItemGroup>> tabs) {
Item newItem = Registry.register(Registries.ITEM, new Identifier(ActMod.MODID, name), item);

// put in item group
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
],

"depends": {
"fabricloader": ">=0.14.18",
"fabric-api": ">=0.76.0",
"minecraft": "~1.19.4",
"fabricloader": ">=0.14.21",
"fabric-api": ">=0.85.0",
"minecraft": "~1.20.1",
"java": ">=17"
}
}

0 comments on commit 8a50fed

Please sign in to comment.