Jump to content

[1.8.9] making blocks place based on orientation


Dark_but_Good

Recommended Posts

Hello I am a first time mod maker and I am trying to make a custom model that get placed like a Dispenser, where the front of model faces the player when the block is placed.

 

The model I am trying to orientable is fairly complicated with multiple elements at 45 degree angels, I have found a thread where someone has had the same problem as I am having now (http://www.minecraftforge.net/forum/index.php?topic=34695.0) and I have followed it's advice as best as possible but all I accomplished was make my block no longer render properly replacing it with black and purple. If anyone can show me what I am doing wrong I would appreciate it.

 

Here is a link to my github page with the code before I tried to make my blocks orientable, the block you are looking for is called Underwater_Art_Deco.

https://github.com/DarkbutGood/BetterWindows

 

Link to comment
Share on other sites

Step 1: use metadata to encode facing.  Look at any vanilla block to see how this is done.

Step 2: in your blockstate file provide rotation based on block state.

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/resources/assets/harderores/blockstates/axel.json#L31-L43

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 comment
Share on other sites

Sorry Draco18s but that hasn't helped me, I've tried to use the example code you gave me and the code in the reference library but nothing has worked. However after having another look in the reference library I'm starting to think that it is my model that is to blame as I noticed that the dispenser has a separate model for rendering the block up and down. I may be worng about this but I think that the rotated elements in my model doesn't like to be orientated like a normal block, is this something that can happen or I'm still missing something?

Link to comment
Share on other sites

Do you want to rotate your block as a dispense (1 model for the 4 sides, 1 for up/down) or like a piston (1 model for each orientation)? That you should look at those classes for reference.

 

Also, you should update to 1.10.2.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Do you want to rotate your block as a dispense (1 model for the 4 sides, 1 for up/down) or like a piston (1 model for each orientation)? That you should look at those classes for reference.

 

Also, you should update to 1.10.2.

 

I hope to rotate my block like a piston but frankly I will take what ever will work because I have tried to use the piston code and it hasn't worked.

 

I don't want to update to 1.10.2 because I use mods that haven't updated yet and I want to play my mod to test it before I publish it.

Link to comment
Share on other sites

Hi

 

You might find this example  project useful, it has a block you can orient in four directions.

https://github.com/TheGreyGhost/MinecraftByExample

see MBE03

In particular have a look at

 

BlockVariants.onBlockPlaced(), getStateFromMeta(), and getMetaFromState()

 

-TGG

 

I have added what I think is the necessary code but when I get eclipse to run client minecraft no longer load's, I feel like I'm missing something but don't know what I have updated my git hub it you want to have a look the update is under a new branch called patch-1.

Link to comment
Share on other sites

1) In your model file, round those numbers with a lot of decimals to 1 decimal, like

4.499999992549419

to

4.5

and

11.50000000745058

to

11.5

. You won't notice a difference.

 

2) Define "no longer works".

 

Not updating to 1.10.2 is the reason other mods won't update, because other mods won't update, because other mods won't update... See what happens? There are plenty of mods available, and you have to get over the fact that some mods won't get updated anymore, or not updated yet.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

1) In your model file, round those numbers with a lot of decimals to 1 decimal, like

4.499999992549419

to

4.5

and

11.50000000745058

to

11.5

. You won't notice a difference.

 

2) Define "no longer works".

 

Not updating to 1.10.2 is the reason other mods won't update, because other mods won't update, because other mods won't update... See what happens? There are plenty of mods available, and you have to get over the fact that some mods won't get updated anymore, or not updated yet.

 

1) I will look into removing the long decimals after I can 2 to stop happening.

 

2) Minecraft no longer loads, I should have been more clear sorry about that.

 

3) I will make the mod in 1.10 but I want to get the basic features of my down first before I start porting to new versions, this means play testing with other mods and the version that I play right now is 1.8.9 because haven't had the time to go though what mods I need to have and update.

Link to comment
Share on other sites

1) In your model file, round those numbers with a lot of decimals to 1 decimal, like

4.499999992549419

to

4.5

and

11.50000000745058

to

11.5

. You won't notice a difference.

 

2) Define "no longer works".

 

Not updating to 1.10.2 is the reason other mods won't update, because other mods won't update, because other mods won't update... See what happens? There are plenty of mods available, and you have to get over the fact that some mods won't get updated anymore, or not updated yet.

 

1) I will look into removing the long decimals after I can 2 to stop happening.

 

2) Minecraft no longer loads, I should have been more clear sorry about that.

 

3) I will make the mod in 1.10 but I want to get the basic features of my down first before I start porting to new versions, this means play testing with other mods and the version that I play right now is 1.8.9 because haven't had the time to go though what mods I need to have and update.

Minecraft no longer starts...how do we help if we do not have the crash report?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Sorry Draco18s but that hasn't helped me, I've tried to use the example code you gave me and the code in the reference library but nothing has worked. However after having another look in the reference library I'm starting to think that it is my model that is to blame as I noticed that the dispenser has a separate model for rendering the block up and down. I may be worng about this but I think that the rotated elements in my model doesn't like to be orientated like a normal block, is this something that can happen or I'm still missing something?

i think dyspenser has separte model for up and dowt because it has other texture when you will place it up/down side facing
Link to comment
Share on other sites

1) In your model file, round those numbers with a lot of decimals to 1 decimal, like

4.499999992549419

to

4.5

and

11.50000000745058

to

11.5

. You won't notice a difference.

 

2) Define "no longer works".

 

Not updating to 1.10.2 is the reason other mods won't update, because other mods won't update, because other mods won't update... See what happens? There are plenty of mods available, and you have to get over the fact that some mods won't get updated anymore, or not updated yet.

 

1) I will look into removing the long decimals after I can 2 to stop happening.

 

2) Minecraft no longer loads, I should have been more clear sorry about that.

 

3) I will make the mod in 1.10 but I want to get the basic features of my down first before I start porting to new versions, this means play testing with other mods and the version that I play right now is 1.8.9 because haven't had the time to go though what mods I need to have and update.

Minecraft no longer starts...how do we help if we do not have the crash report?

When you run minecraft though eclipse when it stops working you don't get a crash report like when you fail to run minecraft though the launcher. I will try to find away around this.

Link to comment
Share on other sites

When you run minecraft though eclipse when it stops working you don't get a crash report like when you fail to run minecraft though the launcher. I will try to find away around this.

Yes, you get one in the console or in your eclipse working directory.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

When you run minecraft though eclipse when it stops working you don't get a crash report like when you fail to run minecraft though the launcher. I will try to find away around this.

Yes, you get one in the console or in your eclipse working directory.

Ah that's how you get it, I had no idea, thanks for letting me know.

 

 

 

Crash report

Time: 9/28/16 5:49 PM

Description: There was a severe problem during mod loading that has caused the game to fail

 

net.minecraftforge.fml.common.LoaderException: java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockState{block=bw:Underwater_Art_Deco, properties=[]}

at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:231)

at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:188)

at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:177)

at com.Dark_but_Good.BetterWindows.blocks.ModBlocks.createBlocks(ModBlocks.java:15)

at com.Dark_but_Good.BetterWindows.CommonProxy.preInit(CommonProxy.java:13)

at com.Dark_but_Good.BetterWindows.ClientProxy.preInit(ClientProxy.java:14)

at com.Dark_but_Good.BetterWindows.Main.preInit(Main.java:25)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:553)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119)

at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550)

at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:446)

at net.minecraft.client.Minecraft.run(Minecraft.java:356)

at net.minecraft.client.main.Main.main(Main.java:117)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

Caused by: java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockState{block=bw:Underwater_Art_Deco, properties=[]}

at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:174)

at com.Dark_but_Good.BetterWindows.blocks.BasicBlock.getMetaFromState(BasicBlock.java:82)

at net.minecraftforge.fml.common.registry.GameData.registerBlock(GameData.java:843)

at net.minecraftforge.fml.common.registry.GameData.registerBlock(GameData.java:805)

at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:220)

... 49 more

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.8

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_101, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 811037872 bytes (773 MB) / 1047592960 bytes (999 MB) up to 1047592960 bytes (999 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.4.1577 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCH mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.4.1577.jar)

UCH Forge{11.14.4.1577} [Minecraft Forge] (forgeSrc-1.8-11.14.4.1577.jar)

UCE bw{1.8.9 1.0} [better Windows] (bin)

Loaded coremods (and transformers):

GL info: ' Vendor: 'ATI Technologies Inc.' Version: '3.3.11672 Compatibility Profile Context' Renderer: 'ATI Radeon HD 2400 XT'

[17:49:12] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Ben Scogings\Desktop\My Mods\Better Windows\run\.\crash-reports\crash-2016-09-28_17.49.11-client.txt

 

 

 

Link to comment
Share on other sites

net.minecraftforge.fml.common.LoaderException: java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockState{block=bw:Underwater_Art_Deco, properties=[]}

 

You never set the default state. To do so, use this line in your

Block

constructor:

setDefaultState(getBlockState().getBaseState().withProperty(PROPERTY, defaultValue));

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

net.minecraftforge.fml.common.LoaderException: java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockState{block=bw:Underwater_Art_Deco, properties=[]}

 

You never set the default state. To do so, use this line in your

Block

constructor:

setDefaultState(getBlockState().getBaseState().withProperty(PROPERTY, defaultValue));

 

Do I add it in the block constructor in a particular place or will any where do? Also do I need to have a preface in front of it such as a public boolean?

Link to comment
Share on other sites

It can go anywhere in the constuctor, you just have to put it after the

super

call. And no, you don't have to save the return value as it simply returns

this

for chaining.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

It can go anywhere in the constuctor, you just have to put it after the

super

call. And no, you don't have to save the return value as it simply returns

this

for chaining.

Strange because whats me to among other things add a void to it. I work on it a bit

Never mind solved that problem but a new problem has a risen, eclipse wants me to change PROPERTY and defaultValue. I assume that this needs to be changed to facing and the direction I want default respectively.

Link to comment
Share on other sites

Yes, they were just placeholders.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

In your case, it has to be an

EnumFacing

, and you only allow

EnumFacing.HORIZONTALS

, so you have to use

EnumFacing.NORTH

,

EnumFacing.EAST

,

EnumFacing.SOUTH

or

EnumFacing.WEST

.

 

I am getting the idea you don't actually know Java very well, in which I suggest you learn that first, and not via modding, as that generally doesn't end well.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

In your case, it has to be an

EnumFacing

, and you only allow

EnumFacing.HORIZONTALS

, so you have to use

EnumFacing.NORTH

,

EnumFacing.EAST

,

EnumFacing.SOUTH

or

EnumFacing.WEST

.

 

I am getting the idea you don't actually know Java very well, in which I suggest you learn that first, and not via modding, as that generally doesn't end well.

 

Thanks for you help I should be able to figure the rest out now, to be honest some errors I make are me just being dumb but a lot is due to being inexperienced with Java, I am learning slowly but not as much as I would have thought I would. Most of the time I learn things like mathematics  better if I learn it though application, I like to see the practical out come of something as usually I get lost in the abstract without it. For example learning about graphs made more sense to me with a goal in mind as in lets me associate the skills with something concrete. Java has not been such a case, I'm just failing my way though it at this point instead of learning anything, the only thing left to do at this point is to be honest, admit defeat for now and learn another way.

 

It hurts to say it like that but it's true and as Adam Savage says failure is always an option, lessons have been learned and it's time to back away form this project. Thanks for helping me see this, you shouldn't have to help me for awhile.

Link to comment
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.
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



×
×
  • Create New...

Important Information

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