property cleanup
This commit is contained in:
parent
734279ad95
commit
a836d7a2a5
99 changed files with 564 additions and 731 deletions
|
@ -161,7 +161,7 @@ import common.packet.HPacketHandshake;
|
|||
import common.packet.CPacketAction.Action;
|
||||
import common.potion.Potion;
|
||||
import common.potion.PotionEffect;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.sound.EventType;
|
||||
import common.sound.PositionedSound;
|
||||
import common.util.BlockPos;
|
||||
|
@ -1929,7 +1929,7 @@ public class Client implements IThreadListener {
|
|||
"Schaue auf: " + BlockRegistry.getNameFromBlock(block.getBlock()) + "\n" +
|
||||
String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ())
|
||||
);
|
||||
for(Entry<IProperty, Comparable> entry : block.getProperties().entrySet()) {
|
||||
for(Entry<Property, Comparable> entry : block.getProperties().entrySet()) {
|
||||
str.append("\n" + entry.getKey().getName() + ": " + entry.getValue().toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import common.collect.Maps;
|
|||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.FluidRegistry;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.util.IRegistry;
|
||||
import common.world.State;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ModelManager
|
|||
// Log.info("Builtin: " + BlockRegistry.getNameFromBlock(block));
|
||||
}
|
||||
else {
|
||||
IProperty<?>[] ignored = block.getIgnoredProperties();
|
||||
Property<?>[] ignored = block.getIgnoredProperties();
|
||||
if(ignored != null)
|
||||
this.mappers.put(block, new MultiStateMap.Builder().ignore(ignored).build());
|
||||
}
|
||||
|
|
|
@ -7,16 +7,16 @@ import java.util.Map;
|
|||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.init.BlockRegistry;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.world.State;
|
||||
|
||||
public class MultiStateMap extends StateMap
|
||||
{
|
||||
private final IProperty<?> name;
|
||||
private final Property<?> name;
|
||||
private final String suffix;
|
||||
private final List < IProperty<? >> ignored;
|
||||
private final List < Property<? >> ignored;
|
||||
|
||||
private MultiStateMap(IProperty<?> name, String suffix, List < IProperty<? >> ignored)
|
||||
private MultiStateMap(Property<?> name, String suffix, List < Property<? >> ignored)
|
||||
{
|
||||
this.name = name;
|
||||
this.suffix = suffix;
|
||||
|
@ -25,7 +25,7 @@ public class MultiStateMap extends StateMap
|
|||
|
||||
protected String getResourceLocation(State state)
|
||||
{
|
||||
Map<IProperty, Comparable> map = Maps.<IProperty, Comparable>newLinkedHashMap(state.getProperties());
|
||||
Map<Property, Comparable> map = Maps.<Property, Comparable>newLinkedHashMap(state.getProperties());
|
||||
String s;
|
||||
|
||||
if (this.name == null)
|
||||
|
@ -34,7 +34,7 @@ public class MultiStateMap extends StateMap
|
|||
}
|
||||
else
|
||||
{
|
||||
s = ((IProperty)this.name).getName((Comparable)map.remove(this.name));
|
||||
s = ((Property)this.name).getName((Comparable)map.remove(this.name));
|
||||
}
|
||||
|
||||
if (this.suffix != null)
|
||||
|
@ -42,7 +42,7 @@ public class MultiStateMap extends StateMap
|
|||
s = s + this.suffix;
|
||||
}
|
||||
|
||||
for (IProperty<?> iproperty : this.ignored)
|
||||
for (Property<?> iproperty : this.ignored)
|
||||
{
|
||||
map.remove(iproperty);
|
||||
}
|
||||
|
@ -52,11 +52,11 @@ public class MultiStateMap extends StateMap
|
|||
|
||||
public static class Builder
|
||||
{
|
||||
private IProperty<?> name;
|
||||
private Property<?> name;
|
||||
private String suffix;
|
||||
private final List < IProperty<? >> ignored = Lists. < IProperty<? >> newArrayList();
|
||||
private final List < Property<? >> ignored = Lists. < Property<? >> newArrayList();
|
||||
|
||||
public MultiStateMap.Builder withName(IProperty<?> builderPropertyIn)
|
||||
public MultiStateMap.Builder withName(Property<?> builderPropertyIn)
|
||||
{
|
||||
this.name = builderPropertyIn;
|
||||
return this;
|
||||
|
@ -68,7 +68,7 @@ public class MultiStateMap extends StateMap
|
|||
return this;
|
||||
}
|
||||
|
||||
public MultiStateMap.Builder ignore(IProperty<?>... p_178442_1_)
|
||||
public MultiStateMap.Builder ignore(Property<?>... p_178442_1_)
|
||||
{
|
||||
Collections.addAll(this.ignored, p_178442_1_);
|
||||
return this;
|
||||
|
|
|
@ -5,25 +5,25 @@ import java.util.Map.Entry;
|
|||
|
||||
import common.block.Block;
|
||||
import common.collect.Maps;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.world.State;
|
||||
|
||||
public abstract class StateMap
|
||||
{
|
||||
protected Map<State, String> mapStateModelLocations = Maps.<State, String>newLinkedHashMap();
|
||||
|
||||
public String getPropertyString(Map<IProperty, Comparable> p_178131_1_)
|
||||
public String getPropertyString(Map<Property, Comparable> p_178131_1_)
|
||||
{
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
|
||||
for (Entry<IProperty, Comparable> entry : p_178131_1_.entrySet())
|
||||
for (Entry<Property, Comparable> entry : p_178131_1_.entrySet())
|
||||
{
|
||||
if (stringbuilder.length() != 0)
|
||||
{
|
||||
stringbuilder.append(",");
|
||||
}
|
||||
|
||||
IProperty iproperty = (IProperty)entry.getKey();
|
||||
Property iproperty = (Property)entry.getKey();
|
||||
Comparable comparable = (Comparable)entry.getValue();
|
||||
stringbuilder.append(iproperty.getName());
|
||||
stringbuilder.append("=");
|
||||
|
|
|
@ -32,7 +32,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -156,7 +156,7 @@ public class Block {
|
|||
}
|
||||
}
|
||||
|
||||
private final ImmutableList<IProperty> properties;
|
||||
private final ImmutableList<Property> properties;
|
||||
private final ImmutableList<State> states;
|
||||
protected final Material material;
|
||||
|
||||
|
@ -212,14 +212,14 @@ public class Block {
|
|||
return (T[])((Object[])((Object[])Array.newInstance(clazz, size)));
|
||||
}
|
||||
|
||||
private static Map<IProperty, Comparable> createMap(Iterable<IProperty> keys, Iterable<Comparable> values) {
|
||||
return populateMap(keys, values, Maps.<IProperty, Comparable>newLinkedHashMap());
|
||||
private static Map<Property, Comparable> createMap(Iterable<Property> keys, Iterable<Comparable> values) {
|
||||
return populateMap(keys, values, Maps.<Property, Comparable>newLinkedHashMap());
|
||||
}
|
||||
|
||||
private static Map<IProperty, Comparable> populateMap(Iterable<IProperty> keys, Iterable<Comparable> values, Map<IProperty, Comparable> map) {
|
||||
private static Map<Property, Comparable> populateMap(Iterable<Property> keys, Iterable<Comparable> values, Map<Property, Comparable> map) {
|
||||
Iterator<Comparable> iterator = values.iterator();
|
||||
|
||||
for(IProperty prop : keys) {
|
||||
for(Property prop : keys) {
|
||||
map.put(prop, iterator.next());
|
||||
}
|
||||
|
||||
|
@ -231,28 +231,28 @@ public class Block {
|
|||
}
|
||||
}
|
||||
|
||||
private static List<Iterable<Comparable>> getAllowedValues(List<IProperty> properties) {
|
||||
private static List<Iterable<Comparable>> getAllowedValues(List<Property> properties) {
|
||||
List<Iterable<Comparable>> list = Lists.<Iterable<Comparable>>newArrayList();
|
||||
for(int z = 0; z < properties.size(); z++) {
|
||||
list.add((properties.get(z)).getAllowedValues());
|
||||
list.add((properties.get(z)).getStates());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static ImmutableList<IProperty> getPropertyList(IProperty[] properties) {
|
||||
Arrays.sort(properties, new Comparator<IProperty>() {
|
||||
public int compare(IProperty p1, IProperty p2) {
|
||||
private static ImmutableList<Property> getPropertyList(Property[] properties) {
|
||||
Arrays.sort(properties, new Comparator<Property>() {
|
||||
public int compare(Property p1, Property p2) {
|
||||
return p1.getName().compareTo(p2.getName());
|
||||
}
|
||||
});
|
||||
return ImmutableList.copyOf(properties);
|
||||
}
|
||||
|
||||
private static ImmutableList<State> getStateList(List<IProperty> properties, Block block) {
|
||||
Map<Map<IProperty, Comparable>, State> map = Maps.<Map<IProperty, Comparable>, State>newLinkedHashMap();
|
||||
private static ImmutableList<State> getStateList(List<Property> properties, Block block) {
|
||||
Map<Map<Property, Comparable>, State> map = Maps.<Map<Property, Comparable>, State>newLinkedHashMap();
|
||||
List<State> list = Lists.<State>newArrayList();
|
||||
for(List<Comparable> allowed : cartesianProduct(getAllowedValues(properties))) {
|
||||
Map<IProperty, Comparable> props = createMap(properties, allowed);
|
||||
Map<Property, Comparable> props = createMap(properties, allowed);
|
||||
State state = new State(block, ImmutableMap.copyOf(props));
|
||||
map.put(props, state);
|
||||
list.add(state);
|
||||
|
@ -388,7 +388,7 @@ public class Block {
|
|||
return this.states.get(0);
|
||||
}
|
||||
|
||||
public Collection<IProperty> getPropertyMap() {
|
||||
public Collection<Property> getPropertyMap() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
|
@ -934,8 +934,8 @@ public class Block {
|
|||
return state;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[0];
|
||||
protected Property[] getProperties() {
|
||||
return new Property[0];
|
||||
}
|
||||
|
||||
protected final void setDefaultState(State state) {
|
||||
|
@ -974,7 +974,7 @@ public class Block {
|
|||
return provider.getModel(name).add().all();
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package common.block;
|
||||
|
||||
import common.properties.PropertyDirection;
|
||||
import common.util.Facing;
|
||||
|
||||
public abstract class BlockDirectional extends Block {
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
|
||||
public BlockDirectional(Material material) {
|
||||
super(material);
|
||||
}
|
||||
}
|
8
common/src/main/java/common/block/Directional.java
Normal file
8
common/src/main/java/common/block/Directional.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package common.block;
|
||||
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.Facing;
|
||||
|
||||
public interface Directional {
|
||||
public static final PropertyEnum<Facing> FACING = PropertyEnum.create("facing", Facing.class, Facing.values());
|
||||
}
|
8
common/src/main/java/common/block/DirectionalDown.java
Normal file
8
common/src/main/java/common/block/DirectionalDown.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package common.block;
|
||||
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.Facing;
|
||||
|
||||
public interface DirectionalDown {
|
||||
public static final PropertyEnum<Facing> FACING = PropertyEnum.create("facing", Facing.class, Facing.DOWN, Facing.NORTH, Facing.SOUTH, Facing.WEST, Facing.EAST);
|
||||
}
|
8
common/src/main/java/common/block/DirectionalUp.java
Normal file
8
common/src/main/java/common/block/DirectionalUp.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package common.block;
|
||||
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.Facing;
|
||||
|
||||
public interface DirectionalUp {
|
||||
public static final PropertyEnum<Facing> FACING = PropertyEnum.create("facing", Facing.class, Facing.UP, Facing.NORTH, Facing.SOUTH, Facing.WEST, Facing.EAST);
|
||||
}
|
8
common/src/main/java/common/block/Rotatable.java
Executable file
8
common/src/main/java/common/block/Rotatable.java
Executable file
|
@ -0,0 +1,8 @@
|
|||
package common.block;
|
||||
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.Facing;
|
||||
|
||||
public interface Rotatable {
|
||||
public static final PropertyEnum<Facing> FACING = PropertyEnum.create("facing", Facing.class, Facing.NORTH, Facing.SOUTH, Facing.WEST, Facing.EAST);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.color.DyeColor;
|
||||
import common.color.TextColor;
|
||||
|
@ -12,7 +12,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -23,7 +23,7 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockBed extends BlockDirectional {
|
||||
public class BlockBed extends Block implements Rotatable {
|
||||
public static enum EnumPartType implements Identifyable {
|
||||
HEAD("head"), FOOT("foot");
|
||||
|
||||
|
@ -188,8 +188,8 @@ public class BlockBed extends BlockDirectional {
|
|||
return ((Facing)state.getValue(FACING)).getHorizontalIndex() | (state.getValue(PART) == BlockBed.EnumPartType.HEAD ? 8 : 0);
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {FACING, PART};
|
||||
protected Property[] getProperties() {
|
||||
return new Property[] {FACING, PART};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.item.Item;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -228,9 +228,9 @@ public class BlockCake extends Block
|
|||
return ((Integer)state.getValue(BITES)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {BITES};
|
||||
return new Property[] {BITES};
|
||||
}
|
||||
|
||||
public int getComparatorInputOverride(World worldIn, BlockPos pos)
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.block.artificial;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.collect.Lists;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -13,9 +14,8 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -29,9 +29,8 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockDoor extends Block
|
||||
public class BlockDoor extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
public static final PropertyBool OPEN = PropertyBool.create("open");
|
||||
public static final PropertyEnum<BlockDoor.EnumHingePosition> HINGE = PropertyEnum.<BlockDoor.EnumHingePosition>create("hinge", BlockDoor.EnumHingePosition.class);
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
@ -446,9 +445,9 @@ public class BlockDoor extends Block
|
|||
return (combinedMeta & 16) != 0;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {HALF, FACING, OPEN, HINGE, POWERED};
|
||||
return new Property[] {HALF, FACING, OPEN, HINGE, POWERED};
|
||||
}
|
||||
|
||||
private static ModelRotation getRotation(Facing rot, int offset) {
|
||||
|
@ -500,8 +499,8 @@ public class BlockDoor extends Block
|
|||
}
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {POWERED};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {POWERED};
|
||||
}
|
||||
|
||||
public static enum EnumDoorHalf implements Identifyable
|
||||
|
|
|
@ -13,7 +13,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -196,9 +196,9 @@ public class BlockFence extends Block
|
|||
return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {NORTH, EAST, WEST, SOUTH};
|
||||
return new Property[] {NORTH, EAST, WEST, SOUTH};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -12,7 +12,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -22,7 +22,7 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockFenceGate extends BlockDirectional
|
||||
public class BlockFenceGate extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyBool OPEN = PropertyBool.create("open");
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
@ -200,9 +200,9 @@ public class BlockFenceGate extends BlockDirectional
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, OPEN, POWERED, IN_WALL};
|
||||
return new Property[] {FACING, OPEN, POWERED, IN_WALL};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
|
@ -406,7 +406,7 @@ public class BlockFenceGate extends BlockDirectional
|
|||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING).getOpposite()));
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {POWERED};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {POWERED};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.ItemRegistry;
|
||||
import common.item.CheatTab;
|
||||
import common.item.ItemStack;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
|
@ -61,9 +61,9 @@ public class BlockHay extends BlockRotatedPillar
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {AXIS};
|
||||
return new Property[] {AXIS};
|
||||
}
|
||||
|
||||
public ItemStack createStackedBlock(State state)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
|
@ -9,8 +9,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
|
@ -18,10 +17,8 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockLadder extends Block
|
||||
public class BlockLadder extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
|
||||
public BlockLadder()
|
||||
{
|
||||
super(Material.SMALL);
|
||||
|
@ -161,9 +158,9 @@ public class BlockLadder extends Block
|
|||
return ((Facing)state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
@ -171,6 +168,6 @@ public class BlockLadder extends Block
|
|||
.add(0, 0, 15.2f, 16, 16, 15.2f).noShade()
|
||||
.n().uv(0, 0, 16, 16).noCull()
|
||||
.s().uv(0, 0, 16, 16).noCull()
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(BlockDirectional.FACING)));
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -201,9 +201,9 @@ public class BlockPane extends Block
|
|||
return 0;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {NORTH, EAST, WEST, SOUTH};
|
||||
return new Property[] {NORTH, EAST, WEST, SOUTH};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -12,7 +12,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -277,9 +277,9 @@ public class BlockPortal extends Block
|
|||
return (state.getValue(AXIS) == Axis.Z ? 8 : 0) | state.getValue(DIM);
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {AXIS, DIM};
|
||||
return new Property[] {AXIS, DIM};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.block.artificial;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -15,9 +16,8 @@ import common.item.ItemStack;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -26,9 +26,8 @@ import common.util.Facing;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockPortalFrame extends Block
|
||||
public class BlockPortalFrame extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
public static final PropertyBool ORB = PropertyBool.create("orb");
|
||||
|
||||
public BlockPortalFrame()
|
||||
|
@ -133,9 +132,9 @@ public class BlockPortalFrame extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, ORB};
|
||||
return new Property[] {FACING, ORB};
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state)
|
||||
|
|
|
@ -13,7 +13,7 @@ import common.item.ItemStack;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -9,14 +10,14 @@ import common.item.Item;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockSkull extends BlockDirectional {
|
||||
public class BlockSkull extends Block implements Rotatable {
|
||||
public BlockSkull() {
|
||||
super(Material.SMALL);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
|
@ -39,8 +40,8 @@ public class BlockSkull extends BlockDirectional {
|
|||
return state.getValue(FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {FACING};
|
||||
protected Property[] getProperties() {
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.block.artificial;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Directional;
|
||||
import common.block.Material;
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
|
@ -12,9 +13,9 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
|
@ -23,9 +24,8 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockSlab extends Block
|
||||
public class BlockSlab extends Block implements Directional
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
public static final PropertyBool DOUBLE = PropertyBool.create("double");
|
||||
public static final PropertyBool SEAMLESS = PropertyBool.create("seamless");
|
||||
public static final List<BlockSlab> SLABS = Lists.newArrayList();
|
||||
|
@ -72,9 +72,9 @@ public class BlockSlab extends Block
|
|||
return dir == Facing.DOWN ? 0 : (dir == Facing.UP ? 1 : (dir.getHorizontalIndex() + 2));
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, DOUBLE, SEAMLESS};
|
||||
return new Property[] {FACING, DOUBLE, SEAMLESS};
|
||||
}
|
||||
|
||||
public boolean canSilkHarvest()
|
||||
|
|
|
@ -4,7 +4,7 @@ import common.block.Material;
|
|||
import common.color.DyeColor;
|
||||
import common.item.CheatTab;
|
||||
import common.model.BlockLayer;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockStainedGlassPane extends BlockPane
|
||||
|
@ -28,9 +28,9 @@ public class BlockStainedGlassPane extends BlockPane
|
|||
return BlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {NORTH, EAST, WEST, SOUTH};
|
||||
return new Property[] {NORTH, EAST, WEST, SOUTH};
|
||||
}
|
||||
|
||||
protected String getPaneBase(State state) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -15,8 +16,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -33,9 +33,8 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockStairs extends Block
|
||||
public class BlockStairs extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
public static final PropertyEnum<BlockStairs.EnumHalf> HALF = PropertyEnum.<BlockStairs.EnumHalf>create("half", BlockStairs.EnumHalf.class);
|
||||
public static final PropertyEnum<BlockStairs.EnumShape> SHAPE = PropertyEnum.<BlockStairs.EnumShape>create("shape", BlockStairs.EnumShape.class);
|
||||
private static final int[][] field_150150_a = new int[][] {{4, 5}, {5, 7}, {6, 7}, {4, 6}, {0, 1}, {1, 3}, {2, 3}, {0, 2}};
|
||||
|
@ -805,9 +804,9 @@ public class BlockStairs extends Block
|
|||
return state;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, HALF, SHAPE};
|
||||
return new Property[] {FACING, HALF, SHAPE};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -11,9 +12,8 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -26,9 +26,8 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockTrapDoor extends Block
|
||||
public class BlockTrapDoor extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
public static final PropertyBool OPEN = PropertyBool.create("open");
|
||||
public static final PropertyEnum<BlockTrapDoor.DoorHalf> HALF = PropertyEnum.<BlockTrapDoor.DoorHalf>create("half", BlockTrapDoor.DoorHalf.class);
|
||||
|
||||
|
@ -287,9 +286,9 @@ public class BlockTrapDoor extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, OPEN, HALF};
|
||||
return new Property[] {FACING, OPEN, HALF};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -7,7 +7,7 @@ import common.item.CheatTab;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -136,9 +136,9 @@ public class BlockWall extends Block
|
|||
return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock() != Blocks.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {UP, NORTH, EAST, WEST, SOUTH};
|
||||
return new Property[] {UP, NORTH, EAST, WEST, SOUTH};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import common.item.CheatTab;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -161,16 +161,16 @@ public class BlockCactus extends Block
|
|||
return ((Integer)state.getValue(AGE)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {AGE};
|
||||
return new Property[] {AGE};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return cactus;
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {AGE};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {AGE};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.color.DyeColor;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -13,7 +13,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -25,7 +25,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockCocoa extends BlockDirectional implements IGrowable
|
||||
public class BlockCocoa extends Block implements Rotatable, IGrowable
|
||||
{
|
||||
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 2);
|
||||
|
||||
|
@ -220,9 +220,9 @@ public class BlockCocoa extends BlockDirectional implements IGrowable
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, AGE};
|
||||
return new Property[] {FACING, AGE};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -217,9 +217,9 @@ public class BlockCrops extends BlockBush implements IGrowable
|
|||
return ((Integer)state.getValue(AGE)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {AGE};
|
||||
return new Property[] {AGE};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package common.block.foliage;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.block.SoundType;
|
||||
import common.color.Colorizer;
|
||||
|
@ -18,7 +18,7 @@ import common.item.ItemShears;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -32,10 +32,9 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||
public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable
|
||||
{
|
||||
public static final PropertyEnum<BlockDoublePlant.EnumBlockHalf> HALF = PropertyEnum.<BlockDoublePlant.EnumBlockHalf>create("half", BlockDoublePlant.EnumBlockHalf.class);
|
||||
public static final PropertyEnum<Facing> FACING = BlockDirectional.FACING;
|
||||
|
||||
private final EnumPlantType type;
|
||||
|
||||
|
@ -271,9 +270,9 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
return state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER ? 8 | ((Facing)state.getValue(FACING)).getHorizontalIndex() : 0;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {HALF, FACING};
|
||||
return new Property[] {HALF, FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
@ -293,8 +292,8 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
? "top" : "bottom")).cross();
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {FACING};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public static enum EnumBlockHalf implements Identifyable
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.init.Items;
|
|||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -174,9 +174,9 @@ public class BlockFarmland extends Block
|
|||
return ((Integer)state.getValue(MOISTURE)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {MOISTURE};
|
||||
return new Property[] {MOISTURE};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.item.Item;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -132,9 +132,9 @@ public class BlockGrass extends Block implements IGrowable
|
|||
return 0;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {SNOWY};
|
||||
return new Property[] {SNOWY};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import common.init.ItemRegistry;
|
|||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -96,9 +96,9 @@ public class BlockHugeMushroom extends Block
|
|||
return ((BlockHugeMushroom.EnumType)state.getValue(VARIANT)).getMetadata();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {VARIANT};
|
||||
return new Property[] {VARIANT};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import common.item.ItemStack;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -307,8 +307,8 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {DECAY};
|
||||
protected Property[] getProperties() {
|
||||
return new Property[] {DECAY};
|
||||
}
|
||||
|
||||
public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) {
|
||||
|
@ -325,7 +325,7 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
provider.getModel(name + "_" + this.subType.getName()).add().all();
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {DECAY};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {DECAY};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package common.block.foliage;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.block.liquid.BlockStaticLiquid;
|
||||
import common.entity.Entity;
|
||||
|
@ -14,7 +14,7 @@ import common.item.CheatTab;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
|
@ -22,14 +22,14 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockLilyPad extends BlockBush
|
||||
public class BlockLilyPad extends BlockBush implements Rotatable
|
||||
{
|
||||
public BlockLilyPad()
|
||||
{
|
||||
float f = 0.5F;
|
||||
float f1 = 0.015625F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
||||
this.setDefaultState(this.getBaseState().withProperty(BlockDirectional.FACING, Facing.NORTH));
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
}
|
||||
|
||||
|
@ -87,22 +87,22 @@ public class BlockLilyPad extends BlockBush
|
|||
|
||||
public State getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getState().withProperty(BlockDirectional.FACING, Facing.getHorizontal(meta));
|
||||
return this.getState().withProperty(FACING, Facing.getHorizontal(meta));
|
||||
}
|
||||
|
||||
public int getMetaFromState(State state)
|
||||
{
|
||||
return ((Facing)state.getValue(BlockDirectional.FACING)).getHorizontalIndex();
|
||||
return ((Facing)state.getValue(FACING)).getHorizontalIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {BlockDirectional.FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer)
|
||||
{
|
||||
return this.getState().withProperty(BlockDirectional.FACING, placer.getHorizontalFacing().getOpposite());
|
||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
@ -110,6 +110,6 @@ public class BlockLilyPad extends BlockBush
|
|||
.add(0, 0.25f, 0, 16, 0.25f, 16)
|
||||
.d().uv(16, 16, 0, 0).tint().noCull()
|
||||
.u().uv(16, 0, 0, 16).tint().noCull()
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(BlockDirectional.FACING)));
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.item.CheatTab;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -128,9 +128,9 @@ public class BlockLog extends BlockRotatedPillar
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {LOG_AXIS};
|
||||
return new Property[] {LOG_AXIS};
|
||||
}
|
||||
|
||||
public static enum EnumAxis implements Identifyable
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.item.Item;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -95,9 +95,9 @@ public class BlockMycelium extends Block
|
|||
return 0;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {SNOWY};
|
||||
return new Property[] {SNOWY};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockPumpkin extends BlockDirectional {
|
||||
public class BlockPumpkin extends Block implements Rotatable {
|
||||
public BlockPumpkin() {
|
||||
super(Material.SOFT);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
|
@ -36,8 +37,8 @@ public class BlockPumpkin extends BlockDirectional {
|
|||
return state.getValue(FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {FACING};
|
||||
protected Property[] getProperties() {
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.item.Item;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -179,16 +179,16 @@ public class BlockReed extends Block
|
|||
return ((Integer)state.getValue(AGE)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {AGE};
|
||||
return new Property[] {AGE};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("reeds").crossTint();
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {AGE};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {AGE};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import common.init.WoodType;
|
|||
import common.item.CheatTab;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -132,9 +132,9 @@ public class BlockSapling extends BlockBush implements IGrowable
|
|||
return state.getValue(STAGE);
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {STAGE};
|
||||
return new Property[] {STAGE};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.DirectionalUp;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
|
@ -11,8 +10,7 @@ import common.item.ItemStack;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -23,16 +21,10 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockStem extends BlockBush implements IGrowable
|
||||
public class BlockStem extends BlockBush implements DirectionalUp, IGrowable
|
||||
{
|
||||
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7);
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate<Facing>()
|
||||
{
|
||||
public boolean test(Facing p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != Facing.DOWN;
|
||||
}
|
||||
});
|
||||
|
||||
private final Block crop;
|
||||
|
||||
public BlockStem(Block crop)
|
||||
|
@ -234,9 +226,9 @@ public class BlockStem extends BlockBush implements IGrowable
|
|||
return ((Integer)state.getValue(AGE)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {AGE, FACING};
|
||||
return new Property[] {AGE, FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import common.item.ItemShears;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
|
|
@ -7,7 +7,7 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -41,9 +41,9 @@ public class BlockTianSoil extends Block
|
|||
return 0;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {SNOWY};
|
||||
return new Property[] {SNOWY};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -476,9 +476,9 @@ public class BlockVine extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {UP, NORTH, EAST, SOUTH, WEST};
|
||||
return new Property[] {UP, NORTH, EAST, SOUTH, WEST};
|
||||
}
|
||||
|
||||
public static PropertyBool getPropertyFor(Facing side)
|
||||
|
|
|
@ -9,7 +9,7 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -123,9 +123,9 @@ public class BlockWart extends BlockBush
|
|||
return ((Integer)state.getValue(AGE)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {AGE};
|
||||
return new Property[] {AGE};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import common.init.SoundEvent;
|
|||
import common.item.Item;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -382,9 +382,9 @@ public abstract class BlockLiquid extends Block
|
|||
return ((Integer)state.getValue(LEVEL)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {LEVEL};
|
||||
return new Property[] {LEVEL};
|
||||
}
|
||||
|
||||
public boolean isXrayVisible()
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -45,9 +45,9 @@ public class BlockDirt extends Block
|
|||
return state;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {SNOWY};
|
||||
return new Property[] {SNOWY};
|
||||
}
|
||||
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -452,9 +452,9 @@ public class BlockFire extends Block
|
|||
return ((Integer)state.getValue(AGE)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT};
|
||||
return new Property[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT};
|
||||
}
|
||||
|
||||
private static Model fire_nsu2_flip(String fire) {
|
||||
|
@ -1139,8 +1139,8 @@ public class BlockFire extends Block
|
|||
state.getValue(NORTH), state.getValue(SOUTH), state.getValue(WEST), state.getValue(EAST));
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {AGE};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {AGE};
|
||||
}
|
||||
|
||||
public void getAnimatedTextures(Map<String, Object> map) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.item.ItemStack;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -174,9 +174,9 @@ public class BlockSnow extends Block
|
|||
return ((Integer)state.getValue(LAYERS)).intValue() - 1;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {LAYERS};
|
||||
return new Property[] {LAYERS};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.Rotatable;
|
||||
import common.block.BlockFalling;
|
||||
import common.block.Material;
|
||||
import common.entity.item.EntityFalling;
|
||||
|
@ -13,8 +14,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.tileentity.IInteractionObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -22,10 +22,8 @@ import common.world.IWorldAccess;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockAnvil extends BlockFalling
|
||||
public class BlockAnvil extends BlockFalling implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
|
||||
private final int damage;
|
||||
|
||||
public BlockAnvil(int damage)
|
||||
|
@ -129,9 +127,9 @@ public class BlockAnvil extends BlockFalling
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
|
|
|
@ -16,7 +16,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -529,9 +529,9 @@ public class BlockBrewingStand extends BlockContainer
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {HAS_BOTTLE[0], HAS_BOTTLE[1], HAS_BOTTLE[2]};
|
||||
return new Property[] {HAS_BOTTLE[0], HAS_BOTTLE[1], HAS_BOTTLE[2]};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.block.tech;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Directional;
|
||||
import common.block.Material;
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
|
@ -15,9 +16,8 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -27,9 +27,8 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockButton extends Block
|
||||
public class BlockButton extends Block implements Directional
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
public static final List<BlockButton> BUTTONS = Lists.newArrayList();
|
||||
|
||||
|
@ -394,9 +393,9 @@ public class BlockButton extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, POWERED};
|
||||
return new Property[] {FACING, POWERED};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -16,7 +16,7 @@ import common.item.ItemBanner;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
|
@ -659,9 +659,9 @@ public class BlockCauldron extends Block
|
|||
return ((Integer)state.getValue(LEVEL)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {LEVEL};
|
||||
return new Property[] {LEVEL};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -2,6 +2,7 @@ package common.block.tech;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.color.TextColor;
|
||||
import common.entity.Entity;
|
||||
|
@ -17,8 +18,7 @@ import common.inventory.InventoryLargeChest;
|
|||
import common.item.CheatTab;
|
||||
import common.item.ItemStack;
|
||||
import common.packet.SPacketSoundEffect;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.tileentity.ILockableContainer;
|
||||
import common.tileentity.Passcode;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -33,11 +33,8 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockChest extends BlockContainer
|
||||
public class BlockChest extends BlockContainer implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
|
||||
/** 0 : Normal chest, 1 : Trapped chest */
|
||||
public final int chestType;
|
||||
|
||||
public BlockChest(int type)
|
||||
|
@ -628,9 +625,9 @@ public class BlockChest extends BlockContainer
|
|||
return ((Facing)state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public boolean isXrayVisible()
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.item.Item;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -172,9 +172,9 @@ public class BlockDaylightDetector extends BlockContainer
|
|||
return ((Integer)state.getValue(POWER)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {POWER};
|
||||
return new Property[] {POWER};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
|
|
|
@ -2,6 +2,7 @@ package common.block.tech;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Directional;
|
||||
import common.block.Material;
|
||||
import common.dispenser.BehaviorDefaultDispenseItem;
|
||||
import common.dispenser.IBehaviorDispenseItem;
|
||||
|
@ -20,9 +21,8 @@ import common.item.ItemStack;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityDispenser;
|
||||
|
@ -33,9 +33,8 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockDispenser extends BlockContainer
|
||||
public class BlockDispenser extends BlockContainer implements Directional
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
public static final PropertyBool TRIGGERED = PropertyBool.create("triggered");
|
||||
public static final RegistryDefaulted<Item, IBehaviorDispenseItem> dispenseBehaviorRegistry = new RegistryDefaulted(new BehaviorDefaultDispenseItem());
|
||||
protected Random rand = new Random();
|
||||
|
@ -301,9 +300,9 @@ public class BlockDispenser extends BlockContainer
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, TRIGGERED};
|
||||
return new Property[] {FACING, TRIGGERED};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
@ -319,7 +318,7 @@ public class BlockDispenser extends BlockContainer
|
|||
.s("furnace_side").we("furnace_side").rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {TRIGGERED};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {TRIGGERED};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package common.block.tech;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -15,8 +16,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityFurnace;
|
||||
|
@ -27,9 +27,8 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockFurnace extends BlockContainer
|
||||
public class BlockFurnace extends BlockContainer implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
private final boolean isBurning;
|
||||
private static boolean keepInventory;
|
||||
|
||||
|
@ -271,9 +270,9 @@ public class BlockFurnace extends BlockContainer
|
|||
return ((Facing)state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package common.block.tech;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockContainer;
|
||||
import common.block.DirectionalDown;
|
||||
import common.block.Material;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -17,9 +16,8 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityHopper;
|
||||
import common.util.BlockPos;
|
||||
|
@ -30,7 +28,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockHopper extends BlockContainer
|
||||
public class BlockHopper extends BlockContainer implements DirectionalDown
|
||||
{
|
||||
private static final Model hopper_down = ModelProvider.getModelProvider().getModel("hopper_outside")
|
||||
.add(0, 10, 0, 16, 11, 16)
|
||||
|
@ -84,13 +82,6 @@ public class BlockHopper extends BlockContainer
|
|||
.e().uv(6, 12, 10, 16).noCull()
|
||||
;
|
||||
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate<Facing>()
|
||||
{
|
||||
public boolean test(Facing p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != Facing.UP;
|
||||
}
|
||||
});
|
||||
public static final PropertyBool ENABLED = PropertyBool.create("enabled");
|
||||
|
||||
public BlockHopper()
|
||||
|
@ -302,9 +293,9 @@ public class BlockHopper extends BlockContainer
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, ENABLED};
|
||||
return new Property[] {FACING, ENABLED};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
@ -365,7 +356,7 @@ public class BlockHopper extends BlockContainer
|
|||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {ENABLED};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {ENABLED};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import common.item.CheatTab;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.BlockPos;
|
||||
|
@ -270,9 +270,9 @@ public class BlockLever extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, POWERED};
|
||||
return new Property[] {FACING, POWERED};
|
||||
}
|
||||
|
||||
private static ModelRotation getRotation(EnumOrientation face) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -9,7 +9,7 @@ import common.entity.types.EntityLiving;
|
|||
import common.inventory.Container;
|
||||
import common.inventory.InventoryHelper;
|
||||
import common.item.CheatTab;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityDevice;
|
||||
import common.util.BlockPos;
|
||||
|
@ -18,7 +18,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public abstract class BlockMachine extends BlockDirectional implements ITileEntityProvider {
|
||||
public abstract class BlockMachine extends Block implements Rotatable, ITileEntityProvider {
|
||||
public BlockMachine() {
|
||||
super(Material.SOLID);
|
||||
this.hasTile = true;
|
||||
|
@ -94,8 +94,8 @@ public abstract class BlockMachine extends BlockDirectional implements ITileEnti
|
|||
return ((Facing)state.getValue(FACING)).getHorizontalIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties() {
|
||||
return new IProperty[] {FACING};
|
||||
protected Property[] getProperties() {
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.block.tech;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Directional;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
import common.block.SoundType;
|
||||
|
@ -16,9 +17,9 @@ import common.item.ItemStack;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
import common.util.BlockPos;
|
||||
|
@ -31,7 +32,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockPistonBase extends Block
|
||||
public class BlockPistonBase extends Block implements Directional
|
||||
{
|
||||
private static class BlockPistonStructureHelper
|
||||
{
|
||||
|
@ -246,7 +247,6 @@ public class BlockPistonBase extends Block
|
|||
}
|
||||
}
|
||||
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
public static final PropertyBool EXTENDED = PropertyBool.create("extended");
|
||||
|
||||
/** This piston is the sticky one? */
|
||||
|
@ -703,9 +703,9 @@ public class BlockPistonBase extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, EXTENDED};
|
||||
return new Property[] {FACING, EXTENDED};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.block.tech;
|
|||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Directional;
|
||||
import common.block.Material;
|
||||
import common.block.SoundType;
|
||||
import common.entity.Entity;
|
||||
|
@ -12,9 +13,8 @@ import common.item.Item;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -26,9 +26,8 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockPistonHead extends Block
|
||||
public class BlockPistonHead extends Block implements Directional
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
public static final PropertyEnum<BlockPistonHead.EnumPistonType> TYPE = PropertyEnum.<BlockPistonHead.EnumPistonType>create("type", BlockPistonHead.EnumPistonType.class);
|
||||
public static final PropertyBool SHORT = PropertyBool.create("short");
|
||||
|
||||
|
@ -255,9 +254,9 @@ public class BlockPistonHead extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, TYPE, SHORT};
|
||||
return new Property[] {FACING, TYPE, SHORT};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -6,8 +6,7 @@ import common.block.Material;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.item.Item;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -24,7 +23,7 @@ import common.world.AWorldServer;
|
|||
|
||||
public class BlockPistonMoving extends BlockContainer
|
||||
{
|
||||
public static final PropertyDirection FACING = BlockPistonHead.FACING;
|
||||
public static final PropertyEnum<Facing> FACING = BlockPistonHead.FACING;
|
||||
public static final PropertyEnum<BlockPistonHead.EnumPistonType> TYPE = BlockPistonHead.TYPE;
|
||||
|
||||
public BlockPistonMoving()
|
||||
|
@ -307,8 +306,8 @@ public class BlockPistonMoving extends BlockContainer
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, TYPE};
|
||||
return new Property[] {FACING, TYPE};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||
import common.block.Material;
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -83,9 +83,9 @@ public class BlockPressurePlate extends BlockBasePressurePlate
|
|||
return ((Boolean)state.getValue(POWERED)).booleanValue() ? 1 : 0;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {POWERED};
|
||||
return new Property[] {POWERED};
|
||||
}
|
||||
|
||||
public String getTexture() {
|
||||
|
|
|
@ -2,7 +2,7 @@ package common.block.tech;
|
|||
|
||||
import common.block.Material;
|
||||
import common.entity.Entity;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
@ -70,9 +70,9 @@ public class BlockPressurePlateWeighted extends BlockBasePressurePlate
|
|||
return ((Integer)state.getValue(POWER)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {POWER};
|
||||
return new Property[] {POWER};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.Block;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
|
@ -25,7 +25,7 @@ public class BlockRail extends BlockRailBase
|
|||
}
|
||||
}
|
||||
|
||||
public IProperty<BlockRailBase.EnumRailDirection> getShapeProperty()
|
||||
public Property<BlockRailBase.EnumRailDirection> getShapeProperty()
|
||||
{
|
||||
return SHAPE;
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ public class BlockRail extends BlockRailBase
|
|||
return ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {SHAPE};
|
||||
return new Property[] {SHAPE};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
|
@ -227,7 +227,7 @@ public abstract class BlockRailBase extends Block
|
|||
}
|
||||
}
|
||||
|
||||
public abstract IProperty<BlockRailBase.EnumRailDirection> getShapeProperty();
|
||||
public abstract Property<BlockRailBase.EnumRailDirection> getShapeProperty();
|
||||
|
||||
public static enum EnumRailDirection implements Identifyable
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ import common.inventory.Container;
|
|||
import common.inventory.IInventory;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
|
@ -23,20 +23,13 @@ import common.world.AWorldServer;
|
|||
|
||||
public class BlockRailDetector extends BlockRailBase
|
||||
{
|
||||
public static final PropertyEnum<BlockRailBase.EnumRailDirection> SHAPE = PropertyEnum.<BlockRailBase.EnumRailDirection>create("shape", BlockRailBase.EnumRailDirection.class, new Predicate<BlockRailBase.EnumRailDirection>()
|
||||
{
|
||||
public boolean test(BlockRailBase.EnumRailDirection p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_WEST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_WEST;
|
||||
}
|
||||
});
|
||||
public static final PropertyEnum<BlockRailBase.EnumRailDirection> SHAPE = PropertyEnum.<BlockRailBase.EnumRailDirection>create("shape", EnumRailDirection.class, EnumRailDirection.NORTH_SOUTH, EnumRailDirection.EAST_WEST, EnumRailDirection.ASCENDING_EAST, EnumRailDirection.ASCENDING_WEST, EnumRailDirection.ASCENDING_NORTH, EnumRailDirection.ASCENDING_SOUTH);
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
||||
public BlockRailDetector()
|
||||
{
|
||||
super(true);
|
||||
this.setDefaultState(this.getBaseState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH));
|
||||
// this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +128,7 @@ public class BlockRailDetector extends BlockRailBase
|
|||
this.updatePoweredState(worldIn, pos, state);
|
||||
}
|
||||
|
||||
public IProperty<BlockRailBase.EnumRailDirection> getShapeProperty()
|
||||
public Property<BlockRailBase.EnumRailDirection> getShapeProperty()
|
||||
{
|
||||
return SHAPE;
|
||||
}
|
||||
|
@ -207,9 +200,9 @@ public class BlockRailDetector extends BlockRailBase
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {SHAPE, POWERED};
|
||||
return new Property[] {SHAPE, POWERED};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package common.block.tech;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.block.Block;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.BlockPos;
|
||||
|
@ -14,13 +12,7 @@ import common.world.World;
|
|||
|
||||
public class BlockRailPowered extends BlockRailBase
|
||||
{
|
||||
public static final PropertyEnum<BlockRailBase.EnumRailDirection> SHAPE = PropertyEnum.<BlockRailBase.EnumRailDirection>create("shape", BlockRailBase.EnumRailDirection.class, new Predicate<BlockRailBase.EnumRailDirection>()
|
||||
{
|
||||
public boolean test(BlockRailBase.EnumRailDirection p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_WEST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_WEST;
|
||||
}
|
||||
});
|
||||
public static final PropertyEnum<BlockRailBase.EnumRailDirection> SHAPE = PropertyEnum.<BlockRailBase.EnumRailDirection>create("shape", EnumRailDirection.class, EnumRailDirection.NORTH_SOUTH, EnumRailDirection.EAST_WEST, EnumRailDirection.ASCENDING_EAST, EnumRailDirection.ASCENDING_WEST, EnumRailDirection.ASCENDING_NORTH, EnumRailDirection.ASCENDING_SOUTH);
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
||||
public BlockRailPowered()
|
||||
|
@ -166,7 +158,7 @@ public class BlockRailPowered extends BlockRailBase
|
|||
}
|
||||
}
|
||||
|
||||
public IProperty<BlockRailBase.EnumRailDirection> getShapeProperty()
|
||||
public Property<BlockRailBase.EnumRailDirection> getShapeProperty()
|
||||
{
|
||||
return SHAPE;
|
||||
}
|
||||
|
@ -195,9 +187,9 @@ public class BlockRailPowered extends BlockRailBase
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {SHAPE, POWERED};
|
||||
return new Property[] {SHAPE, POWERED};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.item.Item;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
|
@ -301,9 +301,9 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, MODE, POWERED};
|
||||
return new Property[] {FACING, MODE, POWERED};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
|
@ -15,7 +15,7 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public abstract class BlockRedstoneDiode extends BlockDirectional
|
||||
public abstract class BlockRedstoneDiode extends Block implements Rotatable
|
||||
{
|
||||
/** Tells whether the repeater is powered or not */
|
||||
protected final boolean isRepeaterPowered;
|
||||
|
|
|
@ -9,7 +9,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -153,9 +153,9 @@ public class BlockRedstoneRepeater extends BlockRedstoneDiode
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, DELAY, LOCKED};
|
||||
return new Property[] {FACING, DELAY, LOCKED};
|
||||
}
|
||||
|
||||
private static Model getModelOff(int delay) {
|
||||
|
|
|
@ -16,7 +16,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -817,9 +817,9 @@ public class BlockRedstoneWire extends Block
|
|||
return ((Integer)state.getValue(POWER)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {NORTH, EAST, SOUTH, WEST, POWER};
|
||||
return new Property[] {NORTH, EAST, SOUTH, WEST, POWER};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
@ -1023,8 +1023,8 @@ public class BlockRedstoneWire extends Block
|
|||
return redstone_none;
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {POWER};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {POWER};
|
||||
}
|
||||
|
||||
static enum EnumAttachPosition implements Identifyable
|
||||
|
|
|
@ -13,7 +13,7 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -165,9 +165,9 @@ public class BlockTNT extends Block
|
|||
return ((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {EXPLODE};
|
||||
return new Property[] {EXPLODE};
|
||||
}
|
||||
|
||||
public boolean isXrayVisible()
|
||||
|
@ -180,8 +180,8 @@ public class BlockTNT extends Block
|
|||
return provider.getModel("tnt_side" + power).add().nswe().d("tnt_bottom" + power).u("tnt_top" + power);
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {EXPLODE};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {EXPLODE};
|
||||
}
|
||||
|
||||
public void onDestroyedByFire(World world, BlockPos pos, State state) {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package common.block.tech;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.DirectionalUp;
|
||||
import common.block.Material;
|
||||
import common.block.artificial.BlockFence;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -14,8 +12,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -27,16 +24,8 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockTorch extends Block
|
||||
public class BlockTorch extends Block implements DirectionalUp
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate<Facing>()
|
||||
{
|
||||
public boolean test(Facing p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ != Facing.DOWN;
|
||||
}
|
||||
});
|
||||
|
||||
private static boolean isBlockNormalCube(World world, BlockPos pos, boolean def) {
|
||||
if(!World.isValid(pos) || (world.client && !world.isBlockLoaded(pos, false)))
|
||||
return def;
|
||||
|
@ -85,7 +74,7 @@ public class BlockTorch extends Block
|
|||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
for (Facing enumfacing : FACING.getAllowedValues())
|
||||
for (Facing enumfacing : FACING.getStates())
|
||||
{
|
||||
if (this.canPlaceAt(worldIn, pos, enumfacing))
|
||||
{
|
||||
|
@ -320,9 +309,9 @@ public class BlockTorch extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
@ -348,6 +337,6 @@ public class BlockTorch extends Block
|
|||
.add(-8, 3.5f, 7, 8, 19.5f, 9).noShade().rotate(0, 3.5f, 8, Facing.Axis.Z, -22.5f, false)
|
||||
.n().uv(0, 0, 16, 16).noCull()
|
||||
.s().uv(0, 0, 16, 16).noCull()
|
||||
.rotate(ModelRotation.getEastRot(state.getValue(BlockDirectional.FACING), false));
|
||||
.rotate(ModelRotation.getEastRot(state.getValue(FACING), false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -300,9 +300,9 @@ public class BlockTripWire extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {POWERED, SUSPENDED, ATTACHED, DISARMED, NORTH, EAST, WEST, SOUTH};
|
||||
return new Property[] {POWERED, SUSPENDED, ATTACHED, DISARMED, NORTH, EAST, WEST, SOUTH};
|
||||
}
|
||||
|
||||
private static Model getModelDetached(boolean n, boolean s, boolean w, boolean e, int sides) {
|
||||
|
@ -693,7 +693,7 @@ public class BlockTripWire extends Block
|
|||
getModelDetached(n, s, w, e, sides)));
|
||||
}
|
||||
|
||||
public IProperty<?>[] getIgnoredProperties() {
|
||||
return new IProperty[] {DISARMED, POWERED};
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return new Property[] {DISARMED, POWERED};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
|
@ -11,9 +12,8 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -23,9 +23,8 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockTripWireHook extends Block
|
||||
public class BlockTripWireHook extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
public static final PropertyBool ATTACHED = PropertyBool.create("attached");
|
||||
public static final PropertyBool SUSPENDED = PropertyBool.create("suspended");
|
||||
|
@ -370,9 +369,9 @@ public class BlockTripWireHook extends Block
|
|||
return i;
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING, POWERED, ATTACHED, SUSPENDED};
|
||||
return new Property[] {FACING, POWERED, ATTACHED, SUSPENDED};
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.block.tech;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -14,8 +15,7 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.ParticleType;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.Property;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -23,10 +23,8 @@ import common.world.AWorldClient;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockWarpChest extends Block
|
||||
public class BlockWarpChest extends Block implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
|
||||
public BlockWarpChest()
|
||||
{
|
||||
super(Material.SOLID);
|
||||
|
@ -157,9 +155,9 @@ public class BlockWarpChest extends Block
|
|||
return ((Facing)state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public boolean isXrayVisible()
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagObject;
|
||||
|
@ -15,14 +15,12 @@ import common.tileentity.TileEntity;
|
|||
import common.tileentity.TileEntityBanner;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.world.IBlockAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockBanner extends BlockContainer
|
||||
public class BlockBanner extends BlockContainer implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15);
|
||||
|
||||
public BlockBanner()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.Block;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
|
@ -75,8 +75,8 @@ public class BlockBannerHanging extends BlockBanner
|
|||
return ((Facing)state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.Block;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -34,8 +34,8 @@ public class BlockBannerStanding extends BlockBanner
|
|||
return ((Integer)state.getValue(ROTATION)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {ROTATION};
|
||||
return new Property[] {ROTATION};
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.Block;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
|
@ -46,8 +46,8 @@ public class BlockStandingSign extends BlockSign
|
|||
return ((Integer)state.getValue(ROTATION)).intValue();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {ROTATION};
|
||||
return new Property[] {ROTATION};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.Block;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.PropertyDirection;
|
||||
import common.block.Rotatable;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockWallSign extends BlockSign
|
||||
public class BlockWallSign extends BlockSign implements Rotatable
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL);
|
||||
|
||||
public BlockWallSign()
|
||||
{
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
|
@ -87,8 +85,8 @@ public class BlockWallSign extends BlockSign
|
|||
return ((Facing)state.getValue(FACING)).getIndex();
|
||||
}
|
||||
|
||||
protected IProperty[] getProperties()
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new IProperty[] {FACING};
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common.item;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.foliage.BlockLilyPad;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
|
@ -46,7 +46,7 @@ public class ItemLilyPad extends ItemColored
|
|||
|
||||
if (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1))
|
||||
{
|
||||
worldIn.setState(blockpos1, Blocks.waterlily.getState().withProperty(BlockDirectional.FACING, playerIn.getHorizontalFacing().getOpposite()));
|
||||
worldIn.setState(blockpos1, Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, playerIn.getHorizontalFacing().getOpposite()));
|
||||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package common.properties;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IProperty<T extends Comparable<T>>
|
||||
{
|
||||
String getName();
|
||||
|
||||
Collection<T> getAllowedValues();
|
||||
|
||||
Class<T> getValueClass();
|
||||
|
||||
/**
|
||||
* Get the name for the given value.
|
||||
*/
|
||||
String getName(T value);
|
||||
}
|
38
common/src/main/java/common/properties/Property.java
Executable file
38
common/src/main/java/common/properties/Property.java
Executable file
|
@ -0,0 +1,38 @@
|
|||
package common.properties;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public abstract class Property<T extends Comparable<T>> {
|
||||
private final Class<T> type;
|
||||
private final String name;
|
||||
|
||||
protected Property(String name, Class<T> type) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public Class<T> getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public abstract Collection<T> getStates();
|
||||
public abstract String getName(T value);
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if(this == obj)
|
||||
return true;
|
||||
if(obj != null && this.getClass() == obj.getClass()) {
|
||||
Property other = (Property)obj;
|
||||
return this.type.equals(other.type) && this.name.equals(other.name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return 31 * this.type.hashCode() + this.name.hashCode();
|
||||
}
|
||||
}
|
|
@ -4,30 +4,22 @@ import java.util.Collection;
|
|||
|
||||
import common.collect.ImmutableSet;
|
||||
|
||||
public class PropertyBool extends PropertyHelper<Boolean>
|
||||
{
|
||||
private final ImmutableSet<Boolean> allowedValues = ImmutableSet.<Boolean>of(Boolean.valueOf(true), Boolean.valueOf(false));
|
||||
public class PropertyBool extends Property<Boolean> {
|
||||
private final ImmutableSet<Boolean> bools = ImmutableSet.<Boolean>of(true, false);
|
||||
|
||||
protected PropertyBool(String name)
|
||||
{
|
||||
super(name, Boolean.class);
|
||||
}
|
||||
|
||||
public Collection<Boolean> getAllowedValues()
|
||||
{
|
||||
return this.allowedValues;
|
||||
}
|
||||
|
||||
public static PropertyBool create(String name)
|
||||
{
|
||||
public static PropertyBool create(String name) {
|
||||
return new PropertyBool(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name for the given value.
|
||||
*/
|
||||
public String getName(Boolean value)
|
||||
{
|
||||
private PropertyBool(String name) {
|
||||
super(name, Boolean.class);
|
||||
}
|
||||
|
||||
public Collection<Boolean> getStates() {
|
||||
return this.bools;
|
||||
}
|
||||
|
||||
public String getName(Boolean value) {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
package common.properties;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.collect.Filter;
|
||||
import common.collect.Lists;
|
||||
import common.util.Facing;
|
||||
import common.util.Predicates;
|
||||
|
||||
public class PropertyDirection extends PropertyEnum<Facing>
|
||||
{
|
||||
protected PropertyDirection(String name, Collection<Facing> values)
|
||||
{
|
||||
super(name, Facing.class, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PropertyDirection with the given name
|
||||
*/
|
||||
public static PropertyDirection create(String name)
|
||||
{
|
||||
return create(name, Predicates.<Facing>alwaysTrue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PropertyDirection with all directions that match the given Predicate
|
||||
*/
|
||||
public static PropertyDirection create(String name, Predicate<Facing> filter)
|
||||
{
|
||||
return create(name, Filter.<Facing>filter(Lists.newArrayList(Facing.values()), filter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PropertyDirection for the given direction values
|
||||
*/
|
||||
public static PropertyDirection create(String name, Collection<Facing> values)
|
||||
{
|
||||
return new PropertyDirection(name, values);
|
||||
}
|
||||
}
|
|
@ -1,69 +1,59 @@
|
|||
package common.properties;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.Set;
|
||||
|
||||
import common.collect.Filter;
|
||||
import common.collect.ImmutableSet;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
import common.util.Identifyable;
|
||||
import common.util.Predicates;
|
||||
|
||||
public class PropertyEnum<T extends Enum<T> & Identifyable> extends PropertyHelper<T>
|
||||
{
|
||||
private final ImmutableSet<T> allowedValues;
|
||||
private final Map<String, T> nameToValue = Maps.<String, T>newHashMap();
|
||||
public class PropertyEnum<T extends Enum<T> & Identifyable> extends Property<T> {
|
||||
private final ImmutableSet<T> states;
|
||||
|
||||
protected PropertyEnum(String name, Class<T> valueClass, Collection<T> allowedValues)
|
||||
{
|
||||
super(name, valueClass);
|
||||
this.allowedValues = ImmutableSet.copyOf(allowedValues);
|
||||
|
||||
for (T t : allowedValues)
|
||||
{
|
||||
String s = ((Identifyable)t).getName();
|
||||
|
||||
if (this.nameToValue.containsKey(s))
|
||||
{
|
||||
throw new IllegalArgumentException("Multiple values have the same name \'" + s + "\'");
|
||||
public static <T extends Enum<T> & Identifyable> PropertyEnum<T> create(String name, Class<T> clazz) {
|
||||
return new PropertyEnum(name, clazz, clazz.getEnumConstants());
|
||||
}
|
||||
|
||||
this.nameToValue.put(s, t);
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<T> getAllowedValues()
|
||||
{
|
||||
return this.allowedValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name for the given value.
|
||||
*/
|
||||
public String getName(T value)
|
||||
{
|
||||
return ((Identifyable)value).getName();
|
||||
}
|
||||
|
||||
public static <T extends Enum<T> & Identifyable> PropertyEnum<T> create(String name, Class<T> clazz)
|
||||
{
|
||||
return create(name, clazz, Predicates.<T>alwaysTrue());
|
||||
}
|
||||
|
||||
public static <T extends Enum<T> & Identifyable> PropertyEnum<T> create(String name, Class<T> clazz, Predicate<T> filter)
|
||||
{
|
||||
return create(name, clazz, Filter.<T>filter(Lists.newArrayList(clazz.getEnumConstants()), filter));
|
||||
}
|
||||
|
||||
public static <T extends Enum<T> & Identifyable> PropertyEnum<T> create(String name, Class<T> clazz, T... values)
|
||||
{
|
||||
return create(name, clazz, Lists.newArrayList(values));
|
||||
}
|
||||
|
||||
public static <T extends Enum<T> & Identifyable> PropertyEnum<T> create(String name, Class<T> clazz, Collection<T> values)
|
||||
{
|
||||
public static <T extends Enum<T> & Identifyable> PropertyEnum<T> create(String name, Class<T> clazz, T... values) {
|
||||
return new PropertyEnum(name, clazz, values);
|
||||
}
|
||||
|
||||
private PropertyEnum(String name, Class<T> type, T[] states) {
|
||||
super(name, type);
|
||||
Set<String> check = Sets.newHashSet();
|
||||
for(T state : states) {
|
||||
String id = state.getName();
|
||||
if(check.contains(id))
|
||||
throw new IllegalArgumentException("Mehrere Werte haben den Namen '" + id + "'");
|
||||
check.add(id);
|
||||
}
|
||||
check.clear();
|
||||
this.states = ImmutableSet.copyOf(states);
|
||||
}
|
||||
|
||||
public Collection<T> getStates() {
|
||||
return this.states;
|
||||
}
|
||||
|
||||
public String getName(T value) {
|
||||
return value.getName();
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if(this == obj)
|
||||
return true;
|
||||
if(obj != null && this.getClass() == obj.getClass()) {
|
||||
if(!super.equals(obj))
|
||||
return false;
|
||||
PropertyEnum other = (PropertyEnum)obj;
|
||||
return this.states.equals(other.states);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = super.hashCode();
|
||||
i = 31 * i + this.states.hashCode();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
package common.properties;
|
||||
|
||||
public abstract class PropertyHelper<T extends Comparable<T>> implements IProperty<T>
|
||||
{
|
||||
private final Class<T> valueClass;
|
||||
private final String name;
|
||||
|
||||
protected PropertyHelper(String name, Class<T> valueClass)
|
||||
{
|
||||
this.valueClass = valueClass;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public Class<T> getValueClass()
|
||||
{
|
||||
return this.valueClass;
|
||||
}
|
||||
|
||||
// public String toString()
|
||||
// {
|
||||
// return Objects.toStringHelper(this).add("name", this.name).add("clazz", this.valueClass).add("values", this.getAllowedValues()).toString();
|
||||
// }
|
||||
|
||||
public boolean equals(Object p_equals_1_)
|
||||
{
|
||||
if (this == p_equals_1_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass())
|
||||
{
|
||||
PropertyHelper propertyhelper = (PropertyHelper)p_equals_1_;
|
||||
return this.valueClass.equals(propertyhelper.valueClass) && this.name.equals(propertyhelper.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return 31 * this.valueClass.hashCode() + this.name.hashCode();
|
||||
}
|
||||
}
|
|
@ -6,81 +6,49 @@ import java.util.Set;
|
|||
import common.collect.ImmutableSet;
|
||||
import common.collect.Sets;
|
||||
|
||||
public class PropertyInteger extends PropertyHelper<Integer>
|
||||
{
|
||||
private final ImmutableSet<Integer> allowedValues;
|
||||
public class PropertyInteger extends Property<Integer> {
|
||||
private final ImmutableSet<Integer> values;
|
||||
|
||||
protected PropertyInteger(String name, int min, int max)
|
||||
{
|
||||
super(name, Integer.class);
|
||||
|
||||
if (min < 0)
|
||||
{
|
||||
throw new IllegalArgumentException("Min value of " + name + " must be 0 or greater");
|
||||
}
|
||||
else if (max <= min)
|
||||
{
|
||||
throw new IllegalArgumentException("Max value of " + name + " must be greater than min (" + min + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
Set<Integer> set = Sets.<Integer>newHashSet();
|
||||
|
||||
for (int i = min; i <= max; ++i)
|
||||
{
|
||||
set.add(Integer.valueOf(i));
|
||||
}
|
||||
|
||||
this.allowedValues = ImmutableSet.copyOf(set);
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<Integer> getAllowedValues()
|
||||
{
|
||||
return this.allowedValues;
|
||||
}
|
||||
|
||||
public boolean equals(Object p_equals_1_)
|
||||
{
|
||||
if (this == p_equals_1_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass())
|
||||
{
|
||||
if (!super.equals(p_equals_1_))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
PropertyInteger propertyinteger = (PropertyInteger)p_equals_1_;
|
||||
return this.allowedValues.equals(propertyinteger.allowedValues);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
int i = super.hashCode();
|
||||
i = 31 * i + this.allowedValues.hashCode();
|
||||
return i;
|
||||
}
|
||||
|
||||
public static PropertyInteger create(String name, int min, int max)
|
||||
{
|
||||
public static PropertyInteger create(String name, int min, int max) {
|
||||
return new PropertyInteger(name, min, max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name for the given value.
|
||||
*/
|
||||
public String getName(Integer value)
|
||||
{
|
||||
private PropertyInteger(String name, int min, int max) {
|
||||
super(name, Integer.class);
|
||||
if(min < 0)
|
||||
throw new IllegalArgumentException("Mindestwert von " + name + " muss 0 oder höher sein");
|
||||
else if(max <= min)
|
||||
throw new IllegalArgumentException("Maximalwert von " + name + " muss größer als der Mindestwert sein (" + min + ")");
|
||||
Set<Integer> set = Sets.<Integer>newHashSetWithExpectedSize(1 + max - min);
|
||||
for(int z = min; z <= max; z++) {
|
||||
set.add(z);
|
||||
}
|
||||
this.values = ImmutableSet.copyOf(set);
|
||||
}
|
||||
|
||||
public Collection<Integer> getStates() {
|
||||
return this.values;
|
||||
}
|
||||
|
||||
public String getName(Integer value) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if(this == obj)
|
||||
return true;
|
||||
if(obj != null && this.getClass() == obj.getClass()) {
|
||||
if(!super.equals(obj))
|
||||
return false;
|
||||
PropertyInteger other = (PropertyInteger)obj;
|
||||
return this.values.equals(other.values);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = super.hashCode();
|
||||
i = 31 * i + this.values.hashCode();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,34 +15,34 @@ import common.collect.Maps;
|
|||
import common.collect.StandardTable;
|
||||
import common.collect.Table;
|
||||
import common.init.BlockRegistry;
|
||||
import common.properties.IProperty;
|
||||
import common.properties.Property;
|
||||
|
||||
public class State {
|
||||
// private static final Joiner COMMA_JOINER = Joiner.on(',');
|
||||
private static final Function<Entry<IProperty, Comparable>, String> MAP_ENTRY_TO_STRING =
|
||||
new Function<Entry<IProperty, Comparable>, String>() {
|
||||
public String apply(Entry<IProperty, Comparable> entry) {
|
||||
private static final Function<Entry<Property, Comparable>, String> MAP_ENTRY_TO_STRING =
|
||||
new Function<Entry<Property, Comparable>, String>() {
|
||||
public String apply(Entry<Property, Comparable> entry) {
|
||||
if(entry == null) {
|
||||
return "<NULL>";
|
||||
}
|
||||
else {
|
||||
IProperty prop = entry.getKey();
|
||||
Property prop = entry.getKey();
|
||||
return prop.getName() + "=" + prop.getName(entry.getValue());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final Block block;
|
||||
private final ImmutableMap<IProperty, Comparable> properties;
|
||||
private ImmutableTable<IProperty, Comparable, State> map;
|
||||
private final ImmutableMap<Property, Comparable> properties;
|
||||
private ImmutableTable<Property, Comparable, State> map;
|
||||
|
||||
public State(Block block, ImmutableMap<IProperty, Comparable> properties) {
|
||||
public State(Block block, ImmutableMap<Property, Comparable> properties) {
|
||||
this.block = block;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> State cycleProperty(IProperty<T> property) {
|
||||
Collection<T> values = property.getAllowedValues();
|
||||
public <T extends Comparable<T>> State cycleProperty(Property<T> property) {
|
||||
Collection<T> values = property.getStates();
|
||||
T value = this.getValue(property);
|
||||
Iterator<T> iter = values.iterator();
|
||||
while(iter.hasNext()) {
|
||||
|
@ -55,24 +55,24 @@ public class State {
|
|||
return this.withProperty(property, (T)iter.next());
|
||||
}
|
||||
|
||||
public Collection<IProperty> getPropertyNames() {
|
||||
return Collections.<IProperty>unmodifiableCollection(this.properties.keySet());
|
||||
public Collection<Property> getPropertyNames() {
|
||||
return Collections.<Property>unmodifiableCollection(this.properties.keySet());
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> T getValue(IProperty<T> property) {
|
||||
public <T extends Comparable<T>> T getValue(Property<T> property) {
|
||||
if(!this.properties.containsKey(property)) {
|
||||
throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.block);
|
||||
}
|
||||
else {
|
||||
return (T)((Comparable)property.getValueClass().cast(this.properties.get(property)));
|
||||
return (T)((Comparable)property.getType().cast(this.properties.get(property)));
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>, V extends T> State withProperty(IProperty<T> property, V value) {
|
||||
public <T extends Comparable<T>, V extends T> State withProperty(Property<T> property, V value) {
|
||||
if(!this.properties.containsKey(property)) {
|
||||
throw new IllegalArgumentException("Cannot set property " + property + " as it does not exist in " + this.block);
|
||||
}
|
||||
else if(!property.getAllowedValues().contains(value)) {
|
||||
else if(!property.getStates().contains(value)) {
|
||||
throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block "
|
||||
+ BlockRegistry.getNameFromBlock(this.block) + ", it is not an allowed value");
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class State {
|
|||
}
|
||||
}
|
||||
|
||||
public ImmutableMap<IProperty, Comparable> getProperties() {
|
||||
public ImmutableMap<Property, Comparable> getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
|
@ -117,22 +117,22 @@ public class State {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
public void buildTable(Map<Map<IProperty, Comparable>, State> map) {
|
||||
public void buildTable(Map<Map<Property, Comparable>, State> map) {
|
||||
if(this.map != null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
else {
|
||||
Table<IProperty, Comparable, State> table = new StandardTable<IProperty, Comparable, State>();
|
||||
for(IProperty<? extends Comparable> prop : this.properties.keySet()) {
|
||||
for(Comparable value : prop.getAllowedValues()) {
|
||||
Table<Property, Comparable, State> table = new StandardTable<Property, Comparable, State>();
|
||||
for(Property<? extends Comparable> prop : this.properties.keySet()) {
|
||||
for(Comparable value : prop.getStates()) {
|
||||
if(value != this.properties.get(prop)) {
|
||||
Map<IProperty, Comparable> props = Maps.<IProperty, Comparable>newHashMap(this.properties);
|
||||
Map<Property, Comparable> props = Maps.<Property, Comparable>newHashMap(this.properties);
|
||||
props.put(prop, value);
|
||||
table.put(prop, value, map.get(props));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.map = ImmutableTable.<IProperty, Comparable, State>copyOf(table);
|
||||
this.map = ImmutableTable.<Property, Comparable, State>copyOf(table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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