Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

DX12

Members
  • Posts

    22
  • Joined

  • Last visited

Converted

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

DX12's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. package com.SkyWarsFun2019.moreblock.init; import java.util.function.Supplier; import com.SkyWarsFun2019.moreblock.RandomFhings; import com.SkyWarsFun2019.moreblock.blockentity.StorageBlockEntity; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fmllegacy.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class ModBlockEntity { public static DeferredRegister<BlockEntityType<?>> BLOCK_ENTITYS = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, RandomFhings.MOD_ID); public static RegistryObject<BlockEntityType<StorageBlockEntity>> CHEST = register("storage", StorageBlockEntity::new, () -> new Block[] {}); public static void register(IEventBus bus) { BLOCK_ENTITYS.register(bus); } private static <T extends BlockEntity> RegistryObject<BlockEntityType<T>> register(String name, BlockEntityType.BlockEntitySupplier<T> supplier, Supplier<Block[]> validBlocksSupplier) { return BLOCK_ENTITYS.register(name, () -> BlockEntityType.Builder.of(supplier, validBlocksSupplier.get()).build(null)); } } This is my registry class so far however the error reported is as follows. The type StorageBlockEntity does not define StorageBlockEntity(BlockPos, BlocState) that is applicable here package com.SkyWarsFun2019.moreblock.blockentity; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ChestMenu; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; public class StorageBlockEntity extends StorageBlockEntityBase { public StorageBlockEntity(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) { super(pType, pWorldPosition, pBlockState); } @Override public int getContainerSize() { return 27; } @Override protected Component getDefaultName() { return new TranslatableComponent("container.mbs.storage"); } @Override protected AbstractContainerMenu createMenu(int pContainerId, Inventory pInventory) { return new ChestMenu(MenuType.GENERIC_9x3, pContainerId, pInventory, pInventory, pContainerId); } } That is the BlockEntity Class that im trying to register however its super class is below package com.SkyWarsFun2019.moreblock.blockentity; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.ContainerHelper; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ChestMenu; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity; import net.minecraft.world.level.block.state.BlockState; public abstract class StorageBlockEntityBase extends RandomizableContainerBlockEntity { protected NonNullList<ItemStack> items; public StorageBlockEntityBase(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) { super(pType, pWorldPosition, pBlockState); this.items = NonNullList.withSize(getContainerSize(), ItemStack.EMPTY); } public boolean isMatchingContainerMenu(AbstractContainerMenu menu) { return menu instanceof ChestMenu chestMenu && chestMenu.getContainer() == this; } @Override public abstract int getContainerSize(); @Override protected NonNullList<ItemStack> getItems() { return items; } @Override protected void setItems(NonNullList<ItemStack> pItemStacks) { this.items = pItemStacks; } @Override protected abstract Component getDefaultName(); @Override protected abstract AbstractContainerMenu createMenu(int pContainerId, Inventory pInventory); @Override public boolean canPlaceItem(int pIndex, ItemStack pStack) { return true; } public boolean isFull() { for(ItemStack stack : this.items) { if(stack.isEmpty()) { return false; } } return true; } protected boolean addItem(ItemStack stack) { for(int i = 0; i < this.getContainerSize(); i++) { if(this.getItem(i).isEmpty()) { this.setItem(i, stack); return true; } } return false; } //NBT @Override public CompoundTag save(CompoundTag pCompound) { super.save(pCompound); if(!this.trySaveLootTable(pCompound)) { ContainerHelper.saveAllItems(pCompound, this.items); } return pCompound; } @Override public void load(CompoundTag pTag) { super.load(pTag); this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); if(!this.tryLoadLootTable(pTag)) { ContainerHelper.loadAllItems(pTag, this.items); } } } Any help is greatly appreciated.
  2. Yes it does work when the condition is removed
  3. I have tried this to no avail even when the test returns true the recipe is still absent
  4. Apologies for the late response, My computer had malfunctioned. To answer your question yes I do get the false and true when test is ran. however the issue im having is regardless of the value the recipe doesnt register. Also I have created A new topic to discuss this further. Here is the topic Topic
  5. I am trying to add a custom condition that checks whether item exists in registry. an easy example is holder items that provide no functionality. my exact needs are I am going to be making my mod a modular installation through the use of the config file. players can enable/disable parts of the mod. what I need help with is how to go about creating the class and how to register it.
  6. Here is the specific info you requested. I only included these lines
  7. would there be any reason why that code is not working
  8. Project ran successfully, thanks for the help diesieben07
  9. I have deleted the folder in question and just waiting for gradle to run
  10. No even with official mapping and all references to parchment removed it still returns the same error as before
  11. Apologies its a bit of a habit I have. I ran the powershell script in the root directory where the build.gradle is located
  12. https://pastebin.com/BPh91vBD Here Is A Link To The Output With --info and --stacktrace
  13. I Ran With The Option And Copied All Lines To Clipboard. I Can Run With --info If Needed
  14. buildscript { repositories { // These repositories are only for Gradle plugins, put any other repositories in the repository block further below maven { url = 'https://maven.minecraftforge.net' } maven { url = 'https://maven.parchmentmc.org' } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath 'org.parchmentmc:librarian:1.+' } } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.parchmentmc.librarian.forgegradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' apply plugin: 'maven-publish' version = '3.0.0' group = 'info.ddx5_media_network.randomfhings' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'randomfhings' // Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16. java.toolchain.languageVersion = JavaLanguageVersion.of(16) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { // The mappings can be changed at any time and must be in the following format. // Channel: Version: // snapshot YYYYMMDD Snapshot are built nightly. // stable # Stables are built at the discretion of the MCP team. // official MCVersion Official field/method names from Mojang mapping files // // You must be aware of the Mojang license when using the 'official' mappings. // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md // // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: 'parchment', version: '2021.08.15-1.17.1' // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. // Default run configurations. // These can be tweaked, removed, or duplicated as needed. runs { client { workingDirectory project.file('run') // Recommended logging data for a userdev environment // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. property 'forge.logging.markers', 'REGISTRIES' // Recommended logging level for the console // You can set various levels here. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' mods { examplemod { source sourceSets.main } } } server { workingDirectory project.file('run') // Recommended logging data for a userdev environment // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. property 'forge.logging.markers', 'REGISTRIES' // Recommended logging level for the console // You can set various levels here. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' mods { examplemod { source sourceSets.main } } } data { workingDirectory project.file('run') // Recommended logging data for a userdev environment // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. property 'forge.logging.markers', 'REGISTRIES' // Recommended logging level for the console // You can set various levels here. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { examplemod { source sourceSets.main } } } } } // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { // Put repositories for dependencies here // ForgeGradle automatically adds the Forge maven and Maven Central for you // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: // flatDir { // dir 'libs' // } } dependencies { // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. minecraft 'net.minecraftforge:forge:1.17.1-37.1.1' // Real mod deobf dependency examples - these get remapped to your current mappings // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency // Examples using mod jars from ./libs // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") // For more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } // Example for how to get properties into the manifest for reading at runtime. jar { manifest { attributes([ "Specification-Title" : "Random Fhings", "Specification-Vendor" : "Random Fhings Team", "Specification-Version" : "3.0.0", // We are version 1 of ourselves "Implementation-Title" : project.name, "Implementation-Version" : project.jar.archiveVersion, "Implementation-Vendor" : "Random Fhings Team", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } // Example configuration to allow publishing using the maven-publish plugin // This is the preferred method to reobfuscate your jar file jar.finalizedBy('reobfJar') // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing // publish.dependsOn('reobfJar') publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } This Is The Gradle Build. I Have Added Some Items To Use Parchment Mappings
  15. Here Is The Full Log As Requested
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.