Migrate to minecraft 1.20 #70

Merged
BlakeRain merged 1 commits from BlakeRain/utamacraft:main into main 2024-02-11 17:02:40 +00:00
38 changed files with 321 additions and 252 deletions
Showing only changes of commit bc6cea3cec - Show all commits

3
.gitignore vendored
View File

@ -84,3 +84,6 @@ run
# File generated by JDT.LS # File generated by JDT.LS
.factorypath .factorypath
# Generated by Gradle
src/generated/

View File

@ -131,7 +131,7 @@ repositories {
maven { maven {
url "https://squiddev.cc/maven/" url "https://squiddev.cc/maven/"
content { content {
includeGroup("org.squiddev") includeGroup("cc.tweaked")
} }
} }
@ -164,9 +164,9 @@ dependencies {
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
// Compile against only the Curios API artifact // Compile against only the Curios API artifact
compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${minecraft_version}-${curios_version}:api")) compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api"))
// Use the full Curios API jar at runtime // Use the full Curios API jar at runtime
runtimeOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${minecraft_version}-${curios_version}")) runtimeOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}"))
// compile against the JEI API but do not include it at runtime // compile against the JEI API but do not include it at runtime
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")) compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
@ -175,16 +175,18 @@ dependencies {
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")) runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
// CC:Tweaked API // CC:Tweaked API
implementation(fg.deobf("org.squiddev:cc-tweaked-${minecraft_version}:${cct_version}")) implementation(fg.deobf("cc.tweaked:cc-tweaked-${minecraft_version}-forge:${cct_version}"))
// compileOnly fg.deobf("cc.tweaked:cc-tweaked-${minecraft_version}-forge-api:${cct_version}")
// compileOnly fg.deobf("cc.tweaked:cc-tweaked-${minecraft_version}-core-api:${cct_version}")
// Mekanism: useful for testing energy and so on. // Mekanism: useful for testing energy and so on.
runtimeOnly(fg.deobf("mekanism:Mekanism:${minecraft_version}-${mekanism_version}")) runtimeOnly(fg.deobf("mekanism:Mekanism:${minecraft_version}-${mekanism_version}"))
// Storage Drawers: useful for testing different storage interfaces. // Storage Drawers: useful for testing different storage interfaces.
runtimeOnly(fg.deobf("curse.maven:storage-drawers-223852:3884263")) runtimeOnly(fg.deobf("curse.maven:storage-drawers-223852:4668552"))
// Create: useful for testing recipies // Create: useful for testing recipies
runtimeOnly(fg.deobf("curse.maven:create-328085:4835190")) runtimeOnly(fg.deobf("curse.maven:create-328085:4835191"))
} }
mixin { mixin {

View File

@ -6,15 +6,15 @@ org.gradle.daemon=false
## Environment Properties ## Environment Properties
# The Minecraft version must agree with the Forge version to get a valid artifact. # The Minecraft version must agree with the Forge version to get a valid artifact.
minecraft_version=1.19.2 minecraft_version=1.20.1
# The Minecraft version range can use any release version of Minecraft as bounds. # The Minecraft version range can use any release version of Minecraft as bounds.
minecraft_version_range=[1.19.2,1.20) minecraft_version_range=[1.20.1,1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact. # The Forge version must agree with the Minecraft version to get a valid artifact.
forge_version=43.3.5 forge_version=47.2.0
# The Forge version range can use any version of Forge as bounds or match the loader version range # The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[43,) forge_version_range=[47,)
# The loader version range can only use the major version of Forge/FML as bounds # The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[41,) loader_version_range=[47,)
# The mapping channel to use for mappings. # The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
@ -33,18 +33,18 @@ loader_version_range=[41,)
mapping_channel=parchment mapping_channel=parchment
# The mapping version to query from the mapping channel. # The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel. # This must match the format required by the mapping channel.
mapping_version=2022.11.27-1.19.2 mapping_version=2023.09.03-1.20.1
## Dependency Properties ## Dependency Properties
# The version of CC:Tweaked we're building against # The version of CC:Tweaked we're building against
cct_version=1.101.3 cct_version=1.109.5
# The version of JEI that we're building against # The version of JEI that we're building against
jei_version=11.6.0.1015 jei_version=15.3.0.1
# The version of Mekanism we use when testing # The version of Mekanism we use when testing
mekanism_version=10.3.8.477 mekanism_version=10.4.5.19
# The version of Curios we use # The version of Curios we use
curios_version=5.1.4.1 curios_version=5.7.0+1.20.1
## Mod Properties ## Mod Properties
@ -56,7 +56,7 @@ mod_name=Utamacraft Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT License mod_license=MIT License
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=0.2.9-1.19 mod_version=0.3.0-1.20.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -21,7 +21,7 @@ import net.minecraftforge.registries.RegistryObject;
*/ */
public class CCRegistration { public class CCRegistration {
public static final DeferredRegister<TurtleUpgradeSerialiser<?>> TURTLE_SERIALIZERS = DeferredRegister public static final DeferredRegister<TurtleUpgradeSerialiser<?>> TURTLE_SERIALIZERS = DeferredRegister
.create(TurtleUpgradeSerialiser.REGISTRY_ID, Utamacraft.MOD_ID); .create(TurtleUpgradeSerialiser.registryId(), Utamacraft.MOD_ID);
public static final RegistryObject<TurtleUpgradeSerialiser<TurtlePlayerUpgrade>> PLAYER_TURTLE = TURTLE_SERIALIZERS public static final RegistryObject<TurtleUpgradeSerialiser<TurtlePlayerUpgrade>> PLAYER_TURTLE = TURTLE_SERIALIZERS
.register(ID.PLAYER_TURTLE.getPath(), .register(ID.PLAYER_TURTLE.getPath(),

View File

@ -6,6 +6,7 @@ import net.banutama.utamacraft.block.custom.ModBlocks;
import net.banutama.utamacraft.block.entity.ModBlockEntities; import net.banutama.utamacraft.block.entity.ModBlockEntities;
import net.banutama.utamacraft.integrations.curios.CuriosRenderers; import net.banutama.utamacraft.integrations.curios.CuriosRenderers;
import net.banutama.utamacraft.integrations.curios.CuriousLayerDefinitions; import net.banutama.utamacraft.integrations.curios.CuriousLayerDefinitions;
import net.banutama.utamacraft.item.ModCreativeModeTab;
import net.banutama.utamacraft.item.ModItems; import net.banutama.utamacraft.item.ModItems;
import net.banutama.utamacraft.networking.ModMessages; import net.banutama.utamacraft.networking.ModMessages;
@ -14,26 +15,22 @@ import net.banutama.utamacraft.screen.DigitizerScreen;
import net.banutama.utamacraft.screen.InsolatorScreen; import net.banutama.utamacraft.screen.InsolatorScreen;
import net.banutama.utamacraft.screen.ModMenuTypes; import net.banutama.utamacraft.screen.ModMenuTypes;
import net.banutama.utamacraft.sound.ModSounds; import net.banutama.utamacraft.sound.ModSounds;
import net.banutama.utamacraft.world.feature.ModConfiguredFeatures;
import net.banutama.utamacraft.world.feature.ModPlacedFeatures;
import net.minecraft.client.RecipeBookCategories; import net.minecraft.client.RecipeBookCategories;
import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.client.event.RegisterRecipeBookCategoriesEvent; import net.minecraftforge.client.event.RegisterRecipeBookCategoriesEvent;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger; import org.slf4j.Logger;
import top.theillusivec4.curios.api.SlotTypeMessage;
import top.theillusivec4.curios.api.SlotTypePreset;
// The value here should match an entry in the META-INF/mods.toml file // The value here should match an entry in the META-INF/mods.toml file
@Mod(Utamacraft.MOD_ID) @Mod(Utamacraft.MOD_ID)
@ -45,6 +42,7 @@ public class Utamacraft {
LOGGER.info("Utamacraft initializing"); LOGGER.info("Utamacraft initializing");
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
ModCreativeModeTab.register(bus);
ModItems.register(bus); ModItems.register(bus);
ModBlocks.register(bus); ModBlocks.register(bus);
ModBlockEntities.register(bus); ModBlockEntities.register(bus);
@ -52,10 +50,9 @@ public class Utamacraft {
ModMenuTypes.register(bus); ModMenuTypes.register(bus);
ModSounds.register(bus); ModSounds.register(bus);
ModRecipes.register(bus); ModRecipes.register(bus);
ModConfiguredFeatures.register(bus);
ModPlacedFeatures.register(bus);
bus.addListener(this::commonSetup); bus.addListener(this::commonSetup);
bus.addListener(this::addCreative);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
@ -65,6 +62,16 @@ public class Utamacraft {
}); });
} }
private void addCreative(BuildCreativeModeTabContentsEvent event) {
if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) {
event.accept(ModItems.BULB);
event.accept(ModItems.PCB);
event.accept(ModItems.FIBER_GLASS);
event.accept(ModItems.TUNGSTEN_INGOT);
event.accept(ModItems.TUNGSTEN_RAW);
}
}
@Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public static class ModEvents { public static class ModEvents {
@SubscribeEvent @SubscribeEvent
@ -74,11 +81,11 @@ public class Utamacraft {
CuriosRenderers.register(); CuriosRenderers.register();
} }
@SubscribeEvent // @SubscribeEvent
public static void onIntermodEnqueue(InterModEnqueueEvent event) { // public static void onIntermodEnqueue(InterModEnqueueEvent event) {
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, // InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE,
() -> SlotTypePreset.NECKLACE.getMessageBuilder().build()); // () -> SlotTypePreset.NECKLACE.getMessageBuilder().build());
} // }
} }
@Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) @Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)

View File

@ -1,5 +1,7 @@
package net.banutama.utamacraft.block.custom; package net.banutama.utamacraft.block.custom;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -10,7 +12,6 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
public class AwarenessBlock extends BaseEntityBlock { public class AwarenessBlock extends BaseEntityBlock {
@ -20,8 +21,8 @@ public class AwarenessBlock extends BaseEntityBlock {
super(getProperties()); super(getProperties());
} }
public static Block.Properties getProperties() { public static BlockBehaviour.Properties getProperties() {
return Block.Properties.of(Material.STONE) return BlockBehaviour.Properties.copy(Blocks.STONE)
.noOcclusion() .noOcclusion()
.strength(1.5f, 6.0f) .strength(1.5f, 6.0f)
.noOcclusion(); .noOcclusion();

View File

@ -1,5 +1,7 @@
package net.banutama.utamacraft.block.custom; package net.banutama.utamacraft.block.custom;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -16,17 +18,11 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
@ -41,8 +37,8 @@ public class DigitizerBlock extends BaseEntityBlock {
registerDefaultState(this.getStateDefinition().any().setValue(FACING, Direction.NORTH)); registerDefaultState(this.getStateDefinition().any().setValue(FACING, Direction.NORTH));
} }
private static Block.Properties getProperties() { private static BlockBehaviour.Properties getProperties() {
return Block.Properties.of(Material.STONE) return BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK)
.noOcclusion() .noOcclusion()
.isValidSpawn(DigitizerBlock::blockSpawning) .isValidSpawn(DigitizerBlock::blockSpawning)
.isRedstoneConductor(DigitizerBlock::notSolid) .isRedstoneConductor(DigitizerBlock::notSolid)

View File

@ -19,12 +19,12 @@ import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType; 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.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty; 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.DirectionProperty;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
@ -43,8 +43,8 @@ public class InsolatorBlock extends BaseEntityBlock {
registerDefaultState(this.getStateDefinition().any().setValue(FACING, Direction.NORTH).setValue(ACTIVE, false)); registerDefaultState(this.getStateDefinition().any().setValue(FACING, Direction.NORTH).setValue(ACTIVE, false));
} }
private static Block.Properties getProperties() { private static BlockBehaviour.Properties getProperties() {
return Block.Properties.of(Material.METAL) return BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK)
.noOcclusion() .noOcclusion()
.strength(2.0f, 6.0f) .strength(2.0f, 6.0f)
.noOcclusion() .noOcclusion()

View File

@ -3,15 +3,14 @@ package net.banutama.utamacraft.block.custom;
import java.util.function.Supplier; import java.util.function.Supplier;
import net.banutama.utamacraft.Utamacraft; import net.banutama.utamacraft.Utamacraft;
import net.banutama.utamacraft.item.ModCreativeModeTab;
import net.banutama.utamacraft.item.ModItems; import net.banutama.utamacraft.item.ModItems;
import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DropExperienceBlock; import net.minecraft.world.level.block.DropExperienceBlock;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
@ -25,17 +24,17 @@ public class ModBlocks {
public static final RegistryObject<Block> ETHEREAL_GLASS_TINTED = registerBlock("ethereal_glass_tinted", public static final RegistryObject<Block> ETHEREAL_GLASS_TINTED = registerBlock("ethereal_glass_tinted",
EtherealGlassTintedBlock::new); EtherealGlassTintedBlock::new);
public static final RegistryObject<Block> TUNGSTEN_ORE = registerBlock("tungsten_ore", public static final RegistryObject<Block> TUNGSTEN_ORE = registerBlock("tungsten_ore",
() -> new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE) () -> new DropExperienceBlock(BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK)
.strength(6.0f) .strength(6.0f)
.requiresCorrectToolForDrops(), .requiresCorrectToolForDrops(),
UniformInt.of(3, 7))); UniformInt.of(3, 7)));
public static final RegistryObject<Block> DEEPSLATE_TUNGSTEN_ORE = registerBlock("deepslate_tungsten_ore", public static final RegistryObject<Block> DEEPSLATE_TUNGSTEN_ORE = registerBlock("deepslate_tungsten_ore",
() -> new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE) () -> new DropExperienceBlock(BlockBehaviour.Properties.copy(Blocks.STONE)
.strength(6.0f) .strength(6.0f)
.requiresCorrectToolForDrops(), .requiresCorrectToolForDrops(),
UniformInt.of(3, 7))); UniformInt.of(3, 7)));
public static final RegistryObject<Block> TUNGSTEN_BLOCK = registerBlock("tungsten_block", public static final RegistryObject<Block> TUNGSTEN_BLOCK = registerBlock("tungsten_block",
() -> new Block(BlockBehaviour.Properties.of(Material.METAL) () -> new Block(BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK)
.strength(12.0f) .strength(12.0f)
.requiresCorrectToolForDrops())); .requiresCorrectToolForDrops()));
public static final RegistryObject<Block> INSOLATOR = registerBlock("insolator", InsolatorBlock::new); public static final RegistryObject<Block> INSOLATOR = registerBlock("insolator", InsolatorBlock::new);
@ -50,7 +49,7 @@ public class ModBlocks {
private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) { private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) {
ModItems.ITEMS.register(name, ModItems.ITEMS.register(name,
() -> new BlockItem(block.get(), new Item.Properties().tab(ModCreativeModeTab.TAB))); () -> new BlockItem(block.get(), new Item.Properties()));
} }
public static void register(IEventBus bus) { public static void register(IEventBus bus) {

View File

@ -240,9 +240,9 @@ public class InsolatorBlockEntity extends BlockEntity implements MenuProvider {
// Insert the recipe output in to the output slot. // Insert the recipe output in to the output slot.
ItemStack output = inventory.getStackInSlot(2); ItemStack output = inventory.getStackInSlot(2);
if (output.isEmpty()) { if (output.isEmpty()) {
inventory.setStackInSlot(2, recipe.getResultItem().copy()); inventory.setStackInSlot(2, recipe.getResultItem(null).copy());
} else { } else {
output.grow(recipe.getResultItem().getCount()); output.grow(recipe.getResultItem(null).getCount());
} }
resetProgress(recipe.getTicks()); resetProgress(recipe.getTicks());
@ -267,12 +267,12 @@ public class InsolatorBlockEntity extends BlockEntity implements MenuProvider {
// If the output isn't empty, and the item in the output is different to the // If the output isn't empty, and the item in the output is different to the
// output of the recipe, we cannot process. // output of the recipe, we cannot process.
if (!output.isEmpty() && output.getItem() != recipe.getResultItem().getItem()) { if (!output.isEmpty() && output.getItem() != recipe.getResultItem(null).getItem()) {
return false; return false;
} }
// Make sure that the output is not saturated. // Make sure that the output is not saturated.
return output.getCount() + recipe.getResultItem().getCount() <= output.getMaxStackSize(); return output.getCount() + recipe.getResultItem(null).getCount() <= output.getMaxStackSize();
} }
private Optional<InsolatorRecipe> getRecipe() { private Optional<InsolatorRecipe> getRecipe() {

View File

@ -0,0 +1,20 @@
package net.banutama.utamacraft.datagen;
import net.banutama.utamacraft.Utamacraft;
import net.banutama.utamacraft.world.ModWorldgenProvider;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(modid = Utamacraft.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class DataGenerators {
@SubscribeEvent
public static void gatherData(GatherDataEvent event) {
var gen = event.getGenerator();
var out = gen.getPackOutput();
var efh = event.getExistingFileHelper();
var lp = event.getLookupProvider();
gen.addProvider(event.includeServer(), new ModWorldgenProvider(out, lp));
}
}

View File

@ -2,8 +2,7 @@ package net.banutama.utamacraft.integrations.computercraft;
import dan200.computercraft.api.lua.*; import dan200.computercraft.api.lua.*;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.core.asm.NamedMethod; import dan200.computercraft.core.methods.PeripheralMethod;
import dan200.computercraft.core.asm.PeripheralMethod;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Objects; import java.util.Objects;
@ -13,10 +12,10 @@ public class BoundMethod {
private final String name; private final String name;
private final PeripheralMethod method; private final PeripheralMethod method;
public BoundMethod(@NotNull Object target, @NotNull NamedMethod<PeripheralMethod> method) { public BoundMethod(@NotNull Object target, @NotNull String name, @NotNull PeripheralMethod method) {
this.target = target; this.target = target;
this.name = method.getName(); this.name = name;
this.method = method.getMethod(); this.method = method;
} }
@NotNull @NotNull

View File

@ -1,48 +1,23 @@
package net.banutama.utamacraft.integrations.computercraft.peripheral; package net.banutama.utamacraft.integrations.computercraft.peripheral;
import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.MethodResult;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IDynamicPeripheral;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.core.asm.PeripheralMethod;
import net.banutama.utamacraft.integrations.computercraft.BoundMethod;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public abstract class BasePeripheral implements IDynamicPeripheral { public abstract class BasePeripheral implements IPeripheral {
protected final String type; protected final String type;
protected final BasePeripheralOwner owner; protected final BasePeripheralOwner owner;
protected final List<BoundMethod> methods;
protected final Set<IComputerAccess> computers = Collections.newSetFromMap(new ConcurrentHashMap<>()); protected final Set<IComputerAccess> computers = Collections.newSetFromMap(new ConcurrentHashMap<>());
protected BasePeripheral(String type, BasePeripheralOwner owner) { protected BasePeripheral(String type, BasePeripheralOwner owner) {
this.type = type; this.type = type;
this.owner = owner; this.owner = owner;
this.methods = PeripheralMethod.GENERATOR.getMethods(this.getClass()).stream()
.map(named -> new BoundMethod(this, named)).collect(Collectors.toList());
}
@NotNull
@Override
public String @NotNull [] getMethodNames() {
return methods.stream().map(BoundMethod::getName).toArray(String[]::new);
}
@NotNull
@Override
public MethodResult callMethod(@NotNull IComputerAccess computer, @NotNull ILuaContext context, int method,
@NotNull IArguments arguments) throws LuaException {
return methods.get(method).apply(computer, context, arguments);
} }
@NotNull @NotNull

View File

@ -58,12 +58,12 @@ public class InsolatorRecipeCategory implements IRecipeCategory<InsolatorRecipe>
@Override @Override
public void setRecipe(@NotNull IRecipeLayoutBuilder builder, @NotNull InsolatorRecipe recipe, public void setRecipe(@NotNull IRecipeLayoutBuilder builder, @NotNull InsolatorRecipe recipe,
@NotNull IFocusGroup focuses) { @NotNull IFocusGroup focuses) {
builder.addSlot(RecipeIngredientRole.INPUT, 86, 15) builder.addSlot(RecipeIngredientRole.INPUT, 152, 10)
.addIngredients(recipe.getIngredients().get(0)); .addIngredients(recipe.getIngredients().get(0));
builder.addSlot(RecipeIngredientRole.INPUT, 33, 16) builder.addSlot(RecipeIngredientRole.INPUT, 78, 10)
.addIngredients(ForgeTypes.FLUID_STACK, List.of(recipe.getFluid())) .addIngredients(ForgeTypes.FLUID_STACK, List.of(recipe.getFluid()))
.setFluidRenderer(64000, false, 9, 60); .setFluidRenderer(64000, false, 9, 60);
builder.addSlot(RecipeIngredientRole.OUTPUT, 86, 60) builder.addSlot(RecipeIngredientRole.OUTPUT, 152, 10)
.addItemStack(recipe.getResultItem()); .addItemStack(recipe.getResultItem(null));
} }
} }

View File

@ -1,26 +1,11 @@
package net.banutama.utamacraft.item; package net.banutama.utamacraft.item;
import net.minecraft.core.NonNullList;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import dan200.computercraft.shared.Registry;
public abstract class BaseItem extends Item { public abstract class BaseItem extends Item {
public BaseItem(@NotNull Properties properties) { public BaseItem(@NotNull Properties properties) {
super(properties.tab(ModCreativeModeTab.TAB)); super(properties);
}
public static void createTurtleStacks(@NotNull NonNullList<ItemStack> stack, @NotNull ResourceLocation peripheral) {
ItemStack turtleStack = new ItemStack(Registry.ModItems.TURTLE_NORMAL.get());
turtleStack.getOrCreateTag().putString("RightUpgrade", peripheral.toString());
stack.add(turtleStack);
ItemStack advancedTurtleStack = new ItemStack(Registry.ModItems.TURTLE_ADVANCED.get());
advancedTurtleStack.getOrCreateTag().putString("RightUpgrade", peripheral.toString());
stack.add(advancedTurtleStack);
} }
} }

View File

@ -39,7 +39,7 @@ public class FireWardItem extends Item implements ICurioItem {
} }
private static Properties getProperties() { private static Properties getProperties() {
return new Properties().tab(ModCreativeModeTab.TAB).stacksTo(1); return new Properties().stacksTo(1);
} }
@Override @Override

View File

@ -1,17 +1,67 @@
package net.banutama.utamacraft.item; package net.banutama.utamacraft.item;
import dan200.computercraft.shared.ModRegistry;
import net.banutama.utamacraft.CCRegistration;
import net.banutama.utamacraft.Utamacraft; import net.banutama.utamacraft.Utamacraft;
import net.banutama.utamacraft.block.custom.ModBlocks;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
import org.checkerframework.checker.units.qual.A;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@Mod.EventBusSubscriber(modid = Utamacraft.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) import java.util.Collection;
import java.util.Set;
public class ModCreativeModeTab { public class ModCreativeModeTab {
public static final CreativeModeTab TAB = new CreativeModeTab("utamacraft_tab") { public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS =
@Override DeferredRegister.create(Registries.CREATIVE_MODE_TAB, Utamacraft.MOD_ID);
public @NotNull ItemStack makeIcon() {
return new ItemStack(ModItems.BULB.get()); public static final RegistryObject<CreativeModeTab> UTAMACRAFT_TAB = CREATIVE_MODE_TABS.register("utamacraft_tab", () -> {
return CreativeModeTab.builder().icon(() -> new ItemStack(ModItems.BULB.get()))
.title(Component.translatable("creativetab.utamacraft_tab"))
.displayItems((params, output) -> {
output.accept(ModItems.BULB.get());
output.accept(ModItems.FIBER_GLASS.get());
output.accept(ModItems.PCB.get());
output.accept(ModItems.FIRE_WARD.get());
output.accept(ModItems.PLAYER_PERIPHERAL.get());
output.accept(ModItems.TELEPORTER_PERIPHERAL.get());
output.accept(ModItems.TUNGSTEN_INGOT.get());
output.accept(ModItems.TUNGSTEN_RAW.get());
output.accept(ModBlocks.AWARENESS_BLOCK.get());
output.accept(ModBlocks.DEEPSLATE_TUNGSTEN_ORE.get());
output.accept(ModBlocks.TUNGSTEN_BLOCK.get());
output.accept(ModBlocks.DIGITIZER.get());
output.accept(ModBlocks.ETHEREAL_GLASS.get());
output.accept(ModBlocks.ETHEREAL_GLASS_TINTED.get());
output.accept(ModBlocks.INSOLATOR.get());
output.accept(ModBlocks.TUNGSTEN_ORE.get());
output.acceptAll(turtleWithPeripheral(CCRegistration.ID.PLAYER_TURTLE));
output.acceptAll(turtleWithPeripheral(CCRegistration.ID.TELEPORTER_TURTLE));
})
.build();
});
private static Collection<ItemStack> turtleWithPeripheral(ResourceLocation peripheral) {
ItemStack turtleStack = new ItemStack(ModRegistry.Items.TURTLE_NORMAL.get());
turtleStack.getOrCreateTag().putString("RightUpgrade", peripheral.toString());
ItemStack advanctedTurtleStack = new ItemStack(ModRegistry.Items.TURTLE_ADVANCED.get());
advanctedTurtleStack.getOrCreateTag().putString("RightUpgrade", peripheral.toString());
return Set.of(turtleStack, advanctedTurtleStack);
}
public static void register(IEventBus bus) {
CREATIVE_MODE_TABS.register(bus);
} }
};
} }

View File

@ -27,6 +27,6 @@ public class ModItems {
} }
private static Item simpleItem() { private static Item simpleItem() {
return new Item(new Item.Properties().tab(ModCreativeModeTab.TAB)); return new Item(new Item.Properties());
} }
} }

View File

@ -1,23 +1,9 @@
package net.banutama.utamacraft.item; package net.banutama.utamacraft.item;
import net.banutama.utamacraft.CCRegistration;
import net.minecraft.core.NonNullList;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
public class PlayerPeripheralItem extends BaseItem { public class PlayerPeripheralItem extends BaseItem {
public PlayerPeripheralItem() { public PlayerPeripheralItem() {
super(new Item.Properties().stacksTo(16)); super(new Item.Properties().stacksTo(16));
} }
@Override
public void fillItemCategory(@NotNull CreativeModeTab group, @NotNull NonNullList<ItemStack> items) {
super.fillItemCategory(group, items);
if (allowedIn(group)) {
createTurtleStacks(items, CCRegistration.ID.PLAYER_TURTLE);
}
}
} }

View File

@ -1,23 +1,9 @@
package net.banutama.utamacraft.item; package net.banutama.utamacraft.item;
import net.banutama.utamacraft.CCRegistration;
import net.minecraft.core.NonNullList;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
public class TeleporterPeripheralItem extends BaseItem { public class TeleporterPeripheralItem extends BaseItem {
public TeleporterPeripheralItem() { public TeleporterPeripheralItem() {
super(new Item.Properties().stacksTo(16)); super(new Item.Properties().stacksTo(16));
} }
@Override
public void fillItemCategory(@NotNull CreativeModeTab group, @NotNull NonNullList<ItemStack> items) {
super.fillItemCategory(group, items);
if (allowedIn(group)) {
createTurtleStacks(items, CCRegistration.ID.TELEPORTER_TURTLE);
}
}
} }

View File

@ -1,6 +1,7 @@
package net.banutama.utamacraft.mixin; package net.banutama.utamacraft.mixin;
import net.banutama.utamacraft.item.ModItems; import net.banutama.utamacraft.item.ModItems;
import net.minecraft.tags.DamageTypeTags;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
@ -17,12 +18,14 @@ public class EntityMixin {
@Inject(at = @At("HEAD"), method = "isInvulnerableTo", cancellable = true) @Inject(at = @At("HEAD"), method = "isInvulnerableTo", cancellable = true)
private void checkInvulnerabilities(DamageSource source, CallbackInfoReturnable<Boolean> cir) { private void checkInvulnerabilities(DamageSource source, CallbackInfoReturnable<Boolean> cir) {
if (((Object) this) instanceof LivingEntity living) { if (((Object) this) instanceof LivingEntity living) {
if (source.isFire()) { if (source.is(DamageTypeTags.IS_FIRE)) {
ItemStack res = CuriosApi ItemStack res = CuriosApi.getCuriosInventory(living).map(inventory -> {
.getCuriosHelper() return inventory
.findFirstCurio(living, ModItems.FIRE_WARD.get()) .findFirstCurio(ModItems.FIRE_WARD.get())
.map(SlotResult::stack) .map(SlotResult::stack)
.orElse(ItemStack.EMPTY); .orElse(ItemStack.EMPTY);
}).orElse(ItemStack.EMPTY);
if (!res.isEmpty()) { if (!res.isEmpty()) {
cir.setReturnValue(true); cir.setReturnValue(true);
} }

View File

@ -21,7 +21,7 @@ public class ModMessages {
INSTANCE.messageBuilder(DumpInsolatorFluidPacket.class, 0x0000, NetworkDirection.PLAY_TO_SERVER) INSTANCE.messageBuilder(DumpInsolatorFluidPacket.class, 0x0000, NetworkDirection.PLAY_TO_SERVER)
.encoder(DumpInsolatorFluidPacket::encode) .encoder(DumpInsolatorFluidPacket::encode)
.decoder(DumpInsolatorFluidPacket::decode) .decoder(DumpInsolatorFluidPacket::decode)
.consumer(DumpInsolatorFluidPacket::handle) // .consumer(DumpInsolatorFluidPacket::handle)
.add(); .add();
} }

View File

@ -34,7 +34,7 @@ public class DumpInsolatorFluidPacket {
ServerPlayer player = context.getSender(); ServerPlayer player = context.getSender();
if (player == null) return; if (player == null) return;
BlockEntity blockEntity = player.level.getBlockEntity(pos); BlockEntity blockEntity = player.level().getBlockEntity(pos);
if (blockEntity instanceof InsolatorBlockEntity insolator) { if (blockEntity instanceof InsolatorBlockEntity insolator) {
insolator.dumpFluids(); insolator.dumpFluids();
} }

View File

@ -4,6 +4,7 @@ import com.google.gson.JsonObject;
import com.mojang.serialization.JsonOps; import com.mojang.serialization.JsonOps;
import net.banutama.utamacraft.Utamacraft; import net.banutama.utamacraft.Utamacraft;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper; import net.minecraft.util.GsonHelper;
@ -41,7 +42,7 @@ public class InsolatorRecipe implements Recipe<SimpleContainer> {
} }
@Override @Override
public @NotNull ItemStack assemble(@NotNull SimpleContainer pContainer) { public @NotNull ItemStack assemble(@NotNull SimpleContainer pContainer, RegistryAccess access) {
return output; return output;
} }
@ -59,7 +60,7 @@ public class InsolatorRecipe implements Recipe<SimpleContainer> {
} }
@Override @Override
public @NotNull ItemStack getResultItem() { public @NotNull ItemStack getResultItem(RegistryAccess access) {
return output.copy(); return output.copy();
} }
@ -83,7 +84,8 @@ public class InsolatorRecipe implements Recipe<SimpleContainer> {
return NonNullList.of(Ingredient.EMPTY, input); return NonNullList.of(Ingredient.EMPTY, input);
} }
// public static class Type implements RecipeType<InsolatorRecipe> {
// public static class Type implements RecipeType<InsolatorRecipe> {
// public static final Type INSTANCE = new Type(); // public static final Type INSTANCE = new Type();
// public static final String ID = "insolator"; // public static final String ID = "insolator";
// private Type() { // private Type() {

View File

@ -18,7 +18,7 @@ public class DigitizerMenu extends BaseAbstractContainerMenu {
// Client constructor // Client constructor
public DigitizerMenu(int id, Inventory inventory, FriendlyByteBuf extraData) { public DigitizerMenu(int id, Inventory inventory, FriendlyByteBuf extraData) {
this(id, inventory, inventory.player.level.getBlockEntity(extraData.readBlockPos())); this(id, inventory, inventory.player.level().getBlockEntity(extraData.readBlockPos()));
} }
// Server constructor // Server constructor

View File

@ -3,6 +3,7 @@ package net.banutama.utamacraft.screen;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import net.minecraft.client.gui.GuiGraphics;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
@ -36,17 +37,17 @@ public class DigitizerScreen extends AbstractContainerScreen<DigitizerMenu> {
} }
@Override @Override
protected void renderBg(@NotNull PoseStack stack, float partialTick, int mouseX, int mouseY) { protected void renderBg(@NotNull GuiGraphics gui, float pPartialTick, int pMouseX, int pMouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderTexture(0, TEXTURE);
blit(stack, leftPos, topPos, 0, 0, imageWidth, imageHeight); gui.blit(TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight);
renderEnergy(stack, leftPos + 8, topPos + 8); renderEnergy(gui, leftPos + 8, topPos + 8);
} }
@Override @Override
protected void renderLabels(@NotNull PoseStack pPoseStack, int pMouseX, int pMouseY) { protected void renderLabels(@NotNull GuiGraphics gui, int pMouseX, int pMouseY) {
int x = (width - imageWidth) / 2; int x = (width - imageWidth) / 2;
int y = (height - imageHeight) / 2; int y = (height - imageHeight) / 2;
@ -54,11 +55,11 @@ public class DigitizerScreen extends AbstractContainerScreen<DigitizerMenu> {
EnergyStorage energy = menu.getBlockEntity().getEnergy(); EnergyStorage energy = menu.getBlockEntity().getEnergy();
List<Component> components = TooltipUtils.getEnergyTooltip(energy.getEnergyStored(), List<Component> components = TooltipUtils.getEnergyTooltip(energy.getEnergyStored(),
energy.getMaxEnergyStored()); energy.getMaxEnergyStored());
renderTooltip(pPoseStack, components, Optional.empty(), pMouseX - x, pMouseY - y); gui.renderTooltip(font, components, Optional.empty(), pMouseX - x, pMouseY - y);
} }
} }
private void renderEnergy(@NotNull PoseStack stack, int x, int y) { private void renderEnergy(@NotNull GuiGraphics gui, int x, int y) {
EnergyStorage energy = menu.getBlockEntity().getEnergy(); EnergyStorage energy = menu.getBlockEntity().getEnergy();
if (energy.getEnergyStored() <= 0 || energy.getMaxEnergyStored() <= 0) { if (energy.getEnergyStored() <= 0 || energy.getMaxEnergyStored() <= 0) {
return; return;
@ -66,13 +67,13 @@ public class DigitizerScreen extends AbstractContainerScreen<DigitizerMenu> {
final int ENERGY_HEIGHT = 60; final int ENERGY_HEIGHT = 60;
int stored = (int) (ENERGY_HEIGHT * ((float) energy.getEnergyStored() / (float) energy.getMaxEnergyStored())); int stored = (int) (ENERGY_HEIGHT * ((float) energy.getEnergyStored() / (float) energy.getMaxEnergyStored()));
fillGradient(stack, x, y + (ENERGY_HEIGHT - stored), x + 9, y + 60, 0xffb51500, 0xff600b00); gui.fillGradient(x, y + (ENERGY_HEIGHT - stored), x + 9, y + 60, 0xffb51500, 0xff600b00);
} }
@Override @Override
public void render(@NotNull PoseStack stack, int mouseX, int mouseY, float delta) { public void render(@NotNull GuiGraphics gui, int mouseX, int mouseY, float delta) {
renderBackground(stack); renderBackground(gui);
super.render(stack, mouseX, mouseY, delta); super.render(gui, mouseX, mouseY, delta);
renderTooltip(stack, mouseX, mouseY); renderTooltip(gui, mouseX, mouseY);
} }
} }

View File

@ -19,7 +19,7 @@ public class InsolatorMenu extends BaseAbstractContainerMenu {
// Client Constructor // Client Constructor
public InsolatorMenu(int id, Inventory inventory, FriendlyByteBuf extraData) { public InsolatorMenu(int id, Inventory inventory, FriendlyByteBuf extraData) {
this(id, inventory, inventory.player.level.getBlockEntity(extraData.readBlockPos())); this(id, inventory, inventory.player.level().getBlockEntity(extraData.readBlockPos()));
} }
// Server Constructor // Server Constructor

View File

@ -9,6 +9,7 @@ import net.banutama.utamacraft.screen.utils.FluidSprite;
import net.banutama.utamacraft.screen.utils.MouseUtils; import net.banutama.utamacraft.screen.utils.MouseUtils;
import net.banutama.utamacraft.screen.utils.TiledSprite; import net.banutama.utamacraft.screen.utils.TiledSprite;
import net.banutama.utamacraft.screen.utils.TooltipUtils; import net.banutama.utamacraft.screen.utils.TooltipUtils;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.GameRenderer;
@ -49,52 +50,46 @@ public class InsolatorScreen extends AbstractContainerScreen<InsolatorMenu> {
leftPos = (width - imageWidth) / 2; leftPos = (width - imageWidth) / 2;
topPos = (height - imageHeight) / 2; topPos = (height - imageHeight) / 2;
dumpButton = addRenderableWidget(new Button( dumpButton = addRenderableWidget(
leftPos + 8, topPos + 52, new Button.Builder(DUMP_BUTTON, this::onDumpPress)
60, 20, DUMP_BUTTON, this::onDumpPress, .pos(leftPos + 8, topPos + 52)
(button, stack, mouseX, mouseY) -> { .size(60, 20)
if (menu.getBlockEntity().getFluidTank().getFluid().getAmount() <= 0) { .build());
renderTooltip(stack, DUMP_BUTTON_TOOLTIP_EMPTY, mouseX, mouseY);
} else {
renderTooltip(stack, DUMP_BUTTON_TOOLTIP, mouseX, mouseY);
}
}));
} }
@Override @Override
protected void renderBg(@NotNull PoseStack stack, float partialTick, int mouseX, int mouseY) { protected void renderBg(@NotNull GuiGraphics graphics, float partialTick, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.setShaderTexture(0, TEXTURE); RenderSystem.setShaderTexture(0, TEXTURE);
blit(stack, leftPos, topPos, 0, 0, imageWidth, imageHeight); graphics.blit(TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight);
renderBulb(stack); renderBulb(graphics);
renderProgressArrow(stack); renderProgressArrow(graphics);
renderFluid(stack, leftPos + 99, topPos + 11); renderFluid(graphics, leftPos + 99, topPos + 11);
renderEnergy(stack, leftPos + 112, topPos + 11); renderEnergy(graphics, leftPos + 112, topPos + 11);
} }
@Override @Override
protected void renderLabels(@NotNull PoseStack pPoseStack, int pMouseX, int pMouseY) { protected void renderLabels(@NotNull GuiGraphics graphics, int pMouseX, int pMouseY) {
int x = (width - imageWidth) / 2; int x = (width - imageWidth) / 2;
int y = (height - imageHeight) / 2; int y = (height - imageHeight) / 2;
if (MouseUtils.isMouseOver(pMouseX, pMouseY, x + 98, y + 10, 11, 62)) { if (MouseUtils.isMouseOver(pMouseX, pMouseY, x + 98, y + 10, 11, 62)) {
FluidTank tank = menu.getBlockEntity().getFluidTank(); FluidTank tank = menu.getBlockEntity().getFluidTank();
List<Component> components = TooltipUtils.getFluidTooltip(tank.getFluid(), 64000); List<Component> components = TooltipUtils.getFluidTooltip(tank.getFluid(), 64000);
renderTooltip(pPoseStack, components, Optional.empty(), graphics.renderTooltip(font, components, Optional.empty(), pMouseX - x, pMouseY - y);
pMouseX - x, pMouseY - y);
} }
if (MouseUtils.isMouseOver(pMouseX, pMouseY, x + 111, y + 10, 11, 62)) { if (MouseUtils.isMouseOver(pMouseX, pMouseY, x + 111, y + 10, 11, 62)) {
EnergyStorage energy = menu.getBlockEntity().getEnergy(); EnergyStorage energy = menu.getBlockEntity().getEnergy();
List<Component> components = TooltipUtils.getEnergyTooltip(energy.getEnergyStored(), List<Component> components = TooltipUtils.getEnergyTooltip(energy.getEnergyStored(),
energy.getMaxEnergyStored()); energy.getMaxEnergyStored());
renderTooltip(pPoseStack, components, Optional.empty(), pMouseX - x, pMouseY - y); graphics.renderTooltip(font, components, Optional.empty(), pMouseX - x, pMouseY - y);
} }
} }
private void renderEnergy(@NotNull PoseStack stack, int x, int y) { private void renderEnergy(@NotNull GuiGraphics graphics, int x, int y) {
EnergyStorage energy = menu.getBlockEntity().getEnergy(); EnergyStorage energy = menu.getBlockEntity().getEnergy();
if (energy.getEnergyStored() <= 0 || energy.getMaxEnergyStored() <= 0) { if (energy.getEnergyStored() <= 0 || energy.getMaxEnergyStored() <= 0) {
return; return;
@ -102,10 +97,10 @@ public class InsolatorScreen extends AbstractContainerScreen<InsolatorMenu> {
final int ENERGY_HEIGHT = 60; final int ENERGY_HEIGHT = 60;
int stored = (int) (ENERGY_HEIGHT * ((float) energy.getEnergyStored() / (float) energy.getMaxEnergyStored())); int stored = (int) (ENERGY_HEIGHT * ((float) energy.getEnergyStored() / (float) energy.getMaxEnergyStored()));
fillGradient(stack, x, y + (ENERGY_HEIGHT - stored), x + 9, y + 60, 0xffb51500, 0xff600b00); graphics.fillGradient(x, y + (ENERGY_HEIGHT - stored), x + 9, y + 60, 0xffb51500, 0xff600b00);
} }
private void renderFluid(@NotNull PoseStack stack, int x, int y) { private void renderFluid(@NotNull GuiGraphics graphics, int x, int y) {
FluidStack fluid = menu.getBlockEntity().getFluidTank().getFluid(); FluidStack fluid = menu.getBlockEntity().getFluidTank().getFluid();
if (fluid.getFluid().isSame(Fluids.EMPTY)) { if (fluid.getFluid().isSame(Fluids.EMPTY)) {
return; return;
@ -119,37 +114,38 @@ public class InsolatorScreen extends AbstractContainerScreen<InsolatorMenu> {
int scaled = Math.min(FLUID_HEIGHT, Math.max(amount > 0 ? 1 : 0, (amount * FLUID_HEIGHT) / 64000)); int scaled = Math.min(FLUID_HEIGHT, Math.max(amount > 0 ? 1 : 0, (amount * FLUID_HEIGHT) / 64000));
RenderSystem.enableBlend(); RenderSystem.enableBlend();
stack.pushPose(); var pose = graphics.pose();
stack.translate(x, y, 0); pose.pushPose();
pose.translate(x, y, 0);
TiledSprite.drawTiledSprite(stack, 9, FLUID_HEIGHT, tint, scaled, sprite, 16); TiledSprite.drawTiledSprite(pose, 9, FLUID_HEIGHT, tint, scaled, sprite, 16);
stack.popPose(); pose.popPose();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.disableBlend(); RenderSystem.disableBlend();
} }
private void renderProgressArrow(PoseStack stack) { private void renderProgressArrow(GuiGraphics graphics) {
if (menu.getBlockEntity().getActive()) { if (menu.getBlockEntity().getActive()) {
int ticks = menu.getBlockEntity().getTicks(); int ticks = menu.getBlockEntity().getTicks();
if (ticks != 0) { if (ticks != 0) {
float ratio = (float) menu.getBlockEntity().getProgress() / (float) ticks; float ratio = (float) menu.getBlockEntity().getProgress() / (float) ticks;
blit(stack, leftPos + 156, topPos + 28, 176, 0, 8, (int) (25.0f * ratio)); graphics.blit(TEXTURE, leftPos + 156, topPos + 28, 176, 0, 8, (int)(25.0f * ratio));
} }
} }
} }
private void renderBulb(PoseStack stack) { private void renderBulb(GuiGraphics graphics) {
if (menu.getBlockEntity().getActive()) { if (menu.getBlockEntity().getActive()) {
blit(stack, leftPos + 133, topPos + 37, 176, 25, 9, 14); graphics.blit(TEXTURE, leftPos + 133, topPos + 37, 176, 25, 9, 14);
} }
} }
@Override @Override
public void render(@NotNull PoseStack stack, int mouseX, int mouseY, float delta) { public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float delta) {
renderBackground(stack); renderBackground(graphics);
super.render(stack, mouseX, mouseY, delta); super.render(graphics, mouseX, mouseY, delta);
renderTooltip(stack, mouseX, mouseY); renderTooltip(graphics, mouseX, mouseY);
} }
private void onDumpPress(Button button) { private void onDumpPress(Button button) {

View File

@ -2,7 +2,7 @@ package net.banutama.utamacraft.screen.utils;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*; import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Matrix4f; import org.joml.Matrix4f;
import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.inventory.InventoryMenu;

View File

@ -13,10 +13,13 @@ public class ModSounds {
public static final DeferredRegister<SoundEvent> SOUNDS = public static final DeferredRegister<SoundEvent> SOUNDS =
DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, Utamacraft.MOD_ID); DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, Utamacraft.MOD_ID);
public static final RegistryObject<SoundEvent> INSOLATOR = public static final RegistryObject<SoundEvent> INSOLATOR = registerSoundEvent("insolator");
SOUNDS.register("insolator", () -> new SoundEvent(new ResourceLocation(Utamacraft.MOD_ID, "insolator")));
public static void register(IEventBus eventBus) { public static void register(IEventBus eventBus) {
SOUNDS.register(eventBus); SOUNDS.register(eventBus);
} }
private static RegistryObject<SoundEvent> registerSoundEvent(String name) {
return SOUNDS.register(name, () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(Utamacraft.MOD_ID, name)));
}
} }

View File

@ -4,6 +4,7 @@ import com.mojang.authlib.GameProfile;
import net.banutama.utamacraft.Utamacraft; import net.banutama.utamacraft.Utamacraft;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -59,15 +60,20 @@ public class SimpleFakePlayer extends FakePlayer {
HitResult blockHit = null; HitResult blockHit = null;
if (skipBlock) { if (skipBlock) {
Vec3 to = traceContext.getTo(); Vec3 to = traceContext.getTo();
blockHit = BlockHitResult.miss(to, traceDirection, new BlockPos(to)); Vec3i toi = new Vec3i((int)to.x, (int)to.y, (int)to.z);
blockHit = BlockHitResult.miss(to, traceDirection, new BlockPos(toi));
} else { } else {
blockHit = BlockGetter.traverseBlocks(traceContext.getFrom(), traceContext.getTo(), traceContext, (clipContext, pos) -> { blockHit = BlockGetter.traverseBlocks(traceContext.getFrom(), traceContext.getTo(), traceContext, (clipContext, pos) -> {
if (level.isEmptyBlock(pos)) { if (level().isEmptyBlock(pos)) {
return null; return null;
} }
return new BlockHitResult(new Vec3(pos.getX(), pos.getY(), pos.getZ()), traceDirection, pos, false); return new BlockHitResult(new Vec3(pos.getX(), pos.getY(), pos.getZ()), traceDirection, pos, false);
}, clipContext -> BlockHitResult.miss(clipContext.getTo(), traceDirection, new BlockPos(clipContext.getTo()))); }, clipContext -> {
Vec3 to = clipContext.getTo();
Vec3i toi = new Vec3i((int)to.x, (int)to.y, (int)to.z);
return BlockHitResult.miss(clipContext.getTo(), traceDirection, new BlockPos(toi));
});
} }
if (skipEntity) { if (skipEntity) {
@ -75,7 +81,7 @@ public class SimpleFakePlayer extends FakePlayer {
} }
List<Entity> entities = List<Entity> entities =
level.getEntities( level().getEntities(
this, this,
this.getBoundingBox() this.getBoundingBox()
.expandTowards(look.x * range, look.y * range, look.z * range) .expandTowards(look.x * range, look.y * range, look.z * range)
@ -137,12 +143,12 @@ public class SimpleFakePlayer extends FakePlayer {
HitResult hit = findHit(range, skipEntity, skipBlock, entityFilter); HitResult hit = findHit(range, skipEntity, skipBlock, entityFilter);
if (hit instanceof BlockHitResult blockHit) { if (hit instanceof BlockHitResult blockHit) {
InteractionResult res = InteractionResult res =
gameMode.useItemOn(this, level, getMainHandItem(), InteractionHand.MAIN_HAND, blockHit); gameMode.useItemOn(this, level(), getMainHandItem(), InteractionHand.MAIN_HAND, blockHit);
if (res.consumesAction()) { if (res.consumesAction()) {
return res; return res;
} }
return gameMode.useItem(this, level, getMainHandItem(), InteractionHand.MAIN_HAND); return gameMode.useItem(this, level(), getMainHandItem(), InteractionHand.MAIN_HAND);
} else if (hit instanceof EntityHitResult) { } else if (hit instanceof EntityHitResult) {
// TODO: Interact with an entity? // TODO: Interact with an entity?
return InteractionResult.FAIL; return InteractionResult.FAIL;

View File

@ -0,0 +1,23 @@
package net.banutama.utamacraft.world;
import net.banutama.utamacraft.Utamacraft;
import net.banutama.utamacraft.world.feature.ModConfiguredFeatures;
import net.banutama.utamacraft.world.feature.ModPlacedFeatures;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.PackOutput;
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
public class ModWorldgenProvider extends DatapackBuiltinEntriesProvider {
public static final RegistrySetBuilder BUILDER = new RegistrySetBuilder()
.add(Registries.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap)
.add(Registries.PLACED_FEATURE, ModPlacedFeatures::bootstrap);
public ModWorldgenProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) {
super(output, registries, BUILDER, Set.of(Utamacraft.MOD_ID));
}
}

View File

@ -1,38 +1,43 @@
package net.banutama.utamacraft.world.feature; package net.banutama.utamacraft.world.feature;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import net.banutama.utamacraft.Utamacraft; import net.banutama.utamacraft.Utamacraft;
import net.banutama.utamacraft.block.custom.ModBlocks; import net.banutama.utamacraft.block.custom.ModBlocks;
import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.features.OreFeatures; import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
import net.minecraftforge.registries.DeferredRegister; import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
import net.minecraftforge.registries.RegistryObject;
import java.util.List; import java.util.List;
public class ModConfiguredFeatures { public class ModConfiguredFeatures {
public static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = public static final ResourceKey<ConfiguredFeature<?, ?>> TUNGSTEN_ORE_KEY = registerKey("tungsten_ore");
DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, Utamacraft.MOD_ID);
public static final Supplier<List<OreConfiguration.TargetBlockState>> OVERWORLD_TUNGSTEN_ORES = public static void bootstrap(BootstapContext<ConfiguredFeature<?, ?>> context) {
Suppliers.memoize(() -> { RuleTest stoneRep = new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES);
return List.of( RuleTest deepslateRep = new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);
OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, ModBlocks.TUNGSTEN_ORE.get().defaultBlockState()),
OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, ModBlocks.DEEPSLATE_TUNGSTEN_ORE.get().defaultBlockState())
);
});
public static final RegistryObject<ConfiguredFeature<?, ?>> TUNGSTEN_ORE = List<OreConfiguration.TargetBlockState> overworldOres =
CONFIGURED_FEATURES.register("tungsten_ore", () -> { List.of(
return new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(OVERWORLD_TUNGSTEN_ORES.get(), 7)); OreConfiguration.target(stoneRep, ModBlocks.TUNGSTEN_ORE.get().defaultBlockState()),
}); OreConfiguration.target(deepslateRep, ModBlocks.DEEPSLATE_TUNGSTEN_ORE.get().defaultBlockState()));
public static void register(IEventBus bus) { register(context, TUNGSTEN_ORE_KEY, Feature.ORE, new OreConfiguration(overworldOres, 9));
CONFIGURED_FEATURES.register(bus); }
public static ResourceKey<ConfiguredFeature<?, ?>> registerKey(String name) {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, new ResourceLocation(Utamacraft.MOD_ID, name));
}
private static <FC extends FeatureConfiguration, F extends Feature<FC>> void register(BootstapContext<ConfiguredFeature<?, ?>> context,
ResourceKey<ConfiguredFeature<?, ?>> key,
F feature, FC configuration) {
context.register(key, new ConfiguredFeature<>(feature, configuration));
} }
} }

View File

@ -2,8 +2,15 @@ package net.banutama.utamacraft.world.feature;
import net.banutama.utamacraft.Utamacraft; import net.banutama.utamacraft.Utamacraft;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.placement.*; import net.minecraft.world.level.levelgen.placement.*;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
@ -12,29 +19,23 @@ import net.minecraftforge.registries.RegistryObject;
import java.util.List; import java.util.List;
public class ModPlacedFeatures { public class ModPlacedFeatures {
public static final DeferredRegister<PlacedFeature> PLACED_FEATURES = public static final ResourceKey<PlacedFeature> TUNGSTEN_ORE_PLACED_KEY = registerKey("tungsten_ore_placed");
DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, Utamacraft.MOD_ID);
public static final RegistryObject<PlacedFeature> TUNGSTEN_ORE_PLACED = public static void bootstrap(BootstapContext<PlacedFeature> context) {
PLACED_FEATURES.register("tungsten_ore_placed", () -> new PlacedFeature( HolderGetter<ConfiguredFeature<?, ?>> cf = context.lookup(Registries.CONFIGURED_FEATURE);
ModConfiguredFeatures.TUNGSTEN_ORE.getHolder().get(),
commonOrePlacement(7,
HeightRangePlacement.triangle(
VerticalAnchor.aboveBottom(-80),
VerticalAnchor.aboveBottom(80)
)
)
));
public static void register(IEventBus bus) { var p = HeightRangePlacement.uniform(VerticalAnchor.absolute(-64), VerticalAnchor.absolute(80));
PLACED_FEATURES.register(bus); register(context, TUNGSTEN_ORE_PLACED_KEY, cf.getOrThrow(ModConfiguredFeatures.TUNGSTEN_ORE_KEY), p);
} }
private static List<PlacementModifier> commonOrePlacement(int veinsPerChunk, PlacementModifier modifier) { private static ResourceKey<PlacedFeature> registerKey(String name) {
return orePlacement(CountPlacement.of(veinsPerChunk), modifier); return ResourceKey.create(Registries.PLACED_FEATURE, new ResourceLocation(Utamacraft.MOD_ID, name));
} }
private static List<PlacementModifier> orePlacement(PlacementModifier a, PlacementModifier b) { private static void register(BootstapContext<PlacedFeature> context,
return List.of(a, InSquarePlacement.spread(), b, BiomeFilter.biome()); ResourceKey<PlacedFeature> key,
Holder<ConfiguredFeature<?, ?>> configuration,
PlacementModifier modifier) {
context.register(key, new PlacedFeature(configuration, List.of(modifier)));
} }
} }

View File

@ -25,7 +25,7 @@
"item.utamacraft.tungsten_block": "Tungsten Block", "item.utamacraft.tungsten_block": "Tungsten Block",
"item.utamacraft.tungsten_ingot": "Tungsten Ingot", "item.utamacraft.tungsten_ingot": "Tungsten Ingot",
"item.utamacraft.tungsten_raw": "Raw Tungsten", "item.utamacraft.tungsten_raw": "Raw Tungsten",
"itemGroup.utamacraft_tab": "Utamacraft", "creativetab.utamacraft_tab": "Utamacraft",
"tooltip.utamacraft.energy": "Energy", "tooltip.utamacraft.energy": "Energy",
"tooltip.utamacraft.energy.amount": "%s FE", "tooltip.utamacraft.energy.amount": "%s FE",
"tooltip.utamacraft.energy.amount.with_capacity": "%s / %s FE", "tooltip.utamacraft.energy.amount.with_capacity": "%s / %s FE",

View File

@ -0,0 +1,11 @@
{
"entities": ["minecraft:player"],
"slots": [
"belt",
"body",
"charm",
"head",
"necklace",
"ring"
]
}

View File

@ -0,0 +1,4 @@
{
"size": 2,
"add_cosmetic": true
}

View File

@ -1,5 +1,8 @@
{ {
"homepage": "https://git.blakerain.com/bans-minecraft/utamacraft", "homepage": "https://git.blakerain.com/bans-minecraft/utamacraft",
"1.20.1": {
"0.3.0-1.20.1": "Migrate to Minecraft 1.20.1"
},
"1.19.2": { "1.19.2": {
"0.2.9-1.19": "Added the teleportation peripheral", "0.2.9-1.19": "Added the teleportation peripheral",
"0.2.8-1.19": "Fixes for various peripherals", "0.2.8-1.19": "Fixes for various peripherals",
@ -16,6 +19,8 @@
"0.0.1-1.19": "Initial release" "0.0.1-1.19": "Initial release"
}, },
"promos": { "promos": {
"1.20.1-latest": "0.3.0-1.20.1",
"1.20.1-recommended": "0.3.0-1.20.1"
"1.19.2-latest": "0.2.9-1.19", "1.19.2-latest": "0.2.9-1.19",
"1.19.2-recommended": "0.2.9-1.19" "1.19.2-recommended": "0.2.9-1.19"
} }