MonkeyKnight
Members-
Posts
28 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
MonkeyKnight's Achievements
Tree Puncher (2/8)
1
Reputation
-
I am having an issue running a server with my mod. I know that I am reaching across sides somewhere in my Mod, but could not find where this error is occurring in my mod. The crash report that I have attached below mentioned that it involved the LocalPlayer. However, when I searched my mod for LocalPlayer, I only found one case in the event that I have attached below. Can you find where I errored? Crash Report: ---- Minecraft Crash Report ---- // I bet Cylons wouldn't have this problem. Time: 1/17/22, 8:10 PM Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:69) ~[forge-1.18-38.0.17_mapped_official_1.18-recomp.jar%2376%2382!:?] {re:classloading} at net.minecraftforge.server.loading.ServerModLoader.load(ServerModLoader.java:53) ~[forge-1.18-38.0.17_mapped_official_1.18-recomp.jar%2376%2382!:?] {re:classloading} at net.minecraft.server.Main.main(Main.java:104) ~[forge-1.18-38.0.17_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeServerUserdevLaunchHandler.lambda$launchService$0(ForgeServerUserdevLaunchHandler.java:16) ~[fmlloader-1.18-38.0.17.jar%230!:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.24.jar%2310!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.24.jar%2310!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.24.jar%2310!:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.24.jar%2310!:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.24.jar%2310!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.24.jar%2310!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.24.jar%2310!:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: main Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[fmlloader-1.18-38.0.17.jar%230!:1.0] {} -- MOD examplemod -- Details: Mod File: main Failure message: Example Mod (examplemod) has failed to load correctly java.lang.RuntimeException: Attempted to load class net/minecraft/client/player/LocalPlayer for invalid dist DEDICATED_SERVER Mod Version: 3.0 Mod Issue URL: NOT PROVIDED Exception message: java.lang.RuntimeException: Attempted to load class net/minecraft/client/player/LocalPlayer for invalid dist DEDICATED_SERVER Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[fmlloader-1.18-38.0.17.jar:1.0] {} at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88) ~[modlauncher-9.0.7.jar:?] {} at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-9.0.7.jar:?] {} at cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50) ~[modlauncher-9.0.7.jar:?] {} at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:110) ~[securejarhandler-0.9.54.jar:?] {} at cpw.mods.cl.ModuleClassLoader.lambda$findClass$16(ModuleClassLoader.java:213) ~[securejarhandler-0.9.54.jar:?] {} at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:223) ~[securejarhandler-0.9.54.jar:?] {} at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:213) ~[securejarhandler-0.9.54.jar:?] {} at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:130) ~[securejarhandler-0.9.54.jar:?] {} at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {} at java.lang.Class.forName0(Native Method) ~[?:?] {} at java.lang.Class.forName(Class.java:467) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.lambda$inject$6(AutomaticEventSubscriber.java:75) ~[javafmllanguage-1.18-38.0.17.jar%2378!:?] {} at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:62) ~[javafmllanguage-1.18-38.0.17.jar%2378!:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:91) ~[javafmllanguage-1.18-38.0.17.jar%2378!:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18-38.0.17.jar%2380!:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} -- System Details -- Details: Minecraft Version: 1.18 Minecraft Version ID: 1.18 Operating System: Windows 10 (amd64) version 10.0 Java Version: 17.0.1, Eclipse Adoptium Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium Memory: 320780752 bytes (305 MiB) / 1127219200 bytes (1075 MiB) up to 2122317824 bytes (2024 MiB) CPUs: 4 Processor Vendor: GenuineIntel Processor Name: Intel(R) Core(TM) i3-7020U CPU @ 2.30GHz Identifier: Intel64 Family 6 Model 142 Stepping 9 Microarchitecture: Amber Lake Frequency (GHz): 2.30 Number of physical packages: 1 Number of physical CPUs: 2 Number of logical CPUs: 4 Graphics card #0 name: Intel(R) HD Graphics 620 Graphics card #0 vendor: Intel Corporation (0x8086) Graphics card #0 VRAM (MB): 1024.00 Graphics card #0 deviceId: 0x5921 Graphics card #0 versionInfo: DriverVersion=27.20.100.9664 Memory slot #0 capacity (MB): 8192.00 Memory slot #0 clockSpeed (GHz): 2.67 Memory slot #0 type: DDR4 Virtual memory max (MB): 16427.04 Virtual memory used (MB): 10800.33 Swap memory total (MB): 8334.11 Swap memory used (MB): 434.15 JVM Flags: 1 total; -XX:+ShowCodeDetailsInExceptionMessages ModLauncher: 9.0.24+9.0.24+main.7be9f01d ModLauncher launch target: forgeserveruserdev ModLauncher naming: mcp ModLauncher services: mixin PLUGINSERVICE eventbus PLUGINSERVICE object_holder_definalize PLUGINSERVICE runtime_enum_extender PLUGINSERVICE capability_token_subclass PLUGINSERVICE accesstransformer PLUGINSERVICE runtimedistcleaner PLUGINSERVICE mixin TRANSFORMATIONSERVICE fml TRANSFORMATIONSERVICE FML Language Providers: [email protected] javafml@null Mod List: forge-1.18-38.0.17_mapped_official_1.18-recomp.jar|Minecraft |minecraft |1.18 |COMMON_SET|Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f main |Example Mod |examplemod |3.0 |ERROR |Manifest: NOSIGNATURE |Forge |forge |38.0.17 |COMMON_SET|Manifest: NOSIGNATURE Crash Report UUID: a2d945ef-ef76-4bb1-ac09-f2b263e52519 FML: 38.0 Forge: net.minecraftforge:38.0.17 Mod Event with LocalPlayer: @SubscribeEvent public static void renderGameOverlay(RenderGameOverlayEvent.Post event) { if(!(Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER)) { Minecraft mc = Minecraft.getInstance(); LocalPlayer player = mc.player; if (mc.gameMode.canHurtPlayer() && event.getType() == RenderGameOverlayEvent.ElementType.ALL) { ModRender renderer = new ModRender(Minecraft.getInstance()); renderer.renderToolbars(Minecraft.getInstance(), player); } } }
-
I have coded a capability which keeps track of several properties of the Player. All my code is error free, except when I try and register the capability with the CapabilityManager. I have looked in the forge docs but cannot find any examples of this. My entire class is this: public class CapabilityExample { public static Capability<IExample> EXAMPLE_CAPABILITY = CapabilityManager.get(new CapabilityToken<>() {}); public static void register() { CapabilityManager.INSTANCE.register(IExample.class); } } I am getting an error message that reads, "The method register(Class<IExample>) is undefined for the type CapabilityManager. I have looked into the Capability manager and do not see another way to do this. Is there a new method for registering for 1.18?
-
[Solved][1.16.5] Issue with Ore Generation
MonkeyKnight replied to MonkeyKnight's topic in Modder Support
I checked my code and my mod id was lowercase. There must have been an error when I copy and pasted it. I fixed my issue. The setup was not being called for some reason so I tweaked my code a bit and it now works. Thanks you for your help. -
I have been trying to generate an ore for my mod and have created a new feature and registered it. However, whenever I join a world, it immediately crashes. I cannot find anything useful in the crash report and am stumped. Can you find where I made a mistake? Main Mod Class: package com.monkey.ExampleMod; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biomes; import net.minecraft.world.gen.GenerationStage.Decoration; import net.minecraftforge.common.BiomeManager.BiomeType; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.monkey.ExampleMod.capabilities.Examples; import com.monkey.ExampleMod.capabilities.ExamplesProvider; import com.monkey.ExampleMod.capabilities.ExamplesStorage; import com.monkey.ExampleMod.capabilities.IExamples; import com.monkey.ExampleMod.capabilities.IVersions; import com.monkey.ExampleMod.capabilities.Versions; import com.monkey.ExampleMod.capabilities.VersionsProvider; import com.monkey.ExampleMod.capabilities.VersionsStorage; import com.monkey.ExampleMod.events.ExampleStats; import com.monkey.ExampleMod.init.BlockInit; import com.monkey.ExampleMod.init.EffectsInit; import com.monkey.ExampleMod.init.FeaturesInit; import com.monkey.ExampleMod.init.ItemInit; import com.monkey.ExampleMod.init.SoundInit; import com.monkey.ExampleMod.init.TileEntityInit; @Mod("ExampleMod") @Mod.EventBusSubscriber(modid = ExampleMod.MOD_ID, bus = Bus.FORGE) public class ExampleMod { public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "ExampleMod"; public static final ItemGroup ExampleMod_GROUP = new ExampleModGroup("ExampleModtab"); public ExampleMod() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); BlockInit.BLOCKS.register(bus); ItemInit.ITEMS.register(bus); EffectsInit.EFFECTS.register(bus); SoundInit.SOUNDS.register(bus); TileEntityInit.TILE_ENTITY.register(bus); MinecraftForge.EVENT_BUS.register(this); FMLJavaModLoadingContext.get().getModEventBus().addListener(ExampleMod::onCommonSetup); } @SubscribeEvent public static void onCommonSetup(FMLCommonSetupEvent event) { CapabilityManager.INSTANCE.register(IExample.class, new ExampleStorage(), Examples::new); CapabilityManager.INSTANCE.register(IExampleTwo.class, new ExampleTwoStorage(), ExampleTwo::new); RenderTypeLookup.setRenderLayer(BlockInit.FLASK_GLASS.get(), RenderType.translucent()); } @SubscribeEvent public void onBiomeLoading(final BiomeLoadingEvent biome) { if(!(biome.getCategory() == Biome.Category.NETHER || biome.getCategory() == Biome.Category.THEEND)) { System.out.println("!"); biome.getGeneration().getFeatures(Decoration.UNDERGROUND_ORES) .add(() -> FeaturesInit.ORE_SULFUR_CONFIG); } } @SubscribeEvent public static void onAttachCapabilities(AttachCapabilitiesEvent<Entity> event) { if (event.getObject() instanceof PlayerEntity) { event.addCapability(new ResourceLocation(ExampleMod.MOD_ID, "examples"), new ExamplesProvider()); event.addCapability(new ResourceLocation(ExampleMod.MOD_ID, "versions"), new VersionsProvider()); } } public static class ExampleModGroup extends ItemGroup { public ExampleModGroup(String label) { super(label); } @Override public ItemStack makeIcon() { return ItemInit.EXAMPLE_ICON.get().getDefaultInstance(); } } } Feature Class: package com.monkey.Example.init; import com.monkey.Example.Example; import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.WorldGenRegistries; import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.IFeatureConfig; import net.minecraft.world.gen.feature.OreFeatureConfig; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; @Mod.EventBusSubscriber(modid = Example.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class FeaturesInit { public static ConfiguredFeature<?, ?> ORE_SULFUR_CONFIG; @SubscribeEvent public void setup(FMLCommonSetupEvent event) { ORE_SULFUR_CONFIG = register("ore_sulfur", Feature.ORE.configured( new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockInit.SULFUR_ORE.get().defaultBlockState(), 9)).range(64).squared().count(20)); } private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String key, ConfiguredFeature<FC, ?> configuredFeature) { return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation(Example.MOD_ID, key), configuredFeature); } }
-
I have an error that says The Container 'Project and External Dependencies' references non existing library 'C:\Users\benba\.gradle\caches\modules-2\files-2.1\com.mojang\patchy\1.1\aef610b34a1be37fa851825f12372b78424d8903\patchy-1.1.jar'. This error is new and only occurred after I did gradlew build to get the jar file for my project for the first time. Now it is not allowing me to build my new code until I fix the error. I went to the folder and noticed that there was only a patchy-1.2.3 and a patchy-2.1.6 jar file. I tried going into properties but cannot change anything in the Project and External Dependencies. I also tried executing gradlew genEclipseRuns --refresh-dependencies to no effect. Do you have any idea how to fix this error?
-
[Solved][1.16.5] A question about Blockstates JSON files
MonkeyKnight replied to MonkeyKnight's topic in Modder Support
Thanks. I checked the logs and solved my problem. I am not sure if multipart would help for this block but I will definingly read more about them and use them in the future! The issue was that I included a space before the age. -
EDIT: If anyone is having the same issue as me, the log tells you the exact combinations of the missing blockstates. I have been having issues with writing blockstates JSON files. I have searched the documentation but did not find enough information to narrow down the place that I am wrong. I have coded several items with multiple different blockstates and some of my JOSN files work fine while others never seem to work. I do not notice any major differences between the two and am writing to ask your help in figuring out how to write these files. I have coded a lamp that has the blockstates HorizontalBlock.FACING and BlockStateProperties.AGE_3. My JSON file is below. I have checked it in several JSON validators and have a JSON editor addon added to Eclipse but still cannot see anything wrong. The Inventory icon works fine so it is not an issue with the texture. { "variants": { "facing=north, age=0": { "model": "testmod:block/ceiling_light_off", "y": 180 }, "facing=south, age=0": { "model": "testmod:block/ceiling_light_off", "y": 0 }, "facing=west, age=0": { "model": "testmod:block/ceiling_light_off", "y": 270 }, "facing=east, age=0": { "model": "testmod:block/ceiling_light_off", "y": 90 }, "facing=north, age=1": { "model": "testmod:block/ceiling_light_1", "y": 0 }, "facing=south, age=1": { "model": "testmod:block/ceiling_light_1", "y": 180 }, "facing=west, age=1": { "model": "testmod:block/ceiling_light_1", "y": 270 }, "facing=east, age=1": { "model": "testmod:block/ceiling_light_1", "y": 90 }, "facing=north, age=2": { "model": "testmod:block/ceiling_light_2", "y": 0 }, "facing=south, age=2": { "model": "testmod:block/ceiling_light_2", "y": 180 }, "facing=west, age=2": { "model": "testmod:block/ceiling_light_2", "y": 270 }, "facing=east, age=2": { "model": "testmod:block/ceiling_light_2", "y": 90 }, "facing=north, age=3": { "model": "testmod:block/ceiling_light_3", "y": 0 }, "facing=south, age=3": { "model": "testmod:block/ceiling_light_3", "y": 180 }, "facing=west, age=3": { "model": "testmod:block/ceiling_light_3", "y": 270 }, "facing=east, age=3": { "model": "testmod:block/ceiling_light_3", "y": 90 } } }
-
(Solved) Issue with Blockstates (1.16.5)
MonkeyKnight replied to MonkeyKnight's topic in Modder Support
Thank you for your help. It ended up being the entity block animated that was making it not work. I did not need it and getting rid of it solved all my issues. -
(Solved) Issue with Blockstates (1.16.5)
MonkeyKnight replied to MonkeyKnight's topic in Modder Support
I added override to the methods that I missed but the blockstates are still not working. Here is my new code: import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalBlock; import net.minecraft.block.IWaterLoggable; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.BlockItemUseContext; import net.minecraft.pathfinding.PathType; import net.minecraft.state.BooleanProperty; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; public class Incubator extends Block implements IWaterLoggable{ private static final VoxelShape AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 13.0D, 16.0D); public static final DirectionProperty FACING = HorizontalBlock.FACING; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public Incubator(Properties properties) { super(properties); this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, Boolean.FALSE)); } @SuppressWarnings("deprecation") @Override public BlockState updateShape(BlockState state, Direction dir, BlockState oldState, IWorld world, BlockPos pos, BlockPos oldPos) { if (state.hasProperty(WATERLOGGED)) { world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } return super.updateShape(state, dir, oldState, world, pos, oldPos); } @Override public BlockRenderType getRenderShape(BlockState p_149645_1_) { return BlockRenderType.ENTITYBLOCK_ANIMATED; } @Override public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { return AABB; } @Nullable @Override public BlockState getStateForPlacement(BlockItemUseContext context) { Direction direction = context.getNearestLookingDirection().getOpposite(); if (direction.equals(Direction.UP) || direction.equals(Direction.DOWN)) direction = Direction.NORTH; FluidState state = context.getLevel().getFluidState(context.getClickedPos()); return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, state.getType() == Fluids.WATER); } @SuppressWarnings("deprecation") @Override public FluidState getFluidState(BlockState state) { return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override public BlockState rotate(BlockState state, Rotation rotation) { return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, Mirror mirror) { return state.rotate(mirror.getRotation(state.getValue(FACING))); } @Override protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) { super.createBlockStateDefinition(builder); builder.add(FACING, WATERLOGGED); } @Override public boolean isPathfindable(BlockState state, IBlockReader reader, BlockPos pos, PathType pathType) { return false; } } The block looks normal without blockstates but when I change the blockstates json to rotate the model it does not show the block as thee blockstates are not working. When looking at the block, no blockstates were shown. -
I have been trying to create a block that has two blockstates, a basic facing one and a waterlogged one. I have been able to get blockstates to work fine in 1.12, 1.15, and 1.16.4 but when I started coding a new mod in 1.16.5, I have not been able to get the blockstates to work. It does not show up when the block is looked at using f3. My code is below: import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalBlock; import net.minecraft.block.IWaterLoggable; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.BlockItemUseContext; import net.minecraft.pathfinding.PathType; import net.minecraft.state.BooleanProperty; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; public class Incubator extends Block implements IWaterLoggable{ private static final VoxelShape AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 13.0D, 16.0D); public static final DirectionProperty FACING = HorizontalBlock.FACING; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;; public Incubator(Properties properties) { super(properties); this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, Boolean.FALSE)); } @SuppressWarnings("deprecation") @Override public BlockState updateShape(BlockState state, Direction dir, BlockState oldState, IWorld world, BlockPos pos, BlockPos oldPos) { if (state.hasProperty(WATERLOGGED)) { world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } return super.updateShape(state, dir, oldState, world, pos, oldPos); } @Override public BlockRenderType getRenderShape(BlockState p_149645_1_) { return BlockRenderType.ENTITYBLOCK_ANIMATED; } @Override public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { return AABB; } @Nullable @Override public BlockState getStateForPlacement(BlockItemUseContext context) { Direction nearestLookingDirection = context.getNearestLookingDirection(); Direction direction = nearestLookingDirection.getOpposite(); if (direction.equals(Direction.UP) || direction.equals(Direction.DOWN)) direction = Direction.NORTH; FluidState state = context.getLevel().getFluidState(context.getClickedPos()); return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, state.getType() == Fluids.WATER); } @SuppressWarnings("deprecation") @Override public FluidState getFluidState(BlockState state) { return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } public BlockState rotate(BlockState state, Rotation rotation) { return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, Mirror mirror) { return state.rotate(mirror.getRotation(state.getValue(FACING))); } protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) { builder.add(FACING, WATERLOGGED); } public boolean isPathfindable(BlockState state, IBlockReader reader, BlockPos pos, PathType pathType) { return false; } } Is there an issue with my code? I have ran out of ideas. Maybe I imported a wrong class?
-
Sure, here are my two classes that I used. The render event: @EventBusSubscriber(modid = Epidemics.MOD_ID, bus = Bus.FORGE) public class GuiRenderEvents { @SubscribeEvent public static void renderGameOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) { System.out.println(1); RenderTest render = new RenderTest(Minecraft.getInstance()); render.renderTestPumpkin(Minecraft.getInstance()); } } } The renderer: public class RenderTest extends IngameGui{ public static final ResourceLocation NEW_PUMPKIN_LOCATION = new ResourceLocation(Epidemics.MOD_ID + ":textures/gui/pumpkinblurtest.png"); private int screenWidth; private int screenHeight; public RenderTest(Minecraft minecraft) { super(minecraft); screenWidth = minecraft.getWindow().getGuiScaledWidth(); screenHeight = minecraft.getWindow().getGuiScaledHeight(); } public void renderTestPumpkin(Minecraft minecraft) { RenderSystem.disableDepthTest(); RenderSystem.enableBlend(); RenderSystem.depthMask(false); RenderSystem.defaultBlendFunc(); RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableAlphaTest(); minecraft.getTextureManager().bind(NEW_PUMPKIN_LOCATION); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuilder(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.vertex(0.0D, (double)screenHeight, -90.0D).uv(0.0F, 1.0F).endVertex(); bufferbuilder.vertex((double)screenWidth, (double)screenHeight, -90.0D).uv(1.0F, 1.0F).endVertex(); bufferbuilder.vertex((double)screenWidth, 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex(); bufferbuilder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex(); tessellator.end(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); } }
-
I have another update! I changed my render event code to this: @EventBusSubscriber(modid = Epidemics.MOD_ID, bus = Bus.FORGE) public class GuiRenderEvents { @SubscribeEvent public static void renderGameOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) { System.out.println(1); RenderTest render = new RenderTest(Minecraft.getInstance()); render.renderTestPumpkin(Minecraft.getInstance()); } } } public class RenderTest extends IngameGui{ private int screenWidth; private int screenHeight; public RenderTest(Minecraft minecraft) { super(minecraft); screenWidth = minecraft.getWindow().getGuiScaledWidth(); screenHeight = minecraft.getWindow().getGuiScaledHeight(); /* renderTest(minecraft); */ } public void renderTestPumpkin(Minecraft minecraft) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.defaultBlendFunc(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableAlphaTest(); minecraft.getTextureManager().bind(PUMPKIN_BLUR_LOCATION); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuilder(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.vertex(0.0D, (double)screenHeight, -90.0D).uv(0.0F, 1.0F).endVertex(); bufferbuilder.vertex((double)screenWidth, (double)screenHeight, -90.0D).uv(1.0F, 1.0F).endVertex(); bufferbuilder.vertex((double)screenWidth, 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex(); bufferbuilder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex(); tessellator.end(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); } } Now it is showing up n the game, just as a black screen though. Do you know what is causing the black screen?
-
I have a quick update. I have narrowed down the issue to the renderGameOverlay.post event. I changed the code of the renderTest constructor to just trigger the vanilla renderPumpkin() method and there still was no pumpkin face shown. public RenderTest(Minecraft minecraft) { super(minecraft); renderPumpkin(); /* screenWidth = minecraft.getWindow().getGuiScaledWidth(); screenHeight = minecraft.getWindow().getGuiScaledHeight(); renderTest(minecraft); */ } Do you have any suggestions on what I should change in my render event?