Work more on migrations to 1.21
This commit is contained in:
parent
922f89d14c
commit
ddc7fa9952
16 changed files with 480 additions and 212 deletions
193
build.gradle
193
build.gradle
|
@ -1,23 +1,25 @@
|
|||
plugins {
|
||||
id 'dev.architectury.loom' version '1.7-SNAPSHOT'
|
||||
id 'idea'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'net.neoforged.moddev' version '2.0.76'
|
||||
}
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
|
||||
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
|
||||
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
|
||||
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
|
||||
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
|
||||
distributionType = Wrapper.DistributionType.BIN
|
||||
}
|
||||
|
||||
group = project.maven_group
|
||||
version = project.mod_version
|
||||
|
||||
base {
|
||||
archivesName = project.archives_name
|
||||
}
|
||||
|
||||
loom {
|
||||
silentMojangMappingsLicense()
|
||||
|
||||
neoforge {
|
||||
mixinConfig 'ariasessentials.mixins.json'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = 'NeoForged'
|
||||
|
@ -46,53 +48,148 @@ repositories {
|
|||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "net.minecraft:minecraft:$project.minecraft_version"
|
||||
mappings loom.officialMojangMappings()
|
||||
neoForge "net.neoforged:neoforge:$project.neoforge_version"
|
||||
neoForge {
|
||||
|
||||
// Specify the version of NeoForge to use.
|
||||
version = project.neo_version
|
||||
|
||||
// compile against the JEI API but do not include it at runtime
|
||||
modCompileOnly "mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"
|
||||
// at runtime, use the full JEI jar
|
||||
modRuntimeOnly "mezz.jei:jei-${minecraft_version}-forge:${jei_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property 'version', project.version
|
||||
|
||||
filesMatching('META-INF/mods.toml') {
|
||||
expand version: project.version
|
||||
parchment {
|
||||
mappingsVersion = project.parchment_mappings_version
|
||||
minecraftVersion = project.parchment_minecraft_version
|
||||
}
|
||||
}
|
||||
runs {
|
||||
client {
|
||||
client()
|
||||
|
||||
java {
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
server {
|
||||
server()
|
||||
programArgument '--nogui'
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.release = 21
|
||||
}
|
||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||
// By default, the server will crash when no gametests are provided.
|
||||
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||
gameTestServer {
|
||||
type = "gameTestServer"
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
// Configure Maven publishing.
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
data {
|
||||
data()
|
||||
|
||||
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
||||
// gameDirectory = project.file('run-data')
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
||||
}
|
||||
|
||||
// applies to all the run configs above
|
||||
configureEach {
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
logLevel = org.slf4j.event.Level.DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||
repositories {
|
||||
// Add repositories to publish to here.
|
||||
// Notice: This block does NOT have the same function as the block in the top level.
|
||||
// The repositories here will be used for publishing your artifact, not for
|
||||
// retrieving dependencies.
|
||||
mods {
|
||||
// define mod <-> source bindings
|
||||
// these are used to tell the game which sources are for which mod
|
||||
// mostly optional in a single mod project
|
||||
// but multi mod projects should define one per mod
|
||||
"${mod_id}" {
|
||||
sourceSet(sourceSets.main)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Include resources generated by data generators.
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
// Sets up a dependency configuration called 'localRuntime'.
|
||||
// This configuration should be used instead of 'runtimeOnly' to declare
|
||||
// a dependency that will be present for runtime testing but that is
|
||||
// "optional", meaning it will not be pulled by dependents of this mod.
|
||||
configurations {
|
||||
runtimeClasspath.extendsFrom localRuntime
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
|
||||
// compile against the JEI API but do not include it at runtime
|
||||
//compileOnly "mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"
|
||||
// at runtime, use the full JEI jar
|
||||
//runtimeOnly "mezz.jei:jei-${minecraft_version}-forge:${jei_version}"
|
||||
}
|
||||
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
|
||||
var replaceProperties = [
|
||||
minecraft_version : minecraft_version,
|
||||
minecraft_version_range: minecraft_version_range,
|
||||
neo_version : neo_version,
|
||||
neo_version_range : neo_version_range,
|
||||
loader_version_range : loader_version_range,
|
||||
mod_id : mod_id,
|
||||
mod_name : mod_name,
|
||||
mod_license : mod_license,
|
||||
mod_version : mod_version,
|
||||
mod_authors : mod_authors,
|
||||
mod_description : mod_description
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
expand replaceProperties
|
||||
from "src/main/templates"
|
||||
into "build/generated/sources/modMetadata"
|
||||
}
|
||||
|
||||
|
||||
// Include the output of "generateModMetadata" as an input directory for the build
|
||||
// this works with both building through Gradle and the IDE.
|
||||
sourceSets.main.resources.srcDir generateModMetadata
|
||||
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
|
||||
neoForge.ideSyncTask generateModMetadata
|
||||
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish plugin
|
||||
publishing {
|
||||
publications {
|
||||
register('mavenJava', MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file://${project.projectDir}/repo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
|
||||
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
||||
idea {
|
||||
module {
|
||||
downloadSources = true
|
||||
downloadJavadoc = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,49 @@
|
|||
# Done to increase the memory available to Gradle.
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.daemon=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.configuration-cache=true
|
||||
|
||||
|
||||
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
|
||||
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
|
||||
parchment_minecraft_version=1.21.1
|
||||
parchment_mappings_version=2024.11.17
|
||||
|
||||
# Mod properties
|
||||
mod_version = 1211.2.112124.2242
|
||||
maven_group = com.zontreck
|
||||
archives_name = ariasessentials
|
||||
|
||||
# Minecraft properties
|
||||
minecraft_version = 1.21.1
|
||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[1.21.1, 1.22)
|
||||
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||
neo_version=21.1.119
|
||||
# The Neo version range can use any version of Neo as bounds
|
||||
neo_version_range=[21.1.0,)
|
||||
# The loader version range can only use the major version of FML as bounds
|
||||
loader_version_range=[4,)
|
||||
|
||||
# Dependencies
|
||||
neoforge_version = 21.1.84
|
||||
yarn_mappings_patch_version = 1.21+build.4
|
||||
|
||||
|
||||
|
||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||
mod_id=ariasessentials
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=Aria's Essentials
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version = 1211.2.112124.2242
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
mod_group_id=com.zontreck.ariasessentials
|
||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||
mod_authors=zontreck
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=Essentials Mod by Aria
|
|
@ -1,10 +1,14 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven { url "https://maven.architectury.dev/" }
|
||||
maven { url "https://files.minecraftforge.net/maven/" }
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
maven { url = 'https://maven.neoforged.net/releases' }
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = 'ariasessentials'
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
|
||||
}
|
||||
|
||||
rootProject.name = 'ariasessentials'
|
|
@ -3,7 +3,6 @@ package com.zontreck;
|
|||
import com.zontreck.block.DeprecatedModBlocks;
|
||||
import com.zontreck.block.ModBlocks;
|
||||
import com.zontreck.client.TimeBoostEntityRenderer;
|
||||
import com.zontreck.commands.CommandRegistry;
|
||||
import com.zontreck.configs.client.AEClientConfig;
|
||||
import com.zontreck.configs.server.AEServerConfig;
|
||||
import com.zontreck.effects.ModEffects;
|
||||
|
@ -13,29 +12,25 @@ import com.zontreck.entities.ModEntities;
|
|||
import com.zontreck.items.DeprecatedModItems;
|
||||
import com.zontreck.items.ModItems;
|
||||
import com.zontreck.libzontreck.config.ServerConfig;
|
||||
import com.zontreck.libzontreck.util.SNbtIo;
|
||||
|
||||
import net.minecraft.client.renderer.entity.EntityRenderers;
|
||||
import net.minecraft.data.structures.NbtToSnbt;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.slf4j.ILoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.EventBusSubscriber.Bus;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.time.Instant;
|
||||
import java.util.Random;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.zontreck.items.CreativeModeTabs;
|
||||
|
||||
import net.neoforged.fml.loading.FMLLoader;
|
||||
import net.neoforged.neoforge.common.NeoForgeMod;
|
||||
|
||||
@Mod(AriasEssentials.MOD_ID)
|
||||
public final class AriasEssentials {
|
||||
|
@ -43,13 +38,12 @@ public final class AriasEssentials {
|
|||
public static final String MOD_ID = "ariasessentials";
|
||||
public static final Random random = new Random(Instant.now().getEpochSecond());
|
||||
|
||||
public AriasEssentials() {
|
||||
public AriasEssentials(IEventBus bus) {
|
||||
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
||||
// However, some things (like registries and resources) may still be
|
||||
// uninitialized.
|
||||
// Proceed with mild caution.
|
||||
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
LOGGER.info("/!\\ Loading Aria's Essentials Configuration Files /!\\");
|
||||
AEServerConfig.loadFromFile();
|
||||
AEClientConfig.loadFromFile();
|
||||
|
@ -57,6 +51,7 @@ public final class AriasEssentials {
|
|||
LOGGER.info("/!\\ DONE LOADING AECONFIG /!\\");
|
||||
|
||||
ModItems.ITEMS.register(bus);
|
||||
CreativeModeTabs.register(bus);
|
||||
ModEntities.register(bus);
|
||||
ModEffects.register(bus);
|
||||
ModPotions.register(bus);
|
||||
|
@ -67,7 +62,7 @@ public final class AriasEssentials {
|
|||
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
@EventBusSubscriber(bus = Bus.MOD, value = Dist.CLIENT)
|
||||
public static class ClientModEvents {
|
||||
@SubscribeEvent
|
||||
public static void onClientSetup(FMLClientSetupEvent ev) {
|
||||
|
|
|
@ -2,14 +2,13 @@ package com.zontreck.block;
|
|||
|
||||
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
|
||||
@Deprecated
|
||||
public class DeprecatedBlock extends Block
|
||||
{
|
||||
public DeprecatedBlock(){
|
||||
super(BlockBehaviour.Properties.copy(Blocks.STONE).instabreak());
|
||||
super(BlockBehaviour.Properties.of().instabreak());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package com.zontreck.block;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Deprecated
|
||||
public class DeprecatedBlockItem extends BlockItem
|
||||
{
|
||||
|
@ -20,8 +20,12 @@ public class DeprecatedBlockItem extends BlockItem
|
|||
super(a, new Item.Properties().fireResistant());
|
||||
}
|
||||
|
||||
public DeprecatedBlockItem(Object obj) {
|
||||
super((Block)obj, new Item.Properties().fireResistant());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFoil(ItemStack p_41453_) {
|
||||
public boolean isFoil(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,12 +38,14 @@ public class DeprecatedBlockItem extends BlockItem
|
|||
public boolean isPiglinCurrency(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack p_41421_, Level p_41422_, List<Component> p_41423_, TooltipFlag p_41424_) {
|
||||
p_41423_.add(ChatHelpers.macro("!Dark_Red!This block is deprecated"));
|
||||
p_41423_.add(ChatHelpers.macro("!Dark_Green!It would appear this block smells faintly of gold. Maybe piglins will accept it?"));
|
||||
p_41423_.add(ChatHelpers.macro("!Dark_Red!This block is scheduled for removal in a future version. You should use it before it is too late."));
|
||||
public void appendHoverText(ItemStack stack, TooltipContext context, List<Component> tooltipComponents,
|
||||
TooltipFlag tooltipFlag) {
|
||||
|
||||
tooltipComponents.add(ChatHelpers.macro("!Dark_Red!This block is deprecated"));
|
||||
tooltipComponents.add(ChatHelpers.macro("!Dark_Green!It would appear this block smells faintly of gold. Maybe piglins will accept it?"));
|
||||
tooltipComponents.add(ChatHelpers.macro("!Dark_Red!This block is scheduled for removal in a future version. You should use it before it is too late."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,25 +3,25 @@ package com.zontreck.block;
|
|||
|
||||
import com.zontreck.AriasEssentials;
|
||||
import com.zontreck.items.CreativeModeTabs;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredBlock;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
@Deprecated
|
||||
public class DeprecatedModBlocks
|
||||
{
|
||||
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, AriasEssentials.MOD_ID);
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, AriasEssentials.MOD_ID);
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(Registries.BLOCK, AriasEssentials.MOD_ID);
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(Registries.ITEM, AriasEssentials.MOD_ID);
|
||||
|
||||
|
||||
public static void register(IEventBus bus){
|
||||
|
@ -39,11 +39,11 @@ public class DeprecatedModBlocks
|
|||
|
||||
private static BlockBehaviour.Properties standardBehavior()
|
||||
{
|
||||
return BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(7F).destroyTime(6);
|
||||
return BlockBehaviour.Properties.of().requiresCorrectToolForDrops().strength(7F).destroyTime(6);
|
||||
}
|
||||
private static BlockBehaviour.Properties stoneLikeBehavior()
|
||||
{
|
||||
return BlockBehaviour.Properties.copy(Blocks.COBBLESTONE);
|
||||
return BlockBehaviour.Properties.of();
|
||||
}
|
||||
|
||||
private static BlockBehaviour.Properties explosionResistance()
|
||||
|
@ -71,11 +71,11 @@ public class DeprecatedModBlocks
|
|||
|
||||
private static BlockBehaviour.Properties stone = stoneLikeBehavior();
|
||||
|
||||
private static BlockBehaviour.Properties poolLightClean = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 15);
|
||||
private static BlockBehaviour.Properties poolLightDirty = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 12);
|
||||
private static BlockBehaviour.Properties poolLightFilthy = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 4);
|
||||
private static BlockBehaviour.Properties poolLightClean = BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).lightLevel((X) -> 15);
|
||||
private static BlockBehaviour.Properties poolLightDirty = BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).lightLevel((X) -> 12);
|
||||
private static BlockBehaviour.Properties poolLightFilthy = BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).lightLevel((X) -> 4);
|
||||
|
||||
public static RegistryObject<Block> registerDeprecated(RegistryObject<Block> blk)
|
||||
public static DeferredBlock registerDeprecated(DeferredBlock blk)
|
||||
{
|
||||
CreativeModeTabs.addToAETab(ITEMS.register(blk.getId().getPath(), ()->new DeprecatedBlockItem(blk.get())));
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@ package com.zontreck.block;
|
|||
|
||||
import com.zontreck.AriasEssentials;
|
||||
import com.zontreck.items.CreativeModeTabs;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -13,15 +15,14 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredBlock;
|
||||
|
||||
public class ModBlocks {
|
||||
|
||||
private static BlockBehaviour.StatePredicate shulkerState = (p_152653_, p_152654_, p_152655_) -> {
|
||||
|
@ -35,8 +36,8 @@ public class ModBlocks {
|
|||
};
|
||||
|
||||
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, AriasEssentials.MOD_ID);
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, AriasEssentials.MOD_ID);
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(Registries.BLOCK, AriasEssentials.MOD_ID);
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(Registries.ITEM, AriasEssentials.MOD_ID);
|
||||
|
||||
private static boolean never(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos) {
|
||||
return false;
|
||||
|
@ -58,7 +59,7 @@ public class ModBlocks {
|
|||
|
||||
private static BlockBehaviour.Properties standardBehavior()
|
||||
{
|
||||
return BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(7F).destroyTime(6).isValidSpawn(ModBlocks::neverSpawn);
|
||||
return BlockBehaviour.Properties.of().requiresCorrectToolForDrops().strength(7F).destroyTime(6).isValidSpawn(ModBlocks::neverSpawn);
|
||||
}
|
||||
private static BlockBehaviour.Properties gratingBlock()
|
||||
{
|
||||
|
@ -70,7 +71,7 @@ public class ModBlocks {
|
|||
|
||||
private static BlockBehaviour.Properties stoneLikeBehavior()
|
||||
{
|
||||
return BlockBehaviour.Properties.copy(Blocks.COBBLESTONE).isValidSpawn(ModBlocks::neverSpawn);
|
||||
return BlockBehaviour.Properties.of().isValidSpawn(ModBlocks::neverSpawn);
|
||||
}
|
||||
|
||||
private static BlockBehaviour.Properties explosionResistance()
|
||||
|
@ -100,45 +101,45 @@ public class ModBlocks {
|
|||
|
||||
private static BlockBehaviour.Properties gratingBlock = gratingBlock();
|
||||
|
||||
private static BlockBehaviour.Properties poolLightClean = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 15);
|
||||
private static BlockBehaviour.Properties poolLightDirty = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 12);
|
||||
private static BlockBehaviour.Properties poolLightFilthy = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 4);
|
||||
private static BlockBehaviour.Properties poolLightClean = BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).lightLevel((X) -> 15);
|
||||
private static BlockBehaviour.Properties poolLightDirty = BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).lightLevel((X) -> 12);
|
||||
private static BlockBehaviour.Properties poolLightFilthy = BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).lightLevel((X) -> 4);
|
||||
|
||||
|
||||
public static RegistryObject<Block> registerWithItem(RegistryObject<Block> blk, Item.Properties props)
|
||||
public static DeferredBlock registerWithItem(DeferredBlock blk, Item.Properties props)
|
||||
{
|
||||
CreativeModeTabs.addToAETab(ITEMS.register(blk.getId().getPath(), ()->new BlockItem(blk.get(), props.tab(CreativeModeTabs.AETAB))));
|
||||
CreativeModeTabs.addToAETab(ITEMS.register(blk.getId().getPath(), ()->new BlockItem(((Block)blk.get()), props.tab(CreativeModeTabs.AETAB))));
|
||||
|
||||
return blk;
|
||||
}
|
||||
|
||||
|
||||
public static List<RegistryObject<Block>> registerPoolTile(String color) {
|
||||
public static List<DeferredBlock> registerPoolTile(String color) {
|
||||
String baseNick = color.length()>1 ? color+"_pool_tile" : "pool_tile";
|
||||
List<RegistryObject<Block>> ret = new ArrayList<>();
|
||||
final RegistryObject<Block> tile1 = registerWithItem(BLOCKS.register(baseNick, ()->new Block(stone)), new Item.Properties());
|
||||
List<DeferredBlock> ret = new ArrayList<>();
|
||||
final DeferredBlock tile1 = registerWithItem(BLOCKS.register(baseNick, ()->new Block(stone)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> POOL_TILE_STAIRS = registerWithItem(BLOCKS.register(baseNick + "_stairs", ()->new StairBlock(tile1.get()::defaultBlockState, stone)), new Item.Properties());
|
||||
final DeferredBlock POOL_TILE_STAIRS = registerWithItem(BLOCKS.register(baseNick + "_stairs", ()->new StairBlock(tile1.get()::defaultBlockState, stone)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> POOL_TILE_SLAB = registerWithItem(BLOCKS.register(baseNick+"_slab", ()->new SlabBlock(stone)), new Item.Properties());
|
||||
final DeferredBlock POOL_TILE_SLAB = registerWithItem(BLOCKS.register(baseNick+"_slab", ()->new SlabBlock(stone)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> POOL_TILE_WALL = registerWithItem(BLOCKS.register(baseNick + "_wall", ()->new WallBlock(stone)), new Item.Properties());
|
||||
final DeferredBlock POOL_TILE_WALL = registerWithItem(BLOCKS.register(baseNick + "_wall", ()->new WallBlock(stone)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> POOL_LIGHT = registerWithItem(BLOCKS.register(baseNick + "_light", ()->new Block(poolLightClean)), new Item.Properties());
|
||||
final DeferredBlock POOL_LIGHT = registerWithItem(BLOCKS.register(baseNick + "_light", ()->new Block(poolLightClean)), new Item.Properties());
|
||||
|
||||
|
||||
|
||||
final RegistryObject<Block> DIRTY_POOL_TILE = registerWithItem(BLOCKS.register("dirty_" + baseNick, ()->new Block(stone)), new Item.Properties());
|
||||
final DeferredBlock DIRTY_POOL_TILE = registerWithItem(BLOCKS.register("dirty_" + baseNick, ()->new Block(stone)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> DIRTY_POOL_TILE_STAIRS = registerWithItem(BLOCKS.register("dirty_" + baseNick + "_stairs", ()->new StairBlock(DIRTY_POOL_TILE.get()::defaultBlockState, stone)), new Item.Properties());
|
||||
final DeferredBlock DIRTY_POOL_TILE_STAIRS = registerWithItem(BLOCKS.register("dirty_" + baseNick + "_stairs", ()->new StairBlock(DIRTY_POOL_TILE.get()::defaultBlockState, stone)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> DIRTY_POOL_TILE_SLAB = registerWithItem(BLOCKS.register("dirty_" + baseNick + "_slab", ()-> new SlabBlock(stone)), new Item.Properties());
|
||||
final DeferredBlock DIRTY_POOL_TILE_SLAB = registerWithItem(BLOCKS.register("dirty_" + baseNick + "_slab", ()-> new SlabBlock(stone)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> DIRTY_POOL_TILE_WALL = registerWithItem(BLOCKS.register("dirty_" + baseNick + "_wall", ()->new WallBlock(stone)), new Item.Properties());
|
||||
final DeferredBlock DIRTY_POOL_TILE_WALL = registerWithItem(BLOCKS.register("dirty_" + baseNick + "_wall", ()->new WallBlock(stone)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> DIRTY_POOL_LIGHT = registerWithItem(BLOCKS.register("dirty_" + baseNick + "_light", ()->new Block(poolLightDirty)), new Item.Properties());
|
||||
final DeferredBlock DIRTY_POOL_LIGHT = registerWithItem(BLOCKS.register("dirty_" + baseNick + "_light", ()->new Block(poolLightDirty)), new Item.Properties());
|
||||
|
||||
final RegistryObject<Block> FILTHY_POOL_LIGHT = registerWithItem(BLOCKS.register("filthy_" + baseNick + "_light", ()->new Block(poolLightFilthy)), new Item.Properties());
|
||||
final DeferredBlock FILTHY_POOL_LIGHT = registerWithItem(BLOCKS.register("filthy_" + baseNick + "_light", ()->new Block(poolLightFilthy)), new Item.Properties());
|
||||
|
||||
|
||||
ret.add(tile1);
|
||||
|
@ -157,7 +158,7 @@ public class ModBlocks {
|
|||
|
||||
|
||||
|
||||
public static final RegistryObject<Block> DARK_RED_WOOL = registerWithItem(BLOCKS.register("dark_red_wool", ()->new Block(BlockBehaviour.Properties.copy(Blocks.RED_WOOL))), new Item.Properties());
|
||||
public static final DeferredBlock DARK_RED_WOOL = registerWithItem(BLOCKS.register("dark_red_wool", ()->new Block(BlockBehaviour.Properties.copy(Blocks.RED_WOOL))), new Item.Properties());
|
||||
|
||||
public static final RegistryObject<Block> DARK_RED_CARPET = registerWithItem(BLOCKS.register("dark_red_carpet", ()->new CarpetBlock(BlockBehaviour.Properties.copy(Blocks.RED_CARPET))), new Item.Properties());
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.zontreck.block;
|
||||
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
|
@ -24,4 +26,10 @@ public class RotatableBlock extends HorizontalDirectionalBlock
|
|||
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
|
||||
return defaultBlockState().setValue(FACING, pContext.getHorizontalDirection());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalDirectionalBlock> codec() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'codec'");
|
||||
}
|
||||
}
|
||||
|
|
113
src/main/java/com/zontreck/client/BlockFaceTextRenderer.java
Normal file
113
src/main/java/com/zontreck/client/BlockFaceTextRenderer.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
package com.zontreck.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
||||
public record BlockFaceTextRenderer(Font font, Vector3f vector3f) {
|
||||
public static BlockFaceTextRenderer create(Font font) {
|
||||
return new BlockFaceTextRenderer(font, new Vector3f());
|
||||
}
|
||||
|
||||
public static BlockFaceTextRenderer create() {
|
||||
return create(Minecraft.getInstance().font);
|
||||
}
|
||||
|
||||
public IDrawText of(PoseStack poseStack, MultiBufferSource multiBufferSource) {
|
||||
return ((face, text, dropShadows, packedLightCoords, color, backgroundcolor, x, y, z, offsetX, offsetY) -> {
|
||||
drawText(font, poseStack, multiBufferSource, text, face.of(vector3f, x, y, z), face.axis(), packedLightCoords, dropShadows, color, backgroundcolor, offsetX, offsetY);
|
||||
});
|
||||
}
|
||||
|
||||
private static void drawText(Font font, PoseStack matrixStack, MultiBufferSource source, String text, Vector3f translateVector, Quaternionf rotate, int pPackedLightCoords, boolean dropShadows, int color, int backgroundColor, float oX, float oY) {
|
||||
matrixStack.pushPose();
|
||||
matrixStack.translate(translateVector.x(), translateVector.y(), translateVector.z());
|
||||
matrixStack.scale(0.02F, -0.02F, 0.02F);
|
||||
matrixStack.mulPose(rotate);
|
||||
font.drawInBatch(
|
||||
text, // Text
|
||||
oX, // pX
|
||||
oY, // pY
|
||||
color, // pColor
|
||||
dropShadows, // pDropShadow
|
||||
matrixStack.last().pose(), // matrix4f
|
||||
source, // MultiBufferSource
|
||||
Font.DisplayMode.NORMAL, // DisplayMode
|
||||
backgroundColor, // Background Color
|
||||
pPackedLightCoords // pPackedLightsCoords
|
||||
);
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
public enum Face {
|
||||
FRONT((v, x, y, z) -> {
|
||||
return v.set(-x, y, z);
|
||||
}, Axis.YP.rotationDegrees(0)),
|
||||
BACK((v, x, y, z) -> {
|
||||
return v.set(x, y, -z);
|
||||
}, Axis.YP.rotationDegrees(180F)),
|
||||
RIGHT((v, x, y, z) -> {
|
||||
return v.set(z, y, x);
|
||||
}, Axis.YP.rotationDegrees(90F)),
|
||||
LEFT((v, x, y, z) -> {
|
||||
return v.set(-z, y, -x);
|
||||
}, Axis.YP.rotationDegrees(-90F)),
|
||||
TOP((v, x, y, z) -> {
|
||||
return v.set(-x, z, -y);
|
||||
}, Axis.XP.rotationDegrees(90F)),
|
||||
BOTTON((v, x, y, z) -> {
|
||||
return v.set(-x, -z, y);
|
||||
}, Axis.XP.rotationDegrees(-90F));
|
||||
|
||||
private static final List<Face> FACES = List.of(values());
|
||||
|
||||
public static List<Face> valuesList() {
|
||||
return FACES;
|
||||
}
|
||||
|
||||
private final QuadFunction<Vector3f, Float, Float, Float, Vector3f> function;
|
||||
private final Quaternionf rotate;
|
||||
|
||||
Face(QuadFunction<Vector3f, Float, Float, Float, Vector3f> function, Quaternionf rotate) {
|
||||
this.function = function;
|
||||
this.rotate = rotate;
|
||||
}
|
||||
|
||||
public Vector3f of(Vector3f vector3f, float x, float y, float z) {
|
||||
return function.apply(vector3f, x, y, z);
|
||||
}
|
||||
|
||||
public Quaternionf axis() {
|
||||
return rotate;
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface QuadFunction<T, U, V, W, R> {
|
||||
R apply(T t, U u, V v, W w);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IDrawText {
|
||||
void render(Face face, String text, boolean dropShadows, int packedLightCoords, int color, int backgroundcolor, float x, float y, float z, float offsetX, float offsetY);
|
||||
|
||||
|
||||
default void render(List<Face> faces, String text, int packedLightCoords, int color, float x, float y, float z) {
|
||||
faces.forEach(face -> render(face, text, false, packedLightCoords, color, 0, x, y, z, 0, 0));
|
||||
}
|
||||
default void render(List<Face> faces, String text, boolean dropShadows, int packedLightCoords, int color, int backgroundcolor, float x, float y, float z, float offsetX, float offsetY) {
|
||||
faces.forEach(face -> render(face, text, dropShadows, packedLightCoords, color, backgroundcolor, x, y, z, offsetX, offsetY));
|
||||
}
|
||||
default void render(List<Face> faces, String text, boolean dropShadows, int packedLightCoords, int color, int backgroundcolor, float x, float y, float z) {
|
||||
faces.forEach(face -> render(face, text, dropShadows, packedLightCoords, color, backgroundcolor, x, y, z, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,9 @@
|
|||
package com.zontreck.client;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Quaternion;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.zontreck.AriasEssentials;
|
||||
import com.zontreck.entities.TimeBoostEntity;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
|
@ -14,6 +11,8 @@ import net.minecraft.resources.ResourceLocation;
|
|||
|
||||
public class TimeBoostEntityRenderer extends EntityRenderer<TimeBoostEntity> {
|
||||
|
||||
private static final BlockFaceTextRenderer textRenderer = BlockFaceTextRenderer.create();
|
||||
|
||||
public TimeBoostEntityRenderer(EntityRendererProvider.Context erp) {
|
||||
super(erp);
|
||||
}
|
||||
|
@ -21,30 +20,21 @@ public class TimeBoostEntityRenderer extends EntityRenderer<TimeBoostEntity> {
|
|||
|
||||
|
||||
@Override
|
||||
public void render(TimeBoostEntity entity, float entityYaw, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
public void render(TimeBoostEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferSource, int packedLightIn) {
|
||||
String timeRate = "x" + 2 * entity.getTimeRate();
|
||||
float paddingLeftRight = 2 * entity.getTimeRate() < 10 ? 0.11F : 0.19F;
|
||||
drawText(matrixStack, timeRate, new Vector3f(-paddingLeftRight, 0.064F, 0.51F), Vector3f.YP.rotationDegrees(0), ChatFormatting.WHITE.getColor()); // Front
|
||||
drawText(matrixStack, timeRate, new Vector3f(paddingLeftRight, 0.064F, -0.51F), Vector3f.YP.rotationDegrees(180F), ChatFormatting.WHITE.getColor()); // Back
|
||||
drawText(matrixStack, timeRate, new Vector3f(0.51F, 0.064F, paddingLeftRight), Vector3f.YP.rotationDegrees(90F), ChatFormatting.WHITE.getColor()); // Right
|
||||
drawText(matrixStack, timeRate, new Vector3f(-0.51F, 0.064F, -paddingLeftRight), Vector3f.YP.rotationDegrees(-90F), ChatFormatting.WHITE.getColor()); // Left
|
||||
drawText(matrixStack, timeRate, new Vector3f(-paddingLeftRight, 0.51F, -0.064F), Vector3f.XP.rotationDegrees(90F), ChatFormatting.WHITE.getColor()); // Top
|
||||
drawText(matrixStack, timeRate, new Vector3f(-paddingLeftRight, -0.51F, 0.064F), Vector3f.XP.rotationDegrees(-90F), ChatFormatting.WHITE.getColor()); // Bottom
|
||||
|
||||
int remainingTimeSeconds = entity.getRemainingTime() / 20;
|
||||
String timeRemaining = remainingTimeSeconds + "s";
|
||||
|
||||
var rendererText = textRenderer.of(poseStack, bufferSource);
|
||||
|
||||
rendererText.render(BlockFaceTextRenderer.Face.valuesList(), timeRate, packedLightIn, 16777215, paddingLeftRight, 0.064F, 0.51F); // Render Time Rate
|
||||
rendererText.render(BlockFaceTextRenderer.Face.valuesList(), timeRemaining, packedLightIn, remainingTimeSeconds > 10 ? 16777215 : 16711680, paddingLeftRight, 0.264F, 0.51F); // Render Time Remaining, goes reed when < 10 seconds, otherwise white text.
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(TimeBoostEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void drawText(PoseStack matrixStack, String text, Vector3f translateVector, Quaternion rotate, int color) {
|
||||
matrixStack.pushPose();
|
||||
matrixStack.translate(translateVector.x(), translateVector.y(), translateVector.z());
|
||||
matrixStack.scale(0.02F, -0.02F, 0.02F);
|
||||
matrixStack.mulPose(rotate);
|
||||
Font fontRenderer = Minecraft.getInstance().gui.getFont();
|
||||
fontRenderer.draw(matrixStack, text, 0, 0, color);
|
||||
matrixStack.popPose();
|
||||
return ResourceLocation.fromNamespaceAndPath(AriasEssentials.MOD_ID, "accelerate");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,24 +7,42 @@ import java.util.function.Supplier;
|
|||
import com.zontreck.AriasEssentials;
|
||||
import com.zontreck.block.ModBlocks;
|
||||
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredItem;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = AriasEssentials.MOD_ID, value = Dist.CLIENT)
|
||||
@EventBusSubscriber(modid=AriasEssentials.MOD_ID, value = Dist.CLIENT)
|
||||
public class CreativeModeTabs {
|
||||
public static CreativeModeTab AETAB = new CreativeModeTab("ariasessentials") {
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(ModBlocks.BLUE_POOL_TILES.get(0).get().asItem());
|
||||
}
|
||||
};
|
||||
|
||||
public static final List<Supplier<? extends ItemLike>> AE_TAB_ITEMS = new ArrayList<Supplier<? extends ItemLike>>();
|
||||
public static DeferredRegister REGISTRY = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, AriasEssentials.MOD_ID);
|
||||
@SuppressWarnings("unchecked")
|
||||
public static DeferredHolder<CreativeModeTab, CreativeModeTab> AETAB = REGISTRY.register("ariasessentials", ()->
|
||||
CreativeModeTab.builder()
|
||||
.icon(()->((Item)ModItems.TIAB.get()).getDefaultInstance())
|
||||
.displayItems((par, build) -> AE_TAB_ITEMS.forEach(it->build.accept(it.get())))
|
||||
|
||||
.build());
|
||||
|
||||
|
||||
|
||||
public static <T extends Item> RegistryObject<T> addToAETab(RegistryObject<T> item)
|
||||
public static <T extends Item> DeferredItem addToAETab(DeferredItem item)
|
||||
{
|
||||
AE_TAB_ITEMS.add(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static void register(IEventBus bus) {
|
||||
REGISTRY.register(bus);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
package com.zontreck.items;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zontreck.libzontreck.util.ChatHelpers;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DeprecatedItem extends Item
|
||||
{
|
||||
public DeprecatedItem()
|
||||
{
|
||||
super(new Properties().fireResistant().tab(CreativeModeTabs.AETAB));
|
||||
super(new Properties().fireResistant());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,12 +31,14 @@ public class DeprecatedItem extends Item
|
|||
public boolean isPiglinCurrency(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack p_41421_, Level p_41422_, List<Component> p_41423_, TooltipFlag p_41424_) {
|
||||
p_41423_.add(ChatHelpers.macro("!Dark_Red!This item is deprecated"));
|
||||
p_41423_.add(ChatHelpers.macro("!Dark_Green!It would appear this item smells faintly of gold. Maybe piglins will accept it?"));
|
||||
p_41423_.add(ChatHelpers.macro("!Dark_Red!This item is scheduled for removal in a future version. You should use it before it is too late."));
|
||||
}
|
||||
public void appendHoverText(ItemStack stack, TooltipContext context, List<Component> tooltipComponents,
|
||||
TooltipFlag tooltipFlag) {
|
||||
|
||||
tooltipComponents.add(ChatHelpers.macro("!Dark_Red!This item is deprecated"));
|
||||
tooltipComponents.add(ChatHelpers.macro("!Dark_Green!It would appear this item smells faintly of gold. Maybe piglins will accept it?"));
|
||||
tooltipComponents.add(ChatHelpers.macro("!Dark_Red!This item is scheduled for removal in a future version. You should use it before it is too late."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
package com.zontreck.items;
|
||||
|
||||
import com.zontreck.items.impl.TimeBottle;
|
||||
import net.minecraft.world.item.SimpleFoiledItem;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraft.world.item.Item;
|
||||
import com.zontreck.AriasEssentials;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import com.zontreck.items.impl.TimeBottle;
|
||||
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.neoforged.neoforge.registries.DeferredItem;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
public class ModItems {
|
||||
public static DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, AriasEssentials.MOD_ID);
|
||||
public static DeferredRegister<Item> ITEMS = DeferredRegister.create(Registries.ITEM, AriasEssentials.MOD_ID);
|
||||
|
||||
public static RegistryObject<Item> TIAB = ITEMS.register("tiab", ()->new TimeBottle());
|
||||
public static DeferredItem TIAB = ITEMS.register("tiab", ()->new TimeBottle());
|
||||
|
||||
|
||||
|
||||
public static final RegistryObject<Item> IHAN_CRYSTAL = CreativeModeTabs.addToAETab(ITEMS.register("ihan_crystal", () -> new IhanCrystal()));
|
||||
public static final DeferredItem IHAN_CRYSTAL = CreativeModeTabs.addToAETab(ITEMS.register("ihan_crystal", () -> new IhanCrystal()));
|
||||
|
||||
public static final RegistryObject<Item> ETERNIUM_RAW_ORE = CreativeModeTabs.addToAETab(ITEMS.register("eternium_ore", () -> new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem ETERNIUM_RAW_ORE = CreativeModeTabs.addToAETab(ITEMS.register("eternium_ore", () -> new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> ETERNIUM_INGOT = CreativeModeTabs.addToAETab(ITEMS.register("eternium_ingot", ()-> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem ETERNIUM_INGOT = CreativeModeTabs.addToAETab(ITEMS.register("eternium_ingot", ()-> new SimpleFoiledItem(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> ETERNIUM_ROD = CreativeModeTabs.addToAETab(ITEMS.register("eternium_rod", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64).tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem ETERNIUM_ROD = CreativeModeTabs.addToAETab(ITEMS.register("eternium_rod", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64))));
|
||||
|
||||
|
||||
public static final RegistryObject<Item> MIAB = CreativeModeTabs.addToAETab(ITEMS.register("mob_capture_ball", ()->new MobCaptureBallItem()));
|
||||
public static final DeferredItem MIAB = CreativeModeTabs.addToAETab(ITEMS.register("mob_capture_ball", ()->new MobCaptureBallItem()));
|
||||
|
||||
|
||||
public static final RegistryObject<Item> EMPTY_SPAWN_EGG = CreativeModeTabs.addToAETab(ITEMS.register("empty_spawn_egg", () -> new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem EMPTY_SPAWN_EGG = CreativeModeTabs.addToAETab(ITEMS.register("empty_spawn_egg", () -> new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> GENERIC_DEPRECATED_ITEM = CreativeModeTabs.addToAETab(ITEMS.register("deprecated", ()->new DeprecatedItem()));
|
||||
public static final DeferredItem GENERIC_DEPRECATED_ITEM = CreativeModeTabs.addToAETab(ITEMS.register("deprecated", ()->new DeprecatedItem()));
|
||||
|
||||
public static final RegistryObject<Item> WHITE_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("white_brick", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem WHITE_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("white_brick", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> BLUE_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("blue_brick", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem BLUE_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("blue_brick", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> LIGHT_BLUE_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("light_blue_brick", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem LIGHT_BLUE_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("light_blue_brick", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> CYAN_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("cyan_brick", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem CYAN_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("cyan_brick", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> DARK_RED_DYE = CreativeModeTabs.addToAETab(ITEMS.register("dark_red_dye", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem DARK_RED_DYE = CreativeModeTabs.addToAETab(ITEMS.register("dark_red_dye", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> RED_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("red_brick", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem RED_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("red_brick", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> DARK_RED_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("dark_red_brick", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem DARK_RED_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("dark_red_brick", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> GREEN_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("green_brick", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem GREEN_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("green_brick", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> LIME_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("lime_brick", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem LIME_BRICK = CreativeModeTabs.addToAETab(ITEMS.register("lime_brick", ()->new Item(new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Item> PARTIAL_ITEM = CreativeModeTabs.addToAETab(ITEMS.register("partial_item", PartialItem::new));
|
||||
public static final DeferredItem PARTIAL_ITEM = CreativeModeTabs.addToAETab(ITEMS.register("partial_item", PartialItem::new));
|
||||
|
||||
public static final RegistryObject<Item> MAGMA_POWDER = CreativeModeTabs.addToAETab(ITEMS.register("magma_powder", ()-> new MagmaPowder(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem MAGMA_POWDER = CreativeModeTabs.addToAETab(ITEMS.register("magma_powder", ()-> new MagmaPowder(new Item.Properties())));
|
||||
|
||||
|
||||
|
||||
|
||||
public static final RegistryObject<Item> METAL_BAR = CreativeModeTabs.addToAETab(ITEMS.register("metal_bar", ()->new Item(new Item.Properties().tab(CreativeModeTabs.AETAB))));
|
||||
public static final DeferredItem METAL_BAR = CreativeModeTabs.addToAETab(ITEMS.register("metal_bar", ()->new Item(new Item.Properties())));
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
modLoader = "javafml"
|
||||
loaderVersion = "[43,)"
|
||||
loaderVersion = "[4,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "GPLv3"
|
||||
|
||||
|
@ -24,15 +24,18 @@ A mod including features and functions to enhance the game.
|
|||
#logoFile = ""
|
||||
|
||||
[[dependencies.ariasessentials]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
versionRange = "[43,)"
|
||||
modId = "neoforge"
|
||||
type = "required"
|
||||
versionRange = "[21.1,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.ariasessentials]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.19.2,1.20)"
|
||||
type = "required"
|
||||
versionRange = "[1.21.1,1.22)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[mixins]]
|
||||
config = "ariasessentials.mixins.json"
|
|
@ -1,12 +1,10 @@
|
|||
{
|
||||
"required": true,
|
||||
"package": "com.zontreck.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"minVersion": "0.8",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"client": [],
|
||||
"mixins": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue