WIP port to 26.1.1
This commit is contained in:
parent
425ba948a4
commit
53049ab1c0
46
build.gradle
46
build.gradle
|
|
@ -1,7 +1,7 @@
|
|||
plugins {
|
||||
id 'java-library'
|
||||
id 'idea'
|
||||
id 'net.neoforged.moddev' version '2.0.107'
|
||||
id 'net.neoforged.moddev' version '2.0.141'
|
||||
id("com.modrinth.minotaur") version '2.+'
|
||||
id("com.matthewprenger.cursegradle") version '1.4.0'
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ base {
|
|||
archivesName = 'exdeorum'
|
||||
}
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
|
||||
java.toolchain.vendor = JvmVendorSpec.JETBRAINS
|
||||
java.withSourcesJar()
|
||||
|
||||
|
|
@ -21,11 +21,6 @@ evaluationDependsOn(":coremod")
|
|||
neoForge {
|
||||
version = neo_version
|
||||
|
||||
parchment {
|
||||
mappingsVersion = project.parchment_mappings_version
|
||||
minecraftVersion = project.parchment_minecraft_version
|
||||
}
|
||||
|
||||
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
runs {
|
||||
|
|
@ -65,6 +60,15 @@ neoForge {
|
|||
// Include resources generated by data generators.
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
// Exclude compat packages for libraries without 1.26.1 support yet
|
||||
sourceSets.main.java.exclude(
|
||||
'**/compat/jei/**',
|
||||
'**/compat/emi/**',
|
||||
'**/compat/jade/**',
|
||||
'**/compat/kubejs/**',
|
||||
'**/compat/top/**'
|
||||
)
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
|
|
@ -117,36 +121,36 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
// TOP OPTIONAL
|
||||
compileOnly("mcjty.theoneprobe:theoneprobe:1.21_neo-${top_version}") {
|
||||
transitive = false
|
||||
}
|
||||
//compileOnly("mcjty.theoneprobe:theoneprobe:1.21_neo-${top_version}") {
|
||||
// transitive = false
|
||||
//}
|
||||
// JADE OPTIONAL
|
||||
implementation("curse.maven:jade-324717:6291517")
|
||||
//implementation("curse.maven:jade-324717:6291517")
|
||||
// JEI OPTIONAL
|
||||
compileOnly("mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}")
|
||||
runtimeOnly("mezz.jei:jei-${mc_version}-neoforge:${jei_version}")
|
||||
//compileOnly("mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}")
|
||||
//runtimeOnly("mezz.jei:jei-${mc_version}-neoforge:${jei_version}")
|
||||
// EMI OPTIONAL
|
||||
compileOnly("dev.emi:emi-neoforge:${emi_version}+${mc_version}:api")
|
||||
//compileOnly("dev.emi:emi-neoforge:${emi_version}+${mc_version}:api")
|
||||
//runtimeOnly("dev.emi:emi-neoforge:${emi_version}+${mc_version}")
|
||||
// KubeJS OPTIONAL
|
||||
implementation("dev.architectury:architectury-neoforge:${architectury_version}")
|
||||
implementation("dev.latvian.mods:rhino:${rhino_version}")
|
||||
implementation("dev.latvian.mods:kubejs-neoforge:${kubejs_version}")
|
||||
//implementation("dev.architectury:architectury-neoforge:${architectury_version}")
|
||||
//implementation("dev.latvian.mods:rhino:${rhino_version}")
|
||||
//implementation("dev.latvian.mods:kubejs-neoforge:${kubejs_version}")
|
||||
|
||||
// ModKit DEV ONLY
|
||||
implementation('com.github.thedarkcolour:ModKit:4f83c92767')
|
||||
implementation('com.github.thedarkcolour:ModKit:d801a318cf')
|
||||
|
||||
// Core mod
|
||||
implementation(project(':coremod'))
|
||||
jarJar(project(':coremod'))
|
||||
|
||||
// Oculus + Embeddium OPTIONAL
|
||||
compileOnly('maven.modrinth:oculus:1.20.1-1.6.9')
|
||||
compileOnly('maven.modrinth:embeddium:0.3.9+mc1.20.4')
|
||||
//compileOnly('maven.modrinth:oculus:1.20.1-1.6.9')
|
||||
//compileOnly('maven.modrinth:embeddium:0.3.9+mc1.20.4')
|
||||
|
||||
// testing
|
||||
//implementation("curse.maven:allthecompressed-514045:4938351")
|
||||
compileOnly("curse.maven:alltheores-405593:5500624")
|
||||
//compileOnly("curse.maven:alltheores-405593:5500624")
|
||||
//implementation("curse.maven:inventorysorter-240633:4655091")
|
||||
//implementation("curse.maven:cyclic-239286:4994392")
|
||||
//implementation("curse.maven:flib-661261:4724762")
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ org.gradle.daemon=true
|
|||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
|
||||
mc_version=1.21.1
|
||||
neo_version=21.1.213
|
||||
neo_version_range=[21.1,)
|
||||
mc_version=1.26.1
|
||||
neo_version=26.1.1.1-beta
|
||||
neo_version_range=[26.1,)
|
||||
loader_version_range=[4,)
|
||||
|
||||
jei_version=19.25.0.323
|
||||
emi_version=1.1.21
|
||||
cloth_config_version=15.0.127
|
||||
top_version=12.0.3-5
|
||||
#jei_version=19.25.0.323
|
||||
#emi_version=1.1.21
|
||||
#cloth_config_version=15.0.127
|
||||
#top_version=12.0.3-5
|
||||
|
||||
kubejs_version=2101.7.2-build.296
|
||||
rhino_version=2101.2.7-build.81
|
||||
architectury_version=13.0.8
|
||||
#kubejs_version=2101.7.2-build.296
|
||||
#rhino_version=2101.2.7-build.81
|
||||
#architectury_version=13.0.8
|
||||
|
||||
parchment_minecraft_version=1.21.1
|
||||
parchment_mappings_version=2024.11.17
|
||||
#parchment_minecraft_version=1.26.1
|
||||
#parchment_mappings_version=2024.11.17
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pluginManagement {
|
|||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
|
||||
}
|
||||
|
||||
include('coremod')
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package thedarkcolour.exdeorum;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.ModList;
|
||||
|
|
@ -90,7 +90,7 @@ public class ExDeorum {
|
|||
ECompressedBlocks.register();
|
||||
}
|
||||
|
||||
public static ResourceLocation loc(String menuProperty) {
|
||||
return ResourceLocation.fromNamespaceAndPath(ID, menuProperty);
|
||||
public static Identifier loc(String menuProperty) {
|
||||
return Identifier.fromNamespaceAndPath(ID, menuProperty);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package thedarkcolour.exdeorum.asm;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
|
|
@ -67,7 +67,7 @@ public final class ASMHooks {
|
|||
*/
|
||||
public static ResourceKey<WorldPreset> overrideDefaultWorldPreset() {
|
||||
if (ModList.get().isLoaded(ModIds.SKYBLOCK_BUILDER)) {
|
||||
return ResourceKey.create(Registries.WORLD_PRESET, ResourceLocation.fromNamespaceAndPath(ModIds.SKYBLOCK_BUILDER, "skyblock"));
|
||||
return ResourceKey.create(Registries.WORLD_PRESET, Identifier.fromNamespaceAndPath(ModIds.SKYBLOCK_BUILDER, "skyblock"));
|
||||
}
|
||||
return EConfig.COMMON.setVoidWorldAsDefault.get() ? EWorldPresets.VOID_WORLD : WorldPresets.NORMAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.asm;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package thedarkcolour.exdeorum.block;
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
|
@ -67,19 +67,19 @@ public class CompressedBlockType implements ItemLike {
|
|||
return this.hasCompressium;
|
||||
}
|
||||
|
||||
public ResourceLocation getAtc() {
|
||||
return ResourceLocation.fromNamespaceAndPath(ModIds.ALL_THE_COMPRESSED, BuiltInRegistries.BLOCK.getKey(this.base.get()).getPath() + "_1x");
|
||||
public Identifier getAtc() {
|
||||
return Identifier.fromNamespaceAndPath(ModIds.ALL_THE_COMPRESSED, BuiltInRegistries.BLOCK.getKey(this.base.get()).getPath() + "_1x");
|
||||
}
|
||||
|
||||
public ResourceLocation getCompressium() {
|
||||
return ResourceLocation.fromNamespaceAndPath(ModIds.COMPRESSIUM, BuiltInRegistries.BLOCK.getKey(this.base.get()).getPath() + "_1");
|
||||
public Identifier getCompressium() {
|
||||
return Identifier.fromNamespaceAndPath(ModIds.COMPRESSIUM, BuiltInRegistries.BLOCK.getKey(this.base.get()).getPath() + "_1");
|
||||
}
|
||||
|
||||
public Block getBase() {
|
||||
return this.base.get();
|
||||
}
|
||||
|
||||
public ResourceLocation getId() {
|
||||
public Identifier getId() {
|
||||
return this.block.getId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.world.Containers;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
|
@ -61,14 +60,14 @@ public abstract class EBlock extends Block implements EntityBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
|
||||
protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
|
||||
var blockEntity = level.getBlockEntity(pos);
|
||||
|
||||
if (blockEntity instanceof EBlockEntity entity) {
|
||||
return entity.useItemOn(level, player, stack, hand);
|
||||
}
|
||||
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
}
|
||||
|
||||
public static void dropItem(Level level, BlockPos pos, ItemStack stack) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
|||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.neoforged.neoforge.common.EffectCures;
|
||||
import net.neoforged.neoforge.common.NeoForgeMod;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
import thedarkcolour.exdeorum.blockentity.ETankBlockEntity;
|
||||
|
|
@ -65,7 +64,7 @@ public abstract class ETankBlock extends EBlock {
|
|||
} else if (fluidType.getFluidType().canExtinguish(entity)) {
|
||||
entity.extinguishFire();
|
||||
} else if (entity instanceof LivingEntity living && NeoForgeMod.MILK.isBound() && fluidType == NeoForgeMod.MILK.get()) {
|
||||
living.removeEffectsCuredBy(EffectCures.MILK);
|
||||
living.removeAllEffects();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
|
@ -43,12 +42,12 @@ public class EndCakeBlock extends CakeBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
|
||||
protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
|
||||
if (stack.is(EItemTags.END_CAKE_MATERIAL)) {
|
||||
int bites = state.getValue(BITES);
|
||||
|
||||
if (bites == 0) {
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
} else {
|
||||
if (!level.isClientSide) {
|
||||
if (!player.getAbilities().instabuild) {
|
||||
|
|
@ -57,10 +56,10 @@ public class EndCakeBlock extends CakeBlock {
|
|||
level.setBlock(pos, state.setValue(BITES, bites - 1), 3);
|
||||
}
|
||||
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -83,7 +82,7 @@ public class EndCakeBlock extends CakeBlock {
|
|||
}
|
||||
}
|
||||
|
||||
return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ 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.GameRules;
|
||||
import net.minecraft.world.level.gamerules.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
|
|
|
|||
|
|
@ -26,15 +26,16 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import thedarkcolour.exdeorum.blockentity.MechanicalHammerBlockEntity;
|
||||
import thedarkcolour.exdeorum.data.TranslationKeys;
|
||||
import thedarkcolour.exdeorum.registry.EBlockEntities;
|
||||
|
||||
public class MechanicalHammerBlock extends MachineBlock {
|
||||
public static final BooleanProperty RUNNING = BooleanProperty.create("running");
|
||||
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
|
||||
public static final EnumProperty<Direction> FACING = HorizontalDirectionalBlock.FACING;
|
||||
|
||||
public MechanicalHammerBlock(Properties properties) {
|
||||
super(properties, EBlockEntities.MECHANICAL_HAMMER);
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import net.minecraft.world.Difficulty;
|
|||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.*;
|
||||
import net.minecraft.world.entity.animal.MushroomCow;
|
||||
import net.minecraft.world.entity.animal.Rabbit;
|
||||
import net.minecraft.world.entity.animal.cow.MushroomCow;
|
||||
import net.minecraft.world.entity.animal.rabbit.Rabbit;
|
||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
||||
import net.minecraft.world.entity.monster.Creeper;
|
||||
import net.minecraft.world.entity.monster.Zombie;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.block;
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ import net.minecraft.core.HolderLookup;
|
|||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
|
@ -103,8 +103,8 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
super.loadAdditional(nbt, registries);
|
||||
|
||||
this.tank.readFromNBT(registries, nbt.getCompound("Tank"));
|
||||
this.lastMelted = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(nbt.getString("LastMelted")));
|
||||
this.fluid = BuiltInRegistries.FLUID.get(ResourceLocation.parse(nbt.getString("Fluid")));
|
||||
this.lastMelted = BuiltInRegistries.BLOCK.get(Identifier.parse(nbt.getString("LastMelted")));
|
||||
this.fluid = BuiltInRegistries.FLUID.get(Identifier.parse(nbt.getString("Fluid")));
|
||||
this.solids = nbt.getShort("Solids");
|
||||
|
||||
updateLight(this.level, this.worldPosition, this.fluid);
|
||||
|
|
@ -152,11 +152,11 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemInteractionResult useItemOn(Level level, Player player, ItemStack stack, InteractionHand hand) {
|
||||
public InteractionResult useItemOn(Level level, Player player, ItemStack stack, InteractionHand hand) {
|
||||
var playerItem = player.getItemInHand(hand);
|
||||
|
||||
if (playerItem.getCapability(Capabilities.FluidHandler.ITEM) != null) {
|
||||
return FluidUtil.interactWithFluidHandler(player, hand, this.tank) ? ItemInteractionResult.sidedSuccess(level.isClientSide) : ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
return FluidUtil.interactWithFluidHandler(player, hand, this.tank) ? InteractionResult.SUCCESS : InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
}
|
||||
|
||||
if (playerItem.getItem() == Items.GLASS_BOTTLE && this.getType() == EBlockEntities.WATER_CRUCIBLE.get() && EConfig.SERVER.allowWaterBottleTransfer.get()) {
|
||||
|
|
@ -167,21 +167,21 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
BarrelBlockEntity.extractWaterBottle(this.tank, level, player, playerItem, fluid);
|
||||
markUpdated();
|
||||
}
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
} else {
|
||||
var result = canInsertItem(playerItem);
|
||||
|
||||
if (result == InsertionResult.YES) {
|
||||
if (tryMelt(playerItem, player.getAbilities().instabuild ? playerStack -> {} : playerStack -> playerStack.shrink(1))) {
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
} else if (result == InsertionResult.FULL) {
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
}
|
||||
|
||||
// Gets a crucible recipe, using the cache if possible
|
||||
|
|
@ -296,7 +296,7 @@ public abstract class AbstractCrucibleBlockEntity extends ETankBlockEntity {
|
|||
|
||||
if (key.getPath().endsWith("sapling")) {
|
||||
try {
|
||||
overrides.put(item, BuiltInRegistries.BLOCK.get(ResourceLocation.fromNamespaceAndPath(key.getNamespace(), key.getPath().replace("sapling", "leaves"))));
|
||||
overrides.put(item, BuiltInRegistries.BLOCK.get(Identifier.fromNamespaceAndPath(key.getNamespace(), key.getPath().replace("sapling", "leaves"))));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import net.minecraft.stats.Stats;
|
|||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
|
@ -109,7 +108,7 @@ public abstract class AbstractSieveBlockEntity extends EBlockEntity implements S
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemInteractionResult useItemOn(Level level, Player player, ItemStack stack, InteractionHand hand) {
|
||||
public InteractionResult useItemOn(Level level, Player player, ItemStack stack, InteractionHand hand) {
|
||||
ItemStack playerItem = player.getItemInHand(hand);
|
||||
boolean isClientSide = level.isClientSide;
|
||||
|
||||
|
|
@ -122,9 +121,9 @@ public abstract class AbstractSieveBlockEntity extends EBlockEntity implements S
|
|||
if (!player.getAbilities().instabuild) {
|
||||
playerItem.shrink(1);
|
||||
}
|
||||
return ItemInteractionResult.CONSUME;
|
||||
return InteractionResult.CONSUME;
|
||||
} else {
|
||||
return ItemInteractionResult.SUCCESS;
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
} else if (this.logic.getContents().isEmpty()) {
|
||||
|
|
@ -207,7 +206,7 @@ public abstract class AbstractSieveBlockEntity extends EBlockEntity implements S
|
|||
}
|
||||
}
|
||||
|
||||
return ItemInteractionResult.sidedSuccess(isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
// search for another stack in inventory and restock held item
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import net.minecraft.sounds.SoundSource;
|
|||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
@ -211,7 +211,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemInteractionResult useItemOn(Level level, Player player, ItemStack stack, InteractionHand hand) {
|
||||
public InteractionResult useItemOn(Level level, Player player, ItemStack stack, InteractionHand hand) {
|
||||
// Collect an item
|
||||
if (!getItem().isEmpty()) {
|
||||
return giveResultItem(level);
|
||||
|
|
@ -233,7 +233,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
|||
this.progress = 0.0f;
|
||||
}
|
||||
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
this.isBeingFilledByPlayer = false;
|
||||
// try one more time to transfer fluids between item and barrel
|
||||
|
|
@ -250,14 +250,14 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
|||
level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
|
||||
markUpdated();
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
} else if (playerItem.getItem() == Items.GLASS_BOTTLE) {
|
||||
if (this.tank.drain(fluid, IFluidHandler.FluidAction.SIMULATE).getAmount() == 250) {
|
||||
extractWaterBottle(this.tank, level, player, playerItem, fluid);
|
||||
|
||||
markUpdated();
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
|||
}
|
||||
}
|
||||
// If a mix was successful, skip rest of logic
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -298,7 +298,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
|||
}
|
||||
}
|
||||
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
// Also used by Water Crucibles
|
||||
|
|
@ -316,7 +316,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
|||
}
|
||||
|
||||
// Pops the item out of the barrel (ex. dirt that has finished composting)
|
||||
private ItemInteractionResult giveResultItem(Level level) {
|
||||
private InteractionResult giveResultItem(Level level) {
|
||||
if (!level.isClientSide) {
|
||||
popOutItem(level, this.worldPosition, this.item.extract(false));
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
|||
markUpdated();
|
||||
}
|
||||
|
||||
return ItemInteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static void popOutItem(Level level, BlockPos pos, ItemStack stack) {
|
||||
|
|
@ -370,7 +370,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
|||
return false;
|
||||
}
|
||||
|
||||
var recipe = RecipeUtil.getBarrelMixingRecipe(this.level.getRecipeManager(), playerItem, this.tank.getFluid());
|
||||
var recipe = RecipeUtil.getBarrelMixingRecipe(playerItem, this.tank.getFluid());
|
||||
|
||||
if (recipe != null) {
|
||||
if (!simulate) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import net.minecraft.network.RegistryFriendlyByteBuf;
|
|||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
|
@ -71,8 +70,8 @@ public abstract class EBlockEntity extends BlockEntity {
|
|||
public void copyVisualData(BlockEntity fromIntegratedServer) {
|
||||
}
|
||||
|
||||
public ItemInteractionResult useItemOn(Level level, Player player, ItemStack stack, InteractionHand hand) {
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
public InteractionResult useItemOn(Level level, Player player, ItemStack stack, InteractionHand hand) {
|
||||
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
}
|
||||
|
||||
public InteractionResult useWithoutItem(Level level, Player player) {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ import net.minecraft.world.level.block.Blocks;
|
|||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.neoforged.neoforge.client.model.data.ModelData;
|
||||
import net.neoforged.neoforge.client.model.data.ModelProperty;
|
||||
import net.neoforged.neoforge.model.data.ModelData;
|
||||
import net.neoforged.neoforge.model.data.ModelProperty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import thedarkcolour.exdeorum.block.InfestedLeavesBlock;
|
||||
import thedarkcolour.exdeorum.registry.EBlockEntities;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.blockentity.helper;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.blockentity.logic;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.blockentity;
|
||||
|
|
|
|||
|
|
@ -18,15 +18,9 @@
|
|||
|
||||
package thedarkcolour.exdeorum.client;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldCreationUiState;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.ShaderInstance;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.util.Unit;
|
||||
|
|
@ -34,8 +28,8 @@ import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
|||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.neoforged.neoforge.client.event.*;
|
||||
import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
import thedarkcolour.exdeorum.asm.ASMHooks;
|
||||
|
|
@ -44,16 +38,13 @@ import thedarkcolour.exdeorum.client.screen.MechanicalSieveScreen;
|
|||
import thedarkcolour.exdeorum.client.ter.*;
|
||||
import thedarkcolour.exdeorum.compat.ModIds;
|
||||
import thedarkcolour.exdeorum.config.EConfig;
|
||||
import thedarkcolour.exdeorum.fluid.WitchWaterFluid;
|
||||
import thedarkcolour.exdeorum.recipe.RecipeUtil;
|
||||
import thedarkcolour.exdeorum.registry.EBlockEntities;
|
||||
import thedarkcolour.exdeorum.registry.EFluids;
|
||||
import thedarkcolour.exdeorum.registry.EMenus;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientHandler {
|
||||
// Used for the composting recipe category in JEI
|
||||
public static final ModelResourceLocation OAK_BARREL_COMPOSTING = new ModelResourceLocation(ExDeorum.loc("item/oak_barrel_composting"), ModelResourceLocation.STANDALONE_VARIANT);
|
||||
public static boolean isInVoidWorld;
|
||||
// This is used to prevent Ex Deorum from resetting world type when trying to configure Superflat, Single Biome, etc.
|
||||
public static Holder<WorldPreset> originalDefaultWorldPreset;
|
||||
|
|
@ -61,43 +52,32 @@ public class ClientHandler {
|
|||
public static void register(IEventBus modBus) {
|
||||
var fmlBus = NeoForge.EVENT_BUS;
|
||||
|
||||
modBus.addListener(ClientHandler::clientSetup);
|
||||
modBus.addListener(ClientHandler::registerMenuScreens);
|
||||
modBus.addListener(ClientHandler::registerRenderers);
|
||||
modBus.addListener(ClientHandler::registerShaders);
|
||||
modBus.addListener(ClientHandler::registerClientExtensions);
|
||||
modBus.addListener(ClientHandler::addClientReloadListeners);
|
||||
modBus.addListener(ClientHandler::onConfigChanged);
|
||||
fmlBus.addListener(ClientHandler::onPlayerRespawn);
|
||||
fmlBus.addListener(ClientHandler::onPlayerLogout);
|
||||
fmlBus.addListener(ClientHandler::onScreenOpen);
|
||||
fmlBus.addListener(ClientHandler::onRecipesUpdated);
|
||||
|
||||
if (ModList.get().isLoaded(ModIds.JEI) || ModList.get().isLoaded(ModIds.EMI)) {
|
||||
modBus.addListener(ClientHandler::registerAdditionalModels);
|
||||
}
|
||||
fmlBus.addListener(ClientHandler::onRecipesReceived);
|
||||
}
|
||||
|
||||
private static void addClientReloadListeners(RegisterClientReloadListenersEvent event) {
|
||||
event.registerReloadListener((prepBarrier, resourceManager, prepProfiler, reloadProfiler, backgroundExecutor, gameExecutor) -> {
|
||||
private static void registerClientExtensions(RegisterClientExtensionsEvent event) {
|
||||
event.registerFluidType(WitchWaterFluid.createClientExtensions(), EFluids.WITCH_WATER_TYPE.get());
|
||||
}
|
||||
|
||||
private static void addClientReloadListeners(AddClientReloadListenersEvent event) {
|
||||
event.addListener(ExDeorum.loc("render_util"), (prepBarrier, resourceManager, prepProfiler, reloadProfiler, backgroundExecutor, gameExecutor) -> {
|
||||
return prepBarrier.wait(Unit.INSTANCE).thenRunAsync(RenderUtil::reload, gameExecutor);
|
||||
});
|
||||
}
|
||||
|
||||
private static void clientSetup(FMLClientSetupEvent event) {
|
||||
event.enqueueWork(ClientHandler::setRenderLayers);
|
||||
}
|
||||
|
||||
private static void registerMenuScreens(RegisterMenuScreensEvent event) {
|
||||
event.register(EMenus.MECHANICAL_SIEVE.get(), MechanicalSieveScreen::new);
|
||||
event.register(EMenus.MECHANICAL_HAMMER.get(), MechanicalHammerScreen::new);
|
||||
}
|
||||
|
||||
private static void setRenderLayers() {
|
||||
// Fluids
|
||||
ItemBlockRenderTypes.setRenderLayer(EFluids.WITCH_WATER.get(), RenderType.translucent());
|
||||
ItemBlockRenderTypes.setRenderLayer(EFluids.WITCH_WATER_FLOWING.get(), RenderType.translucent());
|
||||
}
|
||||
|
||||
private static void onPlayerRespawn(ClientPlayerNetworkEvent.Clone event) {
|
||||
if (isInVoidWorld) {
|
||||
disableVoidFogRendering();
|
||||
|
|
@ -110,13 +90,13 @@ public class ClientHandler {
|
|||
|
||||
private static void onConfigChanged(ModConfigEvent.Reloading event) {
|
||||
if (event.getConfig().getSpec() == EConfig.CLIENT_SPEC) {
|
||||
RenderSystem.recordRenderCall(() -> Minecraft.getInstance().levelRenderer.allChanged());
|
||||
Minecraft.getInstance().levelRenderer.allChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerRenderers(EntityRenderersEvent.RegisterRenderers event) {
|
||||
event.registerBlockEntityRenderer(EBlockEntities.INFESTED_LEAVES.get(), ctx -> new InfestedLeavesRenderer());
|
||||
event.registerBlockEntityRenderer(EBlockEntities.BARREL.get(), BarrelRenderer::new);
|
||||
event.registerBlockEntityRenderer(EBlockEntities.BARREL.get(), ctx -> new BarrelRenderer());
|
||||
event.registerBlockEntityRenderer(EBlockEntities.LAVA_CRUCIBLE.get(), ctx -> new CrucibleRenderer());
|
||||
event.registerBlockEntityRenderer(EBlockEntities.WATER_CRUCIBLE.get(), ctx -> new CrucibleRenderer());
|
||||
event.registerBlockEntityRenderer(EBlockEntities.SIEVE.get(), ctx -> new SieveRenderer<>(0.75f, 15f));
|
||||
|
|
@ -124,17 +104,6 @@ public class ClientHandler {
|
|||
event.registerBlockEntityRenderer(EBlockEntities.COMPRESSED_SIEVE.get(), ctx -> new CompressedSieveRenderer<>(0.5625f, 16f));
|
||||
}
|
||||
|
||||
private static void registerShaders(RegisterShadersEvent event) {
|
||||
try {
|
||||
// NEW_ENTITY is BLOCK except it also uses UV1 (overlay coordinates)
|
||||
event.registerShader(new ShaderInstance(event.getResourceProvider(), ExDeorum.loc("rendertype_tinted_cutout_mipped"), DefaultVertexFormat.NEW_ENTITY), instance -> {
|
||||
RenderUtil.renderTypeTintedCutoutMippedShader = instance;
|
||||
});
|
||||
} catch (IOException e) {
|
||||
ExDeorum.LOGGER.error("Unable to load tinted shader", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Sets Ex Deorum world type as default
|
||||
private static void onScreenOpen(ScreenEvent.Opening event) {
|
||||
if (event.getNewScreen() instanceof CreateWorldScreen screen && EConfig.COMMON.setVoidWorldAsDefault.get()) {
|
||||
|
|
@ -153,16 +122,8 @@ public class ClientHandler {
|
|||
}
|
||||
}
|
||||
|
||||
// Only called when JEI is loaded, because this registers the recipe category icon models.
|
||||
private static void registerAdditionalModels(ModelEvent.RegisterAdditional event) {
|
||||
event.register(new ModelResourceLocation(ExDeorum.loc("block/oak_barrel_composting"), ModelResourceLocation.STANDALONE_VARIANT));
|
||||
event.register(OAK_BARREL_COMPOSTING);
|
||||
}
|
||||
|
||||
private static void onRecipesUpdated(RecipesUpdatedEvent event) {
|
||||
if (!Minecraft.getInstance().isSingleplayer()) {
|
||||
RecipeUtil.reload(event.getRecipeManager());
|
||||
}
|
||||
private static void onRecipesReceived(RecipesReceivedEvent event) {
|
||||
RecipeUtil.reload(event.getRecipeMap());
|
||||
}
|
||||
|
||||
public static void disableVoidFogRendering() {
|
||||
|
|
|
|||
|
|
@ -18,18 +18,5 @@
|
|||
|
||||
package thedarkcolour.exdeorum.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import net.minecraft.world.item.crafting.RecipeManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ClientsideCode {
|
||||
@Nullable
|
||||
public static RecipeManager getRecipeManager() {
|
||||
ClientPacketListener connection = Minecraft.getInstance().getConnection();
|
||||
if (connection != null) {
|
||||
return connection.getRecipeManager();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,14 +21,13 @@ package thedarkcolour.exdeorum.client;
|
|||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectSet;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
|
@ -37,7 +36,6 @@ import net.minecraft.world.item.Items;
|
|||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.loading.FMLEnvironment;
|
||||
import net.neoforged.neoforge.client.model.data.ModelData;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Vector3i;
|
||||
|
|
@ -89,50 +87,9 @@ public class CompostColors {
|
|||
}
|
||||
|
||||
// Used to generate the list of vanilla colors shipped with the Ex Deorum jar
|
||||
// TODO: port debugCompute to MC 26.x (ItemRenderer/getItemModelShaper/BakedModel.getParticleIcon removed)
|
||||
public static void debugCompute() {
|
||||
// Instead of reading from files, this method pulls colors directly from the texture atlas.
|
||||
var atlas = Minecraft.getInstance().getModelManager().getAtlas(InventoryMenu.BLOCK_ATLAS);
|
||||
int atlasWidth = atlas.width;
|
||||
int atlasHeight = atlas.height;
|
||||
|
||||
try (var image = new NativeImage(atlasWidth, atlasHeight, false)) {
|
||||
// should already be bound but just in case
|
||||
GlStateManager._bindTexture(atlas.getId());
|
||||
// alpha doesn't matter, only RGB
|
||||
image.downloadTexture(0, false);
|
||||
|
||||
for (var item : BuiltInRegistries.ITEM) {
|
||||
var model = Minecraft.getInstance().getItemRenderer().getItemModelShaper().getItemModel(item);
|
||||
|
||||
if (model != null) {
|
||||
var sprite = model.getParticleIcon(ModelData.EMPTY);
|
||||
|
||||
if (sprite.atlasLocation().equals(InventoryMenu.BLOCK_ATLAS)) {
|
||||
int width = sprite.contents().width();
|
||||
int height = sprite.contents().height();
|
||||
int pixels = 0;
|
||||
int totalR = 0;
|
||||
int totalG = 0;
|
||||
int totalB = 0;
|
||||
|
||||
for (int i = sprite.x; i < sprite.x + width; i++) {
|
||||
for (int j = sprite.y; j < sprite.y + height; j++) {
|
||||
int pixel = image.getPixelRGBA(i, j);
|
||||
if (pixel != 0) {
|
||||
// bgr because Minecraft has the pixels backwards
|
||||
totalB += (pixel >> 16) & 0xff;
|
||||
totalG += (pixel >> 8) & 0xff;
|
||||
totalR += (pixel) & 0xff;
|
||||
pixels++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
putColor(pixels, totalR, totalG, totalB, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new UnsupportedOperationException("debugCompute not yet ported to MC 26.x");
|
||||
}
|
||||
|
||||
private static void loadModded() {
|
||||
|
|
@ -216,7 +173,7 @@ public class CompostColors {
|
|||
@Nullable
|
||||
private static String findFirstTexture(JsonObject textureMap) {
|
||||
if (textureMap.get("layer0") instanceof JsonPrimitive primitive) {
|
||||
return ResourceLocation.parse(primitive.getAsString()).getPath();
|
||||
return Identifier.parse(primitive.getAsString()).getPath();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -310,7 +267,7 @@ public class CompostColors {
|
|||
|
||||
var tokenizer = new StringTokenizer(line, ", #");
|
||||
try {
|
||||
var id = ResourceLocation.fromNamespaceAndPath(modid, tokenizer.nextToken());
|
||||
var id = Identifier.fromNamespaceAndPath(modid, tokenizer.nextToken());
|
||||
var item = BuiltInRegistries.ITEM.get(id);
|
||||
String token = tokenizer.nextToken();
|
||||
var color = Integer.parseInt(token, 16);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package thedarkcolour.exdeorum.client;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.rendertype.RenderType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
|||
|
|
@ -18,70 +18,37 @@
|
|||
|
||||
package thedarkcolour.exdeorum.client;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderStateShard;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.ShaderInstance;
|
||||
import net.minecraft.client.renderer.Sheets;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.levelgen.LegacyRandomSource;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.neoforged.neoforge.client.model.CompositeModel;
|
||||
import net.neoforged.neoforge.client.model.data.ModelData;
|
||||
import org.joml.Vector3f;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
import thedarkcolour.exdeorum.client.ter.SieveRenderer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.VarHandle;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class RenderUtil {
|
||||
private static final VarHandle COMPOSITE_MODEL_CHILDREN;
|
||||
private static final Map<Block, RenderFace> TOP_FACES = new HashMap<>();
|
||||
public static final RenderStateShard.ShaderStateShard RENDER_TYPE_TINTED_CUTOUT_MIPPED_SHADER = new RenderStateShard.ShaderStateShard(RenderUtil::getRenderTypeTintedCutoutMippedShader);
|
||||
public static final RenderType TINTED_CUTOUT_MIPPED = RenderType.create(ExDeorum.ID + ":tinted_cutout_mipped", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, RenderType.SMALL_BUFFER_SIZE, false, false, RenderType.CompositeState.builder().setLightmapState(RenderStateShard.LIGHTMAP).setShaderState(RENDER_TYPE_TINTED_CUTOUT_MIPPED_SHADER).setTextureState(RenderStateShard.BLOCK_SHEET_MIPPED).createCompositeState(true));
|
||||
// TODO: port TINTED_CUTOUT_MIPPED to MC 26.x RenderSetup API (RenderStateShard/CompositeState removed)
|
||||
public static final Object TINTED_CUTOUT_MIPPED = null;
|
||||
public static TextureAtlas blockAtlas;
|
||||
public static ShaderInstance renderTypeTintedCutoutMippedShader;
|
||||
public static final IrisAccess IRIS_ACCESS;
|
||||
|
||||
static {
|
||||
IrisAccess irisAccess;
|
||||
try {
|
||||
Class.forName("net.irisshaders.iris.api.v0.IrisApi");
|
||||
irisAccess = IrisApi.getInstance()::isShaderPackInUse;
|
||||
} catch (ClassNotFoundException e) {
|
||||
irisAccess = () -> false;
|
||||
}
|
||||
IRIS_ACCESS = irisAccess;
|
||||
|
||||
var lookup = MethodHandles.lookup();
|
||||
try {
|
||||
COMPOSITE_MODEL_CHILDREN = MethodHandles.privateLookupIn(CompositeModel.Baked.class, lookup).findVarHandle(CompositeModel.Baked.class, "children", ImmutableMap.class);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
IRIS_ACCESS = () -> false;
|
||||
}
|
||||
|
||||
public static void reload() {
|
||||
|
|
@ -95,91 +62,45 @@ public class RenderUtil {
|
|||
blockAtlas = null;
|
||||
}
|
||||
|
||||
// TODO: port getTopFace to MC 26.x (BakedModel/BlockRenderDispatcher removed; use FluidStateModelSet/BlockStateModelSet)
|
||||
public static RenderFace getTopFaceOrDefault(Block block, Block defaultBlock) {
|
||||
var face = getTopFace(block);
|
||||
if (face.isMissingTexture()) {
|
||||
return getTopFace(defaultBlock);
|
||||
} else {
|
||||
return face;
|
||||
}
|
||||
return getTopFace(block);
|
||||
}
|
||||
|
||||
public static RenderFace getTopFace(Block block) {
|
||||
if (TOP_FACES.containsKey(block)) {
|
||||
return TOP_FACES.get(block);
|
||||
} else {
|
||||
var rand = new LegacyRandomSource(block.hashCode());
|
||||
BakedModel model = Minecraft.getInstance().getBlockRenderer().getBlockModel(block.defaultBlockState());
|
||||
RenderFace face;
|
||||
|
||||
if (model instanceof CompositeModel.Baked composite) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ImmutableMap<String, BakedModel> children = (ImmutableMap<String, BakedModel>) COMPOSITE_MODEL_CHILDREN.get(composite);
|
||||
RenderFace.CompositeLayer[] layers = new RenderFace.CompositeLayer[children.size()];
|
||||
int i = 0;
|
||||
|
||||
for (var childModel : children.values()) {
|
||||
var singleFace = getFaceFromModel(block, rand, childModel);
|
||||
layers[i++] = new RenderFace.CompositeLayer(singleFace.renderType(), singleFace.sprite());
|
||||
}
|
||||
|
||||
face = new RenderFace.Composite(layers);
|
||||
} else {
|
||||
face = getFaceFromModel(block, rand, model);
|
||||
}
|
||||
|
||||
TOP_FACES.put(block, face);
|
||||
|
||||
return face;
|
||||
}
|
||||
}
|
||||
|
||||
private static RenderFace.Single getFaceFromModel(Block block, RandomSource rand, BakedModel model) {
|
||||
var texture = getTopTexture(block, model);
|
||||
var blockTypes = model.getRenderTypes(block.defaultBlockState(), rand, ModelData.EMPTY);
|
||||
for (var bufferLayer : RenderType.chunkBufferLayers()) {
|
||||
if (blockTypes.contains(bufferLayer)) {
|
||||
return new RenderFace.Single(bufferLayer, texture);
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("No render type found for block " + block);
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite getTopTexture(Block block, BakedModel model) {
|
||||
var registryName = BuiltInRegistries.BLOCK.getKey(block);
|
||||
var sprite = blockAtlas.getSprite(registryName.withPrefix("block/"));
|
||||
// for stuff like azalea bush, retry to get the top texture
|
||||
if (isMissingTexture(sprite)) {
|
||||
sprite = blockAtlas.getSprite(ResourceLocation.fromNamespaceAndPath(registryName.getNamespace(), "block/" + registryName.getPath() + "_top"));
|
||||
}
|
||||
if (isMissingTexture(sprite)) {
|
||||
sprite = model.getParticleIcon(ModelData.EMPTY);
|
||||
}
|
||||
return sprite;
|
||||
return TOP_FACES.computeIfAbsent(block, b -> {
|
||||
// TODO: implement using 26.x block model API
|
||||
// Placeholder: use missing texture sprite
|
||||
var sprite = blockAtlas != null ? blockAtlas.getSprite(MissingTextureAtlasSprite.getLocation()) : null;
|
||||
return new RenderFace.Single(null, sprite);
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isMissingTexture(TextureAtlasSprite sprite) {
|
||||
return sprite.contents().name() == MissingTextureAtlasSprite.getLocation();
|
||||
}
|
||||
|
||||
// TODO: port renderFlatFluidSprite to 26.x (IClientFluidTypeExtensions no longer has getStillTexture/getTintColor)
|
||||
public static void renderFlatFluidSprite(MultiBufferSource buffers, PoseStack stack, Level level, BlockPos pos, float y, float edge, int light, int r, int g, int b, Fluid fluid) {
|
||||
var extensions = IClientFluidTypeExtensions.of(fluid);
|
||||
var state = fluid.defaultFluidState();
|
||||
var builder = buffers.getBuffer(Sheets.translucentCullBlockSheet());
|
||||
|
||||
RenderUtil.renderFlatSprite(builder, stack, y, r, g, b, RenderUtil.blockAtlas.getSprite(extensions.getStillTexture(state, level, pos)), light, edge);
|
||||
if (blockAtlas == null) return;
|
||||
var builder = buffers.getBuffer(Sheets.translucentBlockSheet());
|
||||
// Use a placeholder sprite until fluid model system is ported
|
||||
var sprite = blockAtlas.getSprite(MissingTextureAtlasSprite.getLocation());
|
||||
RenderUtil.renderFlatSprite(builder, stack, y, r, g, b, sprite, light, edge);
|
||||
}
|
||||
|
||||
// TODO: port renderFluidCube to 26.x (IClientFluidTypeExtensions no longer has getStillTexture/getTintColor)
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
public static void renderFluidCube(MultiBufferSource buffers, PoseStack stack, Level level, BlockPos pos, float minY, float maxY, float edge, int light, int r, int g, int b, Fluid fluid) {
|
||||
var extensions = IClientFluidTypeExtensions.of(fluid);
|
||||
var state = fluid.defaultFluidState();
|
||||
var builder = buffers.getBuffer(Sheets.translucentCullBlockSheet());
|
||||
if (blockAtlas == null) return;
|
||||
var builder = buffers.getBuffer(Sheets.translucentBlockSheet());
|
||||
// Use a placeholder sprite until fluid model system is ported
|
||||
var sprite = blockAtlas.getSprite(MissingTextureAtlasSprite.getLocation());
|
||||
|
||||
var pose = stack.last().pose();
|
||||
var poseNormal = stack.last().normal();
|
||||
|
||||
Vector3f normal;
|
||||
TextureAtlasSprite sprite = RenderUtil.blockAtlas.getSprite(extensions.getStillTexture(state, level, pos));
|
||||
float uMin = sprite.getU0();
|
||||
float uMax = sprite.getU1();
|
||||
float vMin = sprite.getV0();
|
||||
|
|
@ -201,13 +122,6 @@ public class RenderUtil {
|
|||
builder.addVertex(pose, edgeMax, minY, edgeMax).setColor(r, g, b, 255).setUv(uMax, vMax).setUv1(0, 10).setLight(light).setNormal(normal.x, normal.y, normal.z);
|
||||
builder.addVertex(pose, edgeMin, minY, edgeMax).setColor(r, g, b, 255).setUv(uMin, vMax).setUv1(0, 10).setLight(light).setNormal(normal.x, normal.y, normal.z);
|
||||
|
||||
// Flowing texture coordinates
|
||||
//sprite = RenderUtil.blockAtlas.getSprite(extensions.getFlowingTexture(state, level, pos));
|
||||
//uMin = sprite.getU0();
|
||||
//uMax = sprite.getU(8);
|
||||
//vMin = sprite.getV0();
|
||||
//vMax = sprite.getV(8);
|
||||
|
||||
// South face
|
||||
normal = poseNormal.transform(new Vector3f(0, 0, 1));
|
||||
builder.addVertex(pose, edgeMax, maxY, edgeMax).setColor(r, g, b, 255).setUv(uMax, vMin).setUv1(0, 10).setLight(light).setNormal(normal.x, normal.y, normal.z);
|
||||
|
|
@ -237,13 +151,13 @@ public class RenderUtil {
|
|||
// Renders a sprite inside the barrel with the height determined by how full the barrel is.
|
||||
public static void renderFlatSpriteLerp(VertexConsumer builder, PoseStack stack, float percentage, int r, int g, int b, TextureAtlasSprite sprite, int light, float edge, float yMin, float yMax) {
|
||||
float y = Mth.lerp(percentage, yMin, yMax) / 16f;
|
||||
|
||||
renderFlatSprite(builder, stack, y, r, g, b, sprite, light, edge);
|
||||
}
|
||||
|
||||
// Renders a sprite (y should be between 0 and 1)
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
public static void renderFlatSprite(VertexConsumer builder, PoseStack stack, float y, int r, int g, int b, TextureAtlasSprite sprite, int light, float edge) {
|
||||
if (sprite == null) return;
|
||||
var pose = stack.last().pose();
|
||||
var normal = stack.last().normal().transform(new Vector3f(0, 1, 0));
|
||||
|
||||
|
|
@ -268,17 +182,15 @@ public class RenderUtil {
|
|||
return Color.getHSBColor((180 * Mth.sin((time + partialTicks) / 30.0f) - 180) / 360.0f, 0.5f, 0.8f);
|
||||
}
|
||||
|
||||
public static ShaderInstance getRenderTypeTintedCutoutMippedShader() {
|
||||
return renderTypeTintedCutoutMippedShader;
|
||||
}
|
||||
|
||||
// TODO: port getFluidColor to 26.x (IClientFluidTypeExtensions no longer has getTintColor)
|
||||
public static int getFluidColor(Fluid fluid, Level level, BlockPos pos) {
|
||||
return IClientFluidTypeExtensions.of(fluid).getTintColor(fluid.defaultFluidState(), level, pos);
|
||||
return -1; // white/no tint; use FluidModel.fluidTintSource() in 26.x
|
||||
}
|
||||
|
||||
// todo use ambient occlusion
|
||||
// Renders a cuboid using the same side sprite on all six sides
|
||||
public static void renderCuboid(VertexConsumer builder, PoseStack stack, float minY, float maxY, int r, int g, int b, TextureAtlasSprite sprite, int light, float edge) {
|
||||
if (sprite == null) return;
|
||||
var pose = stack.last().pose();
|
||||
var poseNormal = stack.last().normal();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.client;
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
|
||||
package thedarkcolour.exdeorum.client.screen;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -32,7 +32,7 @@ import thedarkcolour.exdeorum.config.EConfig;
|
|||
import thedarkcolour.exdeorum.data.TranslationKeys;
|
||||
|
||||
public class MechanicalHammerScreen extends AbstractContainerScreen<MechanicalHammerMenu> {
|
||||
private static final ResourceLocation BACKGROUND_TEXTURE = ExDeorum.loc("textures/gui/container/mechanical_hammer.png");
|
||||
private static final Identifier BACKGROUND_TEXTURE = ExDeorum.loc("textures/gui/container/mechanical_hammer.png");
|
||||
|
||||
public static final int RECIPE_CLICK_AREA_POS_X = 80;
|
||||
public static final int RECIPE_CLICK_AREA_POS_Y = 34;
|
||||
|
|
@ -63,31 +63,29 @@ public class MechanicalHammerScreen extends AbstractContainerScreen<MechanicalHa
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(GuiGraphics graphics, float pPartialTick, int pMouseX, int pMouseY) {
|
||||
public void extractContents(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
|
||||
int left = this.leftPos;
|
||||
int top = this.topPos;
|
||||
graphics.blit(BACKGROUND_TEXTURE, left, top, 0, 0, this.imageWidth, this.imageHeight);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, BACKGROUND_TEXTURE, left, top, 0, 0, this.imageWidth, this.imageHeight, 256, 256);
|
||||
|
||||
// energy bar
|
||||
int energy = Mth.floor(54 * ((float) this.menu.prevEnergy / EConfig.SERVER.mechanicalSieveEnergyStorage.get()));
|
||||
graphics.blit(BACKGROUND_TEXTURE, left + 10, top + 15 + 54 - energy, this.imageWidth, 16 + 54 - energy, 12, energy);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, BACKGROUND_TEXTURE, left + 10, top + 15 + 54 - energy, this.imageWidth, 16 + 54 - energy, 12, energy, 256, 256);
|
||||
|
||||
// progress arrow
|
||||
int progress = Math.min(23, this.menu.machine.getGuiProgress());
|
||||
graphics.blit(BACKGROUND_TEXTURE, left + RECIPE_CLICK_AREA_POS_X, top + RECIPE_CLICK_AREA_POS_Y, this.imageWidth, 0, progress, 16);
|
||||
}
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, BACKGROUND_TEXTURE, left + RECIPE_CLICK_AREA_POS_X, top + RECIPE_CLICK_AREA_POS_Y, this.imageWidth, 0, progress, 16, 256, 256);
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, int mx, int my, float pPartialTick) {
|
||||
super.render(graphics, mx, my, pPartialTick);
|
||||
renderTooltip(graphics, mx, my);
|
||||
super.extractContents(graphics, mouseX, mouseY, a);
|
||||
|
||||
int rx = mx - this.leftPos;
|
||||
int ry = my - this.topPos;
|
||||
int rx = mouseX - left;
|
||||
int ry = mouseY - top;
|
||||
|
||||
if (9 <= rx && rx < 23 && 14 <= ry && ry < 70) {
|
||||
var energyTooltip = Component.translatable(TranslationKeys.ENERGY).append(Component.translatable(TranslationKeys.FRACTION_DISPLAY, this.menu.prevEnergy, EConfig.SERVER.mechanicalSieveEnergyStorage.get())).append(" FE");
|
||||
graphics.renderTooltip(Minecraft.getInstance().font, energyTooltip, mx, my);
|
||||
graphics.setTooltipForNextFrame(energyTooltip, mouseX, mouseY);
|
||||
}
|
||||
|
||||
extractTooltip(graphics, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
|
||||
package thedarkcolour.exdeorum.client.screen;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -32,7 +32,7 @@ import thedarkcolour.exdeorum.data.TranslationKeys;
|
|||
import thedarkcolour.exdeorum.menu.MechanicalSieveMenu;
|
||||
|
||||
public class MechanicalSieveScreen extends AbstractContainerScreen<MechanicalSieveMenu> {
|
||||
private static final ResourceLocation BACKGROUND_TEXTURE = ExDeorum.loc("textures/gui/container/mechanical_sieve.png");
|
||||
private static final Identifier BACKGROUND_TEXTURE = ExDeorum.loc("textures/gui/container/mechanical_sieve.png");
|
||||
|
||||
// Used by JEI and REI, these are bounds of the little grains texture between the mesh/input and the output slots
|
||||
public static final int RECIPE_CLICK_AREA_POS_X = 51;
|
||||
|
|
@ -65,31 +65,29 @@ public class MechanicalSieveScreen extends AbstractContainerScreen<MechanicalSie
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(GuiGraphics graphics, float partialTick, int mX, int mY) {
|
||||
public void extractContents(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
|
||||
int left = this.leftPos;
|
||||
int top = this.topPos;
|
||||
graphics.blit(BACKGROUND_TEXTURE, left, top, 0, 0, this.imageWidth, this.imageHeight);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, BACKGROUND_TEXTURE, left, top, 0, 0, this.imageWidth, this.imageHeight, 256, 256);
|
||||
|
||||
// energy bar
|
||||
int energy = Mth.floor(54 * ((float) this.menu.prevEnergy / EConfig.SERVER.mechanicalSieveEnergyStorage.get()));
|
||||
graphics.blit(BACKGROUND_TEXTURE, left + 10, top + 22 + 54 - energy, this.imageWidth, 14 + 54 - energy, 12, energy);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, BACKGROUND_TEXTURE, left + 10, top + 22 + 54 - energy, this.imageWidth, 14 + 54 - energy, 12, energy, 256, 256);
|
||||
|
||||
// progress arrow
|
||||
int progress = Math.min(21, (int) (this.menu.machine.getLogic().getProgress() * 22));
|
||||
graphics.blit(BACKGROUND_TEXTURE, left + RECIPE_CLICK_AREA_POS_X, top + RECIPE_CLICK_AREA_POS_Y, this.imageWidth, 0, progress, 14);
|
||||
}
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, BACKGROUND_TEXTURE, left + RECIPE_CLICK_AREA_POS_X, top + RECIPE_CLICK_AREA_POS_Y, this.imageWidth, 0, progress, 14, 256, 256);
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, int mx, int my, float partialTicks) {
|
||||
super.render(graphics, mx, my, partialTicks);
|
||||
renderTooltip(graphics, mx, my);
|
||||
super.extractContents(graphics, mouseX, mouseY, a);
|
||||
|
||||
int rx = mx - this.leftPos;
|
||||
int ry = my - this.topPos;
|
||||
int rx = mouseX - left;
|
||||
int ry = mouseY - top;
|
||||
|
||||
if (9 <= rx && rx < 23 && 21 <= ry && ry < 77) {
|
||||
var energyTooltip = Component.translatable(TranslationKeys.ENERGY).append(Component.translatable(TranslationKeys.FRACTION_DISPLAY, this.menu.prevEnergy, EConfig.SERVER.mechanicalSieveEnergyStorage.get())).append(" FE");
|
||||
graphics.renderTooltip(Minecraft.getInstance().font, energyTooltip, mx, my);
|
||||
graphics.setTooltipForNextFrame(energyTooltip, mouseX, mouseY);
|
||||
}
|
||||
|
||||
extractTooltip(graphics, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,15 +20,16 @@ package thedarkcolour.exdeorum.client.screen;
|
|||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.client.renderer.Rect2i;
|
||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import thedarkcolour.exdeorum.data.TranslationKeys;
|
||||
import thedarkcolour.exdeorum.menu.AbstractMachineMenu;
|
||||
|
|
@ -48,7 +49,7 @@ public class RedstoneControlWidget implements GuiEventListener, NarratableEntry,
|
|||
private static final Component REDSTONE_CONTROL_LABEL = Component.translatable(TranslationKeys.REDSTONE_CONTROL_LABEL);
|
||||
|
||||
private final AbstractMachineMenu<?> screen;
|
||||
private final ResourceLocation texture;
|
||||
private final Identifier texture;
|
||||
private final int posX;
|
||||
private final int posY;
|
||||
private final int tabU;
|
||||
|
|
@ -69,7 +70,7 @@ public class RedstoneControlWidget implements GuiEventListener, NarratableEntry,
|
|||
// Last time (from currentTimeMillis) this button was clicked, used in animation lerp
|
||||
private long lastClicked = -1L;
|
||||
|
||||
public RedstoneControlWidget(AbstractMachineMenu<?> screen, ResourceLocation texture, int posX, int posY) {
|
||||
public RedstoneControlWidget(AbstractMachineMenu<?> screen, Identifier texture, int posX, int posY) {
|
||||
this.screen = screen;
|
||||
this.texture = texture;
|
||||
this.posX = posX;
|
||||
|
|
@ -88,7 +89,7 @@ public class RedstoneControlWidget implements GuiEventListener, NarratableEntry,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, int mx, int my, float pPartialTick) {
|
||||
public void extractRenderState(GuiGraphicsExtractor graphics, int mx, int my, float pPartialTick) {
|
||||
if (this.lastClicked != -1L) {
|
||||
// animation is 200 ms
|
||||
this.percentage = (System.currentTimeMillis() - this.lastClicked) / 200.0f;
|
||||
|
|
@ -108,20 +109,20 @@ public class RedstoneControlWidget implements GuiEventListener, NarratableEntry,
|
|||
|
||||
if (this.expanded) {
|
||||
var redstoneMode = this.screen.machine.getRedstoneMode();
|
||||
graphics.blit(this.texture, this.posX, this.posY, this.expandedU, this.expandedV, this.expandedWidth, this.expandedHeight);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.texture, this.posX, this.posY, this.expandedU, this.expandedV, this.expandedWidth, this.expandedHeight, 256, 256);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
graphics.blit(this.texture, this.buttonsPosX + (i * 19), this.buttonsPosY, (redstoneMode == i ? this.tabU + 16 : this.tabU), this.tabV + this.tabHeight, 16, 16);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.texture, this.buttonsPosX + (i * 19), this.buttonsPosY, (redstoneMode == i ? this.tabU + 16 : this.tabU), this.tabV + this.tabHeight, 16, 16, 256, 256);
|
||||
}
|
||||
graphics.blit(this.texture, this.buttonsPosX, this.buttonsPosY, this.tabU, this.tabV + this.tabHeight + 16, 52, 14);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.texture, this.buttonsPosX, this.buttonsPosY, this.tabU, this.tabV + this.tabHeight + 16, 52, 14, 256, 256);
|
||||
|
||||
graphics.drawString(font, Component.translatable(TranslationKeys.REDSTONE_CONTROL_LABEL), this.posX + 16, this.posY + 10, 0xffffff);
|
||||
graphics.text(font, Component.translatable(TranslationKeys.REDSTONE_CONTROL_LABEL), this.posX + 16, this.posY + 10, 0xffffff);
|
||||
// The label
|
||||
graphics.drawString(font, Component.translatable(TranslationKeys.REDSTONE_CONTROL_MODE).append(REDSTONE_MODES[redstoneMode]), this.posX + 4, this.posY + 26, 0xffffff);
|
||||
graphics.text(font, Component.translatable(TranslationKeys.REDSTONE_CONTROL_MODE).append(REDSTONE_MODES[redstoneMode]), this.posX + 4, this.posY + 26, 0xffffff);
|
||||
} else {
|
||||
graphics.blit(this.texture, this.posX, this.posY, this.tabU, this.tabV, this.tabWidth, this.tabHeight);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.texture, this.posX, this.posY, this.tabU, this.tabV, this.tabWidth, this.tabHeight, 256, 256);
|
||||
|
||||
if (this.posX <= mx && mx < this.posX + this.tabWidth && this.posY <= my && my < this.posY + this.tabHeight) {
|
||||
graphics.renderTooltip(font, REDSTONE_CONTROL_LABEL, mx, my);
|
||||
graphics.setTooltipForNextFrame(REDSTONE_CONTROL_LABEL, mx, my);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -164,7 +165,7 @@ public class RedstoneControlWidget implements GuiEventListener, NarratableEntry,
|
|||
Minecraft.getInstance().gameMode.handleInventoryButtonClick(this.screen.containerId, redstoneMode);
|
||||
}
|
||||
|
||||
private void drawPartialConfig(GuiGraphics graphics) {
|
||||
private void drawPartialConfig(GuiGraphicsExtractor graphics) {
|
||||
float percentage = this.expanded ? 1.0f - this.percentage : this.percentage;
|
||||
// top left without edge
|
||||
int width = getWidth(percentage) - 3;
|
||||
|
|
@ -174,13 +175,13 @@ public class RedstoneControlWidget implements GuiEventListener, NarratableEntry,
|
|||
int edgeV = this.expandedV + this.expandedHeight - 3;
|
||||
|
||||
// top left section (no edges)
|
||||
graphics.blit(this.texture, this.posX, this.posY, this.expandedU, this.expandedV, width, height);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.texture, this.posX, this.posY, this.expandedU, this.expandedV, width, height, 256, 256);
|
||||
// bottom edge
|
||||
graphics.blit(this.texture, this.posX, this.posY + height, this.expandedU, edgeV, width, 3);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.texture, this.posX, this.posY + height, this.expandedU, edgeV, width, 3, 256, 256);
|
||||
// right edge
|
||||
graphics.blit(this.texture, this.posX + width, this.posY, edgeU, this.expandedV, 3, height);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.texture, this.posX + width, this.posY, edgeU, this.expandedV, 3, height, 256, 256);
|
||||
// bottom right corner
|
||||
graphics.blit(this.texture, this.posX + width, this.posY + height, edgeU, edgeV, 3, 3);
|
||||
graphics.blit(RenderPipelines.GUI_TEXTURED, this.texture, this.posX + width, this.posY + height, edgeU, edgeV, 3, 3, 256, 256);
|
||||
}
|
||||
|
||||
public int getWidth(float percentage) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.client.screen;
|
||||
|
|
|
|||
|
|
@ -19,120 +19,26 @@
|
|||
package thedarkcolour.exdeorum.client.ter;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.neoforged.neoforge.client.model.data.ModelData;
|
||||
import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
import thedarkcolour.exdeorum.block.BarrelBlock;
|
||||
import thedarkcolour.exdeorum.blockentity.BarrelBlockEntity;
|
||||
import thedarkcolour.exdeorum.client.RenderUtil;
|
||||
import thedarkcolour.exdeorum.config.EConfig;
|
||||
|
||||
import java.util.Objects;
|
||||
// TODO: port BarrelRenderer to MC 26.x rendering API (BlockEntityRenderer changed to extract/submit pattern,
|
||||
// BlockRenderDispatcher/ItemRenderer removed, fluid color/texture APIs changed)
|
||||
public class BarrelRenderer implements BlockEntityRenderer<BarrelBlockEntity, BlockEntityRenderState> {
|
||||
public static final Identifier COMPOST_DIRT_TEXTURE = ExDeorum.loc("block/compost_dirt");
|
||||
|
||||
public class BarrelRenderer implements BlockEntityRenderer<BarrelBlockEntity> {
|
||||
public static final ResourceLocation COMPOST_DIRT_TEXTURE = ExDeorum.loc("block/compost_dirt");
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
private final ItemRenderer itemRenderer;
|
||||
|
||||
public BarrelRenderer(BlockEntityRendererProvider.Context ctx) {
|
||||
this.blockRenderer = ctx.getBlockRenderDispatcher();
|
||||
this.itemRenderer = ctx.getItemRenderer();
|
||||
@Override
|
||||
public BlockEntityRenderState createRenderState() {
|
||||
return new BlockEntityRenderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(BarrelBlockEntity barrel, float partialTicks, PoseStack stack, MultiBufferSource buffers, int light, int overlay) {
|
||||
var item = barrel.getItem();
|
||||
|
||||
// render an output
|
||||
if (item.getItem() instanceof BlockItem blockItem) {
|
||||
var block = blockItem.getBlock();
|
||||
var state = block.defaultBlockState();
|
||||
|
||||
stack.pushPose();
|
||||
stack.translate(2 / 16f, 2 / 16f, 2 / 16f);
|
||||
stack.scale(12 / 16f, 12 / 16f, 12 / 16f);
|
||||
|
||||
//noinspection DataFlowIssue
|
||||
this.blockRenderer.renderSingleBlock(state, stack, buffers, light, overlay, ModelData.EMPTY, null);
|
||||
|
||||
stack.popPose();
|
||||
} else {
|
||||
stack.pushPose();
|
||||
stack.translate(0.5, 1.5 / 16f + (barrel.getTank().getFluidAmount() / 1000f) * 13f / 16f, 0.5);
|
||||
stack.mulPose(Axis.XP.rotation(Mth.HALF_PI));
|
||||
this.itemRenderer.renderStatic(item, ItemDisplayContext.FIXED, light, OverlayTexture.NO_OVERLAY, stack, buffers, null, 0);
|
||||
stack.popPose();
|
||||
}
|
||||
|
||||
var tank = barrel.getTank();
|
||||
var fluidStack = tank.getFluidInTank(0);
|
||||
|
||||
if (!fluidStack.isEmpty()) { // Get texture
|
||||
var fluid = fluidStack.getFluid();
|
||||
var level = Objects.requireNonNull(barrel.getLevel());
|
||||
var pos = barrel.getBlockPos();
|
||||
var percentage = fluidStack.getAmount() / 1000.0f;
|
||||
var y = Mth.lerp(percentage, BarrelBlock.BARREL_FLUID_BOTTOM, BarrelBlock.BARREL_FLUID_TOP);
|
||||
var inputFluidColor = RenderUtil.getFluidColor(fluid, level, pos);
|
||||
// Split into RGB components
|
||||
var r = (inputFluidColor >> 16) & 0xff;
|
||||
var g = (inputFluidColor >> 8) & 0xff;
|
||||
var b = inputFluidColor & 0xff;
|
||||
|
||||
if (barrel.isBrewing()) {
|
||||
float progress = barrel.progress;
|
||||
|
||||
// Transition between water color and witch water color (200B41)
|
||||
r = (int) Mth.lerp(progress, r, barrel.r);
|
||||
g = (int) Mth.lerp(progress, g, barrel.g);
|
||||
b = (int) Mth.lerp(progress, b, barrel.b);
|
||||
}
|
||||
|
||||
if (barrel.transparent) {
|
||||
RenderUtil.renderFluidCube(buffers, stack, level, pos, BarrelBlock.BARREL_FLUID_BOTTOM, y, 2.0f, light, r, g, b, fluid);
|
||||
} else {
|
||||
RenderUtil.renderFlatFluidSprite(buffers, stack, level, pos, y, 2.0f, light, r, g, b, fluid);
|
||||
}
|
||||
}
|
||||
|
||||
// render compost
|
||||
if (barrel.compost > 0) {
|
||||
var sprite = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(COMPOST_DIRT_TEXTURE);
|
||||
var builder = buffers.getBuffer(RenderType.solid());
|
||||
|
||||
float compostProgress = barrel.progress;
|
||||
int r, g, b;
|
||||
|
||||
if (ExDeorum.IS_JUNE && EConfig.CLIENT.rainbowCompostDuringJune.get() && barrel.getLevel() != null) {
|
||||
var rainbow = RenderUtil.getRainbowColor(barrel.getLevel().getGameTime(), partialTicks);
|
||||
r = rainbow.getRed();
|
||||
g = rainbow.getGreen();
|
||||
b = rainbow.getBlue();
|
||||
} else {
|
||||
r = barrel.r;
|
||||
g = barrel.g;
|
||||
b = barrel.b;
|
||||
}
|
||||
|
||||
// Transition between default green and dirt brown
|
||||
r = (int) Mth.lerp(compostProgress, r, 238); // default green is
|
||||
g = (int) Mth.lerp(compostProgress, g, 169); // default green is
|
||||
b = (int) Mth.lerp(compostProgress, b, 109); // default green is
|
||||
|
||||
RenderUtil.renderFlatSpriteLerp(builder, stack, barrel.compost / 1000.0f, r, g, b, sprite, light, 2.0f, BarrelBlock.BARREL_FLUID_BOTTOM * 16f, BarrelBlock.BARREL_FLUID_TOP * 16f);
|
||||
}
|
||||
public void submit(BlockEntityRenderState state, PoseStack stack, SubmitNodeCollector collector, CameraRenderState cameraState) {
|
||||
// TODO: implement barrel fluid/compost/item rendering using new 26.x rendering API
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,53 +19,21 @@
|
|||
package thedarkcolour.exdeorum.client.ter;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.util.Mth;
|
||||
import thedarkcolour.exdeorum.block.AbstractCrucibleBlock;
|
||||
import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
|
||||
import thedarkcolour.exdeorum.blockentity.AbstractCrucibleBlockEntity;
|
||||
import thedarkcolour.exdeorum.client.RenderUtil;
|
||||
|
||||
public class CrucibleRenderer implements BlockEntityRenderer<AbstractCrucibleBlockEntity> {
|
||||
// TODO: port CrucibleRenderer to MC 26.x rendering API (BlockEntityRenderer changed to extract/submit pattern)
|
||||
public class CrucibleRenderer implements BlockEntityRenderer<AbstractCrucibleBlockEntity, BlockEntityRenderState> {
|
||||
@Override
|
||||
public void render(AbstractCrucibleBlockEntity crucible, float partialTicks, PoseStack stack, MultiBufferSource buffers, int light, int overlay) {
|
||||
var tank = crucible.getTank();
|
||||
var level = crucible.getLevel();
|
||||
if (level == null) return;
|
||||
public BlockEntityRenderState createRenderState() {
|
||||
return new BlockEntityRenderState();
|
||||
}
|
||||
|
||||
var fluidStack = tank.getFluidInTank(0);
|
||||
|
||||
// These are percentages
|
||||
var solids = (float) crucible.getSolids() / (float) AbstractCrucibleBlockEntity.MAX_SOLIDS;
|
||||
var liquid = (float) fluidStack.getAmount() / (float) tank.getTankCapacity(0);
|
||||
|
||||
if (solids != 0 || liquid != 0) {
|
||||
var pos = crucible.getBlockPos();
|
||||
|
||||
if (liquid != 0) {
|
||||
var fluid = fluidStack.getFluid();
|
||||
var color = RenderUtil.getFluidColor(fluid, level, pos);
|
||||
var y = Mth.lerp(liquid, AbstractCrucibleBlock.CRUCIBLE_FLUID_BOTTOM, AbstractCrucibleBlock.CRUCIBLE_FLUID_TOP);
|
||||
|
||||
RenderUtil.renderFlatFluidSprite(buffers, stack, level, pos, y, 2.0f, light, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff, fluid);
|
||||
}
|
||||
if (solids != 0) {
|
||||
// eating my words rn :(
|
||||
var lastMelted = crucible.getLastMelted();
|
||||
if (lastMelted == null) {
|
||||
lastMelted = crucible.getDefaultMeltBlock();
|
||||
}
|
||||
|
||||
var face = RenderUtil.getTopFaceOrDefault(lastMelted, crucible.getDefaultMeltBlock());
|
||||
|
||||
var color = Minecraft.getInstance().getBlockColors().getColor(lastMelted.defaultBlockState(), level, pos, 0);
|
||||
|
||||
if (color == -1) color = 0xffffff;
|
||||
|
||||
face.renderFlatSpriteLerp(buffers, stack, solids, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff, light, 2.0f, AbstractCrucibleBlock.CRUCIBLE_FLUID_BOTTOM * 16f, AbstractCrucibleBlock.CRUCIBLE_FLUID_TOP * 16f);
|
||||
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void submit(BlockEntityRenderState state, PoseStack stack, SubmitNodeCollector collector, CameraRenderState cameraState) {
|
||||
// TODO: implement crucible fluid/solid rendering using new 26.x rendering API
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,37 +19,21 @@
|
|||
package thedarkcolour.exdeorum.client.ter;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.neoforged.neoforge.client.model.data.ModelData;
|
||||
import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
|
||||
import thedarkcolour.exdeorum.blockentity.InfestedLeavesBlockEntity;
|
||||
import thedarkcolour.exdeorum.client.RenderUtil;
|
||||
import thedarkcolour.exdeorum.config.EConfig;
|
||||
|
||||
public class InfestedLeavesRenderer implements BlockEntityRenderer<InfestedLeavesBlockEntity> {
|
||||
// TODO: port InfestedLeavesRenderer to MC 26.x rendering API (BlockEntityRenderer changed to extract/submit pattern)
|
||||
public class InfestedLeavesRenderer implements BlockEntityRenderer<InfestedLeavesBlockEntity, BlockEntityRenderState> {
|
||||
@Override
|
||||
public void render(InfestedLeavesBlockEntity te, float partialTicks, PoseStack stack, MultiBufferSource buffer, int light, int unused) {
|
||||
if (EConfig.CLIENT.useFastInfestedLeaves.get() || RenderUtil.IRIS_ACCESS.areShadersEnabled()) return;
|
||||
public BlockEntityRenderState createRenderState() {
|
||||
return new BlockEntityRenderState();
|
||||
}
|
||||
|
||||
var mc = Minecraft.getInstance();
|
||||
var state = te.getMimic();
|
||||
|
||||
// Default to oak leaves
|
||||
if (state == null) state = Blocks.OAK_LEAVES.defaultBlockState();
|
||||
|
||||
// If something is wrong skip rendering
|
||||
var level = te.getLevel();
|
||||
if (level == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get infested percentage
|
||||
int progress = Math.min(te.getProgress(), 16000);
|
||||
// Render
|
||||
var model = mc.getBlockRenderer().getBlockModel(state);
|
||||
var pos = te.getBlockPos();
|
||||
mc.getBlockRenderer().getModelRenderer().tesselateBlock(level, model, state, pos, stack, buffer.getBuffer(RenderUtil.TINTED_CUTOUT_MIPPED), false, level.random, state.getSeed(pos), progress, ModelData.EMPTY, null);
|
||||
@Override
|
||||
public void submit(BlockEntityRenderState state, PoseStack stack, SubmitNodeCollector collector, CameraRenderState cameraState) {
|
||||
// TODO: implement infested leaves tinting using new 26.x rendering API
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,23 +19,20 @@
|
|||
package thedarkcolour.exdeorum.client.ter;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import thedarkcolour.exdeorum.blockentity.EBlockEntity;
|
||||
import thedarkcolour.exdeorum.blockentity.logic.SieveLogic;
|
||||
import thedarkcolour.exdeorum.client.RenderUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SieveRenderer<T extends EBlockEntity & SieveLogic.Owner> implements BlockEntityRenderer<T> {
|
||||
// TODO: port SieveRenderer to MC 26.x rendering API (BlockEntityRenderer changed to extract/submit pattern)
|
||||
public class SieveRenderer<T extends EBlockEntity & SieveLogic.Owner> implements BlockEntityRenderer<T, BlockEntityRenderState> {
|
||||
public static final Map<Item, TextureAtlasSprite> MESH_TEXTURES = new HashMap<>();
|
||||
|
||||
private final float meshHeight;
|
||||
|
|
@ -49,47 +46,15 @@ public class SieveRenderer<T extends EBlockEntity & SieveLogic.Owner> implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(T sieve, float partialTicks, PoseStack stack, MultiBufferSource buffers, int light, int overlay) {
|
||||
var logic = sieve.getLogic();
|
||||
var contents = logic.getContents();
|
||||
|
||||
if (!contents.isEmpty() && contents.getItem() instanceof BlockItem blockItem) {
|
||||
var block = blockItem.getBlock();
|
||||
var percentage = logic.getProgress();
|
||||
var face = RenderUtil.getTopFace(block);
|
||||
|
||||
if (shouldContentsRender3d(sieve)) {
|
||||
face.renderCuboid(buffers, stack, this.contentsMinY / 16f, Mth.lerp(percentage, this.contentsMaxY, this.contentsMinY) / 16f, 0xff, 0xff, 0xff, light, 1.0f);
|
||||
} else {
|
||||
face.renderFlatSpriteLerp(buffers, stack, percentage, 0xff, 0xff, 0xff, light, 1.0f, this.contentsMaxY, this.contentsMinY);
|
||||
}
|
||||
}
|
||||
|
||||
var mesh = logic.getMesh();
|
||||
|
||||
if (!mesh.isEmpty()) {
|
||||
var builder = buffers.getBuffer(RenderType.cutoutMipped());
|
||||
var meshItem = mesh.getItem();
|
||||
|
||||
TextureAtlasSprite meshSprite;
|
||||
if (MESH_TEXTURES.containsKey(meshItem)) {
|
||||
meshSprite = MESH_TEXTURES.get(meshItem);
|
||||
} else {
|
||||
ResourceLocation registryName = BuiltInRegistries.ITEM.getKey(meshItem);
|
||||
ResourceLocation textureLoc = registryName.withPrefix("item/mesh/");
|
||||
meshSprite = RenderUtil.blockAtlas.getSprite(textureLoc);
|
||||
MESH_TEXTURES.put(meshItem, meshSprite);
|
||||
}
|
||||
|
||||
RenderUtil.renderFlatSprite(builder, stack, this.meshHeight, 0xff, 0xff, 0xff, meshSprite, light, 1f);
|
||||
|
||||
if (mesh.hasFoil()) {
|
||||
RenderUtil.renderFlatSprite(buffers.getBuffer(RenderType.glint()), stack, this.meshHeight, 0xff, 0xff, 0xff, meshSprite, light, 1f);
|
||||
}
|
||||
}
|
||||
public BlockEntityRenderState createRenderState() {
|
||||
return new BlockEntityRenderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(BlockEntityRenderState state, PoseStack stack, SubmitNodeCollector collector, CameraRenderState cameraState) {
|
||||
// TODO: implement sieve mesh/contents rendering using new 26.x rendering API
|
||||
}
|
||||
|
||||
// todo return true for transparent sieves
|
||||
protected boolean shouldContentsRender3d(T sieve) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.client.ter;
|
||||
|
|
|
|||
|
|
@ -1,173 +1,37 @@
|
|||
package thedarkcolour.exdeorum.compat;
|
||||
|
||||
import com.mojang.blaze3d.platform.Lighting;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.CrashReportCategory;
|
||||
import net.minecraft.ReportedException;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.neoforged.neoforge.client.RenderTypeHelper;
|
||||
import net.neoforged.neoforge.client.model.data.ModelData;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Matrix4fStack;
|
||||
import org.joml.Vector3f;
|
||||
import thedarkcolour.exdeorum.client.ClientHandler;
|
||||
import thedarkcolour.exdeorum.data.TranslationKeys;
|
||||
import thedarkcolour.exdeorum.material.DefaultMaterials;
|
||||
import thedarkcolour.exdeorum.registry.EBlocks;
|
||||
|
||||
// TODO: port ClientXeiUtil to MC 26.x:
|
||||
// - GuiGraphics → GuiGraphicsExtractor
|
||||
// - BakedModel/ItemRenderer removed; use new item rendering API
|
||||
// - BlockRenderDispatcher/renderSingleBlock removed
|
||||
// - ItemBlockRenderTypes.getRenderLayer removed; use FluidStateModelSet/FluidModel
|
||||
// - RenderTypeHelper removed
|
||||
// - ModelData moved package
|
||||
// - OAK_BARREL_COMPOSTING removed from ClientHandler (ModelResourceLocation removed)
|
||||
// client-only logic shared between JEI and EMI
|
||||
public class ClientXeiUtil {
|
||||
private static final ItemStack OAK_BARREL = new ItemStack(DefaultMaterials.OAK_BARREL.getItem());
|
||||
|
||||
private static final FluidState EMPTY = Fluids.EMPTY.defaultFluidState();
|
||||
private static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
|
||||
// From https://github.com/The-Aether-Team/Nitrogen/blob/1.20.1-develop/src/main/java/com/aetherteam/nitrogen/integration/jei/BlockStateRenderer.java
|
||||
private static final Vector3f L1 = new Vector3f(0.4F, 0.0F, 1.0F).normalize();
|
||||
private static final Vector3f L2 = new Vector3f(-0.4F, 1.0F, -0.2F).normalize();
|
||||
|
||||
public static void renderItemAlternativeModel(GuiGraphics graphics, BakedModel model, ItemStack stack, int xOffset, int yOffset) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
var pose = graphics.pose();
|
||||
pose.pushPose();
|
||||
pose.translate(8 + xOffset, 8 + yOffset, 150);
|
||||
|
||||
try {
|
||||
pose.mulPose(new Matrix4f().scaling(1.0F, -1.0F, 1.0F));
|
||||
pose.scale(16f, 16f, 16f);
|
||||
boolean flag = !model.usesBlockLight();
|
||||
if (flag) {
|
||||
Lighting.setupForFlatItems();
|
||||
}
|
||||
|
||||
mc.getItemRenderer().render(stack, ItemDisplayContext.GUI, false, pose, graphics.bufferSource(), 0xf000f0, OverlayTexture.NO_OVERLAY, model);
|
||||
graphics.flush();
|
||||
if (flag) {
|
||||
Lighting.setupFor3DItems();
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
|
||||
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
|
||||
crashreportcategory.setDetail("Item Type", () -> String.valueOf(stack.getItem()));
|
||||
crashreportcategory.setDetail("Registry Name", () -> BuiltInRegistries.ITEM.getKey(stack.getItem()).toString());
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
|
||||
pose.popPose();
|
||||
|
||||
// From end of ItemStackRenderer
|
||||
RenderSystem.disableBlend();
|
||||
public static void renderBlock(GuiGraphicsExtractor guiGraphics, BlockState state, float x, float y, float z, float scale) {
|
||||
// TODO: port block/fluid rendering using 26.x FluidRenderer and block model APIs
|
||||
}
|
||||
|
||||
// https://github.com/way2muchnoise/JustEnoughResources/blob/89ee40ff068c8d6eb6ab103f76381445691cffc9/Common/src/main/java/jeresources/util/RenderHelper.java#L100
|
||||
public static void renderBlock(GuiGraphics guiGraphics, BlockState state, float x, float y, float z, float scale) {
|
||||
PoseStack poseStack = guiGraphics.pose();
|
||||
|
||||
poseStack.pushPose();
|
||||
|
||||
poseStack.translate(x, y, z);
|
||||
poseStack.scale(-scale, -scale, -scale);
|
||||
poseStack.translate(-0.5F, -0.5F, 0);
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(-30F));
|
||||
poseStack.translate(0.5F, 0, -0.5F);
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(45f));
|
||||
poseStack.translate(-0.5F, 0, 0.5F);
|
||||
|
||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
|
||||
poseStack.translate(0, 0, -1);
|
||||
|
||||
FluidState fluidState = state.getFluidState();
|
||||
|
||||
if (fluidState.isEmpty()) {
|
||||
MultiBufferSource.BufferSource buffers = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
|
||||
RenderSystem.setupGui3DDiffuseLighting(L1, L2);
|
||||
if (state.is(EBlocks.INFESTED_LEAVES.get())) {
|
||||
var blockRenderer = Minecraft.getInstance().getBlockRenderer();
|
||||
var bakedmodel = blockRenderer.getBlockModel(state);
|
||||
|
||||
for (var renderType : bakedmodel.getRenderTypes(state, RandomSource.create(42), ModelData.EMPTY)) {
|
||||
blockRenderer.getModelRenderer().renderModel(poseStack.last(), buffers.getBuffer(RenderTypeHelper.getEntityRenderType(renderType, false)), state, bakedmodel, 1f, 1f, 1f, 15728880, OverlayTexture.NO_OVERLAY, ModelData.EMPTY, renderType);
|
||||
}
|
||||
} else {
|
||||
Minecraft.getInstance().getBlockRenderer().renderSingleBlock(state, poseStack, buffers, 15728880, OverlayTexture.NO_OVERLAY, ModelData.EMPTY, null);
|
||||
}
|
||||
|
||||
buffers.endBatch();
|
||||
} else {
|
||||
RenderType renderType = ItemBlockRenderTypes.getRenderLayer(fluidState);
|
||||
Matrix4fStack modelView = RenderSystem.getModelViewStack();
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
renderType.setupRenderState();
|
||||
modelView.pushMatrix();
|
||||
modelView.mul(poseStack.last().pose());
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
||||
BufferBuilder builder = tesselator.begin(renderType.mode(), renderType.format());
|
||||
|
||||
Dummy.tempState = state;
|
||||
Dummy.tempFluid = fluidState;
|
||||
Minecraft.getInstance().getBlockRenderer().renderLiquid(BlockPos.ZERO, Dummy.INSTANCE, builder, state, state.getFluidState());
|
||||
Dummy.tempFluid = EMPTY;
|
||||
Dummy.tempState = AIR;
|
||||
|
||||
MeshData build = builder.build();
|
||||
if (build != null) {
|
||||
BufferUploader.drawWithShader(build);
|
||||
}
|
||||
|
||||
renderType.clearRenderState();
|
||||
modelView.popMatrix();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
}
|
||||
|
||||
poseStack.popPose();
|
||||
public static void renderItemWithAsterisk(GuiGraphicsExtractor graphics, net.minecraft.world.item.ItemStack stack) {
|
||||
// TODO: port item rendering using 26.x item model API
|
||||
}
|
||||
|
||||
public static void renderItemWithAsterisk(GuiGraphics graphics, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
BakedModel model = mc.getItemRenderer().getModel(stack, mc.level, null, 0);
|
||||
renderItemAlternativeModel(graphics, model, stack, 0, 0);
|
||||
renderAsterisk(graphics, 0, 0);
|
||||
}
|
||||
|
||||
public static void renderAsterisk(GuiGraphics graphics, int xOffset, int yOffset) {
|
||||
graphics.pose().pushPose();
|
||||
graphics.pose().translate(0f, 0f, 200f);
|
||||
|
||||
var font = Minecraft.getInstance().font;
|
||||
public static void renderAsterisk(GuiGraphicsExtractor graphics, int xOffset, int yOffset) {
|
||||
var font = net.minecraft.client.Minecraft.getInstance().font;
|
||||
// 0xff5555 is Minecraft's red text color.
|
||||
graphics.drawString(font, "*", xOffset + 19 - 2 - font.width("*"), yOffset + 12, 0xff5555, true);
|
||||
graphics.text(font, "*", xOffset + 19 - 2 - font.width("*"), yOffset + 12, 0xff5555);
|
||||
}
|
||||
|
||||
graphics.pose().popPose();
|
||||
public static void renderFilledCompostBarrel(GuiGraphicsExtractor guiGraphics, int xOffset, int yOffset) {
|
||||
// TODO: port using 26.x item model API (ModelResourceLocation/OAK_BARREL_COMPOSTING removed)
|
||||
}
|
||||
|
||||
// Takes a decimal probability and returns a user-friendly percentage value
|
||||
|
|
@ -175,75 +39,4 @@ public class ClientXeiUtil {
|
|||
var chance = XeiUtil.FORMATTER.format(probability * 100);
|
||||
return Component.translatable(TranslationKeys.SIEVE_RECIPE_CHANCE, chance).withStyle(ChatFormatting.GRAY);
|
||||
}
|
||||
|
||||
public static void renderFilledCompostBarrel(GuiGraphics guiGraphics, int xOffset, int yOffset) {
|
||||
// From mezz.jei.library.render.ItemStackRenderer
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
var model = mc.getModelManager().getModel(ClientHandler.OAK_BARREL_COMPOSTING);
|
||||
// From GuiGraphics.renderFakeItem
|
||||
ClientXeiUtil.renderItemAlternativeModel(guiGraphics, model, OAK_BARREL, xOffset, yOffset);
|
||||
// From end of DrawableIngredient
|
||||
RenderSystem.disableDepthTest();
|
||||
}
|
||||
|
||||
public enum Dummy implements BlockAndTintGetter {
|
||||
INSTANCE;
|
||||
|
||||
private static BlockState tempState = AIR;
|
||||
private static FluidState tempFluid = EMPTY;
|
||||
|
||||
@Override
|
||||
public float getShade(Direction pDirection, boolean pShade) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@Override
|
||||
public LevelLightEngine getLightEngine() {
|
||||
return Minecraft.getInstance().level.getLightEngine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTint(BlockPos pBlockPos, ColorResolver pColorResolver) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(LightLayer pLightType, BlockPos pBlockPos) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRawBrightness(BlockPos pBlockPos, int pAmount) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity getBlockEntity(BlockPos pPos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
return pos.equals(BlockPos.ZERO) ? tempState : AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockPos pos) {
|
||||
return pos.equals(BlockPos.ZERO) ? tempFluid : EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinBuildHeight() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class CompatUtil {
|
|||
}
|
||||
|
||||
public static <C extends RecipeInput, R extends Recipe<C>, T> List<T> collectAllRecipes(RecipeType<R> recipeType, Function<R, T> mapper) {
|
||||
var byType = RecipeUtil.getRecipeManager().byType(recipeType);
|
||||
var byType = RecipeUtil.getRecipeMap().byType(recipeType);
|
||||
List<T> recipes = new ObjectArrayList<>(byType.size());
|
||||
for (RecipeHolder<R> value : byType) {
|
||||
recipes.add(mapper.apply(value.value()));
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.google.common.collect.Lists;
|
|||
import it.unimi.dsi.fastutil.Hash;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
|
@ -66,7 +66,7 @@ public class PreferredOres {
|
|||
* @param defaultOre The default ore choice, picked by Ex Deorum based on which mod is the "best" choice according to thedarkcolour.
|
||||
*/
|
||||
private static void putPreferredOre(TagKey<Item> tag, ModConfigSpec.ConfigValue<String> config, Item defaultOre) {
|
||||
var item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(config.get()));
|
||||
var item = BuiltInRegistries.ITEM.get(Identifier.parse(config.get()));
|
||||
|
||||
if (item == Items.AIR) {
|
||||
item = defaultOre;
|
||||
|
|
@ -171,11 +171,11 @@ public class PreferredOres {
|
|||
|
||||
if (modId != null) {
|
||||
if (modId.equals(ModIds.FACTORIUM)) {
|
||||
return BuiltInRegistries.ITEM.get(ResourceLocation.fromNamespaceAndPath(modId, "mat_" + path));
|
||||
return BuiltInRegistries.ITEM.get(Identifier.fromNamespaceAndPath(modId, "mat_" + path));
|
||||
} else if (modId.equals(ModIds.IMMERSIVE_ENGINEERING)) {
|
||||
return BuiltInRegistries.ITEM.get(ResourceLocation.fromNamespaceAndPath(modId, "ore_" + path.substring(0, path.length() - 4)));
|
||||
return BuiltInRegistries.ITEM.get(Identifier.fromNamespaceAndPath(modId, "ore_" + path.substring(0, path.length() - 4)));
|
||||
} else {
|
||||
return BuiltInRegistries.ITEM.get(ResourceLocation.fromNamespaceAndPath(modId, path));
|
||||
return BuiltInRegistries.ITEM.get(Identifier.fromNamespaceAndPath(modId, path));
|
||||
}
|
||||
} else {
|
||||
return Items.AIR;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.gson.JsonObject;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
|
||||
import net.minecraft.advancements.criterion.StatePropertiesPredicate;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import dev.emi.emi.api.stack.EmiIngredient;
|
|||
import dev.emi.emi.api.stack.EmiStack;
|
||||
import dev.emi.emi.api.widget.WidgetHolder;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import thedarkcolour.exdeorum.data.TranslationKeys;
|
||||
import thedarkcolour.exdeorum.recipe.barrel.BarrelCompostRecipe;
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ class BarrelCompostEmiRecipe extends EEmiRecipe {
|
|||
private final List<EmiIngredient> inputs;
|
||||
private final int volume;
|
||||
|
||||
public BarrelCompostEmiRecipe(BarrelCompostRecipe recipe, ResourceLocation id) {
|
||||
public BarrelCompostEmiRecipe(BarrelCompostRecipe recipe, Identifier id) {
|
||||
super(id);
|
||||
|
||||
this.inputs = EmiUtil.inputs(recipe);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import dev.emi.emi.api.render.EmiTexture;
|
|||
import dev.emi.emi.api.stack.EmiIngredient;
|
||||
import dev.emi.emi.api.stack.EmiStack;
|
||||
import dev.emi.emi.api.widget.WidgetHolder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import thedarkcolour.exdeorum.compat.XeiUtil;
|
||||
import thedarkcolour.exdeorum.recipe.barrel.BarrelFluidMixingRecipe;
|
||||
import thedarkcolour.exdeorum.recipe.barrel.BarrelMixingRecipe;
|
||||
|
|
@ -37,7 +37,7 @@ abstract class BarrelMixingEmiRecipe extends EEmiRecipe {
|
|||
private final List<EmiIngredient> inputs;
|
||||
private final List<EmiStack> outputs;
|
||||
|
||||
public BarrelMixingEmiRecipe(EmiIngredient base, EmiIngredient additive, List<EmiStack> outputs, ResourceLocation id) {
|
||||
public BarrelMixingEmiRecipe(EmiIngredient base, EmiIngredient additive, List<EmiStack> outputs, Identifier id) {
|
||||
super(id);
|
||||
|
||||
this.base = base;
|
||||
|
|
@ -77,7 +77,7 @@ abstract class BarrelMixingEmiRecipe extends EEmiRecipe {
|
|||
}
|
||||
|
||||
static class Items extends BarrelMixingEmiRecipe {
|
||||
public Items(BarrelMixingRecipe recipe, ResourceLocation id) {
|
||||
public Items(BarrelMixingRecipe recipe, Identifier id) {
|
||||
super(NeoForgeEmiIngredient.of(recipe.fluid), EmiIngredient.of(recipe.ingredient), EmiUtil.outputs(recipe.result), id);
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ abstract class BarrelMixingEmiRecipe extends EEmiRecipe {
|
|||
}
|
||||
|
||||
static class Fluids extends BarrelMixingEmiRecipe {
|
||||
public Fluids(BarrelFluidMixingRecipe recipe, ResourceLocation id) {
|
||||
public Fluids(BarrelFluidMixingRecipe recipe, Identifier id) {
|
||||
super(NeoForgeEmiIngredient.of(recipe.baseFluid()), NeoForgeEmiIngredient.of(recipe.additiveFluid()), EmiUtil.outputs(recipe.result()), id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import dev.emi.emi.api.render.EmiTexture;
|
|||
import dev.emi.emi.api.stack.EmiIngredient;
|
||||
import dev.emi.emi.api.stack.EmiStack;
|
||||
import dev.emi.emi.api.widget.WidgetHolder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import thedarkcolour.exdeorum.compat.XeiUtil;
|
||||
import thedarkcolour.exdeorum.recipe.BlockPredicate;
|
||||
|
|
@ -38,7 +38,7 @@ class CrookEmiRecipe extends EEmiRecipe {
|
|||
private final List<BlockState> states;
|
||||
private final BlockPredicate predicate;
|
||||
|
||||
public CrookEmiRecipe(CrookRecipe recipe, ResourceLocation id) {
|
||||
public CrookEmiRecipe(CrookRecipe recipe, Identifier id) {
|
||||
super(id);
|
||||
|
||||
this.inputs = EmiUtil.inputs(recipe.blockPredicate());
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package thedarkcolour.exdeorum.compat.emi;
|
|||
|
||||
import dev.emi.emi.api.recipe.EmiRecipeCategory;
|
||||
import dev.emi.emi.api.stack.EmiStack;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import thedarkcolour.exdeorum.recipe.crucible.CrucibleRecipe;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||
abstract class CrucibleEmiRecipe extends EmiOneToOneRecipe {
|
||||
private final List<EmiStack> outputs;
|
||||
|
||||
CrucibleEmiRecipe(CrucibleRecipe recipe, ResourceLocation id) {
|
||||
CrucibleEmiRecipe(CrucibleRecipe recipe, Identifier id) {
|
||||
super(recipe, id);
|
||||
|
||||
this.outputs = EmiUtil.outputs(recipe.getResult());
|
||||
|
|
@ -40,7 +40,7 @@ abstract class CrucibleEmiRecipe extends EmiOneToOneRecipe {
|
|||
}
|
||||
|
||||
static class Lava extends CrucibleEmiRecipe {
|
||||
Lava(CrucibleRecipe recipe, ResourceLocation id) {
|
||||
Lava(CrucibleRecipe recipe, Identifier id) {
|
||||
super(recipe, id);
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ abstract class CrucibleEmiRecipe extends EmiOneToOneRecipe {
|
|||
}
|
||||
|
||||
static class Water extends CrucibleEmiRecipe {
|
||||
Water(CrucibleRecipe recipe, ResourceLocation id) {
|
||||
Water(CrucibleRecipe recipe, Identifier id) {
|
||||
super(recipe, id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import dev.emi.emi.api.stack.EmiStack;
|
|||
import dev.emi.emi.api.widget.TextWidget;
|
||||
import dev.emi.emi.api.widget.WidgetHolder;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import thedarkcolour.exdeorum.compat.XeiUtil;
|
||||
import thedarkcolour.exdeorum.data.TranslationKeys;
|
||||
|
|
@ -39,7 +39,7 @@ class CrucibleHeatEmiRecipe extends EEmiRecipe {
|
|||
private final BlockPredicate predicate;
|
||||
private final int heatValue;
|
||||
|
||||
public CrucibleHeatEmiRecipe(CrucibleHeatRecipe recipe, ResourceLocation id) {
|
||||
public CrucibleHeatEmiRecipe(CrucibleHeatRecipe recipe, Identifier id) {
|
||||
super(id);
|
||||
|
||||
this.inputs = EmiUtil.inputs(recipe.blockPredicate());
|
||||
|
|
|
|||
|
|
@ -19,18 +19,18 @@
|
|||
package thedarkcolour.exdeorum.compat.emi;
|
||||
|
||||
import dev.emi.emi.api.recipe.EmiRecipe;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
abstract class EEmiRecipe implements EmiRecipe {
|
||||
protected final ResourceLocation id;
|
||||
protected final Identifier id;
|
||||
|
||||
EEmiRecipe(ResourceLocation id) {
|
||||
EEmiRecipe(Identifier id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable ResourceLocation getId() {
|
||||
public @Nullable Identifier getId() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package thedarkcolour.exdeorum.compat.emi;
|
|||
import dev.emi.emi.api.render.EmiTexture;
|
||||
import dev.emi.emi.api.stack.EmiIngredient;
|
||||
import dev.emi.emi.api.widget.WidgetHolder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import thedarkcolour.exdeorum.compat.XeiUtil;
|
||||
import thedarkcolour.exdeorum.recipe.SingleIngredientRecipe;
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ import java.util.List;
|
|||
abstract class EmiOneToOneRecipe extends EEmiRecipe {
|
||||
private final List<EmiIngredient> inputs;
|
||||
|
||||
EmiOneToOneRecipe(SingleIngredientRecipe recipe, ResourceLocation id) {
|
||||
EmiOneToOneRecipe(SingleIngredientRecipe recipe, Identifier id) {
|
||||
super(id);
|
||||
|
||||
this.inputs = EmiUtil.inputs(recipe);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import dev.emi.emi.api.neoforge.NeoForgeEmiStack;
|
|||
import dev.emi.emi.api.recipe.EmiRecipe;
|
||||
import dev.emi.emi.api.stack.EmiIngredient;
|
||||
import dev.emi.emi.api.stack.EmiStack;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
|
@ -74,7 +74,7 @@ class EmiUtil {
|
|||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
public static <C extends RecipeInput, R extends Recipe<C>> void addAll(EmiRegistry registry, Supplier<RecipeType<R>> type, BiFunction<R, ResourceLocation, ? extends EmiRecipe> factory) {
|
||||
public static <C extends RecipeInput, R extends Recipe<C>> void addAll(EmiRegistry registry, Supplier<RecipeType<R>> type, BiFunction<R, Identifier, ? extends EmiRecipe> factory) {
|
||||
for (var holder : registry.getRecipeManager().byType(type.get())) {
|
||||
registry.addRecipe(factory.apply(holder.value(), holder.id()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package thedarkcolour.exdeorum.compat.emi;
|
|||
|
||||
import dev.emi.emi.api.recipe.EmiRecipeCategory;
|
||||
import dev.emi.emi.api.stack.EmiStack;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import thedarkcolour.exdeorum.recipe.hammer.HammerRecipe;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
abstract class HammerEmiRecipe extends EmiOneToOneRecipe {
|
||||
private final List<EmiStack> outputs;
|
||||
|
||||
HammerEmiRecipe(HammerRecipe recipe, ResourceLocation id) {
|
||||
HammerEmiRecipe(HammerRecipe recipe, Identifier id) {
|
||||
super(recipe, id);
|
||||
|
||||
this.outputs = EmiUtil.outputs(recipe.result);
|
||||
|
|
@ -22,7 +22,7 @@ abstract class HammerEmiRecipe extends EmiOneToOneRecipe {
|
|||
}
|
||||
|
||||
static class Hammer extends HammerEmiRecipe {
|
||||
Hammer(HammerRecipe recipe, ResourceLocation id) {
|
||||
Hammer(HammerRecipe recipe, Identifier id) {
|
||||
super(recipe, id);
|
||||
}
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ abstract class HammerEmiRecipe extends EmiOneToOneRecipe {
|
|||
}
|
||||
|
||||
static class CompressedHammer extends HammerEmiRecipe {
|
||||
CompressedHammer(HammerRecipe recipe, ResourceLocation id) {
|
||||
CompressedHammer(HammerRecipe recipe, Identifier id) {
|
||||
super(recipe, id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import dev.emi.emi.api.widget.SlotWidget;
|
|||
import dev.emi.emi.api.widget.WidgetHolder;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
|
||||
|
|
@ -56,7 +56,7 @@ abstract class SieveEmiRecipe extends EEmiRecipe {
|
|||
this.outputs = outputs.build();
|
||||
}
|
||||
|
||||
private static ResourceLocation determineId(XeiSieveRecipe recipe) {
|
||||
private static Identifier determineId(XeiSieveRecipe recipe) {
|
||||
Item mesh = recipe.mesh().getItem();
|
||||
int hashCode = Arrays.hashCode(Arrays.stream(recipe.ingredient().getItems())
|
||||
.map(ItemStack::getItem)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.compat.emi;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package thedarkcolour.exdeorum.compat.jade;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import snownee.jade.api.BlockAccessor;
|
||||
import snownee.jade.api.IBlockComponentProvider;
|
||||
import snownee.jade.api.ITooltip;
|
||||
|
|
@ -57,7 +57,7 @@ enum BarrelComponentProvider implements IBlockComponentProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
public Identifier getUid() {
|
||||
return ExDeorumJadePlugin.BARREL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package thedarkcolour.exdeorum.compat.jade;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import snownee.jade.api.BlockAccessor;
|
||||
import snownee.jade.api.IBlockComponentProvider;
|
||||
import snownee.jade.api.ITooltip;
|
||||
|
|
@ -37,7 +37,7 @@ enum CrucibleComponentProvider implements IBlockComponentProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
public Identifier getUid() {
|
||||
return ExDeorumJadePlugin.CRUCIBLE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package thedarkcolour.exdeorum.compat.jade;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import snownee.jade.api.IWailaClientRegistration;
|
||||
import snownee.jade.api.IWailaPlugin;
|
||||
import snownee.jade.api.WailaPlugin;
|
||||
|
|
@ -30,10 +30,10 @@ import thedarkcolour.exdeorum.block.SieveBlock;
|
|||
|
||||
@WailaPlugin
|
||||
public class ExDeorumJadePlugin implements IWailaPlugin {
|
||||
static final ResourceLocation INFESTED_LEAVES = ExDeorum.loc("infested_leaves");
|
||||
static final ResourceLocation BARREL = ExDeorum.loc("barrel");
|
||||
static final ResourceLocation SIEVE = ExDeorum.loc("sieve");
|
||||
static final ResourceLocation CRUCIBLE = ExDeorum.loc("crucible");
|
||||
static final Identifier INFESTED_LEAVES = ExDeorum.loc("infested_leaves");
|
||||
static final Identifier BARREL = ExDeorum.loc("barrel");
|
||||
static final Identifier SIEVE = ExDeorum.loc("sieve");
|
||||
static final Identifier CRUCIBLE = ExDeorum.loc("crucible");
|
||||
|
||||
@Override
|
||||
public void registerClient(IWailaClientRegistration registration) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package thedarkcolour.exdeorum.compat.jade;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import snownee.jade.api.BlockAccessor;
|
||||
import snownee.jade.api.IBlockComponentProvider;
|
||||
import snownee.jade.api.ITooltip;
|
||||
|
|
@ -43,7 +43,7 @@ enum InfestedLeavesComponentProvider implements IBlockComponentProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
public Identifier getUid() {
|
||||
return ExDeorumJadePlugin.INFESTED_LEAVES;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package thedarkcolour.exdeorum.compat.jade;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import snownee.jade.api.BlockAccessor;
|
||||
import snownee.jade.api.IBlockComponentProvider;
|
||||
|
|
@ -52,7 +52,7 @@ enum SieveComponentProvider implements IBlockComponentProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
public Identifier getUid() {
|
||||
return ExDeorumJadePlugin.SIEVE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.compat.jade;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import mezz.jei.api.registration.IRecipeRegistration;
|
|||
import net.minecraft.client.renderer.Rect2i;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
|
|
@ -73,7 +73,7 @@ import java.util.function.Supplier;
|
|||
|
||||
@JeiPlugin
|
||||
public class ExDeorumJeiPlugin implements IModPlugin {
|
||||
public static final ResourceLocation EX_DEORUM_JEI_TEXTURE = ExDeorum.loc("textures/gui/jei/enr_jei.png");
|
||||
public static final Identifier EX_DEORUM_JEI_TEXTURE = ExDeorum.loc("textures/gui/jei/enr_jei.png");
|
||||
|
||||
static final RecipeType<BarrelCompostRecipe> BARREL_COMPOST = recipeType("barrel_compost", BarrelCompostRecipe.class);
|
||||
static final RecipeType<BarrelMixingRecipe> BARREL_MIXING = recipeType("barrel_mixing", BarrelMixingRecipe.class);
|
||||
|
|
@ -94,7 +94,7 @@ public class ExDeorumJeiPlugin implements IModPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getPluginUid() {
|
||||
public Identifier getPluginUid() {
|
||||
return ExDeorum.loc("jei_plugin");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.compat.jei;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import dev.latvian.mods.kubejs.recipe.match.ReplacementMatchInfo;
|
|||
import dev.latvian.mods.kubejs.script.ScriptType;
|
||||
import dev.latvian.mods.rhino.Context;
|
||||
import dev.latvian.mods.rhino.util.HideFromJS;
|
||||
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
|
||||
import net.minecraft.advancements.criterion.StatePropertiesPredicate;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.compat.kubejs;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.compat;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package thedarkcolour.exdeorum.compat.top;
|
|||
import mcjty.theoneprobe.api.*;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
|
@ -36,8 +36,8 @@ import thedarkcolour.exdeorum.registry.EBlocks;
|
|||
|
||||
public class ExDeorumInfoProvider implements IProbeInfoProvider {
|
||||
@Override
|
||||
public ResourceLocation getID() {
|
||||
return ResourceLocation.fromNamespaceAndPath(ExDeorum.ID, "info_provider");
|
||||
public Identifier getID() {
|
||||
return Identifier.fromNamespaceAndPath(ExDeorum.ID, "info_provider");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.compat.top;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.config;
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ package thedarkcolour.exdeorum.data;
|
|||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.advancements.AdvancementType;
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.advancements.critereon.ImpossibleTrigger;
|
||||
import net.minecraft.advancements.criterion.ImpossibleTrigger;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.advancements.AdvancementProvider;
|
||||
import net.minecraft.data.advancements.AdvancementSubProvider;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.neoforged.neoforge.common.data.AdvancementProvider;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
import thedarkcolour.exdeorum.material.DefaultMaterials;
|
||||
import thedarkcolour.exdeorum.registry.EItems;
|
||||
|
|
@ -39,21 +39,21 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
import static net.minecraft.advancements.Advancement.Builder.advancement;
|
||||
import static net.minecraft.advancements.critereon.InventoryChangeTrigger.TriggerInstance.hasItems;
|
||||
import static net.minecraft.advancements.critereon.ItemPredicate.Builder.item;
|
||||
import static net.minecraft.advancements.criterion.InventoryChangeTrigger.TriggerInstance.hasItems;
|
||||
import static net.minecraft.advancements.criterion.ItemPredicate.Builder.item;
|
||||
|
||||
class Advancements extends AdvancementProvider {
|
||||
public Advancements(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, ExistingFileHelper existingFileHelper) {
|
||||
super(output, registries, existingFileHelper, List.of(new CoreAchievements()));
|
||||
public Advancements(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) {
|
||||
super(output, registries, List.of(new CoreAchievements()));
|
||||
}
|
||||
|
||||
private static ResourceLocation modLoc(String path) {
|
||||
return ResourceLocation.fromNamespaceAndPath(ExDeorum.ID, path);
|
||||
private static String modLoc(String path) {
|
||||
return Identifier.fromNamespaceAndPath(ExDeorum.ID, path).toString();
|
||||
}
|
||||
|
||||
public static class CoreAchievements implements AdvancementGenerator {
|
||||
public static class CoreAchievements implements AdvancementSubProvider {
|
||||
@Override
|
||||
public void generate(HolderLookup.Provider registries, Consumer<AdvancementHolder> saver, ExistingFileHelper helper) {
|
||||
public void generate(HolderLookup.Provider registries, Consumer<AdvancementHolder> saver) {
|
||||
var root = advancement()
|
||||
.display(
|
||||
Blocks.OAK_SAPLING,
|
||||
|
|
@ -67,7 +67,7 @@ class Advancements extends AdvancementProvider {
|
|||
)
|
||||
// hardcoded to EventHandler
|
||||
.addCriterion("in_void_world", CriteriaTriggers.IMPOSSIBLE.createCriterion(new ImpossibleTrigger.TriggerInstance()))
|
||||
.save(saver, modLoc("core/root"), helper);
|
||||
.save(saver, modLoc("core/root"));
|
||||
var crook = advancement()
|
||||
.parent(root)
|
||||
.display(
|
||||
|
|
@ -81,7 +81,7 @@ class Advancements extends AdvancementProvider {
|
|||
true
|
||||
)
|
||||
.addCriterion("craft_crook", hasItems(item().of(EItemTags.CROOKS).build()))
|
||||
.save(saver, modLoc("core/crook"), helper);
|
||||
.save(saver, modLoc("core/crook"));
|
||||
var barrel = advancement()
|
||||
.parent(root)
|
||||
.display(
|
||||
|
|
@ -95,7 +95,7 @@ class Advancements extends AdvancementProvider {
|
|||
true
|
||||
)
|
||||
.addCriterion("has_barrel", hasItems(item().of(EItemTags.BARRELS).build()))
|
||||
.save(saver, modLoc("core/barrel"), helper);
|
||||
.save(saver, modLoc("core/barrel"));
|
||||
var silkWorm = advancement()
|
||||
.parent(crook)
|
||||
.display(
|
||||
|
|
@ -109,7 +109,7 @@ class Advancements extends AdvancementProvider {
|
|||
false
|
||||
)
|
||||
.addCriterion("has_silk_worm", hasItems(item().of(EItems.SILKWORM.get()).build()))
|
||||
.save(saver, modLoc("core/silk_worm"), helper);
|
||||
.save(saver, modLoc("core/silk_worm"));
|
||||
var stringMesh = advancement()
|
||||
.parent(silkWorm)
|
||||
.display(
|
||||
|
|
@ -123,7 +123,7 @@ class Advancements extends AdvancementProvider {
|
|||
false
|
||||
)
|
||||
.addCriterion("has_string_mesh", hasItems(item().of(EItems.STRING_MESH.get()).build()))
|
||||
.save(saver, modLoc("core/string_mesh"), helper);
|
||||
.save(saver, modLoc("core/string_mesh"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package thedarkcolour.exdeorum.data;
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.neoforged.neoforge.client.model.generators.BlockModelBuilder;
|
||||
|
|
@ -263,9 +263,9 @@ class BlockModels {
|
|||
.texture("side", texture);
|
||||
}
|
||||
|
||||
private static ResourceLocation texture(Block block, String prefix, String suffix) {
|
||||
private static Identifier texture(Block block, String prefix, String suffix) {
|
||||
var key = Objects.requireNonNull(BuiltInRegistries.BLOCK.getKey(block));
|
||||
return ResourceLocation.fromNamespaceAndPath(key.getNamespace(), "block/" + prefix + key.getPath() + suffix);
|
||||
return Identifier.fromNamespaceAndPath(key.getNamespace(), "block/" + prefix + key.getPath() + suffix);
|
||||
}
|
||||
|
||||
public static void barrel(MKBlockModelProvider models, Block block, Block appearance) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package thedarkcolour.exdeorum.data;
|
||||
|
||||
import net.minecraft.advancements.critereon.ItemPredicate;
|
||||
import net.minecraft.advancements.criterion.ItemPredicate;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package thedarkcolour.exdeorum.data;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
|
|
@ -213,15 +213,15 @@ public class ModCompatData {
|
|||
MAPLE_LOG_ITEM = item(ModIds.BLUE_SKIES, "maple_log"),
|
||||
CRYSTALLIZED_LOG_ITEM = item(ModIds.BLUE_SKIES, "crystallized_log");
|
||||
|
||||
public static final ResourceLocation[] PAMS_CROPS;
|
||||
public static final Identifier[] PAMS_CROPS;
|
||||
|
||||
static {
|
||||
// copy and pasted from the GitHub
|
||||
String[] names = { "pamagavecrop", "pamamaranthcrop", "pamarrowrootcrop", "pamartichokecrop", "pamasparaguscrop", "pambarleycrop", "pambeancrop", "pambellpeppercrop", "pamblackberrycrop", "pamblueberrycrop", "pambroccolicrop", "pambrusselsproutcrop", "pamcabbagecrop", "pamcactusfruitcrop", "pamcandleberrycrop", "pamcantaloupecrop", "pamcassavacrop", "pamcauliflowercrop", "pamcelerycrop", "pamchickpeacrop", "pamchilipeppercrop", "pamcoffeebeancrop", "pamcorncrop", "pamcottoncrop", "pamcranberrycrop", "pamcucumbercrop", "pameggplantcrop", "pamelderberrycrop", "pamflaxcrop", "pamgarliccrop", "pamgingercrop", "pamgrapecrop", "pamgreengrapecrop", "pamhuckleberrycrop", "pamjicamacrop", "pamjuniperberrycrop", "pamjutecrop", "pamkalecrop", "pamkenafcrop", "pamkiwicrop", "pamkohlrabicrop", "pamleekcrop", "pamlentilcrop", "pamlettucecrop", "pammilletcrop", "pammulberrycrop", "pammustardseedscrop", "pamoatscrop", "pamokracrop", "pamonioncrop", "pamparsnipcrop", "pampeanutcrop", "pampeascrop", "pampineapplecrop", "pamquinoacrop", "pamradishcrop", "pamraspberrycrop", "pamrhubarbcrop", "pamricecrop", "pamrutabagacrop", "pamryecrop", "pamscallioncrop", "pamsesameseedscrop", "pamsisalcrop", "pamsoybeancrop", "pamspiceleafcrop", "pamspinachcrop", "pamstrawberrycrop", "pamsweetpotatocrop", "pamtarocrop", "pamtealeafcrop", "pamtomatillocrop", "pamtomatocrop", "pamturnipcrop", "pamwaterchestnutcrop", "pamwhitemushroomcrop", "pamwintersquashcrop", "pamzucchinicrop"};
|
||||
PAMS_CROPS = new ResourceLocation[names.length];
|
||||
PAMS_CROPS = new Identifier[names.length];
|
||||
|
||||
for (int i = 0, namesLength = names.length; i < namesLength; i++) {
|
||||
PAMS_CROPS[i] = ResourceLocation.fromNamespaceAndPath(ModIds.PAMS_HARVESTCRAFT_CROPS, names[i]);
|
||||
PAMS_CROPS[i] = Identifier.fromNamespaceAndPath(ModIds.PAMS_HARVESTCRAFT_CROPS, names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package thedarkcolour.exdeorum.data;
|
|||
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
|
|
@ -62,7 +62,7 @@ class ModTags {
|
|||
public static void createBlockTags(MKTagsProvider<Block> tags) {
|
||||
var wateringCanTickable = tags.tag(EBlockTags.WATERING_CAN_TICKABLE);
|
||||
wateringCanTickable.add(Blocks.GRASS_BLOCK, Blocks.MYCELIUM, Blocks.CRIMSON_FUNGUS, Blocks.WARPED_FUNGUS, Blocks.RED_MUSHROOM, Blocks.BROWN_MUSHROOM, Blocks.CACTUS, Blocks.SUGAR_CANE, Blocks.SWEET_BERRY_BUSH, Blocks.COCOA).addTags(BlockTags.SAPLINGS, BlockTags.NYLIUM, BlockTags.BEE_GROWABLES);
|
||||
for (ResourceLocation path : ModCompatData.PAMS_CROPS) {
|
||||
for (Identifier path : ModCompatData.PAMS_CROPS) {
|
||||
wateringCanTickable.addOptional(path);
|
||||
}
|
||||
tags.tag(EBlockTags.MINEABLE_WITH_HAMMER)
|
||||
|
|
@ -124,7 +124,7 @@ class ModTags {
|
|||
);
|
||||
|
||||
// Cyclic adds ONE compressed block :)
|
||||
tags.tag(ECompressedBlocks.COMPRESSED_COBBLESTONE.getTag()).addOptional(ResourceLocation.fromNamespaceAndPath(ModIds.CYCLIC, "compressed_cobblestone"));
|
||||
tags.tag(ECompressedBlocks.COMPRESSED_COBBLESTONE.getTag()).addOptional(Identifier.fromNamespaceAndPath(ModIds.CYCLIC, "compressed_cobblestone"));
|
||||
|
||||
for (var variant : ECompressedBlocks.ALL_VARIANTS) {
|
||||
var builder = tags.tag(variant.getTag()).add(variant.getItem());
|
||||
|
|
@ -150,7 +150,7 @@ class ModTags {
|
|||
}
|
||||
|
||||
public static void createWorldPresetTags(MKTagsProvider<WorldPreset> tags) {
|
||||
tags.tag(net.minecraft.tags.WorldPresetTags.NORMAL).add(ResourceKey.create(Registries.WORLD_PRESET, ResourceLocation.fromNamespaceAndPath(ExDeorum.ID, "void_world")));
|
||||
tags.tag(net.minecraft.tags.WorldPresetTags.NORMAL).add(ResourceKey.create(Registries.WORLD_PRESET, Identifier.fromNamespaceAndPath(ExDeorum.ID, "void_world")));
|
||||
}
|
||||
|
||||
public static void createFluidTags(MKTagsProvider<Fluid> tags) {
|
||||
|
|
|
|||
|
|
@ -19,15 +19,14 @@
|
|||
package thedarkcolour.exdeorum.data;
|
||||
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.common.data.SoundDefinition;
|
||||
import net.neoforged.neoforge.common.data.SoundDefinitionsProvider;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
import thedarkcolour.exdeorum.registry.ESounds;
|
||||
|
||||
class Sounds extends SoundDefinitionsProvider {
|
||||
protected Sounds(PackOutput output, ExistingFileHelper helper) {
|
||||
super(output, ExDeorum.ID, helper);
|
||||
protected Sounds(PackOutput output) {
|
||||
super(output, ExDeorum.ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.data;
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
package thedarkcolour.exdeorum.data.recipe;
|
||||
|
||||
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
|
||||
import net.minecraft.advancements.criterion.StatePropertiesPredicate;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
|
@ -752,7 +752,7 @@ public class Recipes {
|
|||
writer.accept(modLoc("barrel_fluid_transformation/witch_water"), new FluidTransformationRecipe(FluidIngredient.of(Fluids.WATER), EFluids.WITCH_WATER.get(), 0x2B1057, BlockPredicate.singleBlock(Blocks.MYCELIUM), WeightedList.<BlockState>builder().add(50, Blocks.RED_MUSHROOM.defaultBlockState()).add(50, Blocks.BROWN_MUSHROOM.defaultBlockState()).build(), 1700), null);
|
||||
}
|
||||
|
||||
static ResourceLocation modLoc(String path) {
|
||||
static Identifier modLoc(String path) {
|
||||
return ExDeorum.loc(path);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.data.recipe;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package thedarkcolour.exdeorum.event;
|
||||
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
|
|
@ -26,14 +26,14 @@ import net.minecraft.core.registries.Registries;
|
|||
import net.minecraft.data.worldgen.features.TreeFeatures;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.Unit;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.gamerules.GameRules;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
|
@ -49,7 +49,7 @@ import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
|
|||
import net.neoforged.neoforge.client.event.ClientChatEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.common.NeoForgeMod;
|
||||
import net.neoforged.neoforge.event.AddReloadListenerEvent;
|
||||
import net.neoforged.neoforge.event.AddServerReloadListenersEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||
import net.neoforged.neoforge.event.level.LevelEvent;
|
||||
import net.neoforged.neoforge.event.server.ServerStoppingEvent;
|
||||
|
|
@ -125,7 +125,7 @@ public final class EventHandler {
|
|||
// grow tree, has 5% chance to spawn bees based on world seed
|
||||
var configuredFeatureRegistry = level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE);
|
||||
var defaultTreeFeature = TreeFeatures.OAK_BEES_005;
|
||||
var defaultTreeFeatureLoc = ResourceLocation.tryParse(EConfig.SERVER.defaultSpawnTreeFeature.get());
|
||||
var defaultTreeFeatureLoc = Identifier.tryParse(EConfig.SERVER.defaultSpawnTreeFeature.get());
|
||||
|
||||
Holder<ConfiguredFeature<?, ?>> holder = configuredFeatureRegistry.getHolder(defaultTreeFeature).orElse(null);
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ public final class EventHandler {
|
|||
// tries to account for other SkyBlock generator mods like SkyBlockBuilder
|
||||
if (generator instanceof VoidChunkGenerator || generator.getClass().getName().toLowerCase(Locale.ROOT).contains("skyblock")) {
|
||||
NetworkHandler.sendVoidWorld(player);
|
||||
var advancement = player.server.getAdvancements().get(ResourceLocation.fromNamespaceAndPath(ExDeorum.ID, "core/root"));
|
||||
var advancement = player.server.getAdvancements().get(Identifier.fromNamespaceAndPath(ExDeorum.ID, "core/root"));
|
||||
|
||||
if (advancement != null) {
|
||||
if (!player.getAdvancements().getOrStartProgress(advancement).isDone()) {
|
||||
|
|
@ -209,10 +209,6 @@ public final class EventHandler {
|
|||
ExDeorum.LOGGER.error("Unable to grant player the Void World advancement. Ex Deorum advancements will not show");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Minecraft.getInstance().getConnection() != null) {
|
||||
RecipeUtil.reload(Minecraft.getInstance().getConnection().getRecipeManager());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -227,11 +223,11 @@ public final class EventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private static void addReloadListeners(AddReloadListenerEvent event) {
|
||||
var recipes = event.getServerResources().getRecipeManager();
|
||||
event.addListener((prepBarrier, resourceManager, prepProfiler, reloadProfiler, backgroundExecutor, gameExecutor) -> {
|
||||
private static void addReloadListeners(AddServerReloadListenersEvent event) {
|
||||
var recipeMap = event.getServerResources().getRecipeManager().recipeMap();
|
||||
event.addListener(ExDeorum.loc("recipes"), (prepBarrier, resourceManager, prepProfiler, reloadProfiler, backgroundExecutor, gameExecutor) -> {
|
||||
return prepBarrier.wait(Unit.INSTANCE).thenRunAsync(() -> {
|
||||
RecipeUtil.reload(recipes);
|
||||
RecipeUtil.reload(recipeMap);
|
||||
}, gameExecutor);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.event;
|
||||
|
|
|
|||
|
|
@ -18,27 +18,24 @@
|
|||
|
||||
package thedarkcolour.exdeorum.fluid;
|
||||
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.neoforged.neoforge.common.SoundActions;
|
||||
import net.neoforged.neoforge.fluids.BaseFlowingFluid;
|
||||
import net.neoforged.neoforge.fluids.FluidType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Vector3f;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import org.joml.Vector4f;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
import thedarkcolour.exdeorum.registry.EBlocks;
|
||||
import thedarkcolour.exdeorum.registry.EFluids;
|
||||
import thedarkcolour.exdeorum.registry.EItems;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class WitchWaterFluid extends FluidType {
|
||||
private static final ResourceLocation STILL_TEXTURE = ExDeorum.loc("block/witch_water_still");
|
||||
private static final ResourceLocation FLOWING_TEXTURE = ExDeorum.loc("block/witch_water_flowing");
|
||||
private static final ResourceLocation OVERLAY_TEXTURE = ResourceLocation.withDefaultNamespace("block/water_overlay");
|
||||
public static final Identifier STILL_TEXTURE = ExDeorum.loc("block/witch_water_still");
|
||||
public static final Identifier FLOWING_TEXTURE = ExDeorum.loc("block/witch_water_flowing");
|
||||
public static final Identifier OVERLAY_TEXTURE = Identifier.withDefaultNamespace("block/water_overlay");
|
||||
|
||||
public static BaseFlowingFluid.Properties properties() {
|
||||
return new BaseFlowingFluid.Properties(EFluids.WITCH_WATER_TYPE, EFluids.WITCH_WATER, EFluids.WITCH_WATER_FLOWING).block(EBlocks.WITCH_WATER).bucket(EItems.WITCH_WATER_BUCKET);
|
||||
|
|
@ -55,34 +52,27 @@ public class WitchWaterFluid extends FluidType {
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) {
|
||||
consumer.accept(new IClientFluidTypeExtensions() {
|
||||
private static final Vector3f FOG_COLOR = new Vector3f(32f / 255f, 12f / 255f, 64f / 255f);
|
||||
public static IClientFluidTypeExtensions createClientExtensions() {
|
||||
return new IClientFluidTypeExtensions() {
|
||||
@Override
|
||||
public ResourceLocation getStillTexture() {
|
||||
public Identifier getStillTexture() {
|
||||
return STILL_TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getFlowingTexture() {
|
||||
public Identifier getFlowingTexture() {
|
||||
return FLOWING_TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getOverlayTexture() {
|
||||
public Identifier getOverlayTexture() {
|
||||
return OVERLAY_TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Vector3f modifyFogColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, Vector3f fluidFogColor) {
|
||||
return FOG_COLOR;
|
||||
public void modifyFogColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, Vector4f fluidFogColor) {
|
||||
fluidFogColor.set(32f / 255f, 12f / 255f, 64f / 255f, fluidFogColor.w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTintColor() {
|
||||
return 0xffffffff;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.fluid;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import net.minecraft.world.InteractionHand;
|
|||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.animal.Cow;
|
||||
import net.minecraft.world.entity.animal.cow.Cow;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@
|
|||
|
||||
package thedarkcolour.exdeorum.item;
|
||||
|
||||
import net.minecraft.world.item.DiggerItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.ToolMaterial;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import thedarkcolour.exdeorum.registry.EItems;
|
||||
import thedarkcolour.exdeorum.tag.EBlockTags;
|
||||
|
||||
public class HammerItem extends DiggerItem {
|
||||
public HammerItem(Tier tier, Properties properties) {
|
||||
super(tier, EBlockTags.MINEABLE_WITH_HAMMER, properties);
|
||||
public class HammerItem extends Item {
|
||||
public HammerItem(ToolMaterial material, Properties properties) {
|
||||
super(material.applyToolProperties(properties, EBlockTags.MINEABLE_WITH_HAMMER, 1.5f, -2.8f, 0f));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -28,9 +28,8 @@ import net.minecraft.stats.Stats;
|
|||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.animal.Cow;
|
||||
import net.minecraft.world.entity.animal.cow.Cow;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
@ -87,13 +86,13 @@ public class PorcelainBucket extends Item {
|
|||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand pHand) {
|
||||
public InteractionResult use(Level level, Player player, InteractionHand pHand) {
|
||||
var stack = player.getItemInHand(pHand);
|
||||
var hitResult = getPlayerPOVHitResult(level, player, this.fluid.get() == Fluids.EMPTY ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE);
|
||||
if (hitResult.getType() == HitResult.Type.MISS) {
|
||||
return InteractionResultHolder.pass(stack);
|
||||
return InteractionResult.PASS;
|
||||
} else if (hitResult.getType() != HitResult.Type.BLOCK) {
|
||||
return InteractionResultHolder.pass(stack);
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
var pos = hitResult.getBlockPos();
|
||||
var face = hitResult.getDirection();
|
||||
|
|
@ -124,12 +123,13 @@ public class PorcelainBucket extends Item {
|
|||
CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer) player, result);
|
||||
}
|
||||
|
||||
return InteractionResultHolder.sidedSuccess(filled, level.isClientSide());
|
||||
var success = level.isClientSide() ? InteractionResult.SUCCESS : InteractionResult.SUCCESS_SERVER;
|
||||
return success.heldItemTransformedTo(filled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResultHolder.fail(stack);
|
||||
return InteractionResult.FAIL;
|
||||
} else {
|
||||
var state = level.getBlockState(pos);
|
||||
var placePos = canBlockContainFluid(player, level, pos, state) ? pos : relative;
|
||||
|
|
@ -140,13 +140,14 @@ public class PorcelainBucket extends Item {
|
|||
}
|
||||
|
||||
player.awardStat(Stats.ITEM_USED.get(this));
|
||||
return InteractionResultHolder.sidedSuccess(getEmptySuccessItem(stack, player), level.isClientSide());
|
||||
var success = level.isClientSide() ? InteractionResult.SUCCESS : InteractionResult.SUCCESS_SERVER;
|
||||
return success.heldItemTransformedTo(getEmptySuccessItem(stack, player));
|
||||
} else {
|
||||
return InteractionResultHolder.fail(stack);
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return InteractionResultHolder.fail(stack);
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,25 +19,21 @@
|
|||
package thedarkcolour.exdeorum.item;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.MilkBucketItem;
|
||||
import net.minecraft.world.level.Level;
|
||||
import thedarkcolour.exdeorum.registry.EItems;
|
||||
|
||||
public class PorcelainMilkBucket extends MilkBucketItem {
|
||||
public class PorcelainMilkBucket extends Item {
|
||||
public PorcelainMilkBucket(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity living) {
|
||||
var ret = super.finishUsingItem(new ItemStack(Items.MILK_BUCKET), level, living);
|
||||
|
||||
if (ret.getItem() == Items.BUCKET) {
|
||||
return new ItemStack(EItems.PORCELAIN_BUCKET.get());
|
||||
} else {
|
||||
return stack;
|
||||
if (!level.isClientSide) {
|
||||
living.removeAllEffects();
|
||||
}
|
||||
return new ItemStack(EItems.PORCELAIN_BUCKET.get());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
package thedarkcolour.exdeorum.item;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
@ -46,7 +46,7 @@ public class RandomResultItem extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||
public InteractionResult use(Level level, Player player, InteractionHand hand) {
|
||||
var stack = player.getItemInHand(hand);
|
||||
|
||||
if (!level.isClientSide) {
|
||||
|
|
@ -61,9 +61,9 @@ public class RandomResultItem extends Item {
|
|||
var newItem = new ItemStack(Util.getRandom(possibleResults, level.random));
|
||||
player.getInventory().placeItemBackInInventory(newItem);
|
||||
|
||||
return InteractionResultHolder.consume(stack.isEmpty() ? player.getItemInHand(hand) : stack);
|
||||
return InteractionResult.CONSUME.heldItemTransformedTo(stack.isEmpty() ? player.getItemInHand(hand) : stack);
|
||||
}
|
||||
return InteractionResultHolder.success(stack);
|
||||
return InteractionResult.SUCCESS.heldItemTransformedTo(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
|
|
@ -38,12 +38,12 @@ import net.minecraft.world.entity.player.Player;
|
|||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.UseAnim;
|
||||
import net.minecraft.world.item.ItemUseAnimation;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.BucketPickup;
|
||||
import net.minecraft.world.level.block.FarmBlock;
|
||||
import net.minecraft.world.level.block.FarmlandBlock;
|
||||
import net.minecraft.world.level.block.LevelEvent;
|
||||
import net.minecraft.world.level.block.SugarCaneBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
|
@ -132,8 +132,8 @@ public class WateringCanItem extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public UseAnim getUseAnimation(ItemStack stack) {
|
||||
return UseAnim.NONE;
|
||||
public ItemUseAnimation getUseAnimation(ItemStack stack) {
|
||||
return ItemUseAnimation.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -146,7 +146,7 @@ public class WateringCanItem extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||
public InteractionResult use(Level level, Player player, InteractionHand hand) {
|
||||
var itemInHand = player.getItemInHand(hand);
|
||||
var fluidHandler = itemInHand.getCapability(Capabilities.FluidHandler.ITEM);
|
||||
if (fluidHandler != null) {
|
||||
|
|
@ -164,7 +164,7 @@ public class WateringCanItem extends Item {
|
|||
pickup.getPickupSound(state).ifPresent(sound -> player.playSound(sound, 1.0F, 1.0F));
|
||||
}
|
||||
|
||||
return InteractionResultHolder.sidedSuccess(itemInHand, level.isClientSide);
|
||||
return level.isClientSide ? InteractionResult.SUCCESS : InteractionResult.SUCCESS_SERVER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -178,10 +178,10 @@ public class WateringCanItem extends Item {
|
|||
onUseTick(level, player, itemInHand, 72000);
|
||||
}
|
||||
|
||||
return InteractionResultHolder.consume(itemInHand);
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
}
|
||||
return InteractionResultHolder.pass(itemInHand);
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -258,7 +258,7 @@ public class WateringCanItem extends Item {
|
|||
} else {
|
||||
if (BarrelBlockEntity.isHotFluid(state.getFluidState().getFluidType())) {
|
||||
level.levelEvent(LevelEvent.LAVA_FIZZ, pos, 0);
|
||||
} else if (state.getBlock() == Blocks.FARMLAND) {
|
||||
} else if (state.getBlock() instanceof FarmlandBlock) {
|
||||
hydrateFarmland(level, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
@ -281,8 +281,8 @@ public class WateringCanItem extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
if (state.getValue(FarmBlock.MOISTURE) < 7) {
|
||||
level.setBlockAndUpdate(pos, state.setValue(FarmBlock.MOISTURE, 7));
|
||||
if (state.getValue(FarmlandBlock.MOISTURE) < 7) {
|
||||
level.setBlockAndUpdate(pos, state.setValue(FarmlandBlock.MOISTURE, 7));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.item;
|
||||
|
|
|
|||
|
|
@ -22,12 +22,11 @@ import com.mojang.serialization.MapCodec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction;
|
||||
import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
|
||||
import thedarkcolour.exdeorum.registry.ELootFunctions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -49,8 +48,8 @@ public class MachineLootFunction extends LootItemConditionalFunction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LootItemFunctionType<? extends LootItemConditionalFunction> getType() {
|
||||
return ELootFunctions.MACHINE.get();
|
||||
public MapCodec<MachineLootFunction> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
public static LootItemConditionalFunction.Builder<?> machineLoot() {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,10 @@ package thedarkcolour.exdeorum.loot;
|
|||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.LootNumberProviderType;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.NumberProviders;
|
||||
import thedarkcolour.exdeorum.registry.ENumberProviders;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -41,7 +40,7 @@ public record SummationGenerator(List<NumberProvider> providers) implements Numb
|
|||
}
|
||||
|
||||
@Override
|
||||
public LootNumberProviderType getType() {
|
||||
return ENumberProviders.SUMMATION.get();
|
||||
public MapCodec<SummationGenerator> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.loot;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package thedarkcolour.exdeorum.material;
|
|||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.neoforged.neoforge.common.util.DeferredSoundType;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
|
|
@ -60,11 +60,11 @@ public class MaterialParser {
|
|||
} else if (soundTypeJson instanceof JsonObject soundTypeObj) {
|
||||
if (soundTypeObj.has("break_sound") && soundTypeObj.has("step_sound") && soundTypeObj.has("place_sound") && soundTypeObj.has("hit_sound") && soundTypeObj.has("fall_sound")) {
|
||||
return new DeferredSoundType(1.0f, 1.0f,
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, ResourceLocation.parse(soundTypeObj.get("break_sound").getAsString())),
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, ResourceLocation.parse(soundTypeObj.get("step_sound").getAsString())),
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, ResourceLocation.parse(soundTypeObj.get("place_sound").getAsString())),
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, ResourceLocation.parse(soundTypeObj.get("hit_sound").getAsString())),
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, ResourceLocation.parse(soundTypeObj.get("fall_sound").getAsString()))
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, Identifier.parse(soundTypeObj.get("break_sound").getAsString())),
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, Identifier.parse(soundTypeObj.get("step_sound").getAsString())),
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, Identifier.parse(soundTypeObj.get("place_sound").getAsString())),
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, Identifier.parse(soundTypeObj.get("hit_sound").getAsString())),
|
||||
DeferredHolder.create(Registries.SOUND_EVENT, Identifier.parse(soundTypeObj.get("fall_sound").getAsString()))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.material;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package thedarkcolour.exdeorum.menu;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.DataSlot;
|
||||
|
|
@ -31,7 +31,7 @@ import thedarkcolour.exdeorum.registry.EMenus;
|
|||
import thedarkcolour.exdeorum.tag.EItemTags;
|
||||
|
||||
public class MechanicalHammerMenu extends AbstractMachineMenu<MechanicalHammerBlockEntity> {
|
||||
private static final ResourceLocation EMPTY_SLOT_HAMMER = ExDeorum.loc("item/empty_slot_hammer");
|
||||
private static final Identifier EMPTY_SLOT_HAMMER = ExDeorum.loc("item/empty_slot_hammer");
|
||||
private static final int NUM_SLOTS = 3;
|
||||
|
||||
public MechanicalHammerMenu(int containerId, Inventory playerInventory, FriendlyByteBuf data) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package thedarkcolour.exdeorum.menu;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
|
|
@ -29,7 +29,7 @@ import thedarkcolour.exdeorum.blockentity.MechanicalSieveBlockEntity;
|
|||
import thedarkcolour.exdeorum.registry.EMenus;
|
||||
|
||||
public class MechanicalSieveMenu extends AbstractMachineMenu<MechanicalSieveBlockEntity> {
|
||||
private static final ResourceLocation EMPTY_SLOT_MESH = ExDeorum.loc("item/empty_slot_mesh");
|
||||
private static final Identifier EMPTY_SLOT_MESH = ExDeorum.loc("item/empty_slot_mesh");
|
||||
private static final int NUM_SLOTS = 22; // input + mesh, 20 output slots
|
||||
|
||||
public MechanicalSieveMenu(int containerId, Inventory playerInventory, FriendlyByteBuf data) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.menu;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package thedarkcolour.exdeorum.network;
|
|||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
|
||||
// Server -> Client
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum.network;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@net.minecraft.MethodsReturnNonnullByDefault
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package thedarkcolour.exdeorum;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
|
||||
import net.minecraft.advancements.criterion.StatePropertiesPredicate;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class CodecUtil {
|
|||
public static final StreamCodec<RegistryFriendlyByteBuf, NumberProvider> NUMBER_PROVIDER_CODEC = StreamCodec.of(RecipeUtil::toNetworkNumberProvider, RecipeUtil::fromNetworkNumberProvider);
|
||||
|
||||
public static <T extends SingleIngredientRecipe> App<RecordCodecBuilder.Mu<T>, Ingredient> ingredientField() {
|
||||
return Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(SingleIngredientRecipe::ingredient);
|
||||
return Ingredient.CODEC.fieldOf("ingredient").forGetter(SingleIngredientRecipe::ingredient);
|
||||
}
|
||||
|
||||
public static <T> App<RecordCodecBuilder.Mu<T>, Block> blockField(String name, Function<T, Block> getter) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user