Jump to content

Recommended Posts

Posted (edited)

Hi, I'm (evidently) new to modding, and I can't seem to get my textures to load on my block no matter which method I try or example I look at. My mod is structured after McJty's tutorial.

 

 

Firstly, here's my blockstate json in assets/permitmod/blockstates/permit_writer.json

{
    "forge_marker": 1,
    "variants": {
        "normal": { "model": "permitmod:permit_writer" },
        "inventory": { "model": "permitmod:permit_writer" }
    }
}

 

Here's my model json in assets/permitmod/models/block/permit_writer.json

{
    "parent": "block/cube_all",
    "textures": {
        "all": "permitmod:blocks/patent_writer"
    }
}

 

Here's my Block class

package casuallobster.permitmod;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockPermitWriter extends Block {
	
	public BlockPermitWriter() {
		super(Material.ROCK);
		this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
		this.setRegistryName("permit_writer");
		this.setUnlocalizedName(PermitMod.MODID + ".permit_writer");
	}
	
	@Override
	public boolean isOpaqueCube(IBlockState iState) {
		return true;
	}
	
	@Override
	public boolean isFullCube(IBlockState iState) {
		return true;
	}
	
	@Override
	public EnumBlockRenderType getRenderType(IBlockState iState) {
		return EnumBlockRenderType.MODEL;
	}

	
	@SideOnly(Side.CLIENT)
	public BlockRenderLayer getBlockLayer() {
		return BlockRenderLayer.SOLID;
	}
	
	@SideOnly(Side.CLIENT)
	public void initModel() {
		System.out.println("Loading permit writer block item model");
		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation("permitmod:permit_writer", "inventory"));
	}

}

 

initModel() is called in ModBlocks, a container class of the blocks

package casuallobster.permitmod;

import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class ModBlocks {
	
	@GameRegistry.ObjectHolder("permitmod:permit_writer")
	public static BlockPermitWriter blockPermitWriter;
	
	@SideOnly(Side.CLIENT)
	public static void initModels() {
		blockPermitWriter.initModel();
	}
}

 

and initModels() is called in the client proxy in the appropriate method

package casuallobster.permitmod;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;

@Mod.EventBusSubscriber(Side.CLIENT)
public class ClientOnlyProxy extends CommonProxy {
	
	@Override
	public void preInit(FMLPreInitializationEvent event) {
		super.preInit(event);
	}
	
	public void init() {
	}
	
	public void postInit() {
	}
	
	@SubscribeEvent
	public static void registerModels (ModelRegistryEvent event) {
		ModItems.initModels();
		ModBlocks.initModels();
	}

}

 

Here's the log if it's helpful, from loading the mods up until loading the world:

[10:45:02] [main/INFO] [GradleStart]: Extra: []
[10:45:02] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/crmur/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[10:45:02] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[10:45:02] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[10:45:02] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[10:45:02] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[10:45:02] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2768 for Minecraft 1.12.2 loading
[10:45:02] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_202, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_202
[10:45:02] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
[10:45:02] [main/ERROR] [FML]: Full: C:\Users\crmur\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
[10:45:02] [main/ERROR] [FML]: Trimmed: c:/users/crmur/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
[10:45:02] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[10:45:02] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs.
2019-03-07 10:45:04,441 main WARN Disabling terminal, you're running in an unsupported environment.
[10:45:04] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin
[10:45:04] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
[10:45:04] [main/INFO] [FML]: Searching C:\Users\crmur\Desktop\Permits Mod\run\.\mods for mods
[10:45:04] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[10:45:04] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[10:45:04] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[10:45:04] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[10:45:04] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[10:45:04] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[10:45:04] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[10:45:04] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[10:45:04] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[10:45:07] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[10:45:07] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[10:45:07] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[10:45:07] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[10:45:07] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[10:45:07] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[10:45:07] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[10:45:08] [main/INFO] [minecraft/Minecraft]: Setting user: Player652
[10:45:14] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[10:45:14] [main/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4
[10:45:16] [main/INFO] [FML]: -- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_202, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 151033592 bytes (144 MB) / 373293056 bytes (356 MB) up to 1877475328 bytes (1790 MB)
	JVM Flags: 0 total; 
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: 
	Loaded coremods (and transformers): 
	GL info: ' Vendor: 'Intel' Version: '4.5.0 - Build 23.20.16.4973' Renderer: 'Intel(R) UHD Graphics 630'
[10:45:16] [main/INFO] [FML]: MinecraftForge v14.23.5.2768 Initialized
[10:45:16] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[10:45:16] [main/INFO] [FML]: Replaced 1036 ore ingredients
[10:45:18] [main/INFO] [FML]: Searching C:\Users\crmur\Desktop\Permits Mod\run\.\mods for mods
[10:45:19] [Thread-3/INFO] [FML]: Using sync timing. 200 frames of Display.update took 163910070 nanos
[10:45:21] [main/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
[10:45:22] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, permitmod] at CLIENT
[10:45:22] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, permitmod] at SERVER
[10:45:23] [main/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Permits Mods
[10:45:24] [main/INFO] [FML]: Processing ObjectHolder annotations
[10:45:24] [main/INFO] [FML]: Found 1170 ObjectHolder annotations
[10:45:24] [main/INFO] [FML]: Identifying ItemStackHolder annotations
[10:45:24] [main/INFO] [FML]: Found 0 ItemStackHolder annotations
[10:45:24] [main/INFO] [FML]: Configured a dormant chunk cache size of 0
[10:45:24] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[10:45:24] [main/INFO] [FML]: Applying holder lookups
[10:45:24] [main/INFO] [FML]: Holder lookups applied
[10:45:24] [main/INFO] [FML]: Applying holder lookups
[10:45:24] [main/INFO] [FML]: Holder lookups applied
[10:45:24] [main/INFO] [FML]: Applying holder lookups
[10:45:24] [main/INFO] [FML]: Holder lookups applied
[10:45:24] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null
[10:45:24] [main/INFO] [STDOUT]: [casuallobster.permitmod.BlockPermitWriter:initModel:49]: Loading permit writer block item model
[10:45:24] [main/INFO] [FML]: Applying holder lookups
[10:45:24] [main/INFO] [FML]: Holder lookups applied
[10:45:24] [main/INFO] [FML]: Injecting itemstacks
[10:45:24] [main/INFO] [FML]: Itemstack injection complete
[10:45:43] [Sound Library Loader/INFO] [minecraft/SoundManager]: Starting up SoundSystem...
[10:45:44] [Thread-5/INFO] [minecraft/SoundManager]: Initializing LWJGL OpenAL
[10:45:44] [Thread-5/INFO] [minecraft/SoundManager]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[10:45:44] [Thread-5/INFO] [minecraft/SoundManager]: OpenAL initialized.
[10:45:44] [Sound Library Loader/INFO] [minecraft/SoundManager]: Sound engine started
[10:45:53] [main/INFO] [FML]: Max texture size: 8192
[10:45:53] [main/INFO] [minecraft/TextureMap]: Created: 512x512 textures-atlas
[10:45:56] [main/INFO] [FML]: Applying holder lookups
[10:45:56] [main/INFO] [FML]: Holder lookups applied
[10:45:56] [main/INFO] [FML]: Injecting itemstacks
[10:45:56] [main/INFO] [FML]: Itemstack injection complete
[10:45:56] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods
[10:45:56] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[10:45:56] [main/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded
[10:45:57] [Realms Notification Availability checker #1/INFO] [mojang/RealmsClient]: Could not authorize you against Realms server: Invalid session id
[10:47:44] [Server thread/INFO] [minecraft/IntegratedServer]: Starting integrated minecraft server version 1.12.2
[10:47:44] [Server thread/INFO] [minecraft/IntegratedServer]: Generating keypair
[10:47:44] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance
[10:47:45] [Server thread/INFO] [FML]: Applying holder lookups
[10:47:45] [Server thread/INFO] [FML]: Holder lookups applied
[10:47:45] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@5957b002)
[10:47:45] [Server thread/INFO] [minecraft/AdvancementList]: Loaded 488 advancements
[10:47:46] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@5957b002)
[10:47:46] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@5957b002)
[10:47:46] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing start region for level 0
[10:47:47] [Server thread/INFO] [FML]: Unloading dimension -1
[10:47:47] [Server thread/INFO] [FML]: Unloading dimension 1
[10:47:47] [Server thread/INFO] [minecraft/IntegratedServer]: Changing view distance to 12, from 10
[10:47:48] [main/WARN] [mojang/YggdrasilMinecraftSessionService]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@5679d86e[id=6f525ab9-4df4-3875-8280-4904a48f9cd7,name=Player652,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationUnavailableException: Cannot contact authentication server
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:85) ~[YggdrasilAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:173) [YggdrasilMinecraftSessionService.class:?]
	at net.minecraft.client.Minecraft.launchIntegratedServer(Minecraft.java:2550) [Minecraft.class:?]
	at net.minecraftforge.fml.client.FMLClientHandler.tryLoadExistingWorld(FMLClientHandler.java:734) [FMLClientHandler.class:?]
	at net.minecraft.client.gui.GuiListWorldSelectionEntry.loadWorld(GuiListWorldSelectionEntry.java:253) [GuiListWorldSelectionEntry.class:?]
	at net.minecraft.client.gui.GuiListWorldSelectionEntry.joinWorld(GuiListWorldSelectionEntry.java:203) [GuiListWorldSelectionEntry.class:?]
	at net.minecraft.client.gui.GuiListWorldSelectionEntry.mousePressed(GuiListWorldSelectionEntry.java:172) [GuiListWorldSelectionEntry.class:?]
	at net.minecraft.client.gui.GuiListExtended.mouseClicked(GuiListExtended.java:57) [GuiListExtended.class:?]
	at net.minecraft.client.gui.GuiWorldSelection.mouseClicked(GuiWorldSelection.java:134) [GuiWorldSelection.class:?]
	at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:611) [GuiScreen.class:?]
	at net.minecraft.client.gui.GuiWorldSelection.handleMouseInput(GuiWorldSelection.java:49) [GuiWorldSelection.class:?]
	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:576) [GuiScreen.class:?]
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1885) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1187) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_202]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_202]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_202]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_202]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_202]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_202]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.ssl.Alerts.getSSLException(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.fatalSE(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.fatalSE(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.processLoop(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.process_record(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivilegedWithCombiner(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at com.mojang.authlib.HttpAuthenticationService.performGetRequest(HttpAuthenticationService.java:130) ~[HttpAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:66) ~[YggdrasilAuthenticationService.class:?]
	... 28 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.validator.PKIXValidator.doBuild(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.Validator.validate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.processLoop(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.process_record(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivilegedWithCombiner(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at com.mojang.authlib.HttpAuthenticationService.performGetRequest(HttpAuthenticationService.java:130) ~[HttpAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:66) ~[YggdrasilAuthenticationService.class:?]
	... 28 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source) ~[?:1.8.0_202]
	at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source) ~[?:1.8.0_202]
	at java.security.cert.CertPathBuilder.build(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.PKIXValidator.doBuild(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.Validator.validate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.processLoop(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.process_record(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivilegedWithCombiner(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at com.mojang.authlib.HttpAuthenticationService.performGetRequest(HttpAuthenticationService.java:130) ~[HttpAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:66) ~[YggdrasilAuthenticationService.class:?]
	... 28 more
[10:47:48] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2
[10:47:49] [Netty Server IO #1/INFO] [FML]: Client protocol version 2
[10:47:49] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : [email protected],[email protected],[email protected],[email protected],[email protected]
[10:47:49] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established
[10:47:49] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[10:47:49] [Server thread/INFO] [minecraft/PlayerList]: Player652[local:E:4d37aa50] logged in with entity id 66 at (-345.2449906010666, 4.0, -50.73693163792366)
[10:47:49] [Server thread/INFO] [minecraft/MinecraftServer]: Player652 joined the game
[10:47:51] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game...
[10:47:51] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'New World'/overworld
[10:47:51] [pool-2-thread-1/WARN] [mojang/YggdrasilMinecraftSessionService]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@e6f810a[id=6f525ab9-4df4-3875-8280-4904a48f9cd7,name=Player652,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationUnavailableException: Cannot contact authentication server
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:85) ~[YggdrasilAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) [YggdrasilMinecraftSessionService$1.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) [YggdrasilMinecraftSessionService$1.class:?]
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) [YggdrasilMinecraftSessionService.class:?]
	at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3181) [Minecraft.class:?]
	at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [SkinManager$3.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_202]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_202]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_202]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_202]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_202]
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.ssl.Alerts.getSSLException(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.fatalSE(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.fatalSE(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.processLoop(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.process_record(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivilegedWithCombiner(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at com.mojang.authlib.HttpAuthenticationService.performGetRequest(HttpAuthenticationService.java:130) ~[HttpAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:66) ~[YggdrasilAuthenticationService.class:?]
	... 19 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.validator.PKIXValidator.doBuild(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.Validator.validate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.processLoop(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.process_record(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivilegedWithCombiner(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at com.mojang.authlib.HttpAuthenticationService.performGetRequest(HttpAuthenticationService.java:130) ~[HttpAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:66) ~[YggdrasilAuthenticationService.class:?]
	... 19 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source) ~[?:1.8.0_202]
	at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source) ~[?:1.8.0_202]
	at java.security.cert.CertPathBuilder.build(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.PKIXValidator.doBuild(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.validator.Validator.validate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.processLoop(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.Handshaker.process_record(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_202]
	at java.security.AccessController.doPrivilegedWithCombiner(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) ~[?:1.8.0_202]
	at com.mojang.authlib.HttpAuthenticationService.performGetRequest(HttpAuthenticationService.java:130) ~[HttpAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:66) ~[YggdrasilAuthenticationService.class:?]
	... 19 more
[10:47:55] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game...
[10:47:55] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'New World'/overworld
[10:47:56] [main/INFO] [minecraft/Minecraft]: Stopping!
[10:47:56] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[10:47:56] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players
[10:47:56] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds
[10:47:56] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'New World'/overworld
[10:47:57] [Server thread/INFO] [FML]: Unloading dimension 0
[10:47:57] [Server thread/INFO] [FML]: Applying holder lookups
[10:47:57] [Server thread/INFO] [FML]: Holder lookups applied
[10:47:57] [main/INFO] [minecraft/SoundManager]: SoundSystem shutting down...
[10:47:57] [main/WARN] [minecraft/SoundManager]: Author: Paul Lamb, www.paulscode.com

 

and a screenshot of the issue, showing the placed block, the thrown item, and the itemblock in my inventory:

oKuDQUj.png

Edited by SunnyMorning
Posted

Blocks models aren’t registered in code. Their models are loaded from the BlockState json. Your log contains no errors, please post your code as a working GitHub repository. Also Proxies cannot be “common”. Proxies seperate code that will crash on the wrong side. If it’s common code, it doesn’t belong in a proxy.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

Your BlockItem for the permit writer is being created from a new instance of your Block instead of the one in the registry.  You already have a public static field in ModBlocks with the ObjectHolder annotation, which basically means once the registry name on that annotation is registered (ie. when you register the block part of the writer), you can thereafter reference that field to create the proper BlockItem.

In your case, this amounts to a very minor edit of one file:

 

package casuallobster.permitmod;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import static casuallobster.permitmod.ModBlocks.blockPermitWriter;


@Mod.EventBusSubscriber
public class CommonProxy {
	
	public void preInit(FMLPreInitializationEvent event) {
	}
	
	public void init(FMLInitializationEvent event) {
	}
	
	public void postInit(FMLPostInitializationEvent event) {
	}

	@SubscribeEvent
	public static void registerBlocks(RegistryEvent.Register<Block> event) {
		event.getRegistry().register(new BlockPermitWriter());
	}
	
	@SubscribeEvent
	public static void registerItems(RegistryEvent.Register<Item> event) {
		event.getRegistry().register(new ItemPermit());
		event.getRegistry().register(new ItemBlock(blockPermitWriter).setRegistryName(blockPermitWriter.getRegistryName()));
	}

}

 

Changed areas are one line of code cleanly removed from registerItems() and one new import.  Also removed one unused import, just because.

 

As far as best practices go, I don't know them for sure in this respect.  All I can say is that it loads the textures.

Edited by Laike_Endaril
Posted
11 hours ago, Laike_Endaril said:

Changed areas are one line of code cleanly removed from registerItems() and one new import.  Also removed one unused import, just because. 

Yes thank you! That worked! So for making BlockItems, I must reference the block already in the registry.

 

15 hours ago, Cadiboo said:

Also Proxies cannot be “common”. Proxies seperate code that will crash on the wrong side. If it’s common code, it doesn’t belong in a proxy. 

So, should I (in terms of best practices) move the common init methods to the main mod class? Do mod authors typically put their register methods into another class? And then what should I replace this line of code (in the main mod class) with?

	@SidedProxy(clientSide="casuallobster.permitmod.ClientOnlyProxy", serverSide = "casuallobster.permitmod.DedicatedServerProxy")
	public static CommonProxy proxy;

 

Posted

What: Not using a "common" proxy.
Why: Proxies exist to seperate side-specific code, if there is code that is common, it should not be in a proxy.
Consequences: Issues with physical sides, hard to read code. A "common" proxy goes against fundamental OOP and logical concepts.
How: Have an interface (usually called IProxy or Proxy) and have your client and sever proxies implement this class. Your interface should be in a common package (usually util) and your sever and client proxies should be in their respective packages.

 

You can read more at https://gist.github.com/Cadiboo/fbea89dc95ebbdc58d118f5350b7ba93.

This is more of a code style thing. I recommend putting your register methods into the appropriate event subscriber.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.