Skip to content

Commit

Permalink
Update to 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Dec 1, 2021
1 parent 6aa22d5 commit 2aee248
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 49 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,7 @@
# Impaled - Changelog:

### Impaled 1.0.2 - 1.18
- Updated to Minecraft 1.18

### Impaled 1.0.1 - 1.17
- Updated to Minecraft 1.17
2 changes: 1 addition & 1 deletion build.gradle
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'org.ajoberstar.grgit' version '3.1.1'
Expand Down
11 changes: 0 additions & 11 deletions changelog.md

This file was deleted.

16 changes: 10 additions & 6 deletions gradle.properties
Expand Up @@ -2,15 +2,19 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
minecraft_version=1.17
yarn_mappings=1.17+build.11
loader_version=0.11.6


minecraft_version=1.18
yarn_mappings=1.18+build.1
loader_version=0.12.8

#Fabric api
fabric_version=0.35.1+1.17
fabric_version=0.43.1+1.18



# Mod Properties
mod_version = 1.0.1
mod_version = 1.0.2
maven_group = io.github.ladysnake
archives_base_name = impaled

Expand All @@ -24,7 +28,7 @@ vanguard_version=1.0.+
owners = Ladysnake
license_header = CC-BY-NC-SA+4.0
curseforge_id = 478843
curseforge_versions = 1.17
curseforge_versions = 1.18
cf_requirements = fabric-api
release_type = release
changelog_url = https://github.com/Ladysnake/Impaled/blob/main/CHANGELOG.md
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 0 additions & 4 deletions src/CHANGELOG.md

This file was deleted.

Expand Up @@ -10,7 +10,7 @@

public final class BetterLoyalty {
public static boolean tryInsertTrident(ItemStack stack, PlayerEntity player) {
NbtCompound tag = stack.getSubTag(LoyalTrident.MOD_NBT_KEY);
NbtCompound tag = stack.getSubNbt(LoyalTrident.MOD_NBT_KEY);
if (tag != null) {
TridentRecaller caller = (TridentRecaller) player;

Expand Down
Expand Up @@ -31,7 +31,7 @@ public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int
trident.setTridentAttributes(world, user, stack);
trident.setOwner(user);
trident.setTridentStack(stack);
trident.setProperties(user, user.getPitch(), user.getYaw(), 0.0F, 2.5F, 1.0F);
trident.setVelocity(user, user.getPitch(), user.getYaw(), 0.0F, 2.5F, 1.0F);
trident.updatePosition(user.getX()+user.getRandom().nextGaussian(), user.getEyeY()+user.getRandom().nextGaussian(), user.getZ()+user.getRandom().nextGaussian());
trident.addVelocity(user.getRandom().nextGaussian()/10, 0, user.getRandom().nextGaussian()/10);

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/ladysnake/impaled/common/item/HellforkItem.java
Expand Up @@ -71,32 +71,32 @@ public void inventoryTick(ItemStack stack, World world, Entity entity, int slot,
}

if (hellfork != null) {
if (hellfork.getTag() != null && hellfork.getTag().contains("Heated")) {
if (hellfork.getTag().getBoolean("Heated")) {
if (hellfork.getNbt() != null && hellfork.getNbt().contains("Heated")) {
if (hellfork.getNbt().getBoolean("Heated")) {
if (entity.getFireTicks() <= 0) {
entity.setFireTicks(35);
}
}
} else {
hellfork.getTag().putBoolean("Heated", false);
hellfork.getNbt().putBoolean("Heated", false);
}
}
}
}

@Override
public ActionResult useOnBlock(ItemUsageContext context) {
if (context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.LAVA_CAULDRON && !context.getStack().getTag().getBoolean("Heated")) {
context.getStack().getTag().putBoolean("Heated", true);
if (context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.LAVA_CAULDRON && !context.getStack().getNbt().getBoolean("Heated")) {
context.getStack().getNbt().putBoolean("Heated", true);
context.getWorld().playSound(context.getPlayer().getX(), context.getPlayer().getY(), context.getPlayer().getZ(), SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.PLAYERS, 1.0f, 1.0f, false);
context.getWorld().playSound(context.getPlayer().getX(), context.getPlayer().getY(), context.getPlayer().getZ(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.PLAYERS, 1.0f, 1.0f, false);
context.getWorld().setBlockState(context.getBlockPos(), Blocks.CAULDRON.getDefaultState());
for (int i = 0; i < 20; i++) {
context.getWorld().addParticle(ParticleTypes.LAVA, context.getBlockPos().getX()+.5+context.getWorld().getRandom().nextGaussian()/10, context.getBlockPos().getY()+.5+context.getWorld().getRandom().nextGaussian()/10, context.getBlockPos().getZ()+.5+context.getWorld().getRandom().nextGaussian()/10, 0, context.getWorld().getRandom().nextFloat()/10, 0);
}
return ActionResult.SUCCESS;
} else if ((context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.WATER_CAULDRON || context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.POWDER_SNOW_CAULDRON) && context.getStack().getTag().getBoolean("Heated")) {
context.getStack().getTag().putBoolean("Heated", false);
} else if ((context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.WATER_CAULDRON || context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.POWDER_SNOW_CAULDRON) && context.getStack().getNbt().getBoolean("Heated")) {
context.getStack().getNbt().putBoolean("Heated", false);
context.getWorld().playSound(context.getPlayer().getX(), context.getPlayer().getY(), context.getPlayer().getZ(), SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, SoundCategory.PLAYERS, 1.0f, 1.0f, false);
context.getWorld().playSound(context.getPlayer().getX(), context.getPlayer().getY(), context.getPlayer().getZ(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.PLAYERS, 1.0f, 1.0f, false);
context.getWorld().setBlockState(context.getBlockPos(), Blocks.CAULDRON.getDefaultState());
Expand All @@ -113,7 +113,7 @@ public ActionResult useOnBlock(ItemUsageContext context) {
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
super.appendTooltip(stack, world, tooltip, context);

if (stack.getTag().getBoolean("Heated")) {
if (stack.getNbt().getBoolean("Heated")) {
tooltip.add(new TranslatableText("tooltip.impaled.heated").formatted(Formatting.GOLD));
}
}
Expand Down
Expand Up @@ -105,7 +105,7 @@ protected boolean canRiptide(PlayerEntity playerEntity) {
impaledTridentEntity.setTridentAttributes(world, user, stack);
impaledTridentEntity.setOwner(user);
impaledTridentEntity.setTridentStack(stack);
impaledTridentEntity.setProperties(user, user.getPitch(), user.getYaw(), 0.0F, 2.5F, 1.0F);
impaledTridentEntity.setVelocity(user, user.getPitch(), user.getYaw(), 0.0F, 2.5F, 1.0F);
impaledTridentEntity.updatePosition(user.getX(), user.getEyeY() - 0.1, user.getZ());
return impaledTridentEntity;
}
Expand Down
Expand Up @@ -67,7 +67,7 @@ public void usageTick(World world, LivingEntity user, ItemStack maelstromStack,
trident = ((ImpaledTridentItem) stackToThrow.getItem()).createTrident(world, user, stackToThrow);
} else if (stackToThrow.getItem() instanceof TridentItem) {
trident = new TridentEntity(world, user, stackToThrow);
trident.setProperties(playerEntity, playerEntity.getPitch(), playerEntity.getYaw(), 0.0F, 2.5F, 1.0F);
trident.setVelocity(playerEntity, playerEntity.getPitch(), playerEntity.getYaw(), 0.0F, 2.5F, 1.0F);
}

if (trident != null) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/ladysnake/sincereloyalty/LoyalTrident.java
Expand Up @@ -45,7 +45,7 @@ static LoyalTrident of(TridentEntity trident) {

@Nullable
static UUID getTridentUuid(ItemStack stack) {
NbtCompound loyaltyData = stack.getSubTag(LoyalTrident.MOD_NBT_KEY);
NbtCompound loyaltyData = stack.getSubNbt(LoyalTrident.MOD_NBT_KEY);
if (loyaltyData == null || !loyaltyData.containsUuid(TRIDENT_OWNER_NBT_KEY)) {
return null;
}
Expand All @@ -56,25 +56,25 @@ static UUID getTridentUuid(ItemStack stack) {
}

static void setPreferredSlot(ItemStack tridentStack, int slot) {
tridentStack.getOrCreateSubTag(LoyalTrident.MOD_NBT_KEY).putInt(LoyalTrident.RETURN_SLOT_NBT_KEY, slot);
tridentStack.getOrCreateSubNbt(LoyalTrident.MOD_NBT_KEY).putInt(LoyalTrident.RETURN_SLOT_NBT_KEY, slot);
}

static boolean hasTrueOwner(ItemStack tridentStack) {
if (SincereLoyalty.TRIDENTS.contains(tridentStack.getItem()) && EnchantmentHelper.getLoyalty(tridentStack) > 0) {
NbtCompound loyaltyNbt = tridentStack.getSubTag(MOD_NBT_KEY);
NbtCompound loyaltyNbt = tridentStack.getSubNbt(MOD_NBT_KEY);
return loyaltyNbt != null && loyaltyNbt.containsUuid(TRIDENT_OWNER_NBT_KEY);
}
return false;
}

@Nullable
static UUID getTrueOwner(ItemStack tridentStack) {
return hasTrueOwner(tridentStack) ? Objects.requireNonNull(tridentStack.getSubTag(MOD_NBT_KEY)).getUuid(TRIDENT_OWNER_NBT_KEY) : null;
return hasTrueOwner(tridentStack) ? Objects.requireNonNull(tridentStack.getSubNbt(MOD_NBT_KEY)).getUuid(TRIDENT_OWNER_NBT_KEY) : null;
}

@Nullable
static TridentEntity spawnTridentForStack(Entity thrower, ItemStack tridentStack) {
NbtCompound loyaltyData = tridentStack.getSubTag(MOD_NBT_KEY);
NbtCompound loyaltyData = tridentStack.getSubNbt(MOD_NBT_KEY);
if (loyaltyData != null) {
UUID ownerUuid = loyaltyData.getUuid(TRIDENT_OWNER_NBT_KEY);
if (ownerUuid != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ladysnake/sincereloyalty/SincereLoyalty.java
Expand Up @@ -63,7 +63,7 @@ public void onInitialize() {
return false;
}

LoyalTridentStorage loyalTridentStorage = LoyalTridentStorage.get(player.getServerWorld());
LoyalTridentStorage loyalTridentStorage = LoyalTridentStorage.get(player.getWorld());
TridentRecaller.RecallStatus newRecallStatus;
if (loyalTridentStorage.recallTridents(player)) {
newRecallStatus = TridentRecaller.RecallStatus.RECALLING;
Expand All @@ -79,7 +79,7 @@ public void onInitialize() {
TridentRecaller.RecallStatus requested = buf.readEnumConstant(TridentRecaller.RecallStatus.class);

server.execute(() -> {
LoyalTridentStorage loyalTridentStorage = LoyalTridentStorage.get(player.getServerWorld());
LoyalTridentStorage loyalTridentStorage = LoyalTridentStorage.get(player.getWorld());
TridentRecaller.RecallStatus currentRecallStatus = ((TridentRecaller) player).getCurrentRecallStatus();
TridentRecaller.RecallStatus newRecallStatus;

Expand Down
Expand Up @@ -41,7 +41,7 @@ private void updateTridentInInventory(ItemStack stack, World world, Entity entit
if (entity.age % 10 == 0 && !entity.world.isClient && entity instanceof PlayerEntity) {
UUID trueOwner = LoyalTrident.getTrueOwner(stack);
if (Objects.equals(trueOwner, entity.getUuid())) {
NbtCompound loyaltyData = Objects.requireNonNull(stack.getSubTag(LoyalTrident.MOD_NBT_KEY));
NbtCompound loyaltyData = Objects.requireNonNull(stack.getSubNbt(LoyalTrident.MOD_NBT_KEY));
if (!Objects.equals(entity.getEntityName(), loyaltyData.getString(LoyalTrident.OWNER_NAME_NBT_KEY))) {
loyaltyData.putString(LoyalTrident.OWNER_NAME_NBT_KEY, entity.getEntityName());
}
Expand Down
Expand Up @@ -29,7 +29,7 @@
public abstract class ServerPlayNetworkHandlerMixin {
@ModifyVariable(method = "onCreativeInventoryAction", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/network/packet/c2s/play/CreativeInventoryActionC2SPacket;getItemStack()Lnet/minecraft/item/ItemStack;"))
private ItemStack removeTridentUuid(ItemStack copiedStack) {
NbtCompound NbtCompound = copiedStack.getSubTag(LoyalTrident.MOD_NBT_KEY);
NbtCompound NbtCompound = copiedStack.getSubNbt(LoyalTrident.MOD_NBT_KEY);
if (NbtCompound != null) {
NbtCompound.remove(LoyalTrident.TRIDENT_UUID_NBT_KEY); // prevent stupid copies of the exact same trident
}
Expand Down
Expand Up @@ -74,7 +74,7 @@ private ItemStack updateResult(ItemStack initialResult) {
// we can mutate the map as it is recreated with every call to getEnchantments
enchantments.put(Enchantments.LOYALTY, Enchantments.LOYALTY.getMaxLevel() + 1);
EnchantmentHelper.set(enchantments, result);
NbtCompound loyaltyData = result.getOrCreateSubTag(LoyalTrident.MOD_NBT_KEY);
NbtCompound loyaltyData = result.getOrCreateSubNbt(LoyalTrident.MOD_NBT_KEY);
loyaltyData.putUuid(LoyalTrident.TRIDENT_OWNER_NBT_KEY, this.player.getUuid());
loyaltyData.putString(LoyalTrident.OWNER_NAME_NBT_KEY, this.player.getEntityName());
return result;
Expand Down
Expand Up @@ -31,7 +31,7 @@

@Mixin(TridentItem.class)
public abstract class TridentItemMixin {
@ModifyVariable(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/TridentEntity;setProperties(Lnet/minecraft/entity/Entity;FFFFF)V"))
@ModifyVariable(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/TridentEntity;setVelocity(Lnet/minecraft/entity/Entity;FFFFF)V"))
private TridentEntity setTridentReturnSlot(TridentEntity trident, ItemStack stack, World world, LivingEntity user) {
LoyalTrident.of(trident).loyaltrident_setReturnSlot(user.getActiveHand() == Hand.OFF_HAND ? -1 : ((PlayerEntity) user).getInventory().selectedSlot);
return trident;
Expand Down
Expand Up @@ -46,7 +46,7 @@
public abstract class ItemStackMixin {

@Shadow
public abstract NbtCompound getSubTag(String key);
public abstract NbtCompound getSubNbt(String key);

@Nullable
@Unique
Expand All @@ -55,7 +55,7 @@ public abstract class ItemStackMixin {

@Inject(method = "getTooltip", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;appendEnchantments(Ljava/util/List;Lnet/minecraft/nbt/NbtList;)V"))
private void captureThis(PlayerEntity player, TooltipContext context, CallbackInfoReturnable<List<Text>> cir) {
NbtCompound loyaltyNbt = this.getSubTag(LoyalTrident.MOD_NBT_KEY);
NbtCompound loyaltyNbt = this.getSubNbt(LoyalTrident.MOD_NBT_KEY);
if (loyaltyNbt != null && loyaltyNbt.contains(LoyalTrident.OWNER_NAME_NBT_KEY)) {
impaled$trueOwnerName = loyaltyNbt.getString(LoyalTrident.OWNER_NAME_NBT_KEY);
impaled$riptide = EnchantmentHelper.getRiptide((ItemStack) (Object) this) > 0;
Expand Down
Expand Up @@ -58,7 +58,7 @@ public TridentEntity findTrident() {
if (player != null) {
for (int slot = 0; slot < player.getInventory().size(); slot++) {
ItemStack stack = player.getInventory().getStack(slot);
NbtCompound loyaltyData = stack.getSubTag(LoyalTrident.MOD_NBT_KEY);
NbtCompound loyaltyData = stack.getSubNbt(LoyalTrident.MOD_NBT_KEY);
if (loyaltyData != null && loyaltyData.containsUuid(LoyalTrident.TRIDENT_UUID_NBT_KEY)) {
if (loyaltyData.getUuid(LoyalTrident.TRIDENT_UUID_NBT_KEY).equals(this.tridentUuid)) {
TridentEntity tridentEntity = LoyalTrident.spawnTridentForStack(player, stack);
Expand Down

0 comments on commit 2aee248

Please sign in to comment.