@gabizou
So the reason I requested this "Is there ANY programming method … " question for these blocks is because all the data-manipulator stuff for them is not yet implimented to do them via the several other ways that are promised to work for those when they finally are implimented, and wanted to know if there was a simpler way to currently trip the properties and settings on these right now, since the getTraits works so nicely to identify what is present for everything…
Your response - very good, I got encouraged, and figured “If this works, I’m going to poke at it more, and then volunteer to add a section to the documentation about it to help get this down and the process to find the stuff to change”, cause
that definitely puts a flag firmly in the middle of new territory to look around from within. The Enums for the traits is good, the example of portiontypes shows to look in the data.types package for a list of ones that pretty much jumps off as the one to use, the process seems fairly clear.
Question first:
Would the placing of two trait changes (like quartz top slabs) rquire making a blockstate default, a blockstateA with top-block properties from the default; and a blockstateB with quartz-properties from the blockstateA ??
Eitherway - NONE OF THIS WORKS for me right now still, defeating my question.
==============================
I used your EXACT code, SpongeForge 1521-dev 726, Forge 1521, API-102
With the orElse() I just get stone slab still. Drop the or else with a get() (Which in a true implimentation, would be the way I woudl go if I am precisely writing a method to place quartz slabs, they WILL be slabs, they WILL be quartz slabs, thus the blockstate WILL support the property required and wont return null, no option needed…) … with just get() I get the following error;
Could not pass InteractBlockEvent$Secondary$Impl to SpongePlugin:BoosUFOInvaders{unknown}
java.util.NoSuchElementException: No value present
at java.util.Optional.get(Unknown Source) ~[?:1.8.0_65]
at com.prennet.boomod.ufoinvaders.UFOBuilder.placeTopSlabQuartz(UFOBuilder.java:94) ~[UFOBuilder.class:?]
I tried with the one-state at a time change, with TOP first, followed by Quartz, then switched the order and the results were no different, the first instance in my method of the block-state withTrait() assignment throws that error.
BlockState slabStateChanged = slabState.withTrait(
EnumTraits.STONE_SLAB_HALF,
PortionTypes.TOP
).orElse(slabState);
AND the other one is
BlockState slabStateChanged = slabState.withTrait(
EnumTraits.STONE_SLAB_VARIANT,
SlabTypes.QUARTZ
).orElse(slabState);
No go with either one, and that error message to me says “This has not yet been implimented” for those traits or datatypes features to be added (Also, assumed you meant setBlock() since no setState() method…) OR ELSE we’re still missing something from the process that needs to be in there…
So if indeed these SHOULD Be working this way and it is not, what is the missing link, since these are throwing non-implimented errors…