base mod created
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package net.minecraft.block.material;
|
||||
|
||||
public enum EnumPushReaction
|
||||
{
|
||||
NORMAL,
|
||||
DESTROY,
|
||||
BLOCK,
|
||||
IGNORE,
|
||||
PUSH_ONLY;
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package net.minecraft.block.material;
|
||||
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class MapColor
|
||||
{
|
||||
/** Holds all the 16 colors used on maps, very similar of a pallete system. */
|
||||
public static final MapColor[] COLORS = new MapColor[64];
|
||||
public static final MapColor[] BLOCK_COLORS = new MapColor[16];
|
||||
public static final MapColor AIR = new MapColor(0, 0);
|
||||
public static final MapColor GRASS = new MapColor(1, 8368696);
|
||||
public static final MapColor SAND = new MapColor(2, 16247203);
|
||||
public static final MapColor CLOTH = new MapColor(3, 13092807);
|
||||
public static final MapColor TNT = new MapColor(4, 16711680);
|
||||
public static final MapColor ICE = new MapColor(5, 10526975);
|
||||
public static final MapColor IRON = new MapColor(6, 10987431);
|
||||
public static final MapColor FOLIAGE = new MapColor(7, 31744);
|
||||
public static final MapColor SNOW = new MapColor(8, 16777215);
|
||||
public static final MapColor CLAY = new MapColor(9, 10791096);
|
||||
public static final MapColor DIRT = new MapColor(10, 9923917);
|
||||
public static final MapColor STONE = new MapColor(11, 7368816);
|
||||
public static final MapColor WATER = new MapColor(12, 4210943);
|
||||
public static final MapColor WOOD = new MapColor(13, 9402184);
|
||||
public static final MapColor QUARTZ = new MapColor(14, 16776437);
|
||||
public static final MapColor ADOBE = new MapColor(15, 14188339);
|
||||
public static final MapColor MAGENTA = new MapColor(16, 11685080);
|
||||
public static final MapColor LIGHT_BLUE = new MapColor(17, 6724056);
|
||||
public static final MapColor YELLOW = new MapColor(18, 15066419);
|
||||
public static final MapColor LIME = new MapColor(19, 8375321);
|
||||
public static final MapColor PINK = new MapColor(20, 15892389);
|
||||
public static final MapColor GRAY = new MapColor(21, 5000268);
|
||||
public static final MapColor SILVER = new MapColor(22, 10066329);
|
||||
public static final MapColor CYAN = new MapColor(23, 5013401);
|
||||
public static final MapColor PURPLE = new MapColor(24, 8339378);
|
||||
public static final MapColor BLUE = new MapColor(25, 3361970);
|
||||
public static final MapColor BROWN = new MapColor(26, 6704179);
|
||||
public static final MapColor GREEN = new MapColor(27, 6717235);
|
||||
public static final MapColor RED = new MapColor(28, 10040115);
|
||||
public static final MapColor BLACK = new MapColor(29, 1644825);
|
||||
public static final MapColor GOLD = new MapColor(30, 16445005);
|
||||
public static final MapColor DIAMOND = new MapColor(31, 6085589);
|
||||
public static final MapColor LAPIS = new MapColor(32, 4882687);
|
||||
public static final MapColor EMERALD = new MapColor(33, 55610);
|
||||
public static final MapColor OBSIDIAN = new MapColor(34, 8476209);
|
||||
public static final MapColor NETHERRACK = new MapColor(35, 7340544);
|
||||
public static final MapColor WHITE_STAINED_HARDENED_CLAY = new MapColor(36, 13742497);
|
||||
public static final MapColor ORANGE_STAINED_HARDENED_CLAY = new MapColor(37, 10441252);
|
||||
public static final MapColor MAGENTA_STAINED_HARDENED_CLAY = new MapColor(38, 9787244);
|
||||
public static final MapColor LIGHT_BLUE_STAINED_HARDENED_CLAY = new MapColor(39, 7367818);
|
||||
public static final MapColor YELLOW_STAINED_HARDENED_CLAY = new MapColor(40, 12223780);
|
||||
public static final MapColor LIME_STAINED_HARDENED_CLAY = new MapColor(41, 6780213);
|
||||
public static final MapColor PINK_STAINED_HARDENED_CLAY = new MapColor(42, 10505550);
|
||||
public static final MapColor GRAY_STAINED_HARDENED_CLAY = new MapColor(43, 3746083);
|
||||
public static final MapColor SILVER_STAINED_HARDENED_CLAY = new MapColor(44, 8874850);
|
||||
public static final MapColor CYAN_STAINED_HARDENED_CLAY = new MapColor(45, 5725276);
|
||||
public static final MapColor PURPLE_STAINED_HARDENED_CLAY = new MapColor(46, 8014168);
|
||||
public static final MapColor BLUE_STAINED_HARDENED_CLAY = new MapColor(47, 4996700);
|
||||
public static final MapColor BROWN_STAINED_HARDENED_CLAY = new MapColor(48, 4993571);
|
||||
public static final MapColor GREEN_STAINED_HARDENED_CLAY = new MapColor(49, 5001770);
|
||||
public static final MapColor RED_STAINED_HARDENED_CLAY = new MapColor(50, 9321518);
|
||||
public static final MapColor BLACK_STAINED_HARDENED_CLAY = new MapColor(51, 2430480);
|
||||
/** Holds the color in RGB value that will be rendered on maps. */
|
||||
public final int colorValue;
|
||||
/** Holds the index of the color used on map. */
|
||||
public final int colorIndex;
|
||||
|
||||
private MapColor(int index, int color)
|
||||
{
|
||||
if (index >= 0 && index <= 63)
|
||||
{
|
||||
this.colorIndex = index;
|
||||
this.colorValue = color;
|
||||
COLORS[index] = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IndexOutOfBoundsException("Map colour ID must be between 0 and 63 (inclusive)");
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMapColor(int index)
|
||||
{
|
||||
int i = 220;
|
||||
|
||||
if (index == 3)
|
||||
{
|
||||
i = 135;
|
||||
}
|
||||
|
||||
if (index == 2)
|
||||
{
|
||||
i = 255;
|
||||
}
|
||||
|
||||
if (index == 1)
|
||||
{
|
||||
i = 220;
|
||||
}
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
i = 180;
|
||||
}
|
||||
|
||||
int j = (this.colorValue >> 16 & 255) * i / 255;
|
||||
int k = (this.colorValue >> 8 & 255) * i / 255;
|
||||
int l = (this.colorValue & 255) * i / 255;
|
||||
return -16777216 | j << 16 | k << 8 | l;
|
||||
}
|
||||
|
||||
public static MapColor getBlockColor(EnumDyeColor dyeColorIn)
|
||||
{
|
||||
return BLOCK_COLORS[dyeColorIn.getMetadata()];
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
BLOCK_COLORS[EnumDyeColor.WHITE.getMetadata()] = SNOW;
|
||||
BLOCK_COLORS[EnumDyeColor.ORANGE.getMetadata()] = ADOBE;
|
||||
BLOCK_COLORS[EnumDyeColor.MAGENTA.getMetadata()] = MAGENTA;
|
||||
BLOCK_COLORS[EnumDyeColor.LIGHT_BLUE.getMetadata()] = LIGHT_BLUE;
|
||||
BLOCK_COLORS[EnumDyeColor.YELLOW.getMetadata()] = YELLOW;
|
||||
BLOCK_COLORS[EnumDyeColor.LIME.getMetadata()] = LIME;
|
||||
BLOCK_COLORS[EnumDyeColor.PINK.getMetadata()] = PINK;
|
||||
BLOCK_COLORS[EnumDyeColor.GRAY.getMetadata()] = GRAY;
|
||||
BLOCK_COLORS[EnumDyeColor.SILVER.getMetadata()] = SILVER;
|
||||
BLOCK_COLORS[EnumDyeColor.CYAN.getMetadata()] = CYAN;
|
||||
BLOCK_COLORS[EnumDyeColor.PURPLE.getMetadata()] = PURPLE;
|
||||
BLOCK_COLORS[EnumDyeColor.BLUE.getMetadata()] = BLUE;
|
||||
BLOCK_COLORS[EnumDyeColor.BROWN.getMetadata()] = BROWN;
|
||||
BLOCK_COLORS[EnumDyeColor.GREEN.getMetadata()] = GREEN;
|
||||
BLOCK_COLORS[EnumDyeColor.RED.getMetadata()] = RED;
|
||||
BLOCK_COLORS[EnumDyeColor.BLACK.getMetadata()] = BLACK;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
package net.minecraft.block.material;
|
||||
|
||||
public class Material
|
||||
{
|
||||
public static final Material AIR = new MaterialTransparent(MapColor.AIR);
|
||||
public static final Material GRASS = new Material(MapColor.GRASS);
|
||||
public static final Material GROUND = new Material(MapColor.DIRT);
|
||||
public static final Material WOOD = (new Material(MapColor.WOOD)).setBurning();
|
||||
public static final Material ROCK = (new Material(MapColor.STONE)).setRequiresTool();
|
||||
public static final Material IRON = (new Material(MapColor.IRON)).setRequiresTool();
|
||||
public static final Material ANVIL = (new Material(MapColor.IRON)).setRequiresTool().setImmovableMobility();
|
||||
public static final Material WATER = (new MaterialLiquid(MapColor.WATER)).setNoPushMobility();
|
||||
public static final Material LAVA = (new MaterialLiquid(MapColor.TNT)).setNoPushMobility();
|
||||
public static final Material LEAVES = (new Material(MapColor.FOLIAGE)).setBurning().setTranslucent().setNoPushMobility();
|
||||
public static final Material PLANTS = (new MaterialLogic(MapColor.FOLIAGE)).setNoPushMobility();
|
||||
public static final Material VINE = (new MaterialLogic(MapColor.FOLIAGE)).setBurning().setNoPushMobility().setReplaceable();
|
||||
public static final Material SPONGE = new Material(MapColor.YELLOW);
|
||||
public static final Material CLOTH = (new Material(MapColor.CLOTH)).setBurning();
|
||||
public static final Material FIRE = (new MaterialTransparent(MapColor.AIR)).setNoPushMobility();
|
||||
public static final Material SAND = new Material(MapColor.SAND);
|
||||
public static final Material CIRCUITS = (new MaterialLogic(MapColor.AIR)).setNoPushMobility();
|
||||
public static final Material CARPET = (new MaterialLogic(MapColor.CLOTH)).setBurning();
|
||||
public static final Material GLASS = (new Material(MapColor.AIR)).setTranslucent().setAdventureModeExempt();
|
||||
public static final Material REDSTONE_LIGHT = (new Material(MapColor.AIR)).setAdventureModeExempt();
|
||||
public static final Material TNT = (new Material(MapColor.TNT)).setBurning().setTranslucent();
|
||||
public static final Material CORAL = (new Material(MapColor.FOLIAGE)).setNoPushMobility();
|
||||
public static final Material ICE = (new Material(MapColor.ICE)).setTranslucent().setAdventureModeExempt();
|
||||
public static final Material PACKED_ICE = (new Material(MapColor.ICE)).setAdventureModeExempt();
|
||||
public static final Material SNOW = (new MaterialLogic(MapColor.SNOW)).setReplaceable().setTranslucent().setRequiresTool().setNoPushMobility();
|
||||
/** The material for crafted snow. */
|
||||
public static final Material CRAFTED_SNOW = (new Material(MapColor.SNOW)).setRequiresTool();
|
||||
public static final Material CACTUS = (new Material(MapColor.FOLIAGE)).setTranslucent().setNoPushMobility();
|
||||
public static final Material CLAY = new Material(MapColor.CLAY);
|
||||
public static final Material GOURD = (new Material(MapColor.FOLIAGE)).setNoPushMobility();
|
||||
public static final Material DRAGON_EGG = (new Material(MapColor.FOLIAGE)).setNoPushMobility();
|
||||
public static final Material PORTAL = (new MaterialPortal(MapColor.AIR)).setImmovableMobility();
|
||||
public static final Material CAKE = (new Material(MapColor.AIR)).setNoPushMobility();
|
||||
public static final Material WEB = (new Material(MapColor.CLOTH)
|
||||
{
|
||||
/**
|
||||
* Returns if this material is considered solid or not
|
||||
*/
|
||||
public boolean blocksMovement()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}).setRequiresTool().setNoPushMobility();
|
||||
/** Pistons' material. */
|
||||
public static final Material PISTON = (new Material(MapColor.STONE)).setImmovableMobility();
|
||||
public static final Material BARRIER = (new Material(MapColor.AIR)).setRequiresTool().setImmovableMobility();
|
||||
public static final Material STRUCTURE_VOID = new MaterialTransparent(MapColor.AIR);
|
||||
/** Bool defining if the block can burn or not. */
|
||||
private boolean canBurn;
|
||||
/**
|
||||
* Determines whether blocks with this material can be "overwritten" by other blocks when placed - eg snow, vines
|
||||
* and tall grass.
|
||||
*/
|
||||
private boolean replaceable;
|
||||
/** Indicates if the material is translucent */
|
||||
private boolean isTranslucent;
|
||||
/** The color index used to draw the blocks of this material on maps. */
|
||||
private final MapColor materialMapColor;
|
||||
/** Determines if the material can be harvested without a tool (or with the wrong tool) */
|
||||
private boolean requiresNoTool = true;
|
||||
/**
|
||||
* Mobility information flag. 0 indicates that this block is normal, 1 indicates that it can't push other blocks, 2
|
||||
* indicates that it can't be pushed.
|
||||
*/
|
||||
private EnumPushReaction mobilityFlag = EnumPushReaction.NORMAL;
|
||||
private boolean isAdventureModeExempt;
|
||||
|
||||
public Material(MapColor color)
|
||||
{
|
||||
this.materialMapColor = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if blocks of these materials are liquids.
|
||||
*/
|
||||
public boolean isLiquid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block is a considered solid. This is true by default.
|
||||
*/
|
||||
public boolean isSolid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true
|
||||
*/
|
||||
public boolean blocksLight()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this material is considered solid or not
|
||||
*/
|
||||
public boolean blocksMovement()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the material as translucent
|
||||
*/
|
||||
private Material setTranslucent()
|
||||
{
|
||||
this.isTranslucent = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes blocks with this material require the correct tool to be harvested.
|
||||
*/
|
||||
protected Material setRequiresTool()
|
||||
{
|
||||
this.requiresNoTool = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the canBurn bool to True and return the current object.
|
||||
*/
|
||||
protected Material setBurning()
|
||||
{
|
||||
this.canBurn = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the block can burn or not.
|
||||
*/
|
||||
public boolean getCanBurn()
|
||||
{
|
||||
return this.canBurn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets {@link #replaceable} to true.
|
||||
*/
|
||||
public Material setReplaceable()
|
||||
{
|
||||
this.replaceable = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the material can be replaced by other blocks when placed - eg snow, vines and tall grass.
|
||||
*/
|
||||
public boolean isReplaceable()
|
||||
{
|
||||
return this.replaceable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if the material is opaque
|
||||
*/
|
||||
public boolean isOpaque()
|
||||
{
|
||||
return this.isTranslucent ? false : this.blocksMovement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the material can be harvested without a tool (or with the wrong tool)
|
||||
*/
|
||||
public boolean isToolNotRequired()
|
||||
{
|
||||
return this.requiresNoTool;
|
||||
}
|
||||
|
||||
public EnumPushReaction getMobilityFlag()
|
||||
{
|
||||
return this.mobilityFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type of material can't be pushed, but pistons can move over it.
|
||||
*/
|
||||
protected Material setNoPushMobility()
|
||||
{
|
||||
this.mobilityFlag = EnumPushReaction.DESTROY;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type of material can't be pushed, and pistons are blocked to move.
|
||||
*/
|
||||
protected Material setImmovableMobility()
|
||||
{
|
||||
this.mobilityFlag = EnumPushReaction.BLOCK;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #isAdventureModeExempt()
|
||||
*/
|
||||
protected Material setAdventureModeExempt()
|
||||
{
|
||||
this.isAdventureModeExempt = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the color index of the block. This is is the same color used by vanilla maps to represent this block.
|
||||
*/
|
||||
public MapColor getMaterialMapColor()
|
||||
{
|
||||
return this.materialMapColor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package net.minecraft.block.material;
|
||||
|
||||
public class MaterialLiquid extends Material
|
||||
{
|
||||
public MaterialLiquid(MapColor color)
|
||||
{
|
||||
super(color);
|
||||
this.setReplaceable();
|
||||
this.setNoPushMobility();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if blocks of these materials are liquids.
|
||||
*/
|
||||
public boolean isLiquid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this material is considered solid or not
|
||||
*/
|
||||
public boolean blocksMovement()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block is a considered solid. This is true by default.
|
||||
*/
|
||||
public boolean isSolid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package net.minecraft.block.material;
|
||||
|
||||
public class MaterialLogic extends Material
|
||||
{
|
||||
public MaterialLogic(MapColor color)
|
||||
{
|
||||
super(color);
|
||||
this.setAdventureModeExempt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block is a considered solid. This is true by default.
|
||||
*/
|
||||
public boolean isSolid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true
|
||||
*/
|
||||
public boolean blocksLight()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this material is considered solid or not
|
||||
*/
|
||||
public boolean blocksMovement()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.minecraft.block.material;
|
||||
|
||||
public class MaterialPortal extends Material
|
||||
{
|
||||
public MaterialPortal(MapColor color)
|
||||
{
|
||||
super(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block is a considered solid. This is true by default.
|
||||
*/
|
||||
public boolean isSolid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true
|
||||
*/
|
||||
public boolean blocksLight()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this material is considered solid or not
|
||||
*/
|
||||
public boolean blocksMovement()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package net.minecraft.block.material;
|
||||
|
||||
public class MaterialTransparent extends Material
|
||||
{
|
||||
public MaterialTransparent(MapColor color)
|
||||
{
|
||||
super(color);
|
||||
this.setReplaceable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block is a considered solid. This is true by default.
|
||||
*/
|
||||
public boolean isSolid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true
|
||||
*/
|
||||
public boolean blocksLight()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this material is considered solid or not
|
||||
*/
|
||||
public boolean blocksMovement()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Auto generated package-info by MCP
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package net.minecraft.block.material;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
Reference in New Issue
Block a user