Jump to content

[1.10.2] directional blocks


NEG2013

Recommended Posts

I'm trying to make a block change appearence based on how its facing, ive looked at the hopper's class and blocks state but still cant figure it out.

 

blocks state:

{ 
"forge_marker": 1,
    "defaults": { "model": "storageplus:storage_node_down"
    },
      "variants": {
         "normal": [{}],
         "inventory": [{}],
    
        "facing=down": { "model": "storageplus:storage_node_down" },
        "facing=north": { "model": "storageplus:storage_node_side" },
        "facing=south": { "model": "storageplus:storage_node_side", "y": 180 },
        "facing=west": { "model": "storageplus:storage_node_side", "y": 270 },
        "facing=east": { "model": "storageplus:storage_node_side", "y": 90 }
        "facing=up": { "model": "storageplus:storage_node_up"}
        
        }     
}

 

I also have no idea how to use enumfacing with a propertydirection.

 

 

 

Link to comment
Share on other sites

I'm trying to make a block change appearence based on how its facing, ive looked at the hopper's class and blocks state but still cant figure it out.

 

blocks state:

{ 
"forge_marker": 1,
    "defaults": { "model": "storageplus:storage_node_down"
    },
      "variants": {
         "normal": [{}],
         "inventory": [{}],
    
        "facing=down": { "model": "storageplus:storage_node_down" },
        "facing=north": { "model": "storageplus:storage_node_side" },
        "facing=south": { "model": "storageplus:storage_node_side", "y": 180 },
        "facing=west": { "model": "storageplus:storage_node_side", "y": 270 },
        "facing=east": { "model": "storageplus:storage_node_side", "y": 90 }
        "facing=up": { "model": "storageplus:storage_node_up"}
        
        }     
}

 

I also have no idea how to use enumfacing with a propertydirection.

 

That's not a valid JSON file. You're missing a comma at the end of the "facing=east" line

Link to comment
Share on other sites

Show your Block class.

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

package com.drunkripper.storageplus.block.node;

import java.util.List;

import javax.annotation.Nullable;

import com.drunkripper.storageplus.block.GBlock;
import com.google.common.base.Predicate;

import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class StorageNode extends GBlock {

 public static final PropertyDirection FACING = BlockHorizontal.FACING;



//1 / 16 = 0.0625
private static final AxisAlignedBB BOUNDING_BOX_DOWN = new AxisAlignedBB(0, 0, 0, 1, 0.25, 1);

public StorageNode(Material materialIn, String name) {
	super(materialIn, name);

}//constructor

@Override
public boolean isFullCube(IBlockState state) {

	return false;
}//isFullCube


@Override
public boolean isOpaqueCube(IBlockState state) {

	return false;
}//isOpaqueCube

@Override
public BlockRenderLayer getBlockLayer() {

	return BlockRenderLayer.TRANSLUCENT;
}//BlockRenderLayer

@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {




	return BOUNDING_BOX_DOWN;
}//getBoundingBox

@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
		List<AxisAlignedBB> collidingBoxes, Entity entityIn) {

	super.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOUNDING_BOX_DOWN);;
}//addCollisionBoxToList

}//class

Link to comment
Share on other sites

Yeah, you've done NONE of the things required for a block to have blockstates.

Congrats, you have a PropertyDirection static enum.  You never use it.

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

There are three methods that are important.  If you do a search in BlockFurnace for where it uses the PropertyDirection, you'll find what you need.

 

We are not here to GIVE you code, we're here to HELP you code.

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

 

 

Time: 8/25/16 5:11 PM
Description: Initializing game

java.lang.IllegalArgumentException: Cannot set property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockStateContainer{block=null, properties=[]}
at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:210)
at com.drunkripper.storageplus.block.node.StorageNode.<init>(StorageNode.java:37)
at com.drunkripper.storageplus.registry.BlockRegistry.initBlocks(BlockRegistry.java:24)
at com.drunkripper.storageplus.main.StoragePlus.init(StoragePlus.java:43)
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:579)
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:235)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213)
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:142)
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:774)
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:322)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:561)
at net.minecraft.client.Minecraft.run(Minecraft.java:386)
at net.minecraft.client.main.Main.main(Main.java:118)
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(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


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

-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:210)
at com.drunkripper.storageplus.block.node.StorageNode.<init>(StorageNode.java:37)
at com.drunkripper.storageplus.registry.BlockRegistry.initBlocks(BlockRegistry.java:24)
at com.drunkripper.storageplus.main.StoragePlus.init(StoragePlus.java:43)
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:579)
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:235)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213)
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:142)
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:774)
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:322)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:561)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:386)
at net.minecraft.client.main.Main.main(Main.java:118)
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(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
Minecraft Version: 1.10.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_74, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 771644064 bytes (735 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.32 Powered by Forge 12.18.1.2011 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
UCHI	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHI	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar) 
UCHI	Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar) 
UCHE	storageplus{1.2b} [storagePlus] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13416 Compatibility Profile Context 15.300.1025.1001' Renderer: 'AMD Radeon R7 Graphics'
Launched Version: 1.10.2
LWJGL: 2.9.4
OpenGL: AMD Radeon R7 Graphics GL version 4.5.13416 Compatibility Profile Context 15.300.1025.1001, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: 
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 4x AMD FX-8800P Radeon R7, 12 Compute Cores 4C+8G 

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.