property cleanup
This commit is contained in:
parent
734279ad95
commit
a836d7a2a5
99 changed files with 564 additions and 731 deletions
|
@ -1,8 +1,8 @@
|
|||
package server.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.block.foliage.BlockLilyPad;
|
||||
import common.entity.npc.EntitySlime;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
|
@ -60,7 +60,7 @@ public class BiomeSwamp extends GenBiome
|
|||
|
||||
if (d0 < 0.12D)
|
||||
{
|
||||
chunkPrimerIn.set(j, k + 1, i, Blocks.waterlily.getState().withProperty(BlockDirectional.FACING, Facing.randHorizontal(rand)));
|
||||
chunkPrimerIn.set(j, k + 1, i, Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@ import common.block.tech.BlockRailDetector;
|
|||
import common.block.tech.BlockRailPowered;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3i;
|
||||
import common.world.State;
|
||||
|
@ -28,7 +27,7 @@ public abstract class RotationRegistry {
|
|||
|
||||
public static void register() {
|
||||
for(Block block : common.init.BlockRegistry.REGISTRY) {
|
||||
for(IProperty<?> prop : block.getPropertyMap()) {
|
||||
for(Property<?> prop : block.getPropertyMap()) {
|
||||
Predicate<Integer> predicate = null;
|
||||
if(prop == BlockDoor.FACING) {
|
||||
predicate = new Predicate<Integer>() {
|
||||
|
@ -48,7 +47,7 @@ public abstract class RotationRegistry {
|
|||
}
|
||||
|
||||
byte mask = 0;
|
||||
for(Object v : prop.getAllowedValues()) {
|
||||
for(Object v : prop.getStates()) {
|
||||
if(map.get(v) == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -57,14 +56,14 @@ public abstract class RotationRegistry {
|
|||
if(mask == 0) {
|
||||
continue;
|
||||
}
|
||||
for(Object v : prop.getAllowedValues()) {
|
||||
for(Object v : prop.getStates()) {
|
||||
if(map.get(v) == null) {
|
||||
continue;
|
||||
}
|
||||
Vec3i dv = null;
|
||||
Facing.Axis axis = null;
|
||||
if(prop instanceof PropertyDirection) {
|
||||
dv = ((Facing)v).getDirectionVec();
|
||||
if(v instanceof Facing face) {
|
||||
dv = face.getDirectionVec();
|
||||
}
|
||||
else if(prop == BlockRotatedPillar.AXIS) {
|
||||
axis = ((Facing.Axis)v);
|
||||
|
|
|
@ -28,7 +28,7 @@ import common.init.BlockRegistry;
|
|||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.log.Log;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -38,12 +38,12 @@ import common.world.BlockArray;
|
|||
import common.world.State;
|
||||
|
||||
public class Region {
|
||||
private static Set<IProperty> getSavedProperties(Block block) {
|
||||
Set<IProperty> stored = Sets.newHashSet();
|
||||
Map<IProperty, Comparable> map = Maps.newHashMap();
|
||||
private static Set<Property> getSavedProperties(Block block) {
|
||||
Set<Property> stored = Sets.newHashSet();
|
||||
Map<Property, Comparable> map = Maps.newHashMap();
|
||||
for(int z = 0; z < 16; z++) {
|
||||
State sub = block.getStateFromMeta(z);
|
||||
for(Entry<IProperty, Comparable> entry : sub.getProperties().entrySet()) {
|
||||
for(Entry<Property, Comparable> entry : sub.getProperties().entrySet()) {
|
||||
if(map.containsKey(entry.getKey())) {
|
||||
if(!map.get(entry.getKey()).equals(entry.getValue()))
|
||||
stored.add(entry.getKey());
|
||||
|
@ -55,8 +55,8 @@ public class Region {
|
|||
}
|
||||
for(int z = 0; z < 16; z++) {
|
||||
State sub = block.getStateFromMeta(z);
|
||||
Map<IProperty, Comparable> smap = sub.getProperties();
|
||||
for(IProperty prop : map.keySet()) {
|
||||
Map<Property, Comparable> smap = sub.getProperties();
|
||||
for(Property prop : map.keySet()) {
|
||||
if(!smap.containsKey(prop))
|
||||
stored.add(prop);
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ public class Region {
|
|||
return stored;
|
||||
}
|
||||
|
||||
private static String filterProperties(State state, Set<IProperty> stored) {
|
||||
private static String filterProperties(State state, Set<Property> stored) {
|
||||
StringBuilder sb = new StringBuilder(BlockRegistry.getNameFromBlock(state.getBlock()));
|
||||
for(Entry<IProperty, Comparable> entry : state.getProperties().entrySet()) {
|
||||
for(Entry<Property, Comparable> entry : state.getProperties().entrySet()) {
|
||||
if(stored.contains(entry.getKey()))
|
||||
sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue()));
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class Region {
|
|||
for(int z = 0; z < 4096; z++) {
|
||||
Block block = BlockRegistry.getBlockById(z);
|
||||
if(block != Blocks.air) {
|
||||
Set<IProperty> stored = getSavedProperties(block);
|
||||
Set<Property> stored = getSavedProperties(block);
|
||||
for(int n = 0; n < 16; n++) {
|
||||
State state = block.getStateFromMeta(n);
|
||||
String id = filterProperties(state, stored);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package server.worldgen.foliage;
|
||||
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.foliage.BlockLilyPad;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -20,7 +20,7 @@ public class WorldGenWaterlily extends FeatureGenerator
|
|||
|
||||
if (worldIn.isAirBlock(new BlockPos(j, k, l)) && Blocks.waterlily.canPlaceBlockAt(worldIn, new BlockPos(j, k, l)))
|
||||
{
|
||||
worldIn.setState(new BlockPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockDirectional.FACING, Facing.randHorizontal(rand)), 2);
|
||||
worldIn.setState(new BlockPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package server.worldgen.structure;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.artificial.BlockDoor;
|
||||
import common.init.Blocks;
|
||||
import common.item.ItemDoor;
|
||||
|
@ -415,7 +415,7 @@ public abstract class StructureComponent
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (blockIn != Blocks.tripwire_hook && !(blockIn instanceof BlockDirectional))
|
||||
else if (blockIn != Blocks.tripwire_hook && !(blockIn instanceof Rotatable))
|
||||
{
|
||||
if (blockIn == Blocks.piston || blockIn == Blocks.sticky_piston || blockIn == Blocks.lever || blockIn == Blocks.dispenser)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue