Skip to content

Commit

Permalink
Merge branch 'release/1.0.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
NatoBoram committed Jun 9, 2022
2 parents 81ad4ca + 27e956f commit a21e836
Show file tree
Hide file tree
Showing 24 changed files with 138 additions and 118 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# GitLab CI
.env

# MinePkg
minecraft

# Fabric

# gradle
Expand Down Expand Up @@ -253,7 +256,7 @@ Temporary Items
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
#!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

Expand Down
19 changes: 10 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ dotenv:
image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: .pre
script:
- echo "VERSION=$(echo $CI_COMMIT_TAG | cut -c 2-)" > .env
- echo "VERSION=$(cat gradle.properties | grep 'mod_version' | cut -d '=' -f 2)" > .env
- echo "MINECRAFT=$(cat gradle.properties | grep 'minecraft_version' | cut -d '=' -f 2)" >> .env
- cat .env
only:
- tags
Expand Down Expand Up @@ -88,15 +89,15 @@ release:
description: "$CI_COMMIT_MESSAGE"
assets:
links:
- name: "switcheroo-$CI_COMMIT_TAG-dev.jar"
url: "https://gitlab.com/NatoBoram/fabric-switcheroo/-/jobs/artifacts/$CI_COMMIT_TAG/raw/build/libs/switcheroo-$VERSION-dev.jar?job=build"
- name: "switcheroo-$CI_COMMIT_TAG+$MINECRAFT-dev.jar"
url: "https://gitlab.com/NatoBoram/fabric-switcheroo/-/jobs/artifacts/$CI_COMMIT_TAG/raw/build/libs/switcheroo-$VERSION+$MINECRAFT-dev.jar?job=build"
link_type: "package"
- name: "switcheroo-$CI_COMMIT_TAG-sources-dev.jar"
url: "https://gitlab.com/NatoBoram/fabric-switcheroo/-/jobs/artifacts/$CI_COMMIT_TAG/raw/build/libs/switcheroo-$VERSION-sources-dev.jar?job=build"
- name: "switcheroo-$CI_COMMIT_TAG+$MINECRAFT-sources-dev.jar"
url: "https://gitlab.com/NatoBoram/fabric-switcheroo/-/jobs/artifacts/$CI_COMMIT_TAG/raw/build/libs/switcheroo-$VERSION+$MINECRAFT-sources-dev.jar?job=build"
link_type: "other"
- name: "switcheroo-$CI_COMMIT_TAG-sources.jar"
url: "https://gitlab.com/NatoBoram/fabric-switcheroo/-/jobs/artifacts/$CI_COMMIT_TAG/raw/build/libs/switcheroo-$VERSION-sources.jar?job=build"
- name: "switcheroo-$CI_COMMIT_TAG+$MINECRAFT-sources.jar"
url: "https://gitlab.com/NatoBoram/fabric-switcheroo/-/jobs/artifacts/$CI_COMMIT_TAG/raw/build/libs/switcheroo-$VERSION+$MINECRAFT-sources.jar?job=build"
link_type: "other"
- name: "switcheroo-$CI_COMMIT_TAG.jar"
url: "https://gitlab.com/NatoBoram/fabric-switcheroo/-/jobs/artifacts/$CI_COMMIT_TAG/raw/build/libs/switcheroo-$VERSION.jar?job=build"
- name: "switcheroo-$CI_COMMIT_TAG+$MINECRAFT.jar"
url: "https://gitlab.com/NatoBoram/fabric-switcheroo/-/jobs/artifacts/$CI_COMMIT_TAG/raw/build/libs/switcheroo-$VERSION+$MINECRAFT.jar?job=build"
link_type: "package"
9 changes: 9 additions & 0 deletions .minepkg-lock.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# You should not edit this file.
# It was generated by minepkg.

lockfileVersion = 1

[fabric]
minecraft = "1.19"
fabricLoader = "0.14.7"
mapping = "1.19+build.1"
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"gitlab.gitlab-workflow",
"redhat.vscode-xml",
"shengchen.vscode-checkstyle",
"tamasfe.even-better-toml",
"visualstudioexptteam.vscodeintellicode",
"vscjava.vscode-gradle",
"vscjava.vscode-java-pack"
Expand All @@ -18,6 +19,7 @@
"firefox-devtools.vscode-firefox-debug",
"golang.go",
"ms-vscode.powershell-preview",
"ms-vscode.powershell"
"ms-vscode.powershell",
"vscjava.vscode-spring-initializr"
]
}
27 changes: 0 additions & 27 deletions .vscode/launch.json

This file was deleted.

7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"editor.rulers": [
120
],
"editor.rulers": [120],
"editor.wordWrapColumn": 120,
"explorer.compactFolders": true,
"explorer.fileNesting.patterns": {
"minepkg.toml": ".minepkg-lock.toml"
},
"files.associations": {
"*.launch": "xml"
},
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/) and this

### Security

## [1.0.8] - 2022-06-8

* Updated to Minecraft 1.19

## [1.0.7] - 2021-11-30

* Updated to Minecraft 1.18
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# [Switcheroo](https://gitlab.com/NatoBoram/fabric-switcheroo)

[![Modrinth Downloads](https://img.shields.io/badge/dynamic/json?color=5da426&label=Modrinth&query=downloads&suffix=%20downloads&url=https%3A%2F%2Fapi.modrinth.com%2Fapi%2Fv1%2Fmod%2Fwq6HaMZG)](https://modrinth.com/mod/switcheroo)
[![minepkg](https://img.shields.io/badge/dynamic/json?color=ff9800&label=minepkg&query=stats.totalDownloads&suffix=%20downloads&url=https%3A%2F%2Fapi.preview.minepkg.io%2Fv1%2Fprojects%2Fswitcheroo)](https://preview.minepkg.io/projects/switcheroo)
[![CurseForge Downloads](https://img.shields.io/badge/dynamic/json?color=f16436&label=CurseForge&query=downloads.total&suffix=%20downloads&url=https%3A%2F%2Fapi.cfwidget.com%2F441128)](https://www.curseforge.com/minecraft/mc-mods/switcheroo)
[![Planet Minecraft](https://img.shields.io/badge/Planet%20Minecraft-download-3366cc)](https://www.planetminecraft.com/mod/switcheroo-5459816/)
[![pipeline status](https://gitlab.com/NatoBoram/fabric-switcheroo/badges/master/pipeline.svg)](https://gitlab.com/NatoBoram/fabric-switcheroo/-/commits/master)
[![StackShare](https://img.shields.io/badge/tech-stack-0690fa.svg?style=flat)](https://stackshare.io/NatoBoram/switcheroo)

Expand All @@ -16,7 +18,7 @@ Switch your currently held item for an effective item when clicking on a block.
Switcheroo will use the least effective tool that's still effective to break blocks and the most damaging item per seconds
to attack entities.

![Switcheroo Demo](docs/Switcheroo Demo.webm)
[Demo](https://www.youtube.com/watch?v=JnvHyhDPlpY) | [Trailer](https://www.youtube.com/watch?v=SpE6-4D1x28) | [Meme](https://www.youtube.com/watch?v=2Wm2cTkdJzk)

## Features

Expand All @@ -31,15 +33,17 @@ to attack entities.

## Installation

[![cloth-config2](https://img.shields.io/badge/Cloth%20Config%20API-6.0.42-9cff55)](https://github.com/shedaniel/cloth-config)
[![fabric](https://img.shields.io/badge/Fabric%20API-0.43.1-dbd0b4)](https://github.com/FabricMC/fabric)
[![modmenu](https://img.shields.io/badge/Mod%20Menu-3.0.0-134bff)](https://github.com/TerraformersMC/ModMenu)
[![cloth-config2](https://img.shields.io/badge/Cloth%20Config%20API-7.0.69-9cff55)](https://github.com/shedaniel/cloth-config)
[![fabric](https://img.shields.io/badge/Fabric%20API-0.55.3-dbd0b4)](https://github.com/FabricMC/fabric)
[![modmenu](https://img.shields.io/badge/Mod%20Menu-4.0.0-134bff)](https://github.com/TerraformersMC/ModMenu)

Downloads are available in [Releases](https://gitlab.com/NatoBoram/fabric-switcheroo/-/releases). You can also test
development builds by downloading them form the [Pipelines](https://gitlab.com/NatoBoram/fabric-switcheroo/-/pipelines).

* [Modrinth](https://modrinth.com/mod/switcheroo)
* [minepkg](https://preview.minepkg.io/projects/switcheroo)
* [CurseForge](https://www.curseforge.com/minecraft/mc-mods/switcheroo)
* [Planet Minecraft](https://www.planetminecraft.com/mod/switcheroo-5459816)

## Contributing

Expand Down
15 changes: 3 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
version = "${project.mod_version}+${project.minecraft_version}"
group = project.maven_group

repositories {
Expand Down Expand Up @@ -38,9 +38,6 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.

// https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/cloth-config-fabric
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") {
exclude(group: "net.fabricmc.fabric-api")
Expand Down Expand Up @@ -86,13 +83,7 @@ jar {
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
from components.java
}
}

Expand Down
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
org.gradle.jvmargs=-Xmx1G -Dfile.encoding=UTF-8

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.18
yarn_mappings=1.18+build.1
loader_version=0.12.8
# check these on https://fabricmc.net/develop
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.7

#Fabric api
fabric_version=0.43.1+1.18
# Fabric api
fabric_version=0.55.3+1.19

# Mod Properties
mod_version=1.0.7
mod_version=1.0.8
maven_group=com.natoboram
archives_base_name=switcheroo

# Dependencies
clothconfig_version=6.0.42
modmenu_version=3.0.0
clothconfig_version=7.0.69
modmenu_version=4.0.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
26 changes: 26 additions & 0 deletions minepkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

# Preview of the minepkg.toml format! Could break anytime!
manifestVersion = 0

[package]
type = "mod"
name = "switcheroo"
description = "Switch your currently held item for an effective item when clicking on a block."
version = "1.0.8"
platform = "fabric"
license = "GPL-3.0-or-later"
source = "https://gitlab.com/NatoBoram/fabric-switcheroo"
homepage = "https://gitlab.com/NatoBoram/fabric-switcheroo"
author = "Nato Boram"

# These are global requirements
[requirements]
minecraft = ">=1.19"
fabricLoader = ">=0.14.7"

[dependencies]
cloth-config = ">=7.0.69+mpkg.1"
fabric = ">=0.55.3+1.19"

[dev]
buildCommand = "./gradlew build"
5 changes: 5 additions & 0 deletions scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

rm -rf .classpath .factorypath .gradle .project .settings .vscode/launch.json bin build run switcheroo_client.launch switcheroo_server.launch

gradle clean cleanEclipse downloadAssets genSources eclipse vscode
Empty file modified scripts/push_release.ps1
100644 → 100755
Empty file.
Empty file modified scripts/push_release.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pluginManagement {
repositories {
mavenCentral()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;

import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.command.argument.BlockStateArgumentType;
import net.minecraft.command.argument.EntitySummonArgumentType;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

Expand All @@ -29,7 +29,7 @@ public class BlockIdentifierArgumentType implements ArgumentType<Identifier> {
private static final Collection<String> EXAMPLES = Arrays.asList("stone", "minecraft:stone");

public static final DynamicCommandExceptionType NOT_FOUND_EXCEPTION = new DynamicCommandExceptionType((id) -> {
return new TranslatableText("switcheroo.error.blockNotFound", new Object[] { id });
return Text.translatable("switcheroo.error.blockNotFound", new Object[] { id });
});

public static BlockIdentifierArgumentType blockIdentifier() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/natoboram/switcheroo/BlockSwitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ && axeFilter(block, stack.getItem()))
return ActionResult.PASS;

// Get best or worst tool
if (CLIENT.options.keySprint.isPressed() || config.alwaysFastest)
if (CLIENT.options.sprintKey.isPressed() || config.alwaysFastest)
ItemStackUtil.keepFastestTools(tools, blockState);
else
ItemStackUtil.keepSlowestTools(tools, blockState);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/natoboram/switcheroo/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import me.shedaniel.autoconfig.ConfigHolder;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/natoboram/switcheroo/CropSwitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public ActionResult interact(final PlayerEntity player, final World world, final
return ActionResult.PASS;

// Check if we already have the appropriate item in hand
final CropBlock cropBlock = (CropBlock) block;
final Item seedItem = Item.fromBlock(cropBlock);
final Item seedItem = block.asItem();
final ItemStack mainHandStack = inventory.getMainHandStack();
if (mainHandStack.getItem().equals(seedItem))
return ActionResult.PASS;
Expand All @@ -73,7 +72,7 @@ public ActionResult interact(final PlayerEntity player, final World world, final

// Plant the seed!
final BlockHitResult blockHitResult = (BlockHitResult) CLIENT.crosshairTarget;
final ActionResult placeSeedResult = CLIENT.interactionManager.interactBlock(CLIENT.player, CLIENT.world, hand,
final ActionResult placeSeedResult = CLIENT.interactionManager.interactBlock(CLIENT.player, hand,
blockHitResult);
if (placeSeedResult.isAccepted() && placeSeedResult.shouldSwingHand())
CLIENT.player.swingHand(hand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;

import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.command.argument.BlockStateArgumentType;
import net.minecraft.command.argument.EntitySummonArgumentType;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

Expand All @@ -29,7 +29,7 @@ public class EntityIdentifierArgumentType implements ArgumentType<Identifier> {
private static final Collection<String> EXAMPLES = Arrays.asList("minecraft:pig", "cow");

public static final DynamicCommandExceptionType NOT_FOUND_EXCEPTION = new DynamicCommandExceptionType((id) -> {
return new TranslatableText("switcheroo.error.mobNotFound", new Object[] { id });
return Text.translatable("switcheroo.error.mobNotFound", new Object[] { id });
});

public static EntityIdentifierArgumentType entityIdentifier() {
Expand Down
Loading

0 comments on commit a21e836

Please sign in to comment.