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

[1.13.2] Vanilla block replacement


Recommended Posts

Hey,

What is the correct way to replace vanila blocks in forge 1.13.2?

I tried to register my block with vanilla registry name (similar to what I was doing in 1.12.2) but unfortunately it didn't work (stacktrace below).

 

My block:

Spoiler

package pyre.blockenlightenment.block;

import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;

public class BlockCustomGlass extends BlockGlass {

    public BlockCustomGlass() {
        super(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS));
    }

    @Override
    public boolean isSideInvisible(IBlockState state, IBlockState adjacentBlockState, EnumFacing side) {

        if (adjacentBlockState.getBlock() instanceof BlockCutoutEnlightenedBlock) {
            //do something
        }
        return super.isSideInvisible(state, adjacentBlockState, side);
    }
}

 

 

Registering of block:

Spoiler

@Mod.EventBusSubscriber(modid = Reference.MOD_ID, bus = Bus.MOD)
public class RegistryHandler {

    @SubscribeEvent
    public static void onBlockRegister(final RegistryEvent.Register<Block> event) {
        event.getRegistry().register(new BlockCustomGlass().setRegistryName(new ResourceLocation("minecraft", "glass")));
    }
}

 

 

Latest.log

Spoiler

[01cze2019 21:42:34.355] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20190213.203750, --fml.mcVersion, 1.13.2, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 25.0.202, --version, MOD_DEV, --assetIndex, 1.13.1, --assetsDir, C:\Users\kamil\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ❄❄❄❄❄❄❄❄, --userProperties, {}]
[01cze2019 21:42:34.358] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher starting: java version 1.8.0_181
[01cze2019 21:42:34.641] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
[01cze2019 21:42:35.054] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevclient' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\kamil\.gradle\caches\forge_gradle\assets, --assetIndex, 1.13.1, --username, Dev, --accessToken, ❄❄❄❄❄❄❄❄, --userProperties, {}]
[01cze2019 21:42:36.406] [Client thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev
[01cze2019 21:42:41.262] [Client thread/WARN] [net.minecraft.client.GameSettings/]: Skipping bad option: lastServer:
[01cze2019 21:42:41.277] [Client thread/INFO] [net.minecraft.client.Minecraft/]: LWJGL Version: 3.1.6 build 14
[01cze2019 21:42:42.608] [Client thread/INFO] [net.minecraftforge.fml.ModLoader/CORE]: Loading Network data for FML net version: FML2
[01cze2019 21:42:42.654] [modloading-worker-2/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 25.0.219, for MC 1.13.2 with MCP 20190213.203750
[01cze2019 21:42:42.654] [modloading-worker-2/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v25.0.219 Initialized
[01cze2019 21:42:45.504] [Client thread/INFO] [net.minecraftforge.registries.GameData/]: Potentially Dangerous alternative prefix `minecraft` for name `glass`, expected `blockenlightenment`. This could be a intended override, but in most cases indicates a broken mod.
[01cze2019 21:42:45.509] [Client thread/ERROR] [net.minecraftforge.registries.GameData/REGISTRIES]: Registry replacements for vanilla block 'minecraft:glass' must not change the number or order of blockstates.
	Old: 
	New: 
[01cze2019 21:42:45.509] [Client thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: Invalid vanilla replacement. See log for details.
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: class pyre.blockenlightenment.util.handler.RegistryHandler onBlockRegister(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		2: ASM: class pyre.blockenlightenment.util.handler.RegistryHandler registerTileEntities(Lnet/minecraftforge/event/RegistryEvent$Register;)V
java.lang.RuntimeException: Invalid vanilla replacement. See log for details.
	at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:342)
	at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:306)
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:368)
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:300)
	at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:125)
	at pyre.blockenlightenment.util.handler.RegistryHandler.onBlockRegister(RegistryHandler.java:22)
	at net.minecraftforge.eventbus.ASMEventHandler_4_RegistryHandler_onBlockRegister_Register.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:254)
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:105)
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:111)
	at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$4(ModList.java:111)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:111)
	at net.minecraftforge.fml.ModList.lambda$static$0(ModList.java:82)
	at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:70)
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:153)
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:891)
	at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:141)
	at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:63)
	at net.minecraft.client.Minecraft.init(Minecraft.java:412)
	at net.minecraft.client.Minecraft.run(Minecraft.java:345)
	at net.minecraft.client.main.Main.main(SourceFile:144)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50)
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:59)
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:44)
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98)

[01cze2019 21:42:45.511] [Client thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:blocks> dispatch for modid blockenlightenment
java.lang.RuntimeException: Invalid vanilla replacement. See log for details.
	at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:342) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:306) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:368) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:300) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:125) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at pyre.blockenlightenment.util.handler.RegistryHandler.onBlockRegister(RegistryHandler.java:22) ~[classes/:?]
	at net.minecraftforge.eventbus.ASMEventHandler_4_RegistryHandler_onBlockRegister_Register.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-0.9.2-service.jar:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:254) ~[eventbus-0.9.2-service.jar:?]
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:105) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:25.0]
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_181]
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_181]
	at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:111) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$4(ModList.java:111) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_181]
	at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:111) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.ModList.lambda$static$0(ModList.java:82) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:70) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:153) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:891) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:141) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:63) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:412) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:345) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.main.Main.main(SourceFile:144) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.1.1.jar:?]
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98) [forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
[01cze2019 21:42:45.526] [Client thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event LOAD_REGISTRIES, 1 errors found
[01cze2019 21:42:45.526] [Client thread/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
	at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:274) ~[eventbus-0.9.2-service.jar:?]
	at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:65) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:412) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:345) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.main.Main.main(SourceFile:144) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.1.1.jar:?]
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98) [forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
[01cze2019 21:42:45.547] [Client thread/INFO] [net.minecraft.resources.SimpleReloadableResourceManager/]: Reloading ResourceManager: main, forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar, Default
[01cze2019 21:42:46.918] [Sound Library Loader/INFO] [net.minecraft.client.audio.SoundManager/]: Starting up SoundSystem version 201809301515...
[01cze2019 21:42:47.130] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager/]: Initializing No Sound
[01cze2019 21:42:47.130] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager/]: (Silent Mode)
[01cze2019 21:42:47.193] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager/]: OpenAL initialized.
[01cze2019 21:42:47.520] [Sound Library Loader/INFO] [net.minecraft.client.audio.SoundManager/SOUNDS]: Preloading sound minecraft:sounds/ambient/underwater/underwater_ambience.ogg
[01cze2019 21:42:47.521] [Sound Library Loader/INFO] [net.minecraft.client.audio.SoundManager/SOUNDS]: Sound engine started
[01cze2019 21:42:52.616] [Client thread/INFO] [net.minecraft.client.renderer.texture.TextureMap/]: Max texture size: 16384
[01cze2019 21:42:55.158] [Client thread/INFO] [net.minecraft.client.renderer.texture.TextureMap/]: Created: 512x512 textures-atlas
[01cze2019 21:42:57.551] [Client thread/ERROR] [net.minecraftforge.fml.ModLoader/LOADING]: Skipping lifecycle event ENQUEUE_IMC, 1 errors found.
[01cze2019 21:42:57.551] [Client thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event ENQUEUE_IMC, 1 errors found
[01cze2019 21:42:57.551] [Client thread/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
	at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:274) ~[eventbus-0.9.2-service.jar:?]
	at net.minecraftforge.fml.client.ClientModLoader.end(ClientModLoader.java:76) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:479) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:345) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.main.Main.main(SourceFile:144) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.1.1.jar:?]
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98) [forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
[01cze2019 21:42:57.552] [Client thread/WARN] [net.minecraft.client.GameSettings/]: Skipping bad option: lastServer:
[01cze2019 21:42:57.594] [Client thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded
[01cze2019 21:42:58.445] [Realms Notification Availability checker #1/INFO] [com.mojang.realmsclient.client.RealmsClient/]: Could not authorize you against Realms server: Invalid session id

 

 

Link to post
Share on other sites
8 minutes ago, Pyre540 said:

[01cze2019 21:42:45.509] [Client thread/ERROR] [net.minecraftforge.registries.GameData/REGISTRIES]: Registry replacements for vanilla block 'minecraft:glass' must not change the number or order of blockstates.

 

Link to post
Share on other sites

Ok so I checked what exactly is going on using debugger and found out that there is validStates mismatch (screen below):

- valid state for BlockGlass is apparently Block{minecraft:air}

- valid state for my block is Block{minecraft:glass}

 

Any idea why is that?

I also tried to register original glass block to check if that will change something but the effect is the same.

event.getRegistry().register(new BlockGlass(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS)).setRegistryName(new ResourceLocation("minecraft", "glass")));

 

Screen:

Spoiler

SF3PD8C.png

 

Link to post
Share on other sites
  • 3 months later...

Did you find a solution for that problem? I have the same problem even if the number and order of states are matching. I also tried doing it with the exact same block that minecraft use to register it.

 

Registration

registry.registerAll(
                new BlockLog(MaterialColor.WOOD, Block.Properties.create(Material.WOOD, MaterialColor.OBSIDIAN).hardnessAndResistance(2.0F).sound(SoundType.WOOD)).setRegistryName("minecraft:oak_log")
        );

 

Error

Quote

[05Sep2019 10:39:44.482] [Client thread/ERROR] [net.minecraftforge.registries.GameData/REGISTRIES]: Registry replacements for vanilla block 'minecraft:oak_log' must not change the number or order of blockstates.
    Old: axis={x,y,z}
    New: axis={x,y,z}

 

The Old and New are the exact same thing... 

Link to post
Share on other sites

I used BlockLog which is the class used by Minecraft. I didn't change a thing to test it and make sure it works fine.

 

However, I tested the same thing in 1.14.4 and it works fine. So I'm pretty sure it's a bug in the 1.13.2 version of forge.

 

 

Link to post
Share on other sites
  • 5 months later...

I tried this in 1.15.2, but I get the same result as the first post. I can't change a vanilla block property. For example, I created a waterloggable door class
 

package com.lavalogged.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.DoorBlock;
import net.minecraft.block.IWaterLoggable;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.DoorHingeSide;
import net.minecraft.state.properties.DoubleBlockHalf;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;

/**
 * @author JimiIT92
 */
public class WaterLoggableDoorBlock extends DoorBlock implements IWaterLoggable {

    public WaterLoggableDoorBlock(Properties builder) {
        super(builder);
        this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH).with(OPEN, false).with(HINGE, DoorHingeSide.LEFT).with(POWERED, false).with(HALF, DoubleBlockHalf.LOWER).with(BlockStateProperties.WATERLOGGED, true));
    }

    protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
        builder.add(HALF, FACING, OPEN, HINGE, POWERED, BlockStateProperties.WATERLOGGED);
    }

    public IFluidState getFluidState(BlockState state) {
        return Fluids.WATER.getStillFluidState(false);
    }

    public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, IFluidState fluidStateIn) {
        return IWaterLoggable.super.receiveFluid(worldIn, pos, state, fluidStateIn);
    }

    public boolean canContainFluid(IBlockReader worldIn, BlockPos pos, BlockState state, Fluid fluidIn) {
        return true;
    }

    @Deprecated
    public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) {
        if (!stateIn.get(BlockStateProperties.WATERLOGGED)) {
            this.receiveFluid(worldIn, currentPos, stateIn, Fluids.WATER.getStillFluidState(false));
        }
        worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
        return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos);
    }

    public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
        return VoxelShapes.empty();
    }

    public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
        worldIn.getPendingFluidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
    }

    public Fluid pickupFluid(IWorld worldIn, BlockPos pos, BlockState state) {
        return Fluids.EMPTY;
    }
}

 

And then register with this
 

blockRegistryEvent.getRegistry().register(new WaterLoggableDoorBlock(Block.Properties.from(Blocks.OAK_DOOR))
                .setRegistryName(new ResourceLocation("minecraft", "oak_door")));


But the log says this
 

Registry replacements for vanilla block 'minecraft:oak_door' must not change the number or order of blockstates.
	Old: facing={north,south,west,east};half={upper,lower};hinge={left,right};open={true,false};powered={true,false}
	New: facing={north,south,west,east};half={upper,lower};hinge={left,right};open={true,false};powered={true,false};waterlogged={true,false}

 

So if we can't change or add properties to vanilla blocks like this, how can we do this?

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to post
Share on other sites

You can't change the blockstates that a block has when making an override.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
Share on other sites

That's what the error says, but if I really need to add a property to a vanilla block, like in this case make doors waterloggable, how could you do that, if there is a way to do it? 

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to post
Share on other sites
1 hour ago, JimiIT92 said:

That's what the error says, but if I really need to add a property to a vanilla block, like in this case make doors waterloggable, how could you do that, if there is a way to do it? 

There isn't as that would make your replacement block incompatible with existing code that was written with the original block in mind.

Link to post
Share on other sites

That's unfortunate, I understand why is it like this, but I still find it very limiting :/ I eventually thought that you can write your custom block with it's own ID and then replace it whrn is placed in the world, but is not the nicest solution I guess

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to post
Share on other sites
8 hours ago, JimiIT92 said:

That's unfortunate, I understand why is it like this, but I still find it very limiting :/ I eventually thought that you can write your custom block with it's own ID and then replace it whrn is placed in the world, but is not the nicest solution I guess

You could have a copy of the vanilla block in your mod that is the exact same + always true water logged

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)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
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.



×
×
  • Create New...

Important Information

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