Minecraft beta source code
This commit is contained in:
parent
973e62294d
commit
bfaad56040
1540
src/net/minecraft/client/Minecraft.java
Normal file
1540
src/net/minecraft/client/Minecraft.java
Normal file
File diff suppressed because it is too large
Load Diff
104
src/net/minecraft/client/MinecraftApplet.java
Normal file
104
src/net/minecraft/client/MinecraftApplet.java
Normal file
|
@ -0,0 +1,104 @@
|
|||
package net.minecraft.client;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Canvas;
|
||||
import net.minecraft.src.CanvasMinecraftApplet;
|
||||
import net.minecraft.src.MinecraftAppletImpl;
|
||||
import net.minecraft.src.Session;
|
||||
|
||||
public class MinecraftApplet extends Applet {
|
||||
private Canvas mcCanvas;
|
||||
private Minecraft mc;
|
||||
private Thread mcThread = null;
|
||||
|
||||
public void init() {
|
||||
this.mcCanvas = new CanvasMinecraftApplet(this);
|
||||
boolean var1 = false;
|
||||
if(this.getParameter("fullscreen") != null) {
|
||||
var1 = this.getParameter("fullscreen").equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
this.mc = new MinecraftAppletImpl(this, this, this.mcCanvas, this, this.getWidth(), this.getHeight(), var1);
|
||||
this.mc.minecraftUri = this.getDocumentBase().getHost();
|
||||
if(this.getDocumentBase().getPort() > 0) {
|
||||
this.mc.minecraftUri = this.mc.minecraftUri + ":" + this.getDocumentBase().getPort();
|
||||
}
|
||||
|
||||
if(this.getParameter("username") != null && this.getParameter("sessionid") != null) {
|
||||
this.mc.session = new Session(this.getParameter("username"), this.getParameter("sessionid"));
|
||||
System.out.println("Setting user: " + this.mc.session.username + ", " + this.mc.session.sessionId);
|
||||
if(this.getParameter("mppass") != null) {
|
||||
this.mc.session.mpPassParameter = this.getParameter("mppass");
|
||||
}
|
||||
} else {
|
||||
this.mc.session = new Session("Player", "");
|
||||
}
|
||||
|
||||
if(this.getParameter("server") != null && this.getParameter("port") != null) {
|
||||
this.mc.setServer(this.getParameter("server"), Integer.parseInt(this.getParameter("port")));
|
||||
}
|
||||
|
||||
this.mc.hideQuitButton = true;
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(this.mcCanvas, "Center");
|
||||
this.mcCanvas.setFocusable(true);
|
||||
this.validate();
|
||||
}
|
||||
|
||||
public void startMainThread() {
|
||||
if(this.mcThread == null) {
|
||||
this.mcThread = new Thread(this.mc, "Minecraft main thread");
|
||||
this.mcThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if(this.mc != null) {
|
||||
this.mc.isGamePaused = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if(this.mc != null) {
|
||||
this.mc.isGamePaused = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
this.shutdown();
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
if(this.mcThread != null) {
|
||||
this.mc.shutdown();
|
||||
|
||||
try {
|
||||
this.mcThread.join(10000L);
|
||||
} catch (InterruptedException var4) {
|
||||
try {
|
||||
this.mc.shutdownMinecraftApplet();
|
||||
} catch (Exception var3) {
|
||||
var3.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
this.mcThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearApplet() {
|
||||
this.mcCanvas = null;
|
||||
this.mc = null;
|
||||
this.mcThread = null;
|
||||
|
||||
try {
|
||||
this.removeAll();
|
||||
this.validate();
|
||||
} catch (Exception var2) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
22
src/net/minecraft/isom/IsomPreviewApplet.java
Normal file
22
src/net/minecraft/isom/IsomPreviewApplet.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package net.minecraft.isom;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.awt.BorderLayout;
|
||||
import net.minecraft.src.CanvasIsomPreview;
|
||||
|
||||
public class IsomPreviewApplet extends Applet {
|
||||
private CanvasIsomPreview a = new CanvasIsomPreview();
|
||||
|
||||
public IsomPreviewApplet() {
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(this.a, "Center");
|
||||
}
|
||||
|
||||
public void start() {
|
||||
this.a.func_1272_b();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
this.a.exit();
|
||||
}
|
||||
}
|
85
src/net/minecraft/src/Achievement.java
Normal file
85
src/net/minecraft/src/Achievement.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class Achievement extends StatBase {
|
||||
public final int displayColumn;
|
||||
public final int displayRow;
|
||||
public final Achievement parentAchievement;
|
||||
private final String achievementDescription;
|
||||
private IStatStringFormat statStringFormatter;
|
||||
public final ItemStack theItemStack;
|
||||
private boolean isSpecial;
|
||||
|
||||
public Achievement(int var1, String var2, int var3, int var4, Item var5, Achievement var6) {
|
||||
this(var1, var2, var3, var4, new ItemStack(var5), var6);
|
||||
}
|
||||
|
||||
public Achievement(int var1, String var2, int var3, int var4, Block var5, Achievement var6) {
|
||||
this(var1, var2, var3, var4, new ItemStack(var5), var6);
|
||||
}
|
||||
|
||||
public Achievement(int var1, String var2, int var3, int var4, ItemStack var5, Achievement var6) {
|
||||
super(5242880 + var1, StatCollector.translateToLocal("achievement." + var2));
|
||||
this.theItemStack = var5;
|
||||
this.achievementDescription = StatCollector.translateToLocal("achievement." + var2 + ".desc");
|
||||
this.displayColumn = var3;
|
||||
this.displayRow = var4;
|
||||
if(var3 < AchievementList.minDisplayColumn) {
|
||||
AchievementList.minDisplayColumn = var3;
|
||||
}
|
||||
|
||||
if(var4 < AchievementList.minDisplayRow) {
|
||||
AchievementList.minDisplayRow = var4;
|
||||
}
|
||||
|
||||
if(var3 > AchievementList.maxDisplayColumn) {
|
||||
AchievementList.maxDisplayColumn = var3;
|
||||
}
|
||||
|
||||
if(var4 > AchievementList.maxDisplayRow) {
|
||||
AchievementList.maxDisplayRow = var4;
|
||||
}
|
||||
|
||||
this.parentAchievement = var6;
|
||||
}
|
||||
|
||||
public Achievement func_27089_a() {
|
||||
this.field_27088_g = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Achievement setSpecial() {
|
||||
this.isSpecial = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Achievement registerAchievement() {
|
||||
super.registerStat();
|
||||
AchievementList.achievementList.add(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean func_25067_a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.statStringFormatter != null ? this.statStringFormatter.formatString(this.achievementDescription) : this.achievementDescription;
|
||||
}
|
||||
|
||||
public Achievement setStatStringFormatter(IStatStringFormat var1) {
|
||||
this.statStringFormatter = var1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getSpecial() {
|
||||
return this.isSpecial;
|
||||
}
|
||||
|
||||
public StatBase registerStat() {
|
||||
return this.registerAchievement();
|
||||
}
|
||||
|
||||
public StatBase func_27082_h() {
|
||||
return this.func_27089_a();
|
||||
}
|
||||
}
|
35
src/net/minecraft/src/AchievementList.java
Normal file
35
src/net/minecraft/src/AchievementList.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AchievementList {
|
||||
public static int minDisplayColumn;
|
||||
public static int minDisplayRow;
|
||||
public static int maxDisplayColumn;
|
||||
public static int maxDisplayRow;
|
||||
public static List achievementList = new ArrayList();
|
||||
public static Achievement openInventory = (new Achievement(0, "openInventory", 0, 0, Item.book, (Achievement)null)).func_27089_a().registerAchievement();
|
||||
public static Achievement mineWood = (new Achievement(1, "mineWood", 2, 1, Block.wood, openInventory)).registerAchievement();
|
||||
public static Achievement buildWorkBench = (new Achievement(2, "buildWorkBench", 4, -1, Block.workbench, mineWood)).registerAchievement();
|
||||
public static Achievement buildPickaxe = (new Achievement(3, "buildPickaxe", 4, 2, Item.pickaxeWood, buildWorkBench)).registerAchievement();
|
||||
public static Achievement buildFurnace = (new Achievement(4, "buildFurnace", 3, 4, Block.stoneOvenActive, buildPickaxe)).registerAchievement();
|
||||
public static Achievement acquireIron = (new Achievement(5, "acquireIron", 1, 4, Item.ingotIron, buildFurnace)).registerAchievement();
|
||||
public static Achievement buildHoe = (new Achievement(6, "buildHoe", 2, -3, Item.hoeWood, buildWorkBench)).registerAchievement();
|
||||
public static Achievement makeBread = (new Achievement(7, "makeBread", -1, -3, Item.bread, buildHoe)).registerAchievement();
|
||||
public static Achievement bakeCake = (new Achievement(8, "bakeCake", 0, -5, Item.cake, buildHoe)).registerAchievement();
|
||||
public static Achievement buildBetterPickaxe = (new Achievement(9, "buildBetterPickaxe", 6, 2, Item.pickaxeStone, buildPickaxe)).registerAchievement();
|
||||
public static Achievement cookFish = (new Achievement(10, "cookFish", 2, 6, Item.fishCooked, buildFurnace)).registerAchievement();
|
||||
public static Achievement onARail = (new Achievement(11, "onARail", 2, 3, Block.rail, acquireIron)).setSpecial().registerAchievement();
|
||||
public static Achievement buildSword = (new Achievement(12, "buildSword", 6, -1, Item.swordWood, buildWorkBench)).registerAchievement();
|
||||
public static Achievement killEnemy = (new Achievement(13, "killEnemy", 8, -1, Item.bone, buildSword)).registerAchievement();
|
||||
public static Achievement killCow = (new Achievement(14, "killCow", 7, -3, Item.leather, buildSword)).registerAchievement();
|
||||
public static Achievement flyPig = (new Achievement(15, "flyPig", 8, -4, Item.saddle, killCow)).setSpecial().registerAchievement();
|
||||
|
||||
public static void func_27374_a() {
|
||||
}
|
||||
|
||||
static {
|
||||
System.out.println(achievementList.size() + " achievements");
|
||||
}
|
||||
}
|
36
src/net/minecraft/src/AchievementMap.java
Normal file
36
src/net/minecraft/src/AchievementMap.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AchievementMap {
|
||||
public static AchievementMap instance = new AchievementMap();
|
||||
private Map guidMap = new HashMap();
|
||||
|
||||
private AchievementMap() {
|
||||
try {
|
||||
BufferedReader var1 = new BufferedReader(new InputStreamReader(AchievementMap.class.getResourceAsStream("/achievement/map.txt")));
|
||||
|
||||
while(true) {
|
||||
String var2 = var1.readLine();
|
||||
if(var2 == null) {
|
||||
var1.close();
|
||||
break;
|
||||
}
|
||||
|
||||
String[] var3 = var2.split(",");
|
||||
int var4 = Integer.parseInt(var3[0]);
|
||||
this.guidMap.put(Integer.valueOf(var4), var3[1]);
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getGuid(int var0) {
|
||||
return (String)instance.guidMap.get(Integer.valueOf(var0));
|
||||
}
|
||||
}
|
336
src/net/minecraft/src/AxisAlignedBB.java
Normal file
336
src/net/minecraft/src/AxisAlignedBB.java
Normal file
|
@ -0,0 +1,336 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AxisAlignedBB {
|
||||
private static List boundingBoxes = new ArrayList();
|
||||
private static int numBoundingBoxesInUse = 0;
|
||||
public double minX;
|
||||
public double minY;
|
||||
public double minZ;
|
||||
public double maxX;
|
||||
public double maxY;
|
||||
public double maxZ;
|
||||
|
||||
public static AxisAlignedBB getBoundingBox(double var0, double var2, double var4, double var6, double var8, double var10) {
|
||||
return new AxisAlignedBB(var0, var2, var4, var6, var8, var10);
|
||||
}
|
||||
|
||||
public static void func_28196_a() {
|
||||
boundingBoxes.clear();
|
||||
numBoundingBoxesInUse = 0;
|
||||
}
|
||||
|
||||
public static void clearBoundingBoxPool() {
|
||||
numBoundingBoxesInUse = 0;
|
||||
}
|
||||
|
||||
public static AxisAlignedBB getBoundingBoxFromPool(double var0, double var2, double var4, double var6, double var8, double var10) {
|
||||
if(numBoundingBoxesInUse >= boundingBoxes.size()) {
|
||||
boundingBoxes.add(getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D));
|
||||
}
|
||||
|
||||
return ((AxisAlignedBB)boundingBoxes.get(numBoundingBoxesInUse++)).setBounds(var0, var2, var4, var6, var8, var10);
|
||||
}
|
||||
|
||||
private AxisAlignedBB(double var1, double var3, double var5, double var7, double var9, double var11) {
|
||||
this.minX = var1;
|
||||
this.minY = var3;
|
||||
this.minZ = var5;
|
||||
this.maxX = var7;
|
||||
this.maxY = var9;
|
||||
this.maxZ = var11;
|
||||
}
|
||||
|
||||
public AxisAlignedBB setBounds(double var1, double var3, double var5, double var7, double var9, double var11) {
|
||||
this.minX = var1;
|
||||
this.minY = var3;
|
||||
this.minZ = var5;
|
||||
this.maxX = var7;
|
||||
this.maxY = var9;
|
||||
this.maxZ = var11;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AxisAlignedBB addCoord(double var1, double var3, double var5) {
|
||||
double var7 = this.minX;
|
||||
double var9 = this.minY;
|
||||
double var11 = this.minZ;
|
||||
double var13 = this.maxX;
|
||||
double var15 = this.maxY;
|
||||
double var17 = this.maxZ;
|
||||
if(var1 < 0.0D) {
|
||||
var7 += var1;
|
||||
}
|
||||
|
||||
if(var1 > 0.0D) {
|
||||
var13 += var1;
|
||||
}
|
||||
|
||||
if(var3 < 0.0D) {
|
||||
var9 += var3;
|
||||
}
|
||||
|
||||
if(var3 > 0.0D) {
|
||||
var15 += var3;
|
||||
}
|
||||
|
||||
if(var5 < 0.0D) {
|
||||
var11 += var5;
|
||||
}
|
||||
|
||||
if(var5 > 0.0D) {
|
||||
var17 += var5;
|
||||
}
|
||||
|
||||
return getBoundingBoxFromPool(var7, var9, var11, var13, var15, var17);
|
||||
}
|
||||
|
||||
public AxisAlignedBB expand(double var1, double var3, double var5) {
|
||||
double var7 = this.minX - var1;
|
||||
double var9 = this.minY - var3;
|
||||
double var11 = this.minZ - var5;
|
||||
double var13 = this.maxX + var1;
|
||||
double var15 = this.maxY + var3;
|
||||
double var17 = this.maxZ + var5;
|
||||
return getBoundingBoxFromPool(var7, var9, var11, var13, var15, var17);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getOffsetBoundingBox(double var1, double var3, double var5) {
|
||||
return getBoundingBoxFromPool(this.minX + var1, this.minY + var3, this.minZ + var5, this.maxX + var1, this.maxY + var3, this.maxZ + var5);
|
||||
}
|
||||
|
||||
public double calculateXOffset(AxisAlignedBB var1, double var2) {
|
||||
if(var1.maxY > this.minY && var1.minY < this.maxY) {
|
||||
if(var1.maxZ > this.minZ && var1.minZ < this.maxZ) {
|
||||
double var4;
|
||||
if(var2 > 0.0D && var1.maxX <= this.minX) {
|
||||
var4 = this.minX - var1.maxX;
|
||||
if(var4 < var2) {
|
||||
var2 = var4;
|
||||
}
|
||||
}
|
||||
|
||||
if(var2 < 0.0D && var1.minX >= this.maxX) {
|
||||
var4 = this.maxX - var1.minX;
|
||||
if(var4 > var2) {
|
||||
var2 = var4;
|
||||
}
|
||||
}
|
||||
|
||||
return var2;
|
||||
} else {
|
||||
return var2;
|
||||
}
|
||||
} else {
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
public double calculateYOffset(AxisAlignedBB var1, double var2) {
|
||||
if(var1.maxX > this.minX && var1.minX < this.maxX) {
|
||||
if(var1.maxZ > this.minZ && var1.minZ < this.maxZ) {
|
||||
double var4;
|
||||
if(var2 > 0.0D && var1.maxY <= this.minY) {
|
||||
var4 = this.minY - var1.maxY;
|
||||
if(var4 < var2) {
|
||||
var2 = var4;
|
||||
}
|
||||
}
|
||||
|
||||
if(var2 < 0.0D && var1.minY >= this.maxY) {
|
||||
var4 = this.maxY - var1.minY;
|
||||
if(var4 > var2) {
|
||||
var2 = var4;
|
||||
}
|
||||
}
|
||||
|
||||
return var2;
|
||||
} else {
|
||||
return var2;
|
||||
}
|
||||
} else {
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
public double calculateZOffset(AxisAlignedBB var1, double var2) {
|
||||
if(var1.maxX > this.minX && var1.minX < this.maxX) {
|
||||
if(var1.maxY > this.minY && var1.minY < this.maxY) {
|
||||
double var4;
|
||||
if(var2 > 0.0D && var1.maxZ <= this.minZ) {
|
||||
var4 = this.minZ - var1.maxZ;
|
||||
if(var4 < var2) {
|
||||
var2 = var4;
|
||||
}
|
||||
}
|
||||
|
||||
if(var2 < 0.0D && var1.minZ >= this.maxZ) {
|
||||
var4 = this.maxZ - var1.minZ;
|
||||
if(var4 > var2) {
|
||||
var2 = var4;
|
||||
}
|
||||
}
|
||||
|
||||
return var2;
|
||||
} else {
|
||||
return var2;
|
||||
}
|
||||
} else {
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean intersectsWith(AxisAlignedBB var1) {
|
||||
return var1.maxX > this.minX && var1.minX < this.maxX ? (var1.maxY > this.minY && var1.minY < this.maxY ? var1.maxZ > this.minZ && var1.minZ < this.maxZ : false) : false;
|
||||
}
|
||||
|
||||
public AxisAlignedBB offset(double var1, double var3, double var5) {
|
||||
this.minX += var1;
|
||||
this.minY += var3;
|
||||
this.minZ += var5;
|
||||
this.maxX += var1;
|
||||
this.maxY += var3;
|
||||
this.maxZ += var5;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isVecInside(Vec3D var1) {
|
||||
return var1.xCoord > this.minX && var1.xCoord < this.maxX ? (var1.yCoord > this.minY && var1.yCoord < this.maxY ? var1.zCoord > this.minZ && var1.zCoord < this.maxZ : false) : false;
|
||||
}
|
||||
|
||||
public double getAverageEdgeLength() {
|
||||
double var1 = this.maxX - this.minX;
|
||||
double var3 = this.maxY - this.minY;
|
||||
double var5 = this.maxZ - this.minZ;
|
||||
return (var1 + var3 + var5) / 3.0D;
|
||||
}
|
||||
|
||||
public AxisAlignedBB func_28195_e(double var1, double var3, double var5) {
|
||||
double var7 = this.minX + var1;
|
||||
double var9 = this.minY + var3;
|
||||
double var11 = this.minZ + var5;
|
||||
double var13 = this.maxX - var1;
|
||||
double var15 = this.maxY - var3;
|
||||
double var17 = this.maxZ - var5;
|
||||
return getBoundingBoxFromPool(var7, var9, var11, var13, var15, var17);
|
||||
}
|
||||
|
||||
public AxisAlignedBB copy() {
|
||||
return getBoundingBoxFromPool(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ);
|
||||
}
|
||||
|
||||
public MovingObjectPosition func_1169_a(Vec3D var1, Vec3D var2) {
|
||||
Vec3D var3 = var1.getIntermediateWithXValue(var2, this.minX);
|
||||
Vec3D var4 = var1.getIntermediateWithXValue(var2, this.maxX);
|
||||
Vec3D var5 = var1.getIntermediateWithYValue(var2, this.minY);
|
||||
Vec3D var6 = var1.getIntermediateWithYValue(var2, this.maxY);
|
||||
Vec3D var7 = var1.getIntermediateWithZValue(var2, this.minZ);
|
||||
Vec3D var8 = var1.getIntermediateWithZValue(var2, this.maxZ);
|
||||
if(!this.isVecInYZ(var3)) {
|
||||
var3 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInYZ(var4)) {
|
||||
var4 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInXZ(var5)) {
|
||||
var5 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInXZ(var6)) {
|
||||
var6 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInXY(var7)) {
|
||||
var7 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInXY(var8)) {
|
||||
var8 = null;
|
||||
}
|
||||
|
||||
Vec3D var9 = null;
|
||||
if(var3 != null && (var9 == null || var1.squareDistanceTo(var3) < var1.squareDistanceTo(var9))) {
|
||||
var9 = var3;
|
||||
}
|
||||
|
||||
if(var4 != null && (var9 == null || var1.squareDistanceTo(var4) < var1.squareDistanceTo(var9))) {
|
||||
var9 = var4;
|
||||
}
|
||||
|
||||
if(var5 != null && (var9 == null || var1.squareDistanceTo(var5) < var1.squareDistanceTo(var9))) {
|
||||
var9 = var5;
|
||||
}
|
||||
|
||||
if(var6 != null && (var9 == null || var1.squareDistanceTo(var6) < var1.squareDistanceTo(var9))) {
|
||||
var9 = var6;
|
||||
}
|
||||
|
||||
if(var7 != null && (var9 == null || var1.squareDistanceTo(var7) < var1.squareDistanceTo(var9))) {
|
||||
var9 = var7;
|
||||
}
|
||||
|
||||
if(var8 != null && (var9 == null || var1.squareDistanceTo(var8) < var1.squareDistanceTo(var9))) {
|
||||
var9 = var8;
|
||||
}
|
||||
|
||||
if(var9 == null) {
|
||||
return null;
|
||||
} else {
|
||||
byte var10 = -1;
|
||||
if(var9 == var3) {
|
||||
var10 = 4;
|
||||
}
|
||||
|
||||
if(var9 == var4) {
|
||||
var10 = 5;
|
||||
}
|
||||
|
||||
if(var9 == var5) {
|
||||
var10 = 0;
|
||||
}
|
||||
|
||||
if(var9 == var6) {
|
||||
var10 = 1;
|
||||
}
|
||||
|
||||
if(var9 == var7) {
|
||||
var10 = 2;
|
||||
}
|
||||
|
||||
if(var9 == var8) {
|
||||
var10 = 3;
|
||||
}
|
||||
|
||||
return new MovingObjectPosition(0, 0, 0, var10, var9);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isVecInYZ(Vec3D var1) {
|
||||
return var1 == null ? false : var1.yCoord >= this.minY && var1.yCoord <= this.maxY && var1.zCoord >= this.minZ && var1.zCoord <= this.maxZ;
|
||||
}
|
||||
|
||||
private boolean isVecInXZ(Vec3D var1) {
|
||||
return var1 == null ? false : var1.xCoord >= this.minX && var1.xCoord <= this.maxX && var1.zCoord >= this.minZ && var1.zCoord <= this.maxZ;
|
||||
}
|
||||
|
||||
private boolean isVecInXY(Vec3D var1) {
|
||||
return var1 == null ? false : var1.xCoord >= this.minX && var1.xCoord <= this.maxX && var1.yCoord >= this.minY && var1.yCoord <= this.maxY;
|
||||
}
|
||||
|
||||
public void setBB(AxisAlignedBB var1) {
|
||||
this.minX = var1.minX;
|
||||
this.minY = var1.minY;
|
||||
this.minZ = var1.minZ;
|
||||
this.maxX = var1.maxX;
|
||||
this.maxY = var1.maxY;
|
||||
this.maxZ = var1.maxZ;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "box[" + this.minX + ", " + this.minY + ", " + this.minZ + " -> " + this.maxX + ", " + this.maxY + ", " + this.maxZ + "]";
|
||||
}
|
||||
}
|
126
src/net/minecraft/src/BiomeGenBase.java
Normal file
126
src/net/minecraft/src/BiomeGenBase.java
Normal file
|
@ -0,0 +1,126 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BiomeGenBase {
|
||||
public static final BiomeGenBase rainforest = (new BiomeGenRainforest()).setColor(588342).setBiomeName("Rainforest").func_4124_a(2094168);
|
||||
public static final BiomeGenBase swampland = (new BiomeGenSwamp()).setColor(522674).setBiomeName("Swampland").func_4124_a(9154376);
|
||||
public static final BiomeGenBase seasonalForest = (new BiomeGenBase()).setColor(10215459).setBiomeName("Seasonal Forest");
|
||||
public static final BiomeGenBase forest = (new BiomeGenForest()).setColor(353825).setBiomeName("Forest").func_4124_a(5159473);
|
||||
public static final BiomeGenBase savanna = (new BiomeGenDesert()).setColor(14278691).setBiomeName("Savanna");
|
||||
public static final BiomeGenBase shrubland = (new BiomeGenBase()).setColor(10595616).setBiomeName("Shrubland");
|
||||
public static final BiomeGenBase taiga = (new BiomeGenTaiga()).setColor(3060051).setBiomeName("Taiga").setEnableSnow().func_4124_a(8107825);
|
||||
public static final BiomeGenBase desert = (new BiomeGenDesert()).setColor(16421912).setBiomeName("Desert").setDisableRain();
|
||||
public static final BiomeGenBase plains = (new BiomeGenDesert()).setColor(16767248).setBiomeName("Plains");
|
||||
public static final BiomeGenBase iceDesert = (new BiomeGenDesert()).setColor(16772499).setBiomeName("Ice Desert").setEnableSnow().setDisableRain().func_4124_a(12899129);
|
||||
public static final BiomeGenBase tundra = (new BiomeGenBase()).setColor(5762041).setBiomeName("Tundra").setEnableSnow().func_4124_a(12899129);
|
||||
public static final BiomeGenBase hell = (new BiomeGenHell()).setColor(16711680).setBiomeName("Hell").setDisableRain();
|
||||
public static final BiomeGenBase sky = (new BiomeGenSky()).setColor(8421631).setBiomeName("Sky").setDisableRain();
|
||||
public String biomeName;
|
||||
public int color;
|
||||
public byte topBlock = (byte)Block.grass.blockID;
|
||||
public byte fillerBlock = (byte)Block.dirt.blockID;
|
||||
public int field_6502_q = 5169201;
|
||||
protected List spawnableMonsterList = new ArrayList();
|
||||
protected List spawnableCreatureList = new ArrayList();
|
||||
protected List spawnableWaterCreatureList = new ArrayList();
|
||||
private boolean enableSnow;
|
||||
private boolean enableRain = true;
|
||||
private static BiomeGenBase[] biomeLookupTable = new BiomeGenBase[4096];
|
||||
|
||||
protected BiomeGenBase() {
|
||||
this.spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 10));
|
||||
this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 10));
|
||||
this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 10));
|
||||
this.spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 10));
|
||||
this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10));
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntitySheep.class, 12));
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 10));
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10));
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 8));
|
||||
this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 10));
|
||||
}
|
||||
|
||||
private BiomeGenBase setDisableRain() {
|
||||
this.enableRain = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static void generateBiomeLookup() {
|
||||
for(int var0 = 0; var0 < 64; ++var0) {
|
||||
for(int var1 = 0; var1 < 64; ++var1) {
|
||||
biomeLookupTable[var0 + var1 * 64] = getBiome((float)var0 / 63.0F, (float)var1 / 63.0F);
|
||||
}
|
||||
}
|
||||
|
||||
desert.topBlock = desert.fillerBlock = (byte)Block.sand.blockID;
|
||||
iceDesert.topBlock = iceDesert.fillerBlock = (byte)Block.sand.blockID;
|
||||
}
|
||||
|
||||
public WorldGenerator getRandomWorldGenForTrees(Random var1) {
|
||||
return (WorldGenerator)(var1.nextInt(10) == 0 ? new WorldGenBigTree() : new WorldGenTrees());
|
||||
}
|
||||
|
||||
protected BiomeGenBase setEnableSnow() {
|
||||
this.enableSnow = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected BiomeGenBase setBiomeName(String var1) {
|
||||
this.biomeName = var1;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected BiomeGenBase func_4124_a(int var1) {
|
||||
this.field_6502_q = var1;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected BiomeGenBase setColor(int var1) {
|
||||
this.color = var1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static BiomeGenBase getBiomeFromLookup(double var0, double var2) {
|
||||
int var4 = (int)(var0 * 63.0D);
|
||||
int var5 = (int)(var2 * 63.0D);
|
||||
return biomeLookupTable[var4 + var5 * 64];
|
||||
}
|
||||
|
||||
public static BiomeGenBase getBiome(float var0, float var1) {
|
||||
var1 *= var0;
|
||||
return var0 < 0.1F ? tundra : (var1 < 0.2F ? (var0 < 0.5F ? tundra : (var0 < 0.95F ? savanna : desert)) : (var1 > 0.5F && var0 < 0.7F ? swampland : (var0 < 0.5F ? taiga : (var0 < 0.97F ? (var1 < 0.35F ? shrubland : forest) : (var1 < 0.45F ? plains : (var1 < 0.9F ? seasonalForest : rainforest))))));
|
||||
}
|
||||
|
||||
public int getSkyColorByTemp(float var1) {
|
||||
var1 /= 3.0F;
|
||||
if(var1 < -1.0F) {
|
||||
var1 = -1.0F;
|
||||
}
|
||||
|
||||
if(var1 > 1.0F) {
|
||||
var1 = 1.0F;
|
||||
}
|
||||
|
||||
return Color.getHSBColor(224.0F / 360.0F - var1 * 0.05F, 0.5F + var1 * 0.1F, 1.0F).getRGB();
|
||||
}
|
||||
|
||||
public List getSpawnableList(EnumCreatureType var1) {
|
||||
return var1 == EnumCreatureType.monster ? this.spawnableMonsterList : (var1 == EnumCreatureType.creature ? this.spawnableCreatureList : (var1 == EnumCreatureType.waterCreature ? this.spawnableWaterCreatureList : null));
|
||||
}
|
||||
|
||||
public boolean getEnableSnow() {
|
||||
return this.enableSnow;
|
||||
}
|
||||
|
||||
public boolean canSpawnLightningBolt() {
|
||||
return this.enableSnow ? false : this.enableRain;
|
||||
}
|
||||
|
||||
static {
|
||||
generateBiomeLookup();
|
||||
}
|
||||
}
|
4
src/net/minecraft/src/BiomeGenDesert.java
Normal file
4
src/net/minecraft/src/BiomeGenDesert.java
Normal file
|
@ -0,0 +1,4 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BiomeGenDesert extends BiomeGenBase {
|
||||
}
|
13
src/net/minecraft/src/BiomeGenForest.java
Normal file
13
src/net/minecraft/src/BiomeGenForest.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BiomeGenForest extends BiomeGenBase {
|
||||
public BiomeGenForest() {
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 2));
|
||||
}
|
||||
|
||||
public WorldGenerator getRandomWorldGenForTrees(Random var1) {
|
||||
return (WorldGenerator)(var1.nextInt(5) == 0 ? new WorldGenForest() : (var1.nextInt(3) == 0 ? new WorldGenBigTree() : new WorldGenTrees()));
|
||||
}
|
||||
}
|
11
src/net/minecraft/src/BiomeGenHell.java
Normal file
11
src/net/minecraft/src/BiomeGenHell.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BiomeGenHell extends BiomeGenBase {
|
||||
public BiomeGenHell() {
|
||||
this.spawnableMonsterList.clear();
|
||||
this.spawnableCreatureList.clear();
|
||||
this.spawnableWaterCreatureList.clear();
|
||||
this.spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 10));
|
||||
this.spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 10));
|
||||
}
|
||||
}
|
9
src/net/minecraft/src/BiomeGenRainforest.java
Normal file
9
src/net/minecraft/src/BiomeGenRainforest.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BiomeGenRainforest extends BiomeGenBase {
|
||||
public WorldGenerator getRandomWorldGenForTrees(Random var1) {
|
||||
return (WorldGenerator)(var1.nextInt(3) == 0 ? new WorldGenBigTree() : new WorldGenTrees());
|
||||
}
|
||||
}
|
14
src/net/minecraft/src/BiomeGenSky.java
Normal file
14
src/net/minecraft/src/BiomeGenSky.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BiomeGenSky extends BiomeGenBase {
|
||||
public BiomeGenSky() {
|
||||
this.spawnableMonsterList.clear();
|
||||
this.spawnableCreatureList.clear();
|
||||
this.spawnableWaterCreatureList.clear();
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10));
|
||||
}
|
||||
|
||||
public int getSkyColorByTemp(float var1) {
|
||||
return 12632319;
|
||||
}
|
||||
}
|
4
src/net/minecraft/src/BiomeGenSwamp.java
Normal file
4
src/net/minecraft/src/BiomeGenSwamp.java
Normal file
|
@ -0,0 +1,4 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BiomeGenSwamp extends BiomeGenBase {
|
||||
}
|
13
src/net/minecraft/src/BiomeGenTaiga.java
Normal file
13
src/net/minecraft/src/BiomeGenTaiga.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BiomeGenTaiga extends BiomeGenBase {
|
||||
public BiomeGenTaiga() {
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 2));
|
||||
}
|
||||
|
||||
public WorldGenerator getRandomWorldGenForTrees(Random var1) {
|
||||
return (WorldGenerator)(var1.nextInt(3) == 0 ? new WorldGenTaiga1() : new WorldGenTaiga2());
|
||||
}
|
||||
}
|
581
src/net/minecraft/src/Block.java
Normal file
581
src/net/minecraft/src/Block.java
Normal file
|
@ -0,0 +1,581 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class Block {
|
||||
public static final StepSound soundPowderFootstep = new StepSound("stone", 1.0F, 1.0F);
|
||||
public static final StepSound soundWoodFootstep = new StepSound("wood", 1.0F, 1.0F);
|
||||
public static final StepSound soundGravelFootstep = new StepSound("gravel", 1.0F, 1.0F);
|
||||
public static final StepSound soundGrassFootstep = new StepSound("grass", 1.0F, 1.0F);
|
||||
public static final StepSound soundStoneFootstep = new StepSound("stone", 1.0F, 1.0F);
|
||||
public static final StepSound soundMetalFootstep = new StepSound("stone", 1.0F, 1.5F);
|
||||
public static final StepSound soundGlassFootstep = new StepSoundStone("stone", 1.0F, 1.0F);
|
||||
public static final StepSound soundClothFootstep = new StepSound("cloth", 1.0F, 1.0F);
|
||||
public static final StepSound soundSandFootstep = new StepSoundSand("sand", 1.0F, 1.0F);
|
||||
public static final Block[] blocksList = new Block[256];
|
||||
public static final boolean[] tickOnLoad = new boolean[256];
|
||||
public static final boolean[] opaqueCubeLookup = new boolean[256];
|
||||
public static final boolean[] isBlockContainer = new boolean[256];
|
||||
public static final int[] lightOpacity = new int[256];
|
||||
public static final boolean[] canBlockGrass = new boolean[256];
|
||||
public static final int[] lightValue = new int[256];
|
||||
public static final boolean[] field_28032_t = new boolean[256];
|
||||
public static final Block stone = (new BlockStone(1, 1)).setHardness(1.5F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stone");
|
||||
public static final BlockGrass grass = (BlockGrass)(new BlockGrass(2)).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("grass");
|
||||
public static final Block dirt = (new BlockDirt(3, 2)).setHardness(0.5F).setStepSound(soundGravelFootstep).setBlockName("dirt");
|
||||
public static final Block cobblestone = (new Block(4, 16, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stonebrick");
|
||||
public static final Block planks = (new Block(5, 4, Material.wood)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setBlockName("wood").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block sapling = (new BlockSapling(6, 15)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("sapling").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block bedrock = (new Block(7, 17, Material.rock)).setBlockUnbreakable().setResistance(6000000.0F).setStepSound(soundStoneFootstep).setBlockName("bedrock").disableStats();
|
||||
public static final Block waterMoving = (new BlockFlowing(8, Material.water)).setHardness(100.0F).setLightOpacity(3).setBlockName("water").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block waterStill = (new BlockStationary(9, Material.water)).setHardness(100.0F).setLightOpacity(3).setBlockName("water").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block lavaMoving = (new BlockFlowing(10, Material.lava)).setHardness(0.0F).setLightValue(1.0F).setLightOpacity(255).setBlockName("lava").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block lavaStill = (new BlockStationary(11, Material.lava)).setHardness(100.0F).setLightValue(1.0F).setLightOpacity(255).setBlockName("lava").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block sand = (new BlockSand(12, 18)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("sand");
|
||||
public static final Block gravel = (new BlockGravel(13, 19)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("gravel");
|
||||
public static final Block oreGold = (new BlockOre(14, 32)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreGold");
|
||||
public static final Block oreIron = (new BlockOre(15, 33)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreIron");
|
||||
public static final Block oreCoal = (new BlockOre(16, 34)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreCoal");
|
||||
public static final Block wood = (new BlockLog(17)).setHardness(2.0F).setStepSound(soundWoodFootstep).setBlockName("log").disableNeighborNotifyOnMetadataChange();
|
||||
public static final BlockLeaves leaves = (BlockLeaves)(new BlockLeaves(18, 52)).setHardness(0.2F).setLightOpacity(1).setStepSound(soundGrassFootstep).setBlockName("leaves").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block sponge = (new BlockSponge(19)).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("sponge");
|
||||
public static final Block glass = (new BlockGlass(20, 49, Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setBlockName("glass");
|
||||
public static final Block oreLapis = (new BlockOre(21, 160)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreLapis");
|
||||
public static final Block blockLapis = (new Block(22, 144, Material.rock)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("blockLapis");
|
||||
public static final Block dispenser = (new BlockDispenser(23)).setHardness(3.5F).setStepSound(soundStoneFootstep).setBlockName("dispenser").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block sandStone = (new BlockSandStone(24)).setStepSound(soundStoneFootstep).setHardness(0.8F).setBlockName("sandStone");
|
||||
public static final Block musicBlock = (new BlockNote(25)).setHardness(0.8F).setBlockName("musicBlock").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block blockBed = (new BlockBed(26)).setHardness(0.2F).setBlockName("bed").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block railPowered = (new BlockRail(27, 179, true)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("goldenRail").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block railDetector = (new BlockDetectorRail(28, 195)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("detectorRail").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block pistonStickyBase = (new BlockPistonBase(29, 106, true)).setBlockName("pistonStickyBase").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block web = (new BlockWeb(30, 11)).setLightOpacity(1).setHardness(4.0F).setBlockName("web");
|
||||
public static final BlockTallGrass tallGrass = (BlockTallGrass)(new BlockTallGrass(31, 39)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("tallgrass");
|
||||
public static final BlockDeadBush deadBush = (BlockDeadBush)(new BlockDeadBush(32, 55)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("deadbush");
|
||||
public static final Block pistonBase = (new BlockPistonBase(33, 107, false)).setBlockName("pistonBase").disableNeighborNotifyOnMetadataChange();
|
||||
public static final BlockPistonExtension pistonExtension = (BlockPistonExtension)(new BlockPistonExtension(34, 107)).disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block cloth = (new BlockCloth()).setHardness(0.8F).setStepSound(soundClothFootstep).setBlockName("cloth").disableNeighborNotifyOnMetadataChange();
|
||||
public static final BlockPistonMoving pistonMoving = new BlockPistonMoving(36);
|
||||
public static final BlockFlower plantYellow = (BlockFlower)(new BlockFlower(37, 13)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("flower");
|
||||
public static final BlockFlower plantRed = (BlockFlower)(new BlockFlower(38, 12)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("rose");
|
||||
public static final BlockFlower mushroomBrown = (BlockFlower)(new BlockMushroom(39, 29)).setHardness(0.0F).setStepSound(soundGrassFootstep).setLightValue(2.0F / 16.0F).setBlockName("mushroom");
|
||||
public static final BlockFlower mushroomRed = (BlockFlower)(new BlockMushroom(40, 28)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("mushroom");
|
||||
public static final Block blockGold = (new BlockOreStorage(41, 23)).setHardness(3.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setBlockName("blockGold");
|
||||
public static final Block blockSteel = (new BlockOreStorage(42, 22)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setBlockName("blockIron");
|
||||
public static final Block stairDouble = (new BlockStep(43, true)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stoneSlab");
|
||||
public static final Block stairSingle = (new BlockStep(44, false)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stoneSlab");
|
||||
public static final Block brick = (new Block(45, 7, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("brick");
|
||||
public static final Block tnt = (new BlockTNT(46, 8)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("tnt");
|
||||
public static final Block bookShelf = (new BlockBookshelf(47, 35)).setHardness(1.5F).setStepSound(soundWoodFootstep).setBlockName("bookshelf");
|
||||
public static final Block cobblestoneMossy = (new Block(48, 36, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("stoneMoss");
|
||||
public static final Block obsidian = (new BlockObsidian(49, 37)).setHardness(10.0F).setResistance(2000.0F).setStepSound(soundStoneFootstep).setBlockName("obsidian");
|
||||
public static final Block torchWood = (new BlockTorch(50, 80)).setHardness(0.0F).setLightValue(15.0F / 16.0F).setStepSound(soundWoodFootstep).setBlockName("torch").disableNeighborNotifyOnMetadataChange();
|
||||
public static final BlockFire fire = (BlockFire)(new BlockFire(51, 31)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).setBlockName("fire").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block mobSpawner = (new BlockMobSpawner(52, 65)).setHardness(5.0F).setStepSound(soundMetalFootstep).setBlockName("mobSpawner").disableStats();
|
||||
public static final Block stairCompactPlanks = (new BlockStairs(53, planks)).setBlockName("stairsWood").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block chest = (new BlockChest(54)).setHardness(2.5F).setStepSound(soundWoodFootstep).setBlockName("chest").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block redstoneWire = (new BlockRedstoneWire(55, 164)).setHardness(0.0F).setStepSound(soundPowderFootstep).setBlockName("redstoneDust").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block oreDiamond = (new BlockOre(56, 50)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreDiamond");
|
||||
public static final Block blockDiamond = (new BlockOreStorage(57, 24)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setBlockName("blockDiamond");
|
||||
public static final Block workbench = (new BlockWorkbench(58)).setHardness(2.5F).setStepSound(soundWoodFootstep).setBlockName("workbench");
|
||||
public static final Block crops = (new BlockCrops(59, 88)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("crops").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block tilledField = (new BlockFarmland(60)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("farmland");
|
||||
public static final Block stoneOvenIdle = (new BlockFurnace(61, false)).setHardness(3.5F).setStepSound(soundStoneFootstep).setBlockName("furnace").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block stoneOvenActive = (new BlockFurnace(62, true)).setHardness(3.5F).setStepSound(soundStoneFootstep).setLightValue(14.0F / 16.0F).setBlockName("furnace").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block signPost = (new BlockSign(63, TileEntitySign.class, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("sign").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block doorWood = (new BlockDoor(64, Material.wood)).setHardness(3.0F).setStepSound(soundWoodFootstep).setBlockName("doorWood").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block ladder = (new BlockLadder(65, 83)).setHardness(0.4F).setStepSound(soundWoodFootstep).setBlockName("ladder").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block rail = (new BlockRail(66, 128, false)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("rail").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block stairCompactCobblestone = (new BlockStairs(67, cobblestone)).setBlockName("stairsStone").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block signWall = (new BlockSign(68, TileEntitySign.class, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("sign").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block lever = (new BlockLever(69, 96)).setHardness(0.5F).setStepSound(soundWoodFootstep).setBlockName("lever").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block pressurePlateStone = (new BlockPressurePlate(70, stone.blockIndexInTexture, EnumMobType.mobs, Material.rock)).setHardness(0.5F).setStepSound(soundStoneFootstep).setBlockName("pressurePlate").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block doorSteel = (new BlockDoor(71, Material.iron)).setHardness(5.0F).setStepSound(soundMetalFootstep).setBlockName("doorIron").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block pressurePlatePlanks = (new BlockPressurePlate(72, planks.blockIndexInTexture, EnumMobType.everything, Material.wood)).setHardness(0.5F).setStepSound(soundWoodFootstep).setBlockName("pressurePlate").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block oreRedstone = (new BlockRedstoneOre(73, 51, false)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreRedstone").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block oreRedstoneGlowing = (new BlockRedstoneOre(74, 51, true)).setLightValue(10.0F / 16.0F).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setBlockName("oreRedstone").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block torchRedstoneIdle = (new BlockRedstoneTorch(75, 115, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setBlockName("notGate").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block torchRedstoneActive = (new BlockRedstoneTorch(76, 99, true)).setHardness(0.0F).setLightValue(0.5F).setStepSound(soundWoodFootstep).setBlockName("notGate").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block button = (new BlockButton(77, stone.blockIndexInTexture)).setHardness(0.5F).setStepSound(soundStoneFootstep).setBlockName("button").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block snow = (new BlockSnow(78, 66)).setHardness(0.1F).setStepSound(soundClothFootstep).setBlockName("snow");
|
||||
public static final Block ice = (new BlockIce(79, 67)).setHardness(0.5F).setLightOpacity(3).setStepSound(soundGlassFootstep).setBlockName("ice");
|
||||
public static final Block blockSnow = (new BlockSnowBlock(80, 66)).setHardness(0.2F).setStepSound(soundClothFootstep).setBlockName("snow");
|
||||
public static final Block cactus = (new BlockCactus(81, 70)).setHardness(0.4F).setStepSound(soundClothFootstep).setBlockName("cactus");
|
||||
public static final Block blockClay = (new BlockClay(82, 72)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("clay");
|
||||
public static final Block reed = (new BlockReed(83, 73)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("reeds").disableStats();
|
||||
public static final Block jukebox = (new BlockJukeBox(84, 74)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setBlockName("jukebox").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block fence = (new BlockFence(85, 4)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setBlockName("fence").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block pumpkin = (new BlockPumpkin(86, 102, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("pumpkin").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block netherrack = (new BlockNetherrack(87, 103)).setHardness(0.4F).setStepSound(soundStoneFootstep).setBlockName("hellrock");
|
||||
public static final Block slowSand = (new BlockSoulSand(88, 104)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("hellsand");
|
||||
public static final Block glowStone = (new BlockGlowStone(89, 105, Material.rock)).setHardness(0.3F).setStepSound(soundGlassFootstep).setLightValue(1.0F).setBlockName("lightgem");
|
||||
public static final BlockPortal portal = (BlockPortal)(new BlockPortal(90, 14)).setHardness(-1.0F).setStepSound(soundGlassFootstep).setLightValue(12.0F / 16.0F).setBlockName("portal");
|
||||
public static final Block pumpkinLantern = (new BlockPumpkin(91, 102, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setLightValue(1.0F).setBlockName("litpumpkin").disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block cake = (new BlockCake(92, 121)).setHardness(0.5F).setStepSound(soundClothFootstep).setBlockName("cake").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block redstoneRepeaterIdle = (new BlockRedstoneRepeater(93, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setBlockName("diode").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block redstoneRepeaterActive = (new BlockRedstoneRepeater(94, true)).setHardness(0.0F).setLightValue(10.0F / 16.0F).setStepSound(soundWoodFootstep).setBlockName("diode").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block lockedChest = (new BlockLockedChest(95)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).setBlockName("lockedchest").setTickOnLoad(true).disableNeighborNotifyOnMetadataChange();
|
||||
public static final Block trapdoor = (new BlockTrapDoor(96, Material.wood)).setHardness(3.0F).setStepSound(soundWoodFootstep).setBlockName("trapdoor").disableStats().disableNeighborNotifyOnMetadataChange();
|
||||
public int blockIndexInTexture;
|
||||
public final int blockID;
|
||||
protected float blockHardness;
|
||||
protected float blockResistance;
|
||||
protected boolean blockConstructorCalled;
|
||||
protected boolean enableStats;
|
||||
public double minX;
|
||||
public double minY;
|
||||
public double minZ;
|
||||
public double maxX;
|
||||
public double maxY;
|
||||
public double maxZ;
|
||||
public StepSound stepSound;
|
||||
public float blockParticleGravity;
|
||||
public final Material blockMaterial;
|
||||
public float slipperiness;
|
||||
private String blockName;
|
||||
|
||||
protected Block(int var1, Material var2) {
|
||||
this.blockConstructorCalled = true;
|
||||
this.enableStats = true;
|
||||
this.stepSound = soundPowderFootstep;
|
||||
this.blockParticleGravity = 1.0F;
|
||||
this.slipperiness = 0.6F;
|
||||
if(blocksList[var1] != null) {
|
||||
throw new IllegalArgumentException("Slot " + var1 + " is already occupied by " + blocksList[var1] + " when adding " + this);
|
||||
} else {
|
||||
this.blockMaterial = var2;
|
||||
blocksList[var1] = this;
|
||||
this.blockID = var1;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
opaqueCubeLookup[var1] = this.isOpaqueCube();
|
||||
lightOpacity[var1] = this.isOpaqueCube() ? 255 : 0;
|
||||
canBlockGrass[var1] = !var2.getCanBlockGrass();
|
||||
isBlockContainer[var1] = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected Block disableNeighborNotifyOnMetadataChange() {
|
||||
field_28032_t[this.blockID] = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void initializeBlock() {
|
||||
}
|
||||
|
||||
protected Block(int var1, int var2, Material var3) {
|
||||
this(var1, var3);
|
||||
this.blockIndexInTexture = var2;
|
||||
}
|
||||
|
||||
protected Block setStepSound(StepSound var1) {
|
||||
this.stepSound = var1;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block setLightOpacity(int var1) {
|
||||
lightOpacity[this.blockID] = var1;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block setLightValue(float var1) {
|
||||
lightValue[this.blockID] = (int)(15.0F * var1);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block setResistance(float var1) {
|
||||
this.blockResistance = var1 * 3.0F;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected Block setHardness(float var1) {
|
||||
this.blockHardness = var1;
|
||||
if(this.blockResistance < var1 * 5.0F) {
|
||||
this.blockResistance = var1 * 5.0F;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block setBlockUnbreakable() {
|
||||
this.setHardness(-1.0F);
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getHardness() {
|
||||
return this.blockHardness;
|
||||
}
|
||||
|
||||
protected Block setTickOnLoad(boolean var1) {
|
||||
tickOnLoad[this.blockID] = var1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setBlockBounds(float var1, float var2, float var3, float var4, float var5, float var6) {
|
||||
this.minX = (double)var1;
|
||||
this.minY = (double)var2;
|
||||
this.minZ = (double)var3;
|
||||
this.maxX = (double)var4;
|
||||
this.maxY = (double)var5;
|
||||
this.maxZ = (double)var6;
|
||||
}
|
||||
|
||||
public float getBlockBrightness(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
return var1.getBrightness(var2, var3, var4, lightValue[this.blockID]);
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return var5 == 0 && this.minY > 0.0D ? true : (var5 == 1 && this.maxY < 1.0D ? true : (var5 == 2 && this.minZ > 0.0D ? true : (var5 == 3 && this.maxZ < 1.0D ? true : (var5 == 4 && this.minX > 0.0D ? true : (var5 == 5 && this.maxX < 1.0D ? true : !var1.isBlockOpaqueCube(var2, var3, var4))))));
|
||||
}
|
||||
|
||||
public boolean getIsBlockSolid(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return var1.getBlockMaterial(var2, var3, var4).isSolid();
|
||||
}
|
||||
|
||||
public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return this.getBlockTextureFromSideAndMetadata(var5, var1.getBlockMetadata(var2, var3, var4));
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return this.getBlockTextureFromSide(var1);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)var3 + this.maxY, (double)var4 + this.maxZ);
|
||||
}
|
||||
|
||||
public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) {
|
||||
AxisAlignedBB var7 = this.getCollisionBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
if(var7 != null && var5.intersectsWith(var7)) {
|
||||
var6.add(var7);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)var3 + this.maxY, (double)var4 + this.maxZ);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(int var1, boolean var2) {
|
||||
return this.isCollidable();
|
||||
}
|
||||
|
||||
public boolean isCollidable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) {
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
public float blockStrength(EntityPlayer var1) {
|
||||
return this.blockHardness < 0.0F ? 0.0F : (!var1.canHarvestBlock(this) ? 1.0F / this.blockHardness / 100.0F : var1.getCurrentPlayerStrVsBlock(this) / this.blockHardness / 30.0F);
|
||||
}
|
||||
|
||||
public final void dropBlockAsItem(World var1, int var2, int var3, int var4, int var5) {
|
||||
this.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, 1.0F);
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var7 = this.quantityDropped(var1.rand);
|
||||
|
||||
for(int var8 = 0; var8 < var7; ++var8) {
|
||||
if(var1.rand.nextFloat() <= var6) {
|
||||
int var9 = this.idDropped(var5, var1.rand);
|
||||
if(var9 > 0) {
|
||||
this.dropBlockAsItem_do(var1, var2, var3, var4, new ItemStack(var9, 1, this.damageDropped(var5)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void dropBlockAsItem_do(World var1, int var2, int var3, int var4, ItemStack var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
float var6 = 0.7F;
|
||||
double var7 = (double)(var1.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D;
|
||||
double var9 = (double)(var1.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D;
|
||||
double var11 = (double)(var1.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D;
|
||||
EntityItem var13 = new EntityItem(var1, (double)var2 + var7, (double)var3 + var9, (double)var4 + var11, var5);
|
||||
var13.delayBeforeCanPickup = 10;
|
||||
var1.entityJoinedWorld(var13);
|
||||
}
|
||||
}
|
||||
|
||||
protected int damageDropped(int var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getExplosionResistance(Entity var1) {
|
||||
return this.blockResistance / 5.0F;
|
||||
}
|
||||
|
||||
public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
var5 = var5.addVector((double)(-var2), (double)(-var3), (double)(-var4));
|
||||
var6 = var6.addVector((double)(-var2), (double)(-var3), (double)(-var4));
|
||||
Vec3D var7 = var5.getIntermediateWithXValue(var6, this.minX);
|
||||
Vec3D var8 = var5.getIntermediateWithXValue(var6, this.maxX);
|
||||
Vec3D var9 = var5.getIntermediateWithYValue(var6, this.minY);
|
||||
Vec3D var10 = var5.getIntermediateWithYValue(var6, this.maxY);
|
||||
Vec3D var11 = var5.getIntermediateWithZValue(var6, this.minZ);
|
||||
Vec3D var12 = var5.getIntermediateWithZValue(var6, this.maxZ);
|
||||
if(!this.isVecInsideYZBounds(var7)) {
|
||||
var7 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInsideYZBounds(var8)) {
|
||||
var8 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInsideXZBounds(var9)) {
|
||||
var9 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInsideXZBounds(var10)) {
|
||||
var10 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInsideXYBounds(var11)) {
|
||||
var11 = null;
|
||||
}
|
||||
|
||||
if(!this.isVecInsideXYBounds(var12)) {
|
||||
var12 = null;
|
||||
}
|
||||
|
||||
Vec3D var13 = null;
|
||||
if(var7 != null && (var13 == null || var5.distanceTo(var7) < var5.distanceTo(var13))) {
|
||||
var13 = var7;
|
||||
}
|
||||
|
||||
if(var8 != null && (var13 == null || var5.distanceTo(var8) < var5.distanceTo(var13))) {
|
||||
var13 = var8;
|
||||
}
|
||||
|
||||
if(var9 != null && (var13 == null || var5.distanceTo(var9) < var5.distanceTo(var13))) {
|
||||
var13 = var9;
|
||||
}
|
||||
|
||||
if(var10 != null && (var13 == null || var5.distanceTo(var10) < var5.distanceTo(var13))) {
|
||||
var13 = var10;
|
||||
}
|
||||
|
||||
if(var11 != null && (var13 == null || var5.distanceTo(var11) < var5.distanceTo(var13))) {
|
||||
var13 = var11;
|
||||
}
|
||||
|
||||
if(var12 != null && (var13 == null || var5.distanceTo(var12) < var5.distanceTo(var13))) {
|
||||
var13 = var12;
|
||||
}
|
||||
|
||||
if(var13 == null) {
|
||||
return null;
|
||||
} else {
|
||||
byte var14 = -1;
|
||||
if(var13 == var7) {
|
||||
var14 = 4;
|
||||
}
|
||||
|
||||
if(var13 == var8) {
|
||||
var14 = 5;
|
||||
}
|
||||
|
||||
if(var13 == var9) {
|
||||
var14 = 0;
|
||||
}
|
||||
|
||||
if(var13 == var10) {
|
||||
var14 = 1;
|
||||
}
|
||||
|
||||
if(var13 == var11) {
|
||||
var14 = 2;
|
||||
}
|
||||
|
||||
if(var13 == var12) {
|
||||
var14 = 3;
|
||||
}
|
||||
|
||||
return new MovingObjectPosition(var2, var3, var4, var14, var13.addVector((double)var2, (double)var3, (double)var4));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isVecInsideYZBounds(Vec3D var1) {
|
||||
return var1 == null ? false : var1.yCoord >= this.minY && var1.yCoord <= this.maxY && var1.zCoord >= this.minZ && var1.zCoord <= this.maxZ;
|
||||
}
|
||||
|
||||
private boolean isVecInsideXZBounds(Vec3D var1) {
|
||||
return var1 == null ? false : var1.xCoord >= this.minX && var1.xCoord <= this.maxX && var1.zCoord >= this.minZ && var1.zCoord <= this.maxZ;
|
||||
}
|
||||
|
||||
private boolean isVecInsideXYBounds(Vec3D var1) {
|
||||
return var1 == null ? false : var1.xCoord >= this.minX && var1.xCoord <= this.maxX && var1.yCoord >= this.minY && var1.yCoord <= this.maxY;
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByExplosion(World var1, int var2, int var3, int var4) {
|
||||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) {
|
||||
return this.canPlaceBlockAt(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockId(var2, var3, var4);
|
||||
return var5 == 0 || blocksList[var5].blockMaterial.getIsGroundCover();
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) {
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
}
|
||||
|
||||
public void velocityToAddToEntity(World var1, int var2, int var3, int var4, Entity var5, Vec3D var6) {
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
}
|
||||
|
||||
public int getRenderColor(int var1) {
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canProvidePower() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender() {
|
||||
}
|
||||
|
||||
public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) {
|
||||
var2.addStat(StatList.mineBlockStatArray[this.blockID], 1);
|
||||
this.dropBlockAsItem(var1, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World var1, int var2, int var3, int var4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) {
|
||||
}
|
||||
|
||||
public Block setBlockName(String var1) {
|
||||
this.blockName = "tile." + var1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String translateBlockName() {
|
||||
return StatCollector.translateToLocal(this.getBlockName() + ".name");
|
||||
}
|
||||
|
||||
public String getBlockName() {
|
||||
return this.blockName;
|
||||
}
|
||||
|
||||
public void playBlock(World var1, int var2, int var3, int var4, int var5, int var6) {
|
||||
}
|
||||
|
||||
public boolean getEnableStats() {
|
||||
return this.enableStats;
|
||||
}
|
||||
|
||||
protected Block disableStats() {
|
||||
this.enableStats = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMobilityFlag() {
|
||||
return this.blockMaterial.getMaterialMobility();
|
||||
}
|
||||
|
||||
static {
|
||||
Item.itemsList[cloth.blockID] = (new ItemCloth(cloth.blockID - 256)).setItemName("cloth");
|
||||
Item.itemsList[wood.blockID] = (new ItemLog(wood.blockID - 256)).setItemName("log");
|
||||
Item.itemsList[stairSingle.blockID] = (new ItemSlab(stairSingle.blockID - 256)).setItemName("stoneSlab");
|
||||
Item.itemsList[sapling.blockID] = (new ItemSapling(sapling.blockID - 256)).setItemName("sapling");
|
||||
Item.itemsList[leaves.blockID] = (new ItemLeaves(leaves.blockID - 256)).setItemName("leaves");
|
||||
Item.itemsList[pistonBase.blockID] = new ItemPiston(pistonBase.blockID - 256);
|
||||
Item.itemsList[pistonStickyBase.blockID] = new ItemPiston(pistonStickyBase.blockID - 256);
|
||||
|
||||
for(int var0 = 0; var0 < 256; ++var0) {
|
||||
if(blocksList[var0] != null && Item.itemsList[var0] == null) {
|
||||
Item.itemsList[var0] = new ItemBlock(var0 - 256);
|
||||
blocksList[var0].initializeBlock();
|
||||
}
|
||||
}
|
||||
|
||||
canBlockGrass[0] = true;
|
||||
StatList.func_25154_a();
|
||||
}
|
||||
}
|
194
src/net/minecraft/src/BlockBed.java
Normal file
194
src/net/minecraft/src/BlockBed.java
Normal file
|
@ -0,0 +1,194 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBed extends Block {
|
||||
public static final int[][] headBlockToFootBlockMap = new int[][]{{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
|
||||
|
||||
public BlockBed(int var1) {
|
||||
super(var1, 134, Material.cloth);
|
||||
this.setBounds();
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(!isBlockFootOfBed(var6)) {
|
||||
int var7 = getDirectionFromMetadata(var6);
|
||||
var2 += headBlockToFootBlockMap[var7][0];
|
||||
var4 += headBlockToFootBlockMap[var7][1];
|
||||
if(var1.getBlockId(var2, var3, var4) != this.blockID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
}
|
||||
|
||||
if(!var1.worldProvider.canRespawnHere()) {
|
||||
double var16 = (double)var2 + 0.5D;
|
||||
double var17 = (double)var3 + 0.5D;
|
||||
double var11 = (double)var4 + 0.5D;
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
int var13 = getDirectionFromMetadata(var6);
|
||||
var2 += headBlockToFootBlockMap[var13][0];
|
||||
var4 += headBlockToFootBlockMap[var13][1];
|
||||
if(var1.getBlockId(var2, var3, var4) == this.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
var16 = (var16 + (double)var2 + 0.5D) / 2.0D;
|
||||
var17 = (var17 + (double)var3 + 0.5D) / 2.0D;
|
||||
var11 = (var11 + (double)var4 + 0.5D) / 2.0D;
|
||||
}
|
||||
|
||||
var1.newExplosion((Entity)null, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), 5.0F, true);
|
||||
return true;
|
||||
} else {
|
||||
if(isBedOccupied(var6)) {
|
||||
EntityPlayer var14 = null;
|
||||
Iterator var8 = var1.playerEntities.iterator();
|
||||
|
||||
while(var8.hasNext()) {
|
||||
EntityPlayer var9 = (EntityPlayer)var8.next();
|
||||
if(var9.isPlayerSleeping()) {
|
||||
ChunkCoordinates var10 = var9.bedChunkCoordinates;
|
||||
if(var10.x == var2 && var10.y == var3 && var10.z == var4) {
|
||||
var14 = var9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(var14 != null) {
|
||||
var5.addChatMessage("tile.bed.occupied");
|
||||
return true;
|
||||
}
|
||||
|
||||
setBedOccupied(var1, var2, var3, var4, false);
|
||||
}
|
||||
|
||||
EnumStatus var15 = var5.sleepInBedAt(var2, var3, var4);
|
||||
if(var15 == EnumStatus.OK) {
|
||||
setBedOccupied(var1, var2, var3, var4, true);
|
||||
return true;
|
||||
} else {
|
||||
if(var15 == EnumStatus.NOT_POSSIBLE_NOW) {
|
||||
var5.addChatMessage("tile.bed.noSleep");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
if(var1 == 0) {
|
||||
return Block.planks.blockIndexInTexture;
|
||||
} else {
|
||||
int var3 = getDirectionFromMetadata(var2);
|
||||
int var4 = ModelBed.bedDirection[var3][var1];
|
||||
return isBlockFootOfBed(var2) ? (var4 == 2 ? this.blockIndexInTexture + 2 + 16 : (var4 != 5 && var4 != 4 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture + 1 + 16)) : (var4 == 3 ? this.blockIndexInTexture - 1 + 16 : (var4 != 5 && var4 != 4 ? this.blockIndexInTexture : this.blockIndexInTexture + 16));
|
||||
}
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 14;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
this.setBounds();
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = getDirectionFromMetadata(var6);
|
||||
if(isBlockFootOfBed(var6)) {
|
||||
if(var1.getBlockId(var2 - headBlockToFootBlockMap[var7][0], var3, var4 - headBlockToFootBlockMap[var7][1]) != this.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
} else if(var1.getBlockId(var2 + headBlockToFootBlockMap[var7][0], var3, var4 + headBlockToFootBlockMap[var7][1]) != this.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
if(!var1.multiplayerWorld) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return isBlockFootOfBed(var1) ? 0 : Item.bed.shiftedIndex;
|
||||
}
|
||||
|
||||
private void setBounds() {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 9.0F / 16.0F, 1.0F);
|
||||
}
|
||||
|
||||
public static int getDirectionFromMetadata(int var0) {
|
||||
return var0 & 3;
|
||||
}
|
||||
|
||||
public static boolean isBlockFootOfBed(int var0) {
|
||||
return (var0 & 8) != 0;
|
||||
}
|
||||
|
||||
public static boolean isBedOccupied(int var0) {
|
||||
return (var0 & 4) != 0;
|
||||
}
|
||||
|
||||
public static void setBedOccupied(World var0, int var1, int var2, int var3, boolean var4) {
|
||||
int var5 = var0.getBlockMetadata(var1, var2, var3);
|
||||
if(var4) {
|
||||
var5 |= 4;
|
||||
} else {
|
||||
var5 &= -5;
|
||||
}
|
||||
|
||||
var0.setBlockMetadataWithNotify(var1, var2, var3, var5);
|
||||
}
|
||||
|
||||
public static ChunkCoordinates getNearestEmptyChunkCoordinates(World var0, int var1, int var2, int var3, int var4) {
|
||||
int var5 = var0.getBlockMetadata(var1, var2, var3);
|
||||
int var6 = getDirectionFromMetadata(var5);
|
||||
|
||||
for(int var7 = 0; var7 <= 1; ++var7) {
|
||||
int var8 = var1 - headBlockToFootBlockMap[var6][0] * var7 - 1;
|
||||
int var9 = var3 - headBlockToFootBlockMap[var6][1] * var7 - 1;
|
||||
int var10 = var8 + 2;
|
||||
int var11 = var9 + 2;
|
||||
|
||||
for(int var12 = var8; var12 <= var10; ++var12) {
|
||||
for(int var13 = var9; var13 <= var11; ++var13) {
|
||||
if(var0.isBlockNormalCube(var12, var2 - 1, var13) && var0.isAirBlock(var12, var2, var13) && var0.isAirBlock(var12, var2 + 1, var13)) {
|
||||
if(var4 <= 0) {
|
||||
return new ChunkCoordinates(var12, var2, var13);
|
||||
}
|
||||
|
||||
--var4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
|
||||
if(!isBlockFootOfBed(var5)) {
|
||||
super.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getMobilityFlag() {
|
||||
return 1;
|
||||
}
|
||||
}
|
17
src/net/minecraft/src/BlockBookshelf.java
Normal file
17
src/net/minecraft/src/BlockBookshelf.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBookshelf extends Block {
|
||||
public BlockBookshelf(int var1, int var2) {
|
||||
super(var1, var2, Material.wood);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 <= 1 ? 4 : this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
}
|
19
src/net/minecraft/src/BlockBreakable.java
Normal file
19
src/net/minecraft/src/BlockBreakable.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockBreakable extends Block {
|
||||
private boolean localFlag;
|
||||
|
||||
protected BlockBreakable(int var1, int var2, Material var3, boolean var4) {
|
||||
super(var1, var2, var3);
|
||||
this.localFlag = var4;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockId(var2, var3, var4);
|
||||
return !this.localFlag && var6 == this.blockID ? false : super.shouldSideBeRendered(var1, var2, var3, var4, var5);
|
||||
}
|
||||
}
|
222
src/net/minecraft/src/BlockButton.java
Normal file
222
src/net/minecraft/src/BlockButton.java
Normal file
|
@ -0,0 +1,222 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockButton extends Block {
|
||||
protected BlockButton(int var1, int var2) {
|
||||
super(var1, var2, Material.circuits);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) {
|
||||
return var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1) ? true : (var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : (var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)));
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2 - 1, var3, var4) ? true : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : var1.isBlockNormalCube(var2, var3, var4 + 1)));
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var6 & 8;
|
||||
var6 &= 7;
|
||||
if(var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
var6 = 4;
|
||||
} else if(var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
var6 = 3;
|
||||
} else if(var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
var6 = 2;
|
||||
} else if(var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
var6 = 1;
|
||||
} else {
|
||||
var6 = this.getOrientation(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 + var7);
|
||||
}
|
||||
|
||||
private int getOrientation(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2 - 1, var3, var4) ? 1 : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? 2 : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? 3 : (var1.isBlockNormalCube(var2, var3, var4 + 1) ? 4 : 1)));
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(this.func_305_h(var1, var2, var3, var4)) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4) & 7;
|
||||
boolean var7 = false;
|
||||
if(!var1.isBlockNormalCube(var2 - 1, var3, var4) && var6 == 1) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2 + 1, var3, var4) && var6 == 2) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3, var4 - 1) && var6 == 3) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3, var4 + 1) && var6 == 4) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(var7) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean func_305_h(World var1, int var2, int var3, int var4) {
|
||||
if(!this.canPlaceBlockAt(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var6 = var5 & 7;
|
||||
boolean var7 = (var5 & 8) > 0;
|
||||
float var8 = 6.0F / 16.0F;
|
||||
float var9 = 10.0F / 16.0F;
|
||||
float var10 = 3.0F / 16.0F;
|
||||
float var11 = 2.0F / 16.0F;
|
||||
if(var7) {
|
||||
var11 = 1.0F / 16.0F;
|
||||
}
|
||||
|
||||
if(var6 == 1) {
|
||||
this.setBlockBounds(0.0F, var8, 0.5F - var10, var11, var9, 0.5F + var10);
|
||||
} else if(var6 == 2) {
|
||||
this.setBlockBounds(1.0F - var11, var8, 0.5F - var10, 1.0F, var9, 0.5F + var10);
|
||||
} else if(var6 == 3) {
|
||||
this.setBlockBounds(0.5F - var10, var8, 0.0F, 0.5F + var10, var9, var11);
|
||||
} else if(var6 == 4) {
|
||||
this.setBlockBounds(0.5F - var10, var8, 1.0F - var11, 0.5F + var10, var9, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.blockActivated(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var6 & 7;
|
||||
int var8 = 8 - (var6 & 8);
|
||||
if(var8 == 0) {
|
||||
return true;
|
||||
} else {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var7 + var8);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
if(var7 == 1) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
} else if(var7 == 2) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
} else if(var7 == 3) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
} else if(var7 == 4) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
} else {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
}
|
||||
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var5 & 8) > 0) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
int var6 = var5 & 7;
|
||||
if(var6 == 1) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
} else if(var6 == 2) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
} else if(var6 == 3) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
} else if(var6 == 4) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
} else {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return (var1.getBlockMetadata(var2, var3, var4) & 8) > 0;
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
int var7 = var6 & 7;
|
||||
return var7 == 5 && var5 == 1 ? true : (var7 == 4 && var5 == 2 ? true : (var7 == 3 && var5 == 3 ? true : (var7 == 2 && var5 == 4 ? true : var7 == 1 && var5 == 5)));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) != 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 & 7);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
int var7 = var6 & 7;
|
||||
if(var7 == 1) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
} else if(var7 == 2) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
} else if(var7 == 3) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
} else if(var7 == 4) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
} else {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
}
|
||||
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender() {
|
||||
float var1 = 3.0F / 16.0F;
|
||||
float var2 = 2.0F / 16.0F;
|
||||
float var3 = 2.0F / 16.0F;
|
||||
this.setBlockBounds(0.5F - var1, 0.5F - var2, 0.5F - var3, 0.5F + var1, 0.5F + var2, 0.5F + var3);
|
||||
}
|
||||
}
|
86
src/net/minecraft/src/BlockCactus.java
Normal file
86
src/net/minecraft/src/BlockCactus.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCactus extends Block {
|
||||
protected BlockCactus(int var1, int var2) {
|
||||
super(var1, var2, Material.cactus);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var1.isAirBlock(var2, var3 + 1, var4)) {
|
||||
int var6;
|
||||
for(var6 = 1; var1.getBlockId(var2, var3 - var6, var4) == this.blockID; ++var6) {
|
||||
}
|
||||
|
||||
if(var6 < 3) {
|
||||
int var7 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var7 == 15) {
|
||||
var1.setBlockWithNotify(var2, var3 + 1, var4, this.blockID);
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var7 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
float var5 = 1.0F / 16.0F;
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var5), (double)var3, (double)((float)var4 + var5), (double)((float)(var2 + 1) - var5), (double)((float)(var3 + 1) - var5), (double)((float)(var4 + 1) - var5));
|
||||
}
|
||||
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
float var5 = 1.0F / 16.0F;
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var5), (double)var3, (double)((float)var4 + var5), (double)((float)(var2 + 1) - var5), (double)(var3 + 1), (double)((float)(var4 + 1) - var5));
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture - 1 : (var1 == 0 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture);
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 13;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return !super.canPlaceBlockAt(var1, var2, var3, var4) ? false : this.canBlockStay(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!this.canBlockStay(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World var1, int var2, int var3, int var4) {
|
||||
if(var1.getBlockMaterial(var2 - 1, var3, var4).isSolid()) {
|
||||
return false;
|
||||
} else if(var1.getBlockMaterial(var2 + 1, var3, var4).isSolid()) {
|
||||
return false;
|
||||
} else if(var1.getBlockMaterial(var2, var3, var4 - 1).isSolid()) {
|
||||
return false;
|
||||
} else if(var1.getBlockMaterial(var2, var3, var4 + 1).isSolid()) {
|
||||
return false;
|
||||
} else {
|
||||
int var5 = var1.getBlockId(var2, var3 - 1, var4);
|
||||
return var5 == Block.cactus.blockID || var5 == Block.sand.blockID;
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
var5.attackEntityFrom((Entity)null, 1);
|
||||
}
|
||||
}
|
103
src/net/minecraft/src/BlockCake.java
Normal file
103
src/net/minecraft/src/BlockCake.java
Normal file
|
@ -0,0 +1,103 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCake extends Block {
|
||||
protected BlockCake(int var1, int var2) {
|
||||
super(var1, var2, Material.cakeMaterial);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
float var6 = 1.0F / 16.0F;
|
||||
float var7 = (float)(1 + var5 * 2) / 16.0F;
|
||||
float var8 = 0.5F;
|
||||
this.setBlockBounds(var7, 0.0F, var6, 1.0F - var6, var8, 1.0F - var6);
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender() {
|
||||
float var1 = 1.0F / 16.0F;
|
||||
float var2 = 0.5F;
|
||||
this.setBlockBounds(var1, 0.0F, var1, 1.0F - var1, var2, 1.0F - var1);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
float var6 = 1.0F / 16.0F;
|
||||
float var7 = (float)(1 + var5 * 2) / 16.0F;
|
||||
float var8 = 0.5F;
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var6), (double)((float)(var2 + 1) - var6), (double)((float)var3 + var8 - var6), (double)((float)(var4 + 1) - var6));
|
||||
}
|
||||
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
float var6 = 1.0F / 16.0F;
|
||||
float var7 = (float)(1 + var5 * 2) / 16.0F;
|
||||
float var8 = 0.5F;
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var6), (double)((float)(var2 + 1) - var6), (double)((float)var3 + var8), (double)((float)(var4 + 1) - var6));
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return var1 == 1 ? this.blockIndexInTexture : (var1 == 0 ? this.blockIndexInTexture + 3 : (var2 > 0 && var1 == 4 ? this.blockIndexInTexture + 2 : this.blockIndexInTexture + 1));
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture : (var1 == 0 ? this.blockIndexInTexture + 3 : this.blockIndexInTexture + 1);
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.eatCakeSlice(var1, var2, var3, var4, var5);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.eatCakeSlice(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
private void eatCakeSlice(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var5.health < 20) {
|
||||
var5.heal(3);
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4) + 1;
|
||||
if(var6 >= 6) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6);
|
||||
var1.markBlockAsNeedsUpdate(var2, var3, var4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return !super.canPlaceBlockAt(var1, var2, var3, var4) ? false : this.canBlockStay(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!this.canBlockStay(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World var1, int var2, int var3, int var4) {
|
||||
return var1.getBlockMaterial(var2, var3 - 1, var4).isSolid();
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return 0;
|
||||
}
|
||||
}
|
200
src/net/minecraft/src/BlockChest.java
Normal file
200
src/net/minecraft/src/BlockChest.java
Normal file
|
@ -0,0 +1,200 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockChest extends BlockContainer {
|
||||
private Random random = new Random();
|
||||
|
||||
protected BlockChest(int var1) {
|
||||
super(var1, Material.wood);
|
||||
this.blockIndexInTexture = 26;
|
||||
}
|
||||
|
||||
public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 == 1) {
|
||||
return this.blockIndexInTexture - 1;
|
||||
} else if(var5 == 0) {
|
||||
return this.blockIndexInTexture - 1;
|
||||
} else {
|
||||
int var6 = var1.getBlockId(var2, var3, var4 - 1);
|
||||
int var7 = var1.getBlockId(var2, var3, var4 + 1);
|
||||
int var8 = var1.getBlockId(var2 - 1, var3, var4);
|
||||
int var9 = var1.getBlockId(var2 + 1, var3, var4);
|
||||
int var10;
|
||||
int var11;
|
||||
int var12;
|
||||
byte var13;
|
||||
if(var6 != this.blockID && var7 != this.blockID) {
|
||||
if(var8 != this.blockID && var9 != this.blockID) {
|
||||
byte var14 = 3;
|
||||
if(Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var7]) {
|
||||
var14 = 3;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var6]) {
|
||||
var14 = 2;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var9]) {
|
||||
var14 = 5;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var9] && !Block.opaqueCubeLookup[var8]) {
|
||||
var14 = 4;
|
||||
}
|
||||
|
||||
return var5 == var14 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture;
|
||||
} else if(var5 != 4 && var5 != 5) {
|
||||
var10 = 0;
|
||||
if(var8 == this.blockID) {
|
||||
var10 = -1;
|
||||
}
|
||||
|
||||
var11 = var1.getBlockId(var8 == this.blockID ? var2 - 1 : var2 + 1, var3, var4 - 1);
|
||||
var12 = var1.getBlockId(var8 == this.blockID ? var2 - 1 : var2 + 1, var3, var4 + 1);
|
||||
if(var5 == 3) {
|
||||
var10 = -1 - var10;
|
||||
}
|
||||
|
||||
var13 = 3;
|
||||
if((Block.opaqueCubeLookup[var6] || Block.opaqueCubeLookup[var11]) && !Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var12]) {
|
||||
var13 = 3;
|
||||
}
|
||||
|
||||
if((Block.opaqueCubeLookup[var7] || Block.opaqueCubeLookup[var12]) && !Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var11]) {
|
||||
var13 = 2;
|
||||
}
|
||||
|
||||
return (var5 == var13 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture + 32) + var10;
|
||||
} else {
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
} else if(var5 != 2 && var5 != 3) {
|
||||
var10 = 0;
|
||||
if(var6 == this.blockID) {
|
||||
var10 = -1;
|
||||
}
|
||||
|
||||
var11 = var1.getBlockId(var2 - 1, var3, var6 == this.blockID ? var4 - 1 : var4 + 1);
|
||||
var12 = var1.getBlockId(var2 + 1, var3, var6 == this.blockID ? var4 - 1 : var4 + 1);
|
||||
if(var5 == 4) {
|
||||
var10 = -1 - var10;
|
||||
}
|
||||
|
||||
var13 = 5;
|
||||
if((Block.opaqueCubeLookup[var8] || Block.opaqueCubeLookup[var11]) && !Block.opaqueCubeLookup[var9] && !Block.opaqueCubeLookup[var12]) {
|
||||
var13 = 5;
|
||||
}
|
||||
|
||||
if((Block.opaqueCubeLookup[var9] || Block.opaqueCubeLookup[var12]) && !Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var11]) {
|
||||
var13 = 4;
|
||||
}
|
||||
|
||||
return (var5 == var13 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture + 32) + var10;
|
||||
} else {
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture - 1 : (var1 == 0 ? this.blockIndexInTexture - 1 : (var1 == 3 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture));
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
int var5 = 0;
|
||||
if(var1.getBlockId(var2 - 1, var3, var4) == this.blockID) {
|
||||
++var5;
|
||||
}
|
||||
|
||||
if(var1.getBlockId(var2 + 1, var3, var4) == this.blockID) {
|
||||
++var5;
|
||||
}
|
||||
|
||||
if(var1.getBlockId(var2, var3, var4 - 1) == this.blockID) {
|
||||
++var5;
|
||||
}
|
||||
|
||||
if(var1.getBlockId(var2, var3, var4 + 1) == this.blockID) {
|
||||
++var5;
|
||||
}
|
||||
|
||||
return var5 > 1 ? false : (this.isThereANeighborChest(var1, var2 - 1, var3, var4) ? false : (this.isThereANeighborChest(var1, var2 + 1, var3, var4) ? false : (this.isThereANeighborChest(var1, var2, var3, var4 - 1) ? false : !this.isThereANeighborChest(var1, var2, var3, var4 + 1))));
|
||||
}
|
||||
|
||||
private boolean isThereANeighborChest(World var1, int var2, int var3, int var4) {
|
||||
return var1.getBlockId(var2, var3, var4) != this.blockID ? false : (var1.getBlockId(var2 - 1, var3, var4) == this.blockID ? true : (var1.getBlockId(var2 + 1, var3, var4) == this.blockID ? true : (var1.getBlockId(var2, var3, var4 - 1) == this.blockID ? true : var1.getBlockId(var2, var3, var4 + 1) == this.blockID)));
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
TileEntityChest var5 = (TileEntityChest)var1.getBlockTileEntity(var2, var3, var4);
|
||||
|
||||
for(int var6 = 0; var6 < var5.getSizeInventory(); ++var6) {
|
||||
ItemStack var7 = var5.getStackInSlot(var6);
|
||||
if(var7 != null) {
|
||||
float var8 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
float var9 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
float var10 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(var7.stackSize > 0) {
|
||||
int var11 = this.random.nextInt(21) + 10;
|
||||
if(var11 > var7.stackSize) {
|
||||
var11 = var7.stackSize;
|
||||
}
|
||||
|
||||
var7.stackSize -= var11;
|
||||
EntityItem var12 = new EntityItem(var1, (double)((float)var2 + var8), (double)((float)var3 + var9), (double)((float)var4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
|
||||
float var13 = 0.05F;
|
||||
var12.motionX = (double)((float)this.random.nextGaussian() * var13);
|
||||
var12.motionY = (double)((float)this.random.nextGaussian() * var13 + 0.2F);
|
||||
var12.motionZ = (double)((float)this.random.nextGaussian() * var13);
|
||||
var1.entityJoinedWorld(var12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
Object var6 = (TileEntityChest)var1.getBlockTileEntity(var2, var3, var4);
|
||||
if(var1.isBlockNormalCube(var2, var3 + 1, var4)) {
|
||||
return true;
|
||||
} else if(var1.getBlockId(var2 - 1, var3, var4) == this.blockID && var1.isBlockNormalCube(var2 - 1, var3 + 1, var4)) {
|
||||
return true;
|
||||
} else if(var1.getBlockId(var2 + 1, var3, var4) == this.blockID && var1.isBlockNormalCube(var2 + 1, var3 + 1, var4)) {
|
||||
return true;
|
||||
} else if(var1.getBlockId(var2, var3, var4 - 1) == this.blockID && var1.isBlockNormalCube(var2, var3 + 1, var4 - 1)) {
|
||||
return true;
|
||||
} else if(var1.getBlockId(var2, var3, var4 + 1) == this.blockID && var1.isBlockNormalCube(var2, var3 + 1, var4 + 1)) {
|
||||
return true;
|
||||
} else {
|
||||
if(var1.getBlockId(var2 - 1, var3, var4) == this.blockID) {
|
||||
var6 = new InventoryLargeChest("Large chest", (TileEntityChest)var1.getBlockTileEntity(var2 - 1, var3, var4), (IInventory)var6);
|
||||
}
|
||||
|
||||
if(var1.getBlockId(var2 + 1, var3, var4) == this.blockID) {
|
||||
var6 = new InventoryLargeChest("Large chest", (IInventory)var6, (TileEntityChest)var1.getBlockTileEntity(var2 + 1, var3, var4));
|
||||
}
|
||||
|
||||
if(var1.getBlockId(var2, var3, var4 - 1) == this.blockID) {
|
||||
var6 = new InventoryLargeChest("Large chest", (TileEntityChest)var1.getBlockTileEntity(var2, var3, var4 - 1), (IInventory)var6);
|
||||
}
|
||||
|
||||
if(var1.getBlockId(var2, var3, var4 + 1) == this.blockID) {
|
||||
var6 = new InventoryLargeChest("Large chest", (IInventory)var6, (TileEntityChest)var1.getBlockTileEntity(var2, var3, var4 + 1));
|
||||
}
|
||||
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
var5.displayGUIChest((IInventory)var6);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected TileEntity getBlockEntity() {
|
||||
return new TileEntityChest();
|
||||
}
|
||||
}
|
17
src/net/minecraft/src/BlockClay.java
Normal file
17
src/net/minecraft/src/BlockClay.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockClay extends Block {
|
||||
public BlockClay(int var1, int var2) {
|
||||
super(var1, var2, Material.clay);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.clay.shiftedIndex;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 4;
|
||||
}
|
||||
}
|
28
src/net/minecraft/src/BlockCloth.java
Normal file
28
src/net/minecraft/src/BlockCloth.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockCloth extends Block {
|
||||
public BlockCloth() {
|
||||
super(35, 64, Material.cloth);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
if(var2 == 0) {
|
||||
return this.blockIndexInTexture;
|
||||
} else {
|
||||
var2 = ~(var2 & 15);
|
||||
return 113 + ((var2 & 8) >> 3) + (var2 & 7) * 16;
|
||||
}
|
||||
}
|
||||
|
||||
protected int damageDropped(int var1) {
|
||||
return var1;
|
||||
}
|
||||
|
||||
public static int func_21034_c(int var0) {
|
||||
return ~var0 & 15;
|
||||
}
|
||||
|
||||
public static int func_21035_d(int var0) {
|
||||
return ~var0 & 15;
|
||||
}
|
||||
}
|
25
src/net/minecraft/src/BlockContainer.java
Normal file
25
src/net/minecraft/src/BlockContainer.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public abstract class BlockContainer extends Block {
|
||||
protected BlockContainer(int var1, Material var2) {
|
||||
super(var1, var2);
|
||||
isBlockContainer[var1] = true;
|
||||
}
|
||||
|
||||
protected BlockContainer(int var1, int var2, Material var3) {
|
||||
super(var1, var2, var3);
|
||||
isBlockContainer[var1] = true;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
var1.setBlockTileEntity(var2, var3, var4, this.getBlockEntity());
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
var1.removeBlockTileEntity(var2, var3, var4);
|
||||
}
|
||||
|
||||
protected abstract TileEntity getBlockEntity();
|
||||
}
|
114
src/net/minecraft/src/BlockCrops.java
Normal file
114
src/net/minecraft/src/BlockCrops.java
Normal file
|
@ -0,0 +1,114 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCrops extends BlockFlower {
|
||||
protected BlockCrops(int var1, int var2) {
|
||||
super(var1, var2);
|
||||
this.blockIndexInTexture = var2;
|
||||
this.setTickOnLoad(true);
|
||||
float var3 = 0.5F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.25F, 0.5F + var3);
|
||||
}
|
||||
|
||||
protected boolean canThisPlantGrowOnThisBlockID(int var1) {
|
||||
return var1 == Block.tilledField.blockID;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
super.updateTick(var1, var2, var3, var4, var5);
|
||||
if(var1.getBlockLightValue(var2, var3 + 1, var4) >= 9) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var6 < 7) {
|
||||
float var7 = this.getGrowthRate(var1, var2, var3, var4);
|
||||
if(var5.nextInt((int)(100.0F / var7)) == 0) {
|
||||
++var6;
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void fertilize(World var1, int var2, int var3, int var4) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 7);
|
||||
}
|
||||
|
||||
private float getGrowthRate(World var1, int var2, int var3, int var4) {
|
||||
float var5 = 1.0F;
|
||||
int var6 = var1.getBlockId(var2, var3, var4 - 1);
|
||||
int var7 = var1.getBlockId(var2, var3, var4 + 1);
|
||||
int var8 = var1.getBlockId(var2 - 1, var3, var4);
|
||||
int var9 = var1.getBlockId(var2 + 1, var3, var4);
|
||||
int var10 = var1.getBlockId(var2 - 1, var3, var4 - 1);
|
||||
int var11 = var1.getBlockId(var2 + 1, var3, var4 - 1);
|
||||
int var12 = var1.getBlockId(var2 + 1, var3, var4 + 1);
|
||||
int var13 = var1.getBlockId(var2 - 1, var3, var4 + 1);
|
||||
boolean var14 = var8 == this.blockID || var9 == this.blockID;
|
||||
boolean var15 = var6 == this.blockID || var7 == this.blockID;
|
||||
boolean var16 = var10 == this.blockID || var11 == this.blockID || var12 == this.blockID || var13 == this.blockID;
|
||||
|
||||
for(int var17 = var2 - 1; var17 <= var2 + 1; ++var17) {
|
||||
for(int var18 = var4 - 1; var18 <= var4 + 1; ++var18) {
|
||||
int var19 = var1.getBlockId(var17, var3 - 1, var18);
|
||||
float var20 = 0.0F;
|
||||
if(var19 == Block.tilledField.blockID) {
|
||||
var20 = 1.0F;
|
||||
if(var1.getBlockMetadata(var17, var3 - 1, var18) > 0) {
|
||||
var20 = 3.0F;
|
||||
}
|
||||
}
|
||||
|
||||
if(var17 != var2 || var18 != var4) {
|
||||
var20 /= 4.0F;
|
||||
}
|
||||
|
||||
var5 += var20;
|
||||
}
|
||||
}
|
||||
|
||||
if(var16 || var14 && var15) {
|
||||
var5 /= 2.0F;
|
||||
}
|
||||
|
||||
return var5;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
if(var2 < 0) {
|
||||
var2 = 7;
|
||||
}
|
||||
|
||||
return this.blockIndexInTexture + var2;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
|
||||
super.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6);
|
||||
if(!var1.multiplayerWorld) {
|
||||
for(int var7 = 0; var7 < 3; ++var7) {
|
||||
if(var1.rand.nextInt(15) <= var5) {
|
||||
float var8 = 0.7F;
|
||||
float var9 = var1.rand.nextFloat() * var8 + (1.0F - var8) * 0.5F;
|
||||
float var10 = var1.rand.nextFloat() * var8 + (1.0F - var8) * 0.5F;
|
||||
float var11 = var1.rand.nextFloat() * var8 + (1.0F - var8) * 0.5F;
|
||||
EntityItem var12 = new EntityItem(var1, (double)((float)var2 + var9), (double)((float)var3 + var10), (double)((float)var4 + var11), new ItemStack(Item.seeds));
|
||||
var12.delayBeforeCanPickup = 10;
|
||||
var1.entityJoinedWorld(var12);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return var1 == 7 ? Item.wheat.shiftedIndex : -1;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 1;
|
||||
}
|
||||
}
|
23
src/net/minecraft/src/BlockDeadBush.java
Normal file
23
src/net/minecraft/src/BlockDeadBush.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDeadBush extends BlockFlower {
|
||||
protected BlockDeadBush(int var1, int var2) {
|
||||
super(var1, var2);
|
||||
float var3 = 0.4F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.8F, 0.5F + var3);
|
||||
}
|
||||
|
||||
protected boolean canThisPlantGrowOnThisBlockID(int var1) {
|
||||
return var1 == Block.sand.blockID;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return -1;
|
||||
}
|
||||
}
|
74
src/net/minecraft/src/BlockDetectorRail.java
Normal file
74
src/net/minecraft/src/BlockDetectorRail.java
Normal file
|
@ -0,0 +1,74 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDetectorRail extends BlockRail {
|
||||
public BlockDetectorRail(int var1, int var2) {
|
||||
super(var1, var2, true);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) == 0) {
|
||||
this.setStateIfMinecartInteractsWithRail(var1, var2, var3, var4, var6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) != 0) {
|
||||
this.setStateIfMinecartInteractsWithRail(var1, var2, var3, var4, var6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return (var1.getBlockMetadata(var2, var3, var4) & 8) != 0;
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) {
|
||||
return (var1.getBlockMetadata(var2, var3, var4) & 8) == 0 ? false : var5 == 1;
|
||||
}
|
||||
|
||||
private void setStateIfMinecartInteractsWithRail(World var1, int var2, int var3, int var4, int var5) {
|
||||
boolean var6 = (var5 & 8) != 0;
|
||||
boolean var7 = false;
|
||||
float var8 = 2.0F / 16.0F;
|
||||
List var9 = var1.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var8), (double)var3, (double)((float)var4 + var8), (double)((float)(var2 + 1) - var8), (double)var3 + 0.25D, (double)((float)(var4 + 1) - var8)));
|
||||
if(var9.size() > 0) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(var7 && !var6) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var5 | 8);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
}
|
||||
|
||||
if(!var7 && var6) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var5 & 7);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
}
|
||||
|
||||
if(var7) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
7
src/net/minecraft/src/BlockDirt.java
Normal file
7
src/net/minecraft/src/BlockDirt.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockDirt extends Block {
|
||||
protected BlockDirt(int var1, int var2) {
|
||||
super(var1, var2, Material.ground);
|
||||
}
|
||||
}
|
204
src/net/minecraft/src/BlockDispenser.java
Normal file
204
src/net/minecraft/src/BlockDispenser.java
Normal file
|
@ -0,0 +1,204 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDispenser extends BlockContainer {
|
||||
private Random random = new Random();
|
||||
|
||||
protected BlockDispenser(int var1) {
|
||||
super(var1, Material.rock);
|
||||
this.blockIndexInTexture = 45;
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.dispenser.blockID;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
this.setDispenserDefaultDirection(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
private void setDispenserDefaultDirection(World var1, int var2, int var3, int var4) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var5 = var1.getBlockId(var2, var3, var4 - 1);
|
||||
int var6 = var1.getBlockId(var2, var3, var4 + 1);
|
||||
int var7 = var1.getBlockId(var2 - 1, var3, var4);
|
||||
int var8 = var1.getBlockId(var2 + 1, var3, var4);
|
||||
byte var9 = 3;
|
||||
if(Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) {
|
||||
var9 = 3;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) {
|
||||
var9 = 2;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) {
|
||||
var9 = 5;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) {
|
||||
var9 = 4;
|
||||
}
|
||||
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var9);
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 == 1) {
|
||||
return this.blockIndexInTexture + 17;
|
||||
} else if(var5 == 0) {
|
||||
return this.blockIndexInTexture + 17;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
return var5 != var6 ? this.blockIndexInTexture : this.blockIndexInTexture + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture + 17 : (var1 == 0 ? this.blockIndexInTexture + 17 : (var1 == 3 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture));
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
TileEntityDispenser var6 = (TileEntityDispenser)var1.getBlockTileEntity(var2, var3, var4);
|
||||
var5.displayGUIDispenser(var6);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void dispenseItem(World var1, int var2, int var3, int var4, Random var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
byte var9 = 0;
|
||||
byte var10 = 0;
|
||||
if(var6 == 3) {
|
||||
var10 = 1;
|
||||
} else if(var6 == 2) {
|
||||
var10 = -1;
|
||||
} else if(var6 == 5) {
|
||||
var9 = 1;
|
||||
} else {
|
||||
var9 = -1;
|
||||
}
|
||||
|
||||
TileEntityDispenser var11 = (TileEntityDispenser)var1.getBlockTileEntity(var2, var3, var4);
|
||||
ItemStack var12 = var11.getRandomStackFromInventory();
|
||||
double var13 = (double)var2 + (double)var9 * 0.6D + 0.5D;
|
||||
double var15 = (double)var3 + 0.5D;
|
||||
double var17 = (double)var4 + (double)var10 * 0.6D + 0.5D;
|
||||
if(var12 == null) {
|
||||
var1.func_28106_e(1001, var2, var3, var4, 0);
|
||||
} else {
|
||||
if(var12.itemID == Item.arrow.shiftedIndex) {
|
||||
EntityArrow var19 = new EntityArrow(var1, var13, var15, var17);
|
||||
var19.setArrowHeading((double)var9, (double)0.1F, (double)var10, 1.1F, 6.0F);
|
||||
var19.doesArrowBelongToPlayer = true;
|
||||
var1.entityJoinedWorld(var19);
|
||||
var1.func_28106_e(1002, var2, var3, var4, 0);
|
||||
} else if(var12.itemID == Item.egg.shiftedIndex) {
|
||||
EntityEgg var22 = new EntityEgg(var1, var13, var15, var17);
|
||||
var22.setEggHeading((double)var9, (double)0.1F, (double)var10, 1.1F, 6.0F);
|
||||
var1.entityJoinedWorld(var22);
|
||||
var1.func_28106_e(1002, var2, var3, var4, 0);
|
||||
} else if(var12.itemID == Item.snowball.shiftedIndex) {
|
||||
EntitySnowball var23 = new EntitySnowball(var1, var13, var15, var17);
|
||||
var23.setSnowballHeading((double)var9, (double)0.1F, (double)var10, 1.1F, 6.0F);
|
||||
var1.entityJoinedWorld(var23);
|
||||
var1.func_28106_e(1002, var2, var3, var4, 0);
|
||||
} else {
|
||||
EntityItem var24 = new EntityItem(var1, var13, var15 - 0.3D, var17, var12);
|
||||
double var20 = var5.nextDouble() * 0.1D + 0.2D;
|
||||
var24.motionX = (double)var9 * var20;
|
||||
var24.motionY = (double)0.2F;
|
||||
var24.motionZ = (double)var10 * var20;
|
||||
var24.motionX += var5.nextGaussian() * (double)0.0075F * 6.0D;
|
||||
var24.motionY += var5.nextGaussian() * (double)0.0075F * 6.0D;
|
||||
var24.motionZ += var5.nextGaussian() * (double)0.0075F * 6.0D;
|
||||
var1.entityJoinedWorld(var24);
|
||||
var1.func_28106_e(1000, var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
var1.func_28106_e(2000, var2, var3, var4, var9 + 1 + (var10 + 1) * 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 > 0 && Block.blocksList[var5].canProvidePower()) {
|
||||
boolean var6 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4) || var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4);
|
||||
if(var6) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var1.isBlockIndirectlyGettingPowered(var2, var3, var4) || var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4)) {
|
||||
this.dispenseItem(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected TileEntity getBlockEntity() {
|
||||
return new TileEntityDispenser();
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) {
|
||||
int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
if(var6 == 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 2);
|
||||
}
|
||||
|
||||
if(var6 == 1) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 5);
|
||||
}
|
||||
|
||||
if(var6 == 2) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 3);
|
||||
}
|
||||
|
||||
if(var6 == 3) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
TileEntityDispenser var5 = (TileEntityDispenser)var1.getBlockTileEntity(var2, var3, var4);
|
||||
|
||||
for(int var6 = 0; var6 < var5.getSizeInventory(); ++var6) {
|
||||
ItemStack var7 = var5.getStackInSlot(var6);
|
||||
if(var7 != null) {
|
||||
float var8 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
float var9 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
float var10 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(var7.stackSize > 0) {
|
||||
int var11 = this.random.nextInt(21) + 10;
|
||||
if(var11 > var7.stackSize) {
|
||||
var11 = var7.stackSize;
|
||||
}
|
||||
|
||||
var7.stackSize -= var11;
|
||||
EntityItem var12 = new EntityItem(var1, (double)((float)var2 + var8), (double)((float)var3 + var9), (double)((float)var4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
|
||||
float var13 = 0.05F;
|
||||
var12.motionX = (double)((float)this.random.nextGaussian() * var13);
|
||||
var12.motionY = (double)((float)this.random.nextGaussian() * var13 + 0.2F);
|
||||
var12.motionZ = (double)((float)this.random.nextGaussian() * var13);
|
||||
var1.entityJoinedWorld(var12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
}
|
195
src/net/minecraft/src/BlockDoor.java
Normal file
195
src/net/minecraft/src/BlockDoor.java
Normal file
|
@ -0,0 +1,195 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDoor extends Block {
|
||||
protected BlockDoor(int var1, Material var2) {
|
||||
super(var1, var2);
|
||||
this.blockIndexInTexture = 97;
|
||||
if(var2 == Material.iron) {
|
||||
++this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
float var3 = 0.5F;
|
||||
float var4 = 1.0F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var4, 0.5F + var3);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
if(var1 != 0 && var1 != 1) {
|
||||
int var3 = this.getState(var2);
|
||||
if((var3 == 0 || var3 == 2) ^ var1 <= 3) {
|
||||
return this.blockIndexInTexture;
|
||||
} else {
|
||||
int var4 = var3 / 2 + (var1 & 1 ^ var3);
|
||||
var4 += (var2 & 4) / 4;
|
||||
int var5 = this.blockIndexInTexture - (var2 & 8) * 2;
|
||||
if((var4 & 1) != 0) {
|
||||
var5 = -var5;
|
||||
}
|
||||
|
||||
return var5;
|
||||
}
|
||||
} else {
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
return super.getSelectedBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
return super.getCollisionBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
this.setDoorRotation(this.getState(var1.getBlockMetadata(var2, var3, var4)));
|
||||
}
|
||||
|
||||
public void setDoorRotation(int var1) {
|
||||
float var2 = 3.0F / 16.0F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
|
||||
if(var1 == 0) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2);
|
||||
}
|
||||
|
||||
if(var1 == 1) {
|
||||
this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(var1 == 2) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(var1 == 3) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.blockActivated(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(this.blockMaterial == Material.iron) {
|
||||
return true;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) != 0) {
|
||||
if(var1.getBlockId(var2, var3 - 1, var4) == this.blockID) {
|
||||
this.blockActivated(var1, var2, var3 - 1, var4, var5);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
if(var1.getBlockId(var2, var3 + 1, var4) == this.blockID) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3 + 1, var4, (var6 ^ 4) + 8);
|
||||
}
|
||||
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 ^ 4);
|
||||
var1.markBlocksDirty(var2, var3 - 1, var4, var2, var3, var4);
|
||||
var1.func_28107_a(var5, 1003, var2, var3, var4, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPoweredBlockChange(World var1, int var2, int var3, int var4, boolean var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) != 0) {
|
||||
if(var1.getBlockId(var2, var3 - 1, var4) == this.blockID) {
|
||||
this.onPoweredBlockChange(var1, var2, var3 - 1, var4, var5);
|
||||
}
|
||||
|
||||
} else {
|
||||
boolean var7 = (var1.getBlockMetadata(var2, var3, var4) & 4) > 0;
|
||||
if(var7 != var5) {
|
||||
if(var1.getBlockId(var2, var3 + 1, var4) == this.blockID) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3 + 1, var4, (var6 ^ 4) + 8);
|
||||
}
|
||||
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 ^ 4);
|
||||
var1.markBlocksDirty(var2, var3 - 1, var4, var2, var3, var4);
|
||||
var1.func_28107_a((EntityPlayer)null, 1003, var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) != 0) {
|
||||
if(var1.getBlockId(var2, var3 - 1, var4) != this.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
if(var5 > 0 && Block.blocksList[var5].canProvidePower()) {
|
||||
this.onNeighborBlockChange(var1, var2, var3 - 1, var4, var5);
|
||||
}
|
||||
} else {
|
||||
boolean var7 = false;
|
||||
if(var1.getBlockId(var2, var3 + 1, var4) != this.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4)) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
var7 = true;
|
||||
if(var1.getBlockId(var2, var3 + 1, var4) == this.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3 + 1, var4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(var7) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var6);
|
||||
}
|
||||
} else if(var5 > 0 && Block.blocksList[var5].canProvidePower()) {
|
||||
boolean var8 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4) || var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4);
|
||||
this.onPoweredBlockChange(var1, var2, var3, var4, var8);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return (var1 & 8) != 0 ? 0 : (this.blockMaterial == Material.iron ? Item.doorSteel.shiftedIndex : Item.doorWood.shiftedIndex);
|
||||
}
|
||||
|
||||
public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
return super.collisionRayTrace(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public int getState(int var1) {
|
||||
return (var1 & 4) == 0 ? var1 - 1 & 3 : var1 & 3;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var3 >= 127 ? false : var1.isBlockNormalCube(var2, var3 - 1, var4) && super.canPlaceBlockAt(var1, var2, var3, var4) && super.canPlaceBlockAt(var1, var2, var3 + 1, var4);
|
||||
}
|
||||
|
||||
public static boolean isOpen(int var0) {
|
||||
return (var0 & 4) != 0;
|
||||
}
|
||||
|
||||
public int getMobilityFlag() {
|
||||
return 1;
|
||||
}
|
||||
}
|
93
src/net/minecraft/src/BlockFarmland.java
Normal file
93
src/net/minecraft/src/BlockFarmland.java
Normal file
|
@ -0,0 +1,93 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFarmland extends Block {
|
||||
protected BlockFarmland(int var1) {
|
||||
super(var1, Material.ground);
|
||||
this.blockIndexInTexture = 87;
|
||||
this.setTickOnLoad(true);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 15.0F / 16.0F, 1.0F);
|
||||
this.setLightOpacity(255);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)(var2 + 0), (double)(var3 + 0), (double)(var4 + 0), (double)(var2 + 1), (double)(var3 + 1), (double)(var4 + 1));
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return var1 == 1 && var2 > 0 ? this.blockIndexInTexture - 1 : (var1 == 1 ? this.blockIndexInTexture : 2);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var5.nextInt(5) == 0) {
|
||||
if(!this.isWaterNearby(var1, var2, var3, var4) && !var1.canBlockBeRainedOn(var2, var3 + 1, var4)) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var6 > 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 - 1);
|
||||
} else if(!this.isCropsNearby(var1, var2, var3, var4)) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.dirt.blockID);
|
||||
}
|
||||
} else {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 7);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
if(var1.rand.nextInt(4) == 0) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.dirt.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean isCropsNearby(World var1, int var2, int var3, int var4) {
|
||||
byte var5 = 0;
|
||||
|
||||
for(int var6 = var2 - var5; var6 <= var2 + var5; ++var6) {
|
||||
for(int var7 = var4 - var5; var7 <= var4 + var5; ++var7) {
|
||||
if(var1.getBlockId(var6, var3 + 1, var7) == Block.crops.blockID) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isWaterNearby(World var1, int var2, int var3, int var4) {
|
||||
for(int var5 = var2 - 4; var5 <= var2 + 4; ++var5) {
|
||||
for(int var6 = var3; var6 <= var3 + 1; ++var6) {
|
||||
for(int var7 = var4 - 4; var7 <= var4 + 4; ++var7) {
|
||||
if(var1.getBlockMaterial(var5, var6, var7) == Material.water) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
|
||||
Material var6 = var1.getBlockMaterial(var2, var3 + 1, var4);
|
||||
if(var6.isSolid()) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.dirt.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.dirt.idDropped(0, var2);
|
||||
}
|
||||
}
|
27
src/net/minecraft/src/BlockFence.java
Normal file
27
src/net/minecraft/src/BlockFence.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockFence extends Block {
|
||||
public BlockFence(int var1, int var2) {
|
||||
super(var1, var2, Material.wood);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.getBlockId(var2, var3 - 1, var4) == this.blockID ? true : (!var1.getBlockMaterial(var2, var3 - 1, var4).isSolid() ? false : super.canPlaceBlockAt(var1, var2, var3, var4));
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)var2, (double)var3, (double)var4, (double)(var2 + 1), (double)((float)var3 + 1.5F), (double)(var4 + 1));
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 11;
|
||||
}
|
||||
}
|
253
src/net/minecraft/src/BlockFire.java
Normal file
253
src/net/minecraft/src/BlockFire.java
Normal file
|
@ -0,0 +1,253 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFire extends Block {
|
||||
private int[] chanceToEncourageFire = new int[256];
|
||||
private int[] abilityToCatchFire = new int[256];
|
||||
|
||||
protected BlockFire(int var1, int var2) {
|
||||
super(var1, var2, Material.fire);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public void initializeBlock() {
|
||||
this.setBurnRate(Block.planks.blockID, 5, 20);
|
||||
this.setBurnRate(Block.fence.blockID, 5, 20);
|
||||
this.setBurnRate(Block.stairCompactPlanks.blockID, 5, 20);
|
||||
this.setBurnRate(Block.wood.blockID, 5, 5);
|
||||
this.setBurnRate(Block.leaves.blockID, 30, 60);
|
||||
this.setBurnRate(Block.bookShelf.blockID, 30, 20);
|
||||
this.setBurnRate(Block.tnt.blockID, 15, 100);
|
||||
this.setBurnRate(Block.tallGrass.blockID, 60, 100);
|
||||
this.setBurnRate(Block.cloth.blockID, 30, 60);
|
||||
}
|
||||
|
||||
private void setBurnRate(int var1, int var2, int var3) {
|
||||
this.chanceToEncourageFire[var1] = var2;
|
||||
this.abilityToCatchFire[var1] = var3;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 40;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
boolean var6 = var1.getBlockId(var2, var3 - 1, var4) == Block.netherrack.blockID;
|
||||
if(!this.canPlaceBlockAt(var1, var2, var3, var4)) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
if(var6 || !var1.func_27161_C() || !var1.canBlockBeRainedOn(var2, var3, var4) && !var1.canBlockBeRainedOn(var2 - 1, var3, var4) && !var1.canBlockBeRainedOn(var2 + 1, var3, var4) && !var1.canBlockBeRainedOn(var2, var3, var4 - 1) && !var1.canBlockBeRainedOn(var2, var3, var4 + 1)) {
|
||||
int var7 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var7 < 15) {
|
||||
var1.setBlockMetadata(var2, var3, var4, var7 + var5.nextInt(3) / 2);
|
||||
}
|
||||
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
if(!var6 && !this.func_263_h(var1, var2, var3, var4)) {
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4) || var7 > 3) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
} else if(!var6 && !this.canBlockCatchFire(var1, var2, var3 - 1, var4) && var7 == 15 && var5.nextInt(4) == 0) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
this.tryToCatchBlockOnFire(var1, var2 + 1, var3, var4, 300, var5, var7);
|
||||
this.tryToCatchBlockOnFire(var1, var2 - 1, var3, var4, 300, var5, var7);
|
||||
this.tryToCatchBlockOnFire(var1, var2, var3 - 1, var4, 250, var5, var7);
|
||||
this.tryToCatchBlockOnFire(var1, var2, var3 + 1, var4, 250, var5, var7);
|
||||
this.tryToCatchBlockOnFire(var1, var2, var3, var4 - 1, 300, var5, var7);
|
||||
this.tryToCatchBlockOnFire(var1, var2, var3, var4 + 1, 300, var5, var7);
|
||||
|
||||
for(int var8 = var2 - 1; var8 <= var2 + 1; ++var8) {
|
||||
for(int var9 = var4 - 1; var9 <= var4 + 1; ++var9) {
|
||||
for(int var10 = var3 - 1; var10 <= var3 + 4; ++var10) {
|
||||
if(var8 != var2 || var10 != var3 || var9 != var4) {
|
||||
int var11 = 100;
|
||||
if(var10 > var3 + 1) {
|
||||
var11 += (var10 - (var3 + 1)) * 100;
|
||||
}
|
||||
|
||||
int var12 = this.getChanceOfNeighborsEncouragingFire(var1, var8, var10, var9);
|
||||
if(var12 > 0) {
|
||||
int var13 = (var12 + 40) / (var7 + 30);
|
||||
if(var13 > 0 && var5.nextInt(var11) <= var13 && (!var1.func_27161_C() || !var1.canBlockBeRainedOn(var8, var10, var9)) && !var1.canBlockBeRainedOn(var8 - 1, var10, var4) && !var1.canBlockBeRainedOn(var8 + 1, var10, var9) && !var1.canBlockBeRainedOn(var8, var10, var9 - 1) && !var1.canBlockBeRainedOn(var8, var10, var9 + 1)) {
|
||||
int var14 = var7 + var5.nextInt(5) / 4;
|
||||
if(var14 > 15) {
|
||||
var14 = 15;
|
||||
}
|
||||
|
||||
var1.setBlockAndMetadataWithNotify(var8, var10, var9, this.blockID, var14);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void tryToCatchBlockOnFire(World var1, int var2, int var3, int var4, int var5, Random var6, int var7) {
|
||||
int var8 = this.abilityToCatchFire[var1.getBlockId(var2, var3, var4)];
|
||||
if(var6.nextInt(var5) < var8) {
|
||||
boolean var9 = var1.getBlockId(var2, var3, var4) == Block.tnt.blockID;
|
||||
if(var6.nextInt(var7 + 10) < 5 && !var1.canBlockBeRainedOn(var2, var3, var4)) {
|
||||
int var10 = var7 + var6.nextInt(5) / 4;
|
||||
if(var10 > 15) {
|
||||
var10 = 15;
|
||||
}
|
||||
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3, var4, this.blockID, var10);
|
||||
} else {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
if(var9) {
|
||||
Block.tnt.onBlockDestroyedByPlayer(var1, var2, var3, var4, 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean func_263_h(World var1, int var2, int var3, int var4) {
|
||||
return this.canBlockCatchFire(var1, var2 + 1, var3, var4) ? true : (this.canBlockCatchFire(var1, var2 - 1, var3, var4) ? true : (this.canBlockCatchFire(var1, var2, var3 - 1, var4) ? true : (this.canBlockCatchFire(var1, var2, var3 + 1, var4) ? true : (this.canBlockCatchFire(var1, var2, var3, var4 - 1) ? true : this.canBlockCatchFire(var1, var2, var3, var4 + 1)))));
|
||||
}
|
||||
|
||||
private int getChanceOfNeighborsEncouragingFire(World var1, int var2, int var3, int var4) {
|
||||
byte var5 = 0;
|
||||
if(!var1.isAirBlock(var2, var3, var4)) {
|
||||
return 0;
|
||||
} else {
|
||||
int var6 = this.getChanceToEncourageFire(var1, var2 + 1, var3, var4, var5);
|
||||
var6 = this.getChanceToEncourageFire(var1, var2 - 1, var3, var4, var6);
|
||||
var6 = this.getChanceToEncourageFire(var1, var2, var3 - 1, var4, var6);
|
||||
var6 = this.getChanceToEncourageFire(var1, var2, var3 + 1, var4, var6);
|
||||
var6 = this.getChanceToEncourageFire(var1, var2, var3, var4 - 1, var6);
|
||||
var6 = this.getChanceToEncourageFire(var1, var2, var3, var4 + 1, var6);
|
||||
return var6;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCollidable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canBlockCatchFire(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
return this.chanceToEncourageFire[var1.getBlockId(var2, var3, var4)] > 0;
|
||||
}
|
||||
|
||||
public int getChanceToEncourageFire(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = this.chanceToEncourageFire[var1.getBlockId(var2, var3, var4)];
|
||||
return var6 > var5 ? var6 : var5;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2, var3 - 1, var4) || this.func_263_h(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && !this.func_263_h(var1, var2, var3, var4)) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
if(var1.getBlockId(var2, var3 - 1, var4) != Block.obsidian.blockID || !Block.portal.tryToCreatePortal(var1, var2, var3, var4)) {
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && !this.func_263_h(var1, var2, var3, var4)) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var5.nextInt(24) == 0) {
|
||||
var1.playSoundEffect((double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), "fire.fire", 1.0F + var5.nextFloat(), var5.nextFloat() * 0.7F + 0.3F);
|
||||
}
|
||||
|
||||
int var6;
|
||||
float var7;
|
||||
float var8;
|
||||
float var9;
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && !Block.fire.canBlockCatchFire(var1, var2, var3 - 1, var4)) {
|
||||
if(Block.fire.canBlockCatchFire(var1, var2 - 1, var3, var4)) {
|
||||
for(var6 = 0; var6 < 2; ++var6) {
|
||||
var7 = (float)var2 + var5.nextFloat() * 0.1F;
|
||||
var8 = (float)var3 + var5.nextFloat();
|
||||
var9 = (float)var4 + var5.nextFloat();
|
||||
var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
if(Block.fire.canBlockCatchFire(var1, var2 + 1, var3, var4)) {
|
||||
for(var6 = 0; var6 < 2; ++var6) {
|
||||
var7 = (float)(var2 + 1) - var5.nextFloat() * 0.1F;
|
||||
var8 = (float)var3 + var5.nextFloat();
|
||||
var9 = (float)var4 + var5.nextFloat();
|
||||
var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
if(Block.fire.canBlockCatchFire(var1, var2, var3, var4 - 1)) {
|
||||
for(var6 = 0; var6 < 2; ++var6) {
|
||||
var7 = (float)var2 + var5.nextFloat();
|
||||
var8 = (float)var3 + var5.nextFloat();
|
||||
var9 = (float)var4 + var5.nextFloat() * 0.1F;
|
||||
var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
if(Block.fire.canBlockCatchFire(var1, var2, var3, var4 + 1)) {
|
||||
for(var6 = 0; var6 < 2; ++var6) {
|
||||
var7 = (float)var2 + var5.nextFloat();
|
||||
var8 = (float)var3 + var5.nextFloat();
|
||||
var9 = (float)(var4 + 1) - var5.nextFloat() * 0.1F;
|
||||
var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
if(Block.fire.canBlockCatchFire(var1, var2, var3 + 1, var4)) {
|
||||
for(var6 = 0; var6 < 2; ++var6) {
|
||||
var7 = (float)var2 + var5.nextFloat();
|
||||
var8 = (float)(var3 + 1) - var5.nextFloat() * 0.1F;
|
||||
var9 = (float)var4 + var5.nextFloat();
|
||||
var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(var6 = 0; var6 < 3; ++var6) {
|
||||
var7 = (float)var2 + var5.nextFloat();
|
||||
var8 = (float)var3 + var5.nextFloat() * 0.5F + 0.5F;
|
||||
var9 = (float)var4 + var5.nextFloat();
|
||||
var1.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
58
src/net/minecraft/src/BlockFlower.java
Normal file
58
src/net/minecraft/src/BlockFlower.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFlower extends Block {
|
||||
protected BlockFlower(int var1, int var2) {
|
||||
super(var1, Material.plants);
|
||||
this.blockIndexInTexture = var2;
|
||||
this.setTickOnLoad(true);
|
||||
float var3 = 0.2F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 3.0F, 0.5F + var3);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return super.canPlaceBlockAt(var1, var2, var3, var4) && this.canThisPlantGrowOnThisBlockID(var1.getBlockId(var2, var3 - 1, var4));
|
||||
}
|
||||
|
||||
protected boolean canThisPlantGrowOnThisBlockID(int var1) {
|
||||
return var1 == Block.grass.blockID || var1 == Block.dirt.blockID || var1 == Block.tilledField.blockID;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
|
||||
this.func_268_h(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
this.func_268_h(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
protected final void func_268_h(World var1, int var2, int var3, int var4) {
|
||||
if(!this.canBlockStay(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World var1, int var2, int var3, int var4) {
|
||||
return (var1.getFullBlockLightValue(var2, var3, var4) >= 8 || var1.canBlockSeeTheSky(var2, var3, var4)) && this.canThisPlantGrowOnThisBlockID(var1.getBlockId(var2, var3 - 1, var4));
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 1;
|
||||
}
|
||||
}
|
263
src/net/minecraft/src/BlockFlowing.java
Normal file
263
src/net/minecraft/src/BlockFlowing.java
Normal file
|
@ -0,0 +1,263 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFlowing extends BlockFluid {
|
||||
int numAdjacentSources = 0;
|
||||
boolean[] isOptimalFlowDirection = new boolean[4];
|
||||
int[] flowCost = new int[4];
|
||||
|
||||
protected BlockFlowing(int var1, Material var2) {
|
||||
super(var1, var2);
|
||||
}
|
||||
|
||||
private void func_30003_j(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
var1.setBlockAndMetadata(var2, var3, var4, this.blockID + 1, var5);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
var1.markBlockNeedsUpdate(var2, var3, var4);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
int var6 = this.getFlowDecay(var1, var2, var3, var4);
|
||||
byte var7 = 1;
|
||||
if(this.blockMaterial == Material.lava && !var1.worldProvider.isHellWorld) {
|
||||
var7 = 2;
|
||||
}
|
||||
|
||||
boolean var8 = true;
|
||||
int var10;
|
||||
if(var6 > 0) {
|
||||
byte var9 = -100;
|
||||
this.numAdjacentSources = 0;
|
||||
int var12 = this.getSmallestFlowDecay(var1, var2 - 1, var3, var4, var9);
|
||||
var12 = this.getSmallestFlowDecay(var1, var2 + 1, var3, var4, var12);
|
||||
var12 = this.getSmallestFlowDecay(var1, var2, var3, var4 - 1, var12);
|
||||
var12 = this.getSmallestFlowDecay(var1, var2, var3, var4 + 1, var12);
|
||||
var10 = var12 + var7;
|
||||
if(var10 >= 8 || var12 < 0) {
|
||||
var10 = -1;
|
||||
}
|
||||
|
||||
if(this.getFlowDecay(var1, var2, var3 + 1, var4) >= 0) {
|
||||
int var11 = this.getFlowDecay(var1, var2, var3 + 1, var4);
|
||||
if(var11 >= 8) {
|
||||
var10 = var11;
|
||||
} else {
|
||||
var10 = var11 + 8;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.numAdjacentSources >= 2 && this.blockMaterial == Material.water) {
|
||||
if(var1.getBlockMaterial(var2, var3 - 1, var4).isSolid()) {
|
||||
var10 = 0;
|
||||
} else if(var1.getBlockMaterial(var2, var3 - 1, var4) == this.blockMaterial && var1.getBlockMetadata(var2, var3, var4) == 0) {
|
||||
var10 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.blockMaterial == Material.lava && var6 < 8 && var10 < 8 && var10 > var6 && var5.nextInt(4) != 0) {
|
||||
var10 = var6;
|
||||
var8 = false;
|
||||
}
|
||||
|
||||
if(var10 != var6) {
|
||||
var6 = var10;
|
||||
if(var10 < 0) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var10);
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
}
|
||||
} else if(var8) {
|
||||
this.func_30003_j(var1, var2, var3, var4);
|
||||
}
|
||||
} else {
|
||||
this.func_30003_j(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
if(this.liquidCanDisplaceBlock(var1, var2, var3 - 1, var4)) {
|
||||
if(var6 >= 8) {
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3 - 1, var4, this.blockID, var6);
|
||||
} else {
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3 - 1, var4, this.blockID, var6 + 8);
|
||||
}
|
||||
} else if(var6 >= 0 && (var6 == 0 || this.blockBlocksFlow(var1, var2, var3 - 1, var4))) {
|
||||
boolean[] var13 = this.getOptimalFlowDirections(var1, var2, var3, var4);
|
||||
var10 = var6 + var7;
|
||||
if(var6 >= 8) {
|
||||
var10 = 1;
|
||||
}
|
||||
|
||||
if(var10 >= 8) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(var13[0]) {
|
||||
this.flowIntoBlock(var1, var2 - 1, var3, var4, var10);
|
||||
}
|
||||
|
||||
if(var13[1]) {
|
||||
this.flowIntoBlock(var1, var2 + 1, var3, var4, var10);
|
||||
}
|
||||
|
||||
if(var13[2]) {
|
||||
this.flowIntoBlock(var1, var2, var3, var4 - 1, var10);
|
||||
}
|
||||
|
||||
if(var13[3]) {
|
||||
this.flowIntoBlock(var1, var2, var3, var4 + 1, var10);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void flowIntoBlock(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(this.liquidCanDisplaceBlock(var1, var2, var3, var4)) {
|
||||
int var6 = var1.getBlockId(var2, var3, var4);
|
||||
if(var6 > 0) {
|
||||
if(this.blockMaterial == Material.lava) {
|
||||
this.triggerLavaMixEffects(var1, var2, var3, var4);
|
||||
} else {
|
||||
Block.blocksList[var6].dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
}
|
||||
}
|
||||
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3, var4, this.blockID, var5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int calculateFlowCost(World var1, int var2, int var3, int var4, int var5, int var6) {
|
||||
int var7 = 1000;
|
||||
|
||||
for(int var8 = 0; var8 < 4; ++var8) {
|
||||
if((var8 != 0 || var6 != 1) && (var8 != 1 || var6 != 0) && (var8 != 2 || var6 != 3) && (var8 != 3 || var6 != 2)) {
|
||||
int var9 = var2;
|
||||
int var11 = var4;
|
||||
if(var8 == 0) {
|
||||
var9 = var2 - 1;
|
||||
}
|
||||
|
||||
if(var8 == 1) {
|
||||
++var9;
|
||||
}
|
||||
|
||||
if(var8 == 2) {
|
||||
var11 = var4 - 1;
|
||||
}
|
||||
|
||||
if(var8 == 3) {
|
||||
++var11;
|
||||
}
|
||||
|
||||
if(!this.blockBlocksFlow(var1, var9, var3, var11) && (var1.getBlockMaterial(var9, var3, var11) != this.blockMaterial || var1.getBlockMetadata(var9, var3, var11) != 0)) {
|
||||
if(!this.blockBlocksFlow(var1, var9, var3 - 1, var11)) {
|
||||
return var5;
|
||||
}
|
||||
|
||||
if(var5 < 4) {
|
||||
int var12 = this.calculateFlowCost(var1, var9, var3, var11, var5 + 1, var8);
|
||||
if(var12 < var7) {
|
||||
var7 = var12;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return var7;
|
||||
}
|
||||
|
||||
private boolean[] getOptimalFlowDirections(World var1, int var2, int var3, int var4) {
|
||||
int var5;
|
||||
int var6;
|
||||
for(var5 = 0; var5 < 4; ++var5) {
|
||||
this.flowCost[var5] = 1000;
|
||||
var6 = var2;
|
||||
int var8 = var4;
|
||||
if(var5 == 0) {
|
||||
var6 = var2 - 1;
|
||||
}
|
||||
|
||||
if(var5 == 1) {
|
||||
++var6;
|
||||
}
|
||||
|
||||
if(var5 == 2) {
|
||||
var8 = var4 - 1;
|
||||
}
|
||||
|
||||
if(var5 == 3) {
|
||||
++var8;
|
||||
}
|
||||
|
||||
if(!this.blockBlocksFlow(var1, var6, var3, var8) && (var1.getBlockMaterial(var6, var3, var8) != this.blockMaterial || var1.getBlockMetadata(var6, var3, var8) != 0)) {
|
||||
if(!this.blockBlocksFlow(var1, var6, var3 - 1, var8)) {
|
||||
this.flowCost[var5] = 0;
|
||||
} else {
|
||||
this.flowCost[var5] = this.calculateFlowCost(var1, var6, var3, var8, 1, var5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var5 = this.flowCost[0];
|
||||
|
||||
for(var6 = 1; var6 < 4; ++var6) {
|
||||
if(this.flowCost[var6] < var5) {
|
||||
var5 = this.flowCost[var6];
|
||||
}
|
||||
}
|
||||
|
||||
for(var6 = 0; var6 < 4; ++var6) {
|
||||
this.isOptimalFlowDirection[var6] = this.flowCost[var6] == var5;
|
||||
}
|
||||
|
||||
return this.isOptimalFlowDirection;
|
||||
}
|
||||
|
||||
private boolean blockBlocksFlow(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockId(var2, var3, var4);
|
||||
if(var5 != Block.doorWood.blockID && var5 != Block.doorSteel.blockID && var5 != Block.signPost.blockID && var5 != Block.ladder.blockID && var5 != Block.reed.blockID) {
|
||||
if(var5 == 0) {
|
||||
return false;
|
||||
} else {
|
||||
Material var6 = Block.blocksList[var5].blockMaterial;
|
||||
return var6.getIsSolid();
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected int getSmallestFlowDecay(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = this.getFlowDecay(var1, var2, var3, var4);
|
||||
if(var6 < 0) {
|
||||
return var5;
|
||||
} else {
|
||||
if(var6 == 0) {
|
||||
++this.numAdjacentSources;
|
||||
}
|
||||
|
||||
if(var6 >= 8) {
|
||||
var6 = 0;
|
||||
}
|
||||
|
||||
return var5 >= 0 && var6 >= var5 ? var5 : var6;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean liquidCanDisplaceBlock(World var1, int var2, int var3, int var4) {
|
||||
Material var5 = var1.getBlockMaterial(var2, var3, var4);
|
||||
return var5 == this.blockMaterial ? false : (var5 == Material.lava ? false : !this.blockBlocksFlow(var1, var2, var3, var4));
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
if(var1.getBlockId(var2, var3, var4) == this.blockID) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
278
src/net/minecraft/src/BlockFluid.java
Normal file
278
src/net/minecraft/src/BlockFluid.java
Normal file
|
@ -0,0 +1,278 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockFluid extends Block {
|
||||
protected BlockFluid(int var1, Material var2) {
|
||||
super(var1, (var2 == Material.lava ? 14 : 12) * 16 + 13, var2);
|
||||
float var3 = 0.0F;
|
||||
float var4 = 0.0F;
|
||||
this.setBlockBounds(0.0F + var4, 0.0F + var3, 0.0F + var4, 1.0F + var4, 1.0F + var3, 1.0F + var4);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
public static float getPercentAir(int var0) {
|
||||
if(var0 >= 8) {
|
||||
var0 = 0;
|
||||
}
|
||||
|
||||
float var1 = (float)(var0 + 1) / 9.0F;
|
||||
return var1;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 != 0 && var1 != 1 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
protected int getFlowDecay(World var1, int var2, int var3, int var4) {
|
||||
return var1.getBlockMaterial(var2, var3, var4) != this.blockMaterial ? -1 : var1.getBlockMetadata(var2, var3, var4);
|
||||
}
|
||||
|
||||
protected int getEffectiveFlowDecay(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
if(var1.getBlockMaterial(var2, var3, var4) != this.blockMaterial) {
|
||||
return -1;
|
||||
} else {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var5 >= 8) {
|
||||
var5 = 0;
|
||||
}
|
||||
|
||||
return var5;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(int var1, boolean var2) {
|
||||
return var2 && var1 == 0;
|
||||
}
|
||||
|
||||
public boolean getIsBlockSolid(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
Material var6 = var1.getBlockMaterial(var2, var3, var4);
|
||||
return var6 == this.blockMaterial ? false : (var6 == Material.ice ? false : (var5 == 1 ? true : super.getIsBlockSolid(var1, var2, var3, var4, var5)));
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
Material var6 = var1.getBlockMaterial(var2, var3, var4);
|
||||
return var6 == this.blockMaterial ? false : (var6 == Material.ice ? false : (var5 == 1 ? true : super.shouldSideBeRendered(var1, var2, var3, var4, var5)));
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private Vec3D getFlowVector(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
Vec3D var5 = Vec3D.createVector(0.0D, 0.0D, 0.0D);
|
||||
int var6 = this.getEffectiveFlowDecay(var1, var2, var3, var4);
|
||||
|
||||
for(int var7 = 0; var7 < 4; ++var7) {
|
||||
int var8 = var2;
|
||||
int var10 = var4;
|
||||
if(var7 == 0) {
|
||||
var8 = var2 - 1;
|
||||
}
|
||||
|
||||
if(var7 == 1) {
|
||||
var10 = var4 - 1;
|
||||
}
|
||||
|
||||
if(var7 == 2) {
|
||||
++var8;
|
||||
}
|
||||
|
||||
if(var7 == 3) {
|
||||
++var10;
|
||||
}
|
||||
|
||||
int var11 = this.getEffectiveFlowDecay(var1, var8, var3, var10);
|
||||
int var12;
|
||||
if(var11 < 0) {
|
||||
if(!var1.getBlockMaterial(var8, var3, var10).getIsSolid()) {
|
||||
var11 = this.getEffectiveFlowDecay(var1, var8, var3 - 1, var10);
|
||||
if(var11 >= 0) {
|
||||
var12 = var11 - (var6 - 8);
|
||||
var5 = var5.addVector((double)((var8 - var2) * var12), (double)((var3 - var3) * var12), (double)((var10 - var4) * var12));
|
||||
}
|
||||
}
|
||||
} else if(var11 >= 0) {
|
||||
var12 = var11 - var6;
|
||||
var5 = var5.addVector((double)((var8 - var2) * var12), (double)((var3 - var3) * var12), (double)((var10 - var4) * var12));
|
||||
}
|
||||
}
|
||||
|
||||
if(var1.getBlockMetadata(var2, var3, var4) >= 8) {
|
||||
boolean var13 = false;
|
||||
if(var13 || this.getIsBlockSolid(var1, var2, var3, var4 - 1, 2)) {
|
||||
var13 = true;
|
||||
}
|
||||
|
||||
if(var13 || this.getIsBlockSolid(var1, var2, var3, var4 + 1, 3)) {
|
||||
var13 = true;
|
||||
}
|
||||
|
||||
if(var13 || this.getIsBlockSolid(var1, var2 - 1, var3, var4, 4)) {
|
||||
var13 = true;
|
||||
}
|
||||
|
||||
if(var13 || this.getIsBlockSolid(var1, var2 + 1, var3, var4, 5)) {
|
||||
var13 = true;
|
||||
}
|
||||
|
||||
if(var13 || this.getIsBlockSolid(var1, var2, var3 + 1, var4 - 1, 2)) {
|
||||
var13 = true;
|
||||
}
|
||||
|
||||
if(var13 || this.getIsBlockSolid(var1, var2, var3 + 1, var4 + 1, 3)) {
|
||||
var13 = true;
|
||||
}
|
||||
|
||||
if(var13 || this.getIsBlockSolid(var1, var2 - 1, var3 + 1, var4, 4)) {
|
||||
var13 = true;
|
||||
}
|
||||
|
||||
if(var13 || this.getIsBlockSolid(var1, var2 + 1, var3 + 1, var4, 5)) {
|
||||
var13 = true;
|
||||
}
|
||||
|
||||
if(var13) {
|
||||
var5 = var5.normalize().addVector(0.0D, -6.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
var5 = var5.normalize();
|
||||
return var5;
|
||||
}
|
||||
|
||||
public void velocityToAddToEntity(World var1, int var2, int var3, int var4, Entity var5, Vec3D var6) {
|
||||
Vec3D var7 = this.getFlowVector(var1, var2, var3, var4);
|
||||
var6.xCoord += var7.xCoord;
|
||||
var6.yCoord += var7.yCoord;
|
||||
var6.zCoord += var7.zCoord;
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return this.blockMaterial == Material.water ? 5 : (this.blockMaterial == Material.lava ? 30 : 0);
|
||||
}
|
||||
|
||||
public float getBlockBrightness(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
float var5 = var1.getLightBrightness(var2, var3, var4);
|
||||
float var6 = var1.getLightBrightness(var2, var3 + 1, var4);
|
||||
return var5 > var6 ? var5 : var6;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
super.updateTick(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return this.blockMaterial == Material.water ? 1 : 0;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(this.blockMaterial == Material.water && var5.nextInt(64) == 0) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var6 > 0 && var6 < 8) {
|
||||
var1.playSoundEffect((double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), "liquid.water", var5.nextFloat() * 0.25F + 12.0F / 16.0F, var5.nextFloat() * 1.0F + 0.5F);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.blockMaterial == Material.lava && var1.getBlockMaterial(var2, var3 + 1, var4) == Material.air && !var1.isBlockOpaqueCube(var2, var3 + 1, var4) && var5.nextInt(100) == 0) {
|
||||
double var12 = (double)((float)var2 + var5.nextFloat());
|
||||
double var8 = (double)var3 + this.maxY;
|
||||
double var10 = (double)((float)var4 + var5.nextFloat());
|
||||
var1.spawnParticle("lava", var12, var8, var10, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static double func_293_a(IBlockAccess var0, int var1, int var2, int var3, Material var4) {
|
||||
Vec3D var5 = null;
|
||||
if(var4 == Material.water) {
|
||||
var5 = ((BlockFluid)Block.waterMoving).getFlowVector(var0, var1, var2, var3);
|
||||
}
|
||||
|
||||
if(var4 == Material.lava) {
|
||||
var5 = ((BlockFluid)Block.lavaMoving).getFlowVector(var0, var1, var2, var3);
|
||||
}
|
||||
|
||||
return var5.xCoord == 0.0D && var5.zCoord == 0.0D ? -1000.0D : Math.atan2(var5.zCoord, var5.xCoord) - Math.PI * 0.5D;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
this.checkForHarden(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
this.checkForHarden(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
private void checkForHarden(World var1, int var2, int var3, int var4) {
|
||||
if(var1.getBlockId(var2, var3, var4) == this.blockID) {
|
||||
if(this.blockMaterial == Material.lava) {
|
||||
boolean var5 = false;
|
||||
if(var5 || var1.getBlockMaterial(var2, var3, var4 - 1) == Material.water) {
|
||||
var5 = true;
|
||||
}
|
||||
|
||||
if(var5 || var1.getBlockMaterial(var2, var3, var4 + 1) == Material.water) {
|
||||
var5 = true;
|
||||
}
|
||||
|
||||
if(var5 || var1.getBlockMaterial(var2 - 1, var3, var4) == Material.water) {
|
||||
var5 = true;
|
||||
}
|
||||
|
||||
if(var5 || var1.getBlockMaterial(var2 + 1, var3, var4) == Material.water) {
|
||||
var5 = true;
|
||||
}
|
||||
|
||||
if(var5 || var1.getBlockMaterial(var2, var3 + 1, var4) == Material.water) {
|
||||
var5 = true;
|
||||
}
|
||||
|
||||
if(var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var6 == 0) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.obsidian.blockID);
|
||||
} else if(var6 <= 4) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.cobblestone.blockID);
|
||||
}
|
||||
|
||||
this.triggerLavaMixEffects(var1, var2, var3, var4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void triggerLavaMixEffects(World var1, int var2, int var3, int var4) {
|
||||
var1.playSoundEffect((double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), "random.fizz", 0.5F, 2.6F + (var1.rand.nextFloat() - var1.rand.nextFloat()) * 0.8F);
|
||||
|
||||
for(int var5 = 0; var5 < 8; ++var5) {
|
||||
var1.spawnParticle("largesmoke", (double)var2 + Math.random(), (double)var3 + 1.2D, (double)var4 + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
173
src/net/minecraft/src/BlockFurnace.java
Normal file
173
src/net/minecraft/src/BlockFurnace.java
Normal file
|
@ -0,0 +1,173 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFurnace extends BlockContainer {
|
||||
private Random furnaceRand = new Random();
|
||||
private final boolean isActive;
|
||||
private static boolean keepFurnaceInventory = false;
|
||||
|
||||
protected BlockFurnace(int var1, boolean var2) {
|
||||
super(var1, Material.rock);
|
||||
this.isActive = var2;
|
||||
this.blockIndexInTexture = 45;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.stoneOvenIdle.blockID;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
this.setDefaultDirection(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World var1, int var2, int var3, int var4) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var5 = var1.getBlockId(var2, var3, var4 - 1);
|
||||
int var6 = var1.getBlockId(var2, var3, var4 + 1);
|
||||
int var7 = var1.getBlockId(var2 - 1, var3, var4);
|
||||
int var8 = var1.getBlockId(var2 + 1, var3, var4);
|
||||
byte var9 = 3;
|
||||
if(Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) {
|
||||
var9 = 3;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) {
|
||||
var9 = 2;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) {
|
||||
var9 = 5;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) {
|
||||
var9 = 4;
|
||||
}
|
||||
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var9);
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 == 1) {
|
||||
return this.blockIndexInTexture + 17;
|
||||
} else if(var5 == 0) {
|
||||
return this.blockIndexInTexture + 17;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
return var5 != var6 ? this.blockIndexInTexture : (this.isActive ? this.blockIndexInTexture + 16 : this.blockIndexInTexture - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(this.isActive) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
float var7 = (float)var2 + 0.5F;
|
||||
float var8 = (float)var3 + 0.0F + var5.nextFloat() * 6.0F / 16.0F;
|
||||
float var9 = (float)var4 + 0.5F;
|
||||
float var10 = 0.52F;
|
||||
float var11 = var5.nextFloat() * 0.6F - 0.3F;
|
||||
if(var6 == 4) {
|
||||
var1.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 5) {
|
||||
var1.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 2) {
|
||||
var1.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 3) {
|
||||
var1.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture + 17 : (var1 == 0 ? this.blockIndexInTexture + 17 : (var1 == 3 ? this.blockIndexInTexture - 1 : this.blockIndexInTexture));
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
TileEntityFurnace var6 = (TileEntityFurnace)var1.getBlockTileEntity(var2, var3, var4);
|
||||
var5.displayGUIFurnace(var6);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateFurnaceBlockState(boolean var0, World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
TileEntity var6 = var1.getBlockTileEntity(var2, var3, var4);
|
||||
keepFurnaceInventory = true;
|
||||
if(var0) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.stoneOvenActive.blockID);
|
||||
} else {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.stoneOvenIdle.blockID);
|
||||
}
|
||||
|
||||
keepFurnaceInventory = false;
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var5);
|
||||
var6.func_31004_j();
|
||||
var1.setBlockTileEntity(var2, var3, var4, var6);
|
||||
}
|
||||
|
||||
protected TileEntity getBlockEntity() {
|
||||
return new TileEntityFurnace();
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) {
|
||||
int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
if(var6 == 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 2);
|
||||
}
|
||||
|
||||
if(var6 == 1) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 5);
|
||||
}
|
||||
|
||||
if(var6 == 2) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 3);
|
||||
}
|
||||
|
||||
if(var6 == 3) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
if(!keepFurnaceInventory) {
|
||||
TileEntityFurnace var5 = (TileEntityFurnace)var1.getBlockTileEntity(var2, var3, var4);
|
||||
|
||||
for(int var6 = 0; var6 < var5.getSizeInventory(); ++var6) {
|
||||
ItemStack var7 = var5.getStackInSlot(var6);
|
||||
if(var7 != null) {
|
||||
float var8 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
|
||||
float var9 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
|
||||
float var10 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(var7.stackSize > 0) {
|
||||
int var11 = this.furnaceRand.nextInt(21) + 10;
|
||||
if(var11 > var7.stackSize) {
|
||||
var11 = var7.stackSize;
|
||||
}
|
||||
|
||||
var7.stackSize -= var11;
|
||||
EntityItem var12 = new EntityItem(var1, (double)((float)var2 + var8), (double)((float)var3 + var9), (double)((float)var4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage()));
|
||||
float var13 = 0.05F;
|
||||
var12.motionX = (double)((float)this.furnaceRand.nextGaussian() * var13);
|
||||
var12.motionY = (double)((float)this.furnaceRand.nextGaussian() * var13 + 0.2F);
|
||||
var12.motionZ = (double)((float)this.furnaceRand.nextGaussian() * var13);
|
||||
var1.entityJoinedWorld(var12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
}
|
17
src/net/minecraft/src/BlockGlass.java
Normal file
17
src/net/minecraft/src/BlockGlass.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGlass extends BlockBreakable {
|
||||
public BlockGlass(int var1, int var2, Material var3, boolean var4) {
|
||||
super(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return 0;
|
||||
}
|
||||
}
|
17
src/net/minecraft/src/BlockGlowStone.java
Normal file
17
src/net/minecraft/src/BlockGlowStone.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGlowStone extends Block {
|
||||
public BlockGlowStone(int var1, int var2, Material var3) {
|
||||
super(var1, var2, var3);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 2 + var1.nextInt(3);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.lightStoneDust.shiftedIndex;
|
||||
}
|
||||
}
|
54
src/net/minecraft/src/BlockGrass.java
Normal file
54
src/net/minecraft/src/BlockGrass.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGrass extends Block {
|
||||
protected BlockGrass(int var1) {
|
||||
super(var1, Material.grassMaterial);
|
||||
this.blockIndexInTexture = 3;
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 == 1) {
|
||||
return 0;
|
||||
} else if(var5 == 0) {
|
||||
return 2;
|
||||
} else {
|
||||
Material var6 = var1.getBlockMaterial(var2, var3 + 1, var4);
|
||||
return var6 != Material.snow && var6 != Material.builtSnow ? 3 : 68;
|
||||
}
|
||||
}
|
||||
|
||||
public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
var1.getWorldChunkManager().func_4069_a(var2, var4, 1, 1);
|
||||
double var5 = var1.getWorldChunkManager().temperature[0];
|
||||
double var7 = var1.getWorldChunkManager().humidity[0];
|
||||
return ColorizerGrass.getGrassColor(var5, var7);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
if(var1.getBlockLightValue(var2, var3 + 1, var4) < 4 && Block.lightOpacity[var1.getBlockId(var2, var3 + 1, var4)] > 2) {
|
||||
if(var5.nextInt(4) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.dirt.blockID);
|
||||
} else if(var1.getBlockLightValue(var2, var3 + 1, var4) >= 9) {
|
||||
int var6 = var2 + var5.nextInt(3) - 1;
|
||||
int var7 = var3 + var5.nextInt(5) - 3;
|
||||
int var8 = var4 + var5.nextInt(3) - 1;
|
||||
int var9 = var1.getBlockId(var6, var7 + 1, var8);
|
||||
if(var1.getBlockId(var6, var7, var8) == Block.dirt.blockID && var1.getBlockLightValue(var6, var7 + 1, var8) >= 4 && Block.lightOpacity[var9] <= 2) {
|
||||
var1.setBlockWithNotify(var6, var7, var8, Block.grass.blockID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.dirt.idDropped(0, var2);
|
||||
}
|
||||
}
|
13
src/net/minecraft/src/BlockGravel.java
Normal file
13
src/net/minecraft/src/BlockGravel.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGravel extends BlockSand {
|
||||
public BlockGravel(int var1, int var2) {
|
||||
super(var1, var2);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return var2.nextInt(10) == 0 ? Item.flint.shiftedIndex : this.blockID;
|
||||
}
|
||||
}
|
44
src/net/minecraft/src/BlockIce.java
Normal file
44
src/net/minecraft/src/BlockIce.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockIce extends BlockBreakable {
|
||||
public BlockIce(int var1, int var2) {
|
||||
super(var1, var2, Material.ice, false);
|
||||
this.slipperiness = 0.98F;
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return super.shouldSideBeRendered(var1, var2, var3, var4, 1 - var5);
|
||||
}
|
||||
|
||||
public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) {
|
||||
super.harvestBlock(var1, var2, var3, var4, var5, var6);
|
||||
Material var7 = var1.getBlockMaterial(var3, var4 - 1, var5);
|
||||
if(var7.getIsSolid() || var7.getIsLiquid()) {
|
||||
var1.setBlockWithNotify(var3, var4, var5, Block.waterMoving.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var1.getSavedLightValue(EnumSkyBlock.Block, var2, var3, var4) > 11 - Block.lightOpacity[this.blockID]) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.waterStill.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
}
|
65
src/net/minecraft/src/BlockJukeBox.java
Normal file
65
src/net/minecraft/src/BlockJukeBox.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockJukeBox extends BlockContainer {
|
||||
protected BlockJukeBox(int var1, int var2) {
|
||||
super(var1, var2, Material.wood);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return this.blockIndexInTexture + (var1 == 1 ? 1 : 0);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var1.getBlockMetadata(var2, var3, var4) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
this.func_28038_b_(var1, var2, var3, var4);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ejectRecord(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
TileEntityRecordPlayer var6 = (TileEntityRecordPlayer)var1.getBlockTileEntity(var2, var3, var4);
|
||||
var6.record = var5;
|
||||
var6.onInventoryChanged();
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void func_28038_b_(World var1, int var2, int var3, int var4) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
TileEntityRecordPlayer var5 = (TileEntityRecordPlayer)var1.getBlockTileEntity(var2, var3, var4);
|
||||
int var6 = var5.record;
|
||||
if(var6 != 0) {
|
||||
var1.func_28106_e(1005, var2, var3, var4, 0);
|
||||
var1.playRecord((String)null, var2, var3, var4);
|
||||
var5.record = 0;
|
||||
var5.onInventoryChanged();
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 0);
|
||||
float var8 = 0.7F;
|
||||
double var9 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D;
|
||||
double var11 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.2D + 0.6D;
|
||||
double var13 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D;
|
||||
EntityItem var15 = new EntityItem(var1, (double)var2 + var9, (double)var3 + var11, (double)var4 + var13, new ItemStack(var6, 1, 0));
|
||||
var15.delayBeforeCanPickup = 10;
|
||||
var1.entityJoinedWorld(var15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
this.func_28038_b_(var1, var2, var3, var4);
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
super.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
}
|
||||
|
||||
protected TileEntity getBlockEntity() {
|
||||
return new TileEntityRecordPlayer();
|
||||
}
|
||||
}
|
121
src/net/minecraft/src/BlockLadder.java
Normal file
121
src/net/minecraft/src/BlockLadder.java
Normal file
|
@ -0,0 +1,121 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockLadder extends Block {
|
||||
protected BlockLadder(int var1, int var2) {
|
||||
super(var1, var2, Material.circuits);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
float var6 = 2.0F / 16.0F;
|
||||
if(var5 == 2) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - var6, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(var5 == 3) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var6);
|
||||
}
|
||||
|
||||
if(var5 == 4) {
|
||||
this.setBlockBounds(1.0F - var6, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(var5 == 5) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, var6, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return super.getCollisionBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
float var6 = 2.0F / 16.0F;
|
||||
if(var5 == 2) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - var6, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(var5 == 3) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var6);
|
||||
}
|
||||
|
||||
if(var5 == 4) {
|
||||
this.setBlockBounds(1.0F - var6, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(var5 == 5) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, var6, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return super.getSelectedBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2 - 1, var3, var4) ? true : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : var1.isBlockNormalCube(var2, var3, var4 + 1)));
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 == 0 || var5 == 2) && var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
var6 = 2;
|
||||
}
|
||||
|
||||
if((var6 == 0 || var5 == 3) && var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
var6 = 3;
|
||||
}
|
||||
|
||||
if((var6 == 0 || var5 == 4) && var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
var6 = 4;
|
||||
}
|
||||
|
||||
if((var6 == 0 || var5 == 5) && var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
var6 = 5;
|
||||
}
|
||||
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6);
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
boolean var7 = false;
|
||||
if(var6 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(var6 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(var6 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(var6 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var7) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var6);
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 1;
|
||||
}
|
||||
}
|
189
src/net/minecraft/src/BlockLeaves.java
Normal file
189
src/net/minecraft/src/BlockLeaves.java
Normal file
|
@ -0,0 +1,189 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockLeaves extends BlockLeavesBase {
|
||||
private int baseIndexInPNG;
|
||||
int[] adjacentTreeBlocks;
|
||||
|
||||
protected BlockLeaves(int var1, int var2) {
|
||||
super(var1, var2, Material.leaves, false);
|
||||
this.baseIndexInPNG = var2;
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public int getRenderColor(int var1) {
|
||||
return (var1 & 1) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((var1 & 2) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.func_31073_c());
|
||||
}
|
||||
|
||||
public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var5 & 1) == 1) {
|
||||
return ColorizerFoliage.getFoliageColorPine();
|
||||
} else if((var5 & 2) == 2) {
|
||||
return ColorizerFoliage.getFoliageColorBirch();
|
||||
} else {
|
||||
var1.getWorldChunkManager().func_4069_a(var2, var4, 1, 1);
|
||||
double var6 = var1.getWorldChunkManager().temperature[0];
|
||||
double var8 = var1.getWorldChunkManager().humidity[0];
|
||||
return ColorizerFoliage.getFoliageColor(var6, var8);
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
byte var5 = 1;
|
||||
int var6 = var5 + 1;
|
||||
if(var1.checkChunksExist(var2 - var6, var3 - var6, var4 - var6, var2 + var6, var3 + var6, var4 + var6)) {
|
||||
for(int var7 = -var5; var7 <= var5; ++var7) {
|
||||
for(int var8 = -var5; var8 <= var5; ++var8) {
|
||||
for(int var9 = -var5; var9 <= var5; ++var9) {
|
||||
int var10 = var1.getBlockId(var2 + var7, var3 + var8, var4 + var9);
|
||||
if(var10 == Block.leaves.blockID) {
|
||||
int var11 = var1.getBlockMetadata(var2 + var7, var3 + var8, var4 + var9);
|
||||
var1.setBlockMetadata(var2 + var7, var3 + var8, var4 + var9, var11 | 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) != 0) {
|
||||
byte var7 = 4;
|
||||
int var8 = var7 + 1;
|
||||
byte var9 = 32;
|
||||
int var10 = var9 * var9;
|
||||
int var11 = var9 / 2;
|
||||
if(this.adjacentTreeBlocks == null) {
|
||||
this.adjacentTreeBlocks = new int[var9 * var9 * var9];
|
||||
}
|
||||
|
||||
int var12;
|
||||
if(var1.checkChunksExist(var2 - var8, var3 - var8, var4 - var8, var2 + var8, var3 + var8, var4 + var8)) {
|
||||
var12 = -var7;
|
||||
|
||||
label111:
|
||||
while(true) {
|
||||
int var13;
|
||||
int var14;
|
||||
int var15;
|
||||
if(var12 > var7) {
|
||||
var12 = 1;
|
||||
|
||||
while(true) {
|
||||
if(var12 > 4) {
|
||||
break label111;
|
||||
}
|
||||
|
||||
for(var13 = -var7; var13 <= var7; ++var13) {
|
||||
for(var14 = -var7; var14 <= var7; ++var14) {
|
||||
for(var15 = -var7; var15 <= var7; ++var15) {
|
||||
if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11] == var12 - 1) {
|
||||
if(this.adjacentTreeBlocks[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2) {
|
||||
this.adjacentTreeBlocks[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12;
|
||||
}
|
||||
|
||||
if(this.adjacentTreeBlocks[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2) {
|
||||
this.adjacentTreeBlocks[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12;
|
||||
}
|
||||
|
||||
if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] == -2) {
|
||||
this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] = var12;
|
||||
}
|
||||
|
||||
if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] == -2) {
|
||||
this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] = var12;
|
||||
}
|
||||
|
||||
if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] == -2) {
|
||||
this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] = var12;
|
||||
}
|
||||
|
||||
if(this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] == -2) {
|
||||
this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] = var12;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++var12;
|
||||
}
|
||||
}
|
||||
|
||||
for(var13 = -var7; var13 <= var7; ++var13) {
|
||||
for(var14 = -var7; var14 <= var7; ++var14) {
|
||||
var15 = var1.getBlockId(var2 + var12, var3 + var13, var4 + var14);
|
||||
if(var15 == Block.wood.blockID) {
|
||||
this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0;
|
||||
} else if(var15 == Block.leaves.blockID) {
|
||||
this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2;
|
||||
} else {
|
||||
this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++var12;
|
||||
}
|
||||
}
|
||||
|
||||
var12 = this.adjacentTreeBlocks[var11 * var10 + var11 * var9 + var11];
|
||||
if(var12 >= 0) {
|
||||
var1.setBlockMetadata(var2, var3, var4, var6 & -9);
|
||||
} else {
|
||||
this.removeLeaves(var1, var2, var3, var4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void removeLeaves(World var1, int var2, int var3, int var4) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return var1.nextInt(20) == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.sapling.blockID;
|
||||
}
|
||||
|
||||
public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) {
|
||||
if(!var1.multiplayerWorld && var2.getCurrentEquippedItem() != null && var2.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) {
|
||||
var2.addStat(StatList.mineBlockStatArray[this.blockID], 1);
|
||||
this.dropBlockAsItem_do(var1, var3, var4, var5, new ItemStack(Block.leaves.blockID, 1, var6 & 3));
|
||||
} else {
|
||||
super.harvestBlock(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected int damageDropped(int var1) {
|
||||
return var1 & 3;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return !this.graphicsLevel;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return (var2 & 3) == 1 ? this.blockIndexInTexture + 80 : this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
public void setGraphicsLevel(boolean var1) {
|
||||
this.graphicsLevel = var1;
|
||||
this.blockIndexInTexture = this.baseIndexInPNG + (var1 ? 0 : 1);
|
||||
}
|
||||
|
||||
public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
super.onEntityWalking(var1, var2, var3, var4, var5);
|
||||
}
|
||||
}
|
19
src/net/minecraft/src/BlockLeavesBase.java
Normal file
19
src/net/minecraft/src/BlockLeavesBase.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockLeavesBase extends Block {
|
||||
protected boolean graphicsLevel;
|
||||
|
||||
protected BlockLeavesBase(int var1, int var2, Material var3, boolean var4) {
|
||||
super(var1, var2, var3);
|
||||
this.graphicsLevel = var4;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockId(var2, var3, var4);
|
||||
return !this.graphicsLevel && var6 == this.blockID ? false : super.shouldSideBeRendered(var1, var2, var3, var4, var5);
|
||||
}
|
||||
}
|
198
src/net/minecraft/src/BlockLever.java
Normal file
198
src/net/minecraft/src/BlockLever.java
Normal file
|
@ -0,0 +1,198 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockLever extends Block {
|
||||
protected BlockLever(int var1, int var2) {
|
||||
super(var1, var2, Material.circuits);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) {
|
||||
return var5 == 1 && var1.isBlockNormalCube(var2, var3 - 1, var4) ? true : (var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1) ? true : (var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : (var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4))));
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2 - 1, var3, var4) ? true : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : (var1.isBlockNormalCube(var2, var3, var4 + 1) ? true : var1.isBlockNormalCube(var2, var3 - 1, var4))));
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var6 & 8;
|
||||
var6 &= 7;
|
||||
var6 = -1;
|
||||
if(var5 == 1 && var1.isBlockNormalCube(var2, var3 - 1, var4)) {
|
||||
var6 = 5 + var1.rand.nextInt(2);
|
||||
}
|
||||
|
||||
if(var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
var6 = 4;
|
||||
}
|
||||
|
||||
if(var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
var6 = 3;
|
||||
}
|
||||
|
||||
if(var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
var6 = 2;
|
||||
}
|
||||
|
||||
if(var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
var6 = 1;
|
||||
}
|
||||
|
||||
if(var6 == -1) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 + var7);
|
||||
}
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(this.checkIfAttachedToBlock(var1, var2, var3, var4)) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4) & 7;
|
||||
boolean var7 = false;
|
||||
if(!var1.isBlockNormalCube(var2 - 1, var3, var4) && var6 == 1) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2 + 1, var3, var4) && var6 == 2) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3, var4 - 1) && var6 == 3) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3, var4 + 1) && var6 == 4) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && var6 == 5) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4) && var6 == 6) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(var7) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean checkIfAttachedToBlock(World var1, int var2, int var3, int var4) {
|
||||
if(!this.canPlaceBlockAt(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4) & 7;
|
||||
float var6 = 3.0F / 16.0F;
|
||||
if(var5 == 1) {
|
||||
this.setBlockBounds(0.0F, 0.2F, 0.5F - var6, var6 * 2.0F, 0.8F, 0.5F + var6);
|
||||
} else if(var5 == 2) {
|
||||
this.setBlockBounds(1.0F - var6 * 2.0F, 0.2F, 0.5F - var6, 1.0F, 0.8F, 0.5F + var6);
|
||||
} else if(var5 == 3) {
|
||||
this.setBlockBounds(0.5F - var6, 0.2F, 0.0F, 0.5F + var6, 0.8F, var6 * 2.0F);
|
||||
} else if(var5 == 4) {
|
||||
this.setBlockBounds(0.5F - var6, 0.2F, 1.0F - var6 * 2.0F, 0.5F + var6, 0.8F, 1.0F);
|
||||
} else {
|
||||
var6 = 0.25F;
|
||||
this.setBlockBounds(0.5F - var6, 0.0F, 0.5F - var6, 0.5F + var6, 0.6F, 0.5F + var6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.blockActivated(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var6 & 7;
|
||||
int var8 = 8 - (var6 & 8);
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var7 + var8);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "random.click", 0.3F, var8 > 0 ? 0.6F : 0.5F);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
if(var7 == 1) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
} else if(var7 == 2) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
} else if(var7 == 3) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
} else if(var7 == 4) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
} else {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var5 & 8) > 0) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
int var6 = var5 & 7;
|
||||
if(var6 == 1) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
} else if(var6 == 2) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
} else if(var6 == 3) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
} else if(var6 == 4) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
} else {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return (var1.getBlockMetadata(var2, var3, var4) & 8) > 0;
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
int var7 = var6 & 7;
|
||||
return var7 == 6 && var5 == 1 ? true : (var7 == 5 && var5 == 1 ? true : (var7 == 4 && var5 == 2 ? true : (var7 == 3 && var5 == 3 ? true : (var7 == 2 && var5 == 4 ? true : var7 == 1 && var5 == 5))));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
}
|
53
src/net/minecraft/src/BlockLockedChest.java
Normal file
53
src/net/minecraft/src/BlockLockedChest.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockLockedChest extends Block {
|
||||
protected BlockLockedChest(int var1) {
|
||||
super(var1, Material.wood);
|
||||
this.blockIndexInTexture = 26;
|
||||
}
|
||||
|
||||
public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 == 1) {
|
||||
return this.blockIndexInTexture - 1;
|
||||
} else if(var5 == 0) {
|
||||
return this.blockIndexInTexture - 1;
|
||||
} else {
|
||||
int var6 = var1.getBlockId(var2, var3, var4 - 1);
|
||||
int var7 = var1.getBlockId(var2, var3, var4 + 1);
|
||||
int var8 = var1.getBlockId(var2 - 1, var3, var4);
|
||||
int var9 = var1.getBlockId(var2 + 1, var3, var4);
|
||||
byte var10 = 3;
|
||||
if(Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var7]) {
|
||||
var10 = 3;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var6]) {
|
||||
var10 = 2;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var9]) {
|
||||
var10 = 5;
|
||||
}
|
||||
|
||||
if(Block.opaqueCubeLookup[var9] && !Block.opaqueCubeLookup[var8]) {
|
||||
var10 = 4;
|
||||
}
|
||||
|
||||
return var5 == var10 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture - 1 : (var1 == 0 ? this.blockIndexInTexture - 1 : (var1 == 3 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture));
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
}
|
51
src/net/minecraft/src/BlockLog.java
Normal file
51
src/net/minecraft/src/BlockLog.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockLog extends Block {
|
||||
protected BlockLog(int var1) {
|
||||
super(var1, Material.wood);
|
||||
this.blockIndexInTexture = 20;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.wood.blockID;
|
||||
}
|
||||
|
||||
public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) {
|
||||
super.harvestBlock(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
byte var5 = 4;
|
||||
int var6 = var5 + 1;
|
||||
if(var1.checkChunksExist(var2 - var6, var3 - var6, var4 - var6, var2 + var6, var3 + var6, var4 + var6)) {
|
||||
for(int var7 = -var5; var7 <= var5; ++var7) {
|
||||
for(int var8 = -var5; var8 <= var5; ++var8) {
|
||||
for(int var9 = -var5; var9 <= var5; ++var9) {
|
||||
int var10 = var1.getBlockId(var2 + var7, var3 + var8, var4 + var9);
|
||||
if(var10 == Block.leaves.blockID) {
|
||||
int var11 = var1.getBlockMetadata(var2 + var7, var3 + var8, var4 + var9);
|
||||
if((var11 & 8) == 0) {
|
||||
var1.setBlockMetadata(var2 + var7, var3 + var8, var4 + var9, var11 | 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return var1 == 1 ? 21 : (var1 == 0 ? 21 : (var2 == 1 ? 116 : (var2 == 2 ? 117 : 20)));
|
||||
}
|
||||
|
||||
protected int damageDropped(int var1) {
|
||||
return var1;
|
||||
}
|
||||
}
|
25
src/net/minecraft/src/BlockMobSpawner.java
Normal file
25
src/net/minecraft/src/BlockMobSpawner.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockMobSpawner extends BlockContainer {
|
||||
protected BlockMobSpawner(int var1, int var2) {
|
||||
super(var1, var2, Material.rock);
|
||||
}
|
||||
|
||||
protected TileEntity getBlockEntity() {
|
||||
return new TileEntityMobSpawner();
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
}
|
36
src/net/minecraft/src/BlockMushroom.java
Normal file
36
src/net/minecraft/src/BlockMushroom.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockMushroom extends BlockFlower {
|
||||
protected BlockMushroom(int var1, int var2) {
|
||||
super(var1, var2);
|
||||
float var3 = 0.2F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 2.0F, 0.5F + var3);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var5.nextInt(100) == 0) {
|
||||
int var6 = var2 + var5.nextInt(3) - 1;
|
||||
int var7 = var3 + var5.nextInt(2) - var5.nextInt(2);
|
||||
int var8 = var4 + var5.nextInt(3) - 1;
|
||||
if(var1.isAirBlock(var6, var7, var8) && this.canBlockStay(var1, var6, var7, var8)) {
|
||||
int var10000 = var2 + (var5.nextInt(3) - 1);
|
||||
var10000 = var4 + (var5.nextInt(3) - 1);
|
||||
if(var1.isAirBlock(var6, var7, var8) && this.canBlockStay(var1, var6, var7, var8)) {
|
||||
var1.setBlockWithNotify(var6, var7, var8, this.blockID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected boolean canThisPlantGrowOnThisBlockID(int var1) {
|
||||
return Block.opaqueCubeLookup[var1];
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World var1, int var2, int var3, int var4) {
|
||||
return var3 >= 0 && var3 < 128 ? var1.getFullBlockLightValue(var2, var3, var4) < 13 && this.canThisPlantGrowOnThisBlockID(var1.getBlockId(var2, var3 - 1, var4)) : false;
|
||||
}
|
||||
}
|
7
src/net/minecraft/src/BlockNetherrack.java
Normal file
7
src/net/minecraft/src/BlockNetherrack.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockNetherrack extends Block {
|
||||
public BlockNetherrack(int var1, int var2) {
|
||||
super(var1, var2, Material.rock);
|
||||
}
|
||||
}
|
71
src/net/minecraft/src/BlockNote.java
Normal file
71
src/net/minecraft/src/BlockNote.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockNote extends BlockContainer {
|
||||
public BlockNote(int var1) {
|
||||
super(var1, 74, Material.wood);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 > 0 && Block.blocksList[var5].canProvidePower()) {
|
||||
boolean var6 = var1.isBlockGettingPowered(var2, var3, var4);
|
||||
TileEntityNote var7 = (TileEntityNote)var1.getBlockTileEntity(var2, var3, var4);
|
||||
if(var7.previousRedstoneState != var6) {
|
||||
if(var6) {
|
||||
var7.triggerNote(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
var7.previousRedstoneState = var6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
TileEntityNote var6 = (TileEntityNote)var1.getBlockTileEntity(var2, var3, var4);
|
||||
var6.changePitch();
|
||||
var6.triggerNote(var1, var2, var3, var4);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
TileEntityNote var6 = (TileEntityNote)var1.getBlockTileEntity(var2, var3, var4);
|
||||
var6.triggerNote(var1, var2, var3, var4);
|
||||
}
|
||||
}
|
||||
|
||||
protected TileEntity getBlockEntity() {
|
||||
return new TileEntityNote();
|
||||
}
|
||||
|
||||
public void playBlock(World var1, int var2, int var3, int var4, int var5, int var6) {
|
||||
float var7 = (float)Math.pow(2.0D, (double)(var6 - 12) / 12.0D);
|
||||
String var8 = "harp";
|
||||
if(var5 == 1) {
|
||||
var8 = "bd";
|
||||
}
|
||||
|
||||
if(var5 == 2) {
|
||||
var8 = "snare";
|
||||
}
|
||||
|
||||
if(var5 == 3) {
|
||||
var8 = "hat";
|
||||
}
|
||||
|
||||
if(var5 == 4) {
|
||||
var8 = "bassattack";
|
||||
}
|
||||
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "note." + var8, 3.0F, var7);
|
||||
var1.spawnParticle("note", (double)var2 + 0.5D, (double)var3 + 1.2D, (double)var4 + 0.5D, (double)var6 / 24.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
17
src/net/minecraft/src/BlockObsidian.java
Normal file
17
src/net/minecraft/src/BlockObsidian.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockObsidian extends BlockStone {
|
||||
public BlockObsidian(int var1, int var2) {
|
||||
super(var1, var2);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.obsidian.blockID;
|
||||
}
|
||||
}
|
21
src/net/minecraft/src/BlockOre.java
Normal file
21
src/net/minecraft/src/BlockOre.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockOre extends Block {
|
||||
public BlockOre(int var1, int var2) {
|
||||
super(var1, var2, Material.rock);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return this.blockID == Block.oreCoal.blockID ? Item.coal.shiftedIndex : (this.blockID == Block.oreDiamond.blockID ? Item.diamond.shiftedIndex : (this.blockID == Block.oreLapis.blockID ? Item.dyePowder.shiftedIndex : this.blockID));
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return this.blockID == Block.oreLapis.blockID ? 4 + var1.nextInt(5) : 1;
|
||||
}
|
||||
|
||||
protected int damageDropped(int var1) {
|
||||
return this.blockID == Block.oreLapis.blockID ? 4 : 0;
|
||||
}
|
||||
}
|
12
src/net/minecraft/src/BlockOreStorage.java
Normal file
12
src/net/minecraft/src/BlockOreStorage.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockOreStorage extends Block {
|
||||
public BlockOreStorage(int var1, int var2) {
|
||||
super(var1, Material.iron);
|
||||
this.blockIndexInTexture = var2;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
}
|
329
src/net/minecraft/src/BlockPistonBase.java
Normal file
329
src/net/minecraft/src/BlockPistonBase.java
Normal file
|
@ -0,0 +1,329 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlockPistonBase extends Block {
|
||||
private boolean isSticky;
|
||||
private boolean field_31048_b;
|
||||
|
||||
public BlockPistonBase(int var1, int var2, boolean var3) {
|
||||
super(var1, var2, Material.field_31067_B);
|
||||
this.isSticky = var3;
|
||||
this.setStepSound(soundStoneFootstep);
|
||||
this.setHardness(0.5F);
|
||||
}
|
||||
|
||||
public int func_31040_i() {
|
||||
return this.isSticky ? 106 : 107;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
int var3 = func_31044_d(var2);
|
||||
return var3 > 5 ? this.blockIndexInTexture : (var1 == var3 ? (!isPowered(var2) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.blockIndexInTexture : 110) : (var1 == PistonBlockTextures.field_31057_a[var3] ? 109 : 108));
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) {
|
||||
int var6 = func_31039_c(var1, var2, var3, var4, (EntityPlayer)var5);
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6);
|
||||
if(!var1.multiplayerWorld) {
|
||||
this.func_31043_h(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!var1.multiplayerWorld && !this.field_31048_b) {
|
||||
this.func_31043_h(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
if(!var1.multiplayerWorld && var1.getBlockTileEntity(var2, var3, var4) == null) {
|
||||
this.func_31043_h(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void func_31043_h(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var6 = func_31044_d(var5);
|
||||
boolean var7 = this.func_31041_f(var1, var2, var3, var4, var6);
|
||||
if(var5 != 7) {
|
||||
if(var7 && !isPowered(var5)) {
|
||||
if(func_31045_h(var1, var2, var3, var4, var6)) {
|
||||
var1.setBlockMetadata(var2, var3, var4, var6 | 8);
|
||||
var1.playNoteAt(var2, var3, var4, 0, var6);
|
||||
}
|
||||
} else if(!var7 && isPowered(var5)) {
|
||||
var1.setBlockMetadata(var2, var3, var4, var6);
|
||||
var1.playNoteAt(var2, var3, var4, 1, var6);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean func_31041_f(World var1, int var2, int var3, int var4, int var5) {
|
||||
return var5 != 0 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3 - 1, var4, 0) ? true : (var5 != 1 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3 + 1, var4, 1) ? true : (var5 != 2 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 - 1, 2) ? true : (var5 != 3 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 + 1, 3) ? true : (var5 != 5 && var1.isBlockIndirectlyProvidingPowerTo(var2 + 1, var3, var4, 5) ? true : (var5 != 4 && var1.isBlockIndirectlyProvidingPowerTo(var2 - 1, var3, var4, 4) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4, 0) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2, var3 + 2, var4, 1) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2, var3 + 1, var4 - 1, 2) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2, var3 + 1, var4 + 1, 3) ? true : (var1.isBlockIndirectlyProvidingPowerTo(var2 - 1, var3 + 1, var4, 4) ? true : var1.isBlockIndirectlyProvidingPowerTo(var2 + 1, var3 + 1, var4, 5)))))))))));
|
||||
}
|
||||
|
||||
public void playBlock(World var1, int var2, int var3, int var4, int var5, int var6) {
|
||||
this.field_31048_b = true;
|
||||
if(var5 == 0) {
|
||||
if(this.func_31047_i(var1, var2, var3, var4, var6)) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 | 8);
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "tile.piston.out", 0.5F, var1.rand.nextFloat() * 0.25F + 0.6F);
|
||||
}
|
||||
} else if(var5 == 1) {
|
||||
TileEntity var8 = var1.getBlockTileEntity(var2 + PistonBlockTextures.field_31056_b[var6], var3 + PistonBlockTextures.field_31059_c[var6], var4 + PistonBlockTextures.field_31058_d[var6]);
|
||||
if(var8 != null && var8 instanceof TileEntityPiston) {
|
||||
((TileEntityPiston)var8).func_31011_l();
|
||||
}
|
||||
|
||||
var1.setBlockAndMetadata(var2, var3, var4, Block.pistonMoving.blockID, var6);
|
||||
var1.setBlockTileEntity(var2, var3, var4, BlockPistonMoving.func_31036_a(this.blockID, var6, var6, false, true));
|
||||
if(this.isSticky) {
|
||||
int var9 = var2 + PistonBlockTextures.field_31056_b[var6] * 2;
|
||||
int var10 = var3 + PistonBlockTextures.field_31059_c[var6] * 2;
|
||||
int var11 = var4 + PistonBlockTextures.field_31058_d[var6] * 2;
|
||||
int var12 = var1.getBlockId(var9, var10, var11);
|
||||
int var13 = var1.getBlockMetadata(var9, var10, var11);
|
||||
boolean var14 = false;
|
||||
if(var12 == Block.pistonMoving.blockID) {
|
||||
TileEntity var15 = var1.getBlockTileEntity(var9, var10, var11);
|
||||
if(var15 != null && var15 instanceof TileEntityPiston) {
|
||||
TileEntityPiston var16 = (TileEntityPiston)var15;
|
||||
if(var16.func_31009_d() == var6 && var16.func_31015_b()) {
|
||||
var16.func_31011_l();
|
||||
var12 = var16.getStoredBlockID();
|
||||
var13 = var16.getBlockMetadata();
|
||||
var14 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(var14 || var12 <= 0 || !canPushBlock(var12, var1, var9, var10, var11, false) || Block.blocksList[var12].getMobilityFlag() != 0 && var12 != Block.pistonBase.blockID && var12 != Block.pistonStickyBase.blockID) {
|
||||
if(!var14) {
|
||||
this.field_31048_b = false;
|
||||
var1.setBlockWithNotify(var2 + PistonBlockTextures.field_31056_b[var6], var3 + PistonBlockTextures.field_31059_c[var6], var4 + PistonBlockTextures.field_31058_d[var6], 0);
|
||||
this.field_31048_b = true;
|
||||
}
|
||||
} else {
|
||||
this.field_31048_b = false;
|
||||
var1.setBlockWithNotify(var9, var10, var11, 0);
|
||||
this.field_31048_b = true;
|
||||
var2 += PistonBlockTextures.field_31056_b[var6];
|
||||
var3 += PistonBlockTextures.field_31059_c[var6];
|
||||
var4 += PistonBlockTextures.field_31058_d[var6];
|
||||
var1.setBlockAndMetadata(var2, var3, var4, Block.pistonMoving.blockID, var13);
|
||||
var1.setBlockTileEntity(var2, var3, var4, BlockPistonMoving.func_31036_a(var12, var13, var6, false, false));
|
||||
}
|
||||
} else {
|
||||
this.field_31048_b = false;
|
||||
var1.setBlockWithNotify(var2 + PistonBlockTextures.field_31056_b[var6], var3 + PistonBlockTextures.field_31059_c[var6], var4 + PistonBlockTextures.field_31058_d[var6], 0);
|
||||
this.field_31048_b = true;
|
||||
}
|
||||
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "tile.piston.in", 0.5F, var1.rand.nextFloat() * 0.15F + 0.6F);
|
||||
}
|
||||
|
||||
this.field_31048_b = false;
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(isPowered(var5)) {
|
||||
switch(func_31044_d(var5)) {
|
||||
case 0:
|
||||
this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 1:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 12.0F / 16.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 12.0F / 16.0F);
|
||||
break;
|
||||
case 4:
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 12.0F / 16.0F, 1.0F, 1.0F);
|
||||
}
|
||||
} else {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender() {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int func_31044_d(int var0) {
|
||||
return var0 & 7;
|
||||
}
|
||||
|
||||
public static boolean isPowered(int var0) {
|
||||
return (var0 & 8) != 0;
|
||||
}
|
||||
|
||||
private static int func_31039_c(World var0, int var1, int var2, int var3, EntityPlayer var4) {
|
||||
if(MathHelper.abs((float)var4.posX - (float)var1) < 2.0F && MathHelper.abs((float)var4.posZ - (float)var3) < 2.0F) {
|
||||
double var5 = var4.posY + 1.82D - (double)var4.yOffset;
|
||||
if(var5 - (double)var2 > 2.0D) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if((double)var2 - var5 > 0.0D) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int var7 = MathHelper.floor_double((double)(var4.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
return var7 == 0 ? 2 : (var7 == 1 ? 5 : (var7 == 2 ? 3 : (var7 == 3 ? 4 : 0)));
|
||||
}
|
||||
|
||||
private static boolean canPushBlock(int var0, World var1, int var2, int var3, int var4, boolean var5) {
|
||||
if(var0 == Block.obsidian.blockID) {
|
||||
return false;
|
||||
} else {
|
||||
if(var0 != Block.pistonBase.blockID && var0 != Block.pistonStickyBase.blockID) {
|
||||
if(Block.blocksList[var0].getHardness() == -1.0F) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Block.blocksList[var0].getMobilityFlag() == 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!var5 && Block.blocksList[var0].getMobilityFlag() == 1) {
|
||||
return false;
|
||||
}
|
||||
} else if(isPowered(var1.getBlockMetadata(var2, var3, var4))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity var6 = var1.getBlockTileEntity(var2, var3, var4);
|
||||
return var6 == null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean func_31045_h(World var0, int var1, int var2, int var3, int var4) {
|
||||
int var5 = var1 + PistonBlockTextures.field_31056_b[var4];
|
||||
int var6 = var2 + PistonBlockTextures.field_31059_c[var4];
|
||||
int var7 = var3 + PistonBlockTextures.field_31058_d[var4];
|
||||
int var8 = 0;
|
||||
|
||||
while(true) {
|
||||
if(var8 < 13) {
|
||||
if(var6 <= 0 || var6 >= 127) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int var9 = var0.getBlockId(var5, var6, var7);
|
||||
if(var9 != 0) {
|
||||
if(!canPushBlock(var9, var0, var5, var6, var7, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Block.blocksList[var9].getMobilityFlag() != 1) {
|
||||
if(var8 == 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var5 += PistonBlockTextures.field_31056_b[var4];
|
||||
var6 += PistonBlockTextures.field_31059_c[var4];
|
||||
var7 += PistonBlockTextures.field_31058_d[var4];
|
||||
++var8;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean func_31047_i(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var2 + PistonBlockTextures.field_31056_b[var5];
|
||||
int var7 = var3 + PistonBlockTextures.field_31059_c[var5];
|
||||
int var8 = var4 + PistonBlockTextures.field_31058_d[var5];
|
||||
int var9 = 0;
|
||||
|
||||
while(true) {
|
||||
int var10;
|
||||
if(var9 < 13) {
|
||||
if(var7 <= 0 || var7 >= 127) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var10 = var1.getBlockId(var6, var7, var8);
|
||||
if(var10 != 0) {
|
||||
if(!canPushBlock(var10, var1, var6, var7, var8, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Block.blocksList[var10].getMobilityFlag() != 1) {
|
||||
if(var9 == 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var6 += PistonBlockTextures.field_31056_b[var5];
|
||||
var7 += PistonBlockTextures.field_31059_c[var5];
|
||||
var8 += PistonBlockTextures.field_31058_d[var5];
|
||||
++var9;
|
||||
continue;
|
||||
}
|
||||
|
||||
Block.blocksList[var10].dropBlockAsItem(var1, var6, var7, var8, var1.getBlockMetadata(var6, var7, var8));
|
||||
var1.setBlockWithNotify(var6, var7, var8, 0);
|
||||
}
|
||||
}
|
||||
|
||||
while(var6 != var2 || var7 != var3 || var8 != var4) {
|
||||
var9 = var6 - PistonBlockTextures.field_31056_b[var5];
|
||||
var10 = var7 - PistonBlockTextures.field_31059_c[var5];
|
||||
int var11 = var8 - PistonBlockTextures.field_31058_d[var5];
|
||||
int var12 = var1.getBlockId(var9, var10, var11);
|
||||
int var13 = var1.getBlockMetadata(var9, var10, var11);
|
||||
if(var12 == this.blockID && var9 == var2 && var10 == var3 && var11 == var4) {
|
||||
var1.setBlockAndMetadata(var6, var7, var8, Block.pistonMoving.blockID, var5 | (this.isSticky ? 8 : 0));
|
||||
var1.setBlockTileEntity(var6, var7, var8, BlockPistonMoving.func_31036_a(Block.pistonExtension.blockID, var5 | (this.isSticky ? 8 : 0), var5, true, false));
|
||||
} else {
|
||||
var1.setBlockAndMetadata(var6, var7, var8, Block.pistonMoving.blockID, var13);
|
||||
var1.setBlockTileEntity(var6, var7, var8, BlockPistonMoving.func_31036_a(var12, var13, var5, true, false));
|
||||
}
|
||||
|
||||
var6 = var9;
|
||||
var7 = var10;
|
||||
var8 = var11;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
151
src/net/minecraft/src/BlockPistonExtension.java
Normal file
151
src/net/minecraft/src/BlockPistonExtension.java
Normal file
|
@ -0,0 +1,151 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPistonExtension extends Block {
|
||||
private int field_31053_a = -1;
|
||||
|
||||
public BlockPistonExtension(int var1, int var2) {
|
||||
super(var1, var2, Material.field_31067_B);
|
||||
this.setStepSound(soundStoneFootstep);
|
||||
this.setHardness(0.5F);
|
||||
}
|
||||
|
||||
public void func_31052_a_(int var1) {
|
||||
this.field_31053_a = var1;
|
||||
}
|
||||
|
||||
public void func_31051_a() {
|
||||
this.field_31053_a = -1;
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var6 = PistonBlockTextures.field_31057_a[func_31050_c(var5)];
|
||||
var2 += PistonBlockTextures.field_31056_b[var6];
|
||||
var3 += PistonBlockTextures.field_31059_c[var6];
|
||||
var4 += PistonBlockTextures.field_31058_d[var6];
|
||||
int var7 = var1.getBlockId(var2, var3, var4);
|
||||
if(var7 == Block.pistonBase.blockID || var7 == Block.pistonStickyBase.blockID) {
|
||||
var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(BlockPistonBase.isPowered(var5)) {
|
||||
Block.blocksList[var7].dropBlockAsItem(var1, var2, var3, var4, var5);
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
int var3 = func_31050_c(var2);
|
||||
return var1 == var3 ? (this.field_31053_a >= 0 ? this.field_31053_a : ((var2 & 8) != 0 ? this.blockIndexInTexture - 1 : this.blockIndexInTexture)) : (var1 == PistonBlockTextures.field_31057_a[var3] ? 107 : 108);
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 17;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) {
|
||||
int var7 = var1.getBlockMetadata(var2, var3, var4);
|
||||
switch(func_31050_c(var7)) {
|
||||
case 0:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(6.0F / 16.0F, 0.25F, 6.0F / 16.0F, 10.0F / 16.0F, 1.0F, 10.0F / 16.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
break;
|
||||
case 1:
|
||||
this.setBlockBounds(0.0F, 12.0F / 16.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(6.0F / 16.0F, 0.0F, 6.0F / 16.0F, 10.0F / 16.0F, 12.0F / 16.0F, 10.0F / 16.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(0.25F, 6.0F / 16.0F, 0.25F, 12.0F / 16.0F, 10.0F / 16.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(0.0F, 0.0F, 12.0F / 16.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(0.25F, 6.0F / 16.0F, 0.0F, 12.0F / 16.0F, 10.0F / 16.0F, 12.0F / 16.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
break;
|
||||
case 4:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(6.0F / 16.0F, 0.25F, 0.25F, 10.0F / 16.0F, 12.0F / 16.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(12.0F / 16.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(0.0F, 6.0F / 16.0F, 0.25F, 12.0F / 16.0F, 10.0F / 16.0F, 12.0F / 16.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
switch(func_31050_c(var5)) {
|
||||
case 0:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
|
||||
break;
|
||||
case 1:
|
||||
this.setBlockBounds(0.0F, 12.0F / 16.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(0.0F, 0.0F, 12.0F / 16.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 4:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(12.0F / 16.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = func_31050_c(var1.getBlockMetadata(var2, var3, var4));
|
||||
int var7 = var1.getBlockId(var2 - PistonBlockTextures.field_31056_b[var6], var3 - PistonBlockTextures.field_31059_c[var6], var4 - PistonBlockTextures.field_31058_d[var6]);
|
||||
if(var7 != Block.pistonBase.blockID && var7 != Block.pistonStickyBase.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
Block.blocksList[var7].onNeighborBlockChange(var1, var2 - PistonBlockTextures.field_31056_b[var6], var3 - PistonBlockTextures.field_31059_c[var6], var4 - PistonBlockTextures.field_31058_d[var6], var5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int func_31050_c(int var0) {
|
||||
return var0 & 7;
|
||||
}
|
||||
}
|
142
src/net/minecraft/src/BlockPistonMoving.java
Normal file
142
src/net/minecraft/src/BlockPistonMoving.java
Normal file
|
@ -0,0 +1,142 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPistonMoving extends BlockContainer {
|
||||
public BlockPistonMoving(int var1) {
|
||||
super(var1, Material.field_31067_B);
|
||||
this.setHardness(-1.0F);
|
||||
}
|
||||
|
||||
protected TileEntity getBlockEntity() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
TileEntity var5 = var1.getBlockTileEntity(var2, var3, var4);
|
||||
if(var5 != null && var5 instanceof TileEntityPiston) {
|
||||
((TileEntityPiston)var5).func_31011_l();
|
||||
} else {
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(!var1.multiplayerWorld && var1.getBlockTileEntity(var2, var3, var4) == null) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
TileEntityPiston var7 = this.func_31034_c(var1, var2, var3, var4);
|
||||
if(var7 != null) {
|
||||
Block.blocksList[var7.getStoredBlockID()].dropBlockAsItem(var1, var2, var3, var4, var7.getBlockMetadata());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!var1.multiplayerWorld && var1.getBlockTileEntity(var2, var3, var4) == null) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static TileEntity func_31036_a(int var0, int var1, int var2, boolean var3, boolean var4) {
|
||||
return new TileEntityPiston(var0, var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
TileEntityPiston var5 = this.func_31034_c(var1, var2, var3, var4);
|
||||
if(var5 == null) {
|
||||
return null;
|
||||
} else {
|
||||
float var6 = var5.func_31008_a(0.0F);
|
||||
if(var5.func_31015_b()) {
|
||||
var6 = 1.0F - var6;
|
||||
}
|
||||
|
||||
return this.func_31035_a(var1, var2, var3, var4, var5.getStoredBlockID(), var6, var5.func_31009_d());
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
TileEntityPiston var5 = this.func_31034_c(var1, var2, var3, var4);
|
||||
if(var5 != null) {
|
||||
Block var6 = Block.blocksList[var5.getStoredBlockID()];
|
||||
if(var6 == null || var6 == this) {
|
||||
return;
|
||||
}
|
||||
|
||||
var6.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
float var7 = var5.func_31008_a(0.0F);
|
||||
if(var5.func_31015_b()) {
|
||||
var7 = 1.0F - var7;
|
||||
}
|
||||
|
||||
int var8 = var5.func_31009_d();
|
||||
this.minX = var6.minX - (double)((float)PistonBlockTextures.field_31056_b[var8] * var7);
|
||||
this.minY = var6.minY - (double)((float)PistonBlockTextures.field_31059_c[var8] * var7);
|
||||
this.minZ = var6.minZ - (double)((float)PistonBlockTextures.field_31058_d[var8] * var7);
|
||||
this.maxX = var6.maxX - (double)((float)PistonBlockTextures.field_31056_b[var8] * var7);
|
||||
this.maxY = var6.maxY - (double)((float)PistonBlockTextures.field_31059_c[var8] * var7);
|
||||
this.maxZ = var6.maxZ - (double)((float)PistonBlockTextures.field_31058_d[var8] * var7);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AxisAlignedBB func_31035_a(World var1, int var2, int var3, int var4, int var5, float var6, int var7) {
|
||||
if(var5 != 0 && var5 != this.blockID) {
|
||||
AxisAlignedBB var8 = Block.blocksList[var5].getCollisionBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
if(var8 == null) {
|
||||
return null;
|
||||
} else {
|
||||
var8.minX -= (double)((float)PistonBlockTextures.field_31056_b[var7] * var6);
|
||||
var8.maxX -= (double)((float)PistonBlockTextures.field_31056_b[var7] * var6);
|
||||
var8.minY -= (double)((float)PistonBlockTextures.field_31059_c[var7] * var6);
|
||||
var8.maxY -= (double)((float)PistonBlockTextures.field_31059_c[var7] * var6);
|
||||
var8.minZ -= (double)((float)PistonBlockTextures.field_31058_d[var7] * var6);
|
||||
var8.maxZ -= (double)((float)PistonBlockTextures.field_31058_d[var7] * var6);
|
||||
return var8;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private TileEntityPiston func_31034_c(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
TileEntity var5 = var1.getBlockTileEntity(var2, var3, var4);
|
||||
return var5 != null && var5 instanceof TileEntityPiston ? (TileEntityPiston)var5 : null;
|
||||
}
|
||||
}
|
177
src/net/minecraft/src/BlockPortal.java
Normal file
177
src/net/minecraft/src/BlockPortal.java
Normal file
|
@ -0,0 +1,177 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPortal extends BlockBreakable {
|
||||
public BlockPortal(int var1, int var2) {
|
||||
super(var1, var2, Material.portal, false);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
float var5;
|
||||
float var6;
|
||||
if(var1.getBlockId(var2 - 1, var3, var4) != this.blockID && var1.getBlockId(var2 + 1, var3, var4) != this.blockID) {
|
||||
var5 = 2.0F / 16.0F;
|
||||
var6 = 0.5F;
|
||||
this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var6, 0.5F + var5, 1.0F, 0.5F + var6);
|
||||
} else {
|
||||
var5 = 0.5F;
|
||||
var6 = 2.0F / 16.0F;
|
||||
this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var6, 0.5F + var5, 1.0F, 0.5F + var6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean tryToCreatePortal(World var1, int var2, int var3, int var4) {
|
||||
byte var5 = 0;
|
||||
byte var6 = 0;
|
||||
if(var1.getBlockId(var2 - 1, var3, var4) == Block.obsidian.blockID || var1.getBlockId(var2 + 1, var3, var4) == Block.obsidian.blockID) {
|
||||
var5 = 1;
|
||||
}
|
||||
|
||||
if(var1.getBlockId(var2, var3, var4 - 1) == Block.obsidian.blockID || var1.getBlockId(var2, var3, var4 + 1) == Block.obsidian.blockID) {
|
||||
var6 = 1;
|
||||
}
|
||||
|
||||
if(var5 == var6) {
|
||||
return false;
|
||||
} else {
|
||||
if(var1.getBlockId(var2 - var5, var3, var4 - var6) == 0) {
|
||||
var2 -= var5;
|
||||
var4 -= var6;
|
||||
}
|
||||
|
||||
int var7;
|
||||
int var8;
|
||||
for(var7 = -1; var7 <= 2; ++var7) {
|
||||
for(var8 = -1; var8 <= 3; ++var8) {
|
||||
boolean var9 = var7 == -1 || var7 == 2 || var8 == -1 || var8 == 3;
|
||||
if(var7 != -1 && var7 != 2 || var8 != -1 && var8 != 3) {
|
||||
int var10 = var1.getBlockId(var2 + var5 * var7, var3 + var8, var4 + var6 * var7);
|
||||
if(var9) {
|
||||
if(var10 != Block.obsidian.blockID) {
|
||||
return false;
|
||||
}
|
||||
} else if(var10 != 0 && var10 != Block.fire.blockID) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var1.editingBlocks = true;
|
||||
|
||||
for(var7 = 0; var7 < 2; ++var7) {
|
||||
for(var8 = 0; var8 < 3; ++var8) {
|
||||
var1.setBlockWithNotify(var2 + var5 * var7, var3 + var8, var4 + var6 * var7, Block.portal.blockID);
|
||||
}
|
||||
}
|
||||
|
||||
var1.editingBlocks = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
byte var6 = 0;
|
||||
byte var7 = 1;
|
||||
if(var1.getBlockId(var2 - 1, var3, var4) == this.blockID || var1.getBlockId(var2 + 1, var3, var4) == this.blockID) {
|
||||
var6 = 1;
|
||||
var7 = 0;
|
||||
}
|
||||
|
||||
int var8;
|
||||
for(var8 = var3; var1.getBlockId(var2, var8 - 1, var4) == this.blockID; --var8) {
|
||||
}
|
||||
|
||||
if(var1.getBlockId(var2, var8 - 1, var4) != Block.obsidian.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
int var9;
|
||||
for(var9 = 1; var9 < 4 && var1.getBlockId(var2, var8 + var9, var4) == this.blockID; ++var9) {
|
||||
}
|
||||
|
||||
if(var9 == 3 && var1.getBlockId(var2, var8 + var9, var4) == Block.obsidian.blockID) {
|
||||
boolean var10 = var1.getBlockId(var2 - 1, var3, var4) == this.blockID || var1.getBlockId(var2 + 1, var3, var4) == this.blockID;
|
||||
boolean var11 = var1.getBlockId(var2, var3, var4 - 1) == this.blockID || var1.getBlockId(var2, var3, var4 + 1) == this.blockID;
|
||||
if(var10 && var11) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else if((var1.getBlockId(var2 + var6, var3, var4 + var7) != Block.obsidian.blockID || var1.getBlockId(var2 - var6, var3, var4 - var7) != this.blockID) && (var1.getBlockId(var2 - var6, var3, var4 - var7) != Block.obsidian.blockID || var1.getBlockId(var2 + var6, var3, var4 + var7) != this.blockID)) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
} else {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(var1.getBlockId(var2, var3, var4) == this.blockID) {
|
||||
return false;
|
||||
} else {
|
||||
boolean var6 = var1.getBlockId(var2 - 1, var3, var4) == this.blockID && var1.getBlockId(var2 - 2, var3, var4) != this.blockID;
|
||||
boolean var7 = var1.getBlockId(var2 + 1, var3, var4) == this.blockID && var1.getBlockId(var2 + 2, var3, var4) != this.blockID;
|
||||
boolean var8 = var1.getBlockId(var2, var3, var4 - 1) == this.blockID && var1.getBlockId(var2, var3, var4 - 2) != this.blockID;
|
||||
boolean var9 = var1.getBlockId(var2, var3, var4 + 1) == this.blockID && var1.getBlockId(var2, var3, var4 + 2) != this.blockID;
|
||||
boolean var10 = var6 || var7;
|
||||
boolean var11 = var8 || var9;
|
||||
return var10 && var5 == 4 ? true : (var10 && var5 == 5 ? true : (var11 && var5 == 2 ? true : var11 && var5 == 3));
|
||||
}
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
if(var5.ridingEntity == null && var5.riddenByEntity == null) {
|
||||
var5.setInPortal();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var5.nextInt(100) == 0) {
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "portal.portal", 1.0F, var5.nextFloat() * 0.4F + 0.8F);
|
||||
}
|
||||
|
||||
for(int var6 = 0; var6 < 4; ++var6) {
|
||||
double var7 = (double)((float)var2 + var5.nextFloat());
|
||||
double var9 = (double)((float)var3 + var5.nextFloat());
|
||||
double var11 = (double)((float)var4 + var5.nextFloat());
|
||||
double var13 = 0.0D;
|
||||
double var15 = 0.0D;
|
||||
double var17 = 0.0D;
|
||||
int var19 = var5.nextInt(2) * 2 - 1;
|
||||
var13 = ((double)var5.nextFloat() - 0.5D) * 0.5D;
|
||||
var15 = ((double)var5.nextFloat() - 0.5D) * 0.5D;
|
||||
var17 = ((double)var5.nextFloat() - 0.5D) * 0.5D;
|
||||
if(var1.getBlockId(var2 - 1, var3, var4) != this.blockID && var1.getBlockId(var2 + 1, var3, var4) != this.blockID) {
|
||||
var7 = (double)var2 + 0.5D + 0.25D * (double)var19;
|
||||
var13 = (double)(var5.nextFloat() * 2.0F * (float)var19);
|
||||
} else {
|
||||
var11 = (double)var4 + 0.5D + 0.25D * (double)var19;
|
||||
var17 = (double)(var5.nextFloat() * 2.0F * (float)var19);
|
||||
}
|
||||
|
||||
var1.spawnParticle("portal", var7, var9, var11, var13, var15, var17);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
155
src/net/minecraft/src/BlockPressurePlate.java
Normal file
155
src/net/minecraft/src/BlockPressurePlate.java
Normal file
|
@ -0,0 +1,155 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPressurePlate extends Block {
|
||||
private EnumMobType triggerMobType;
|
||||
|
||||
protected BlockPressurePlate(int var1, int var2, EnumMobType var3, Material var4) {
|
||||
super(var1, var2, var4);
|
||||
this.triggerMobType = var3;
|
||||
this.setTickOnLoad(true);
|
||||
float var5 = 1.0F / 16.0F;
|
||||
this.setBlockBounds(var5, 0.0F, var5, 1.0F - var5, 0.03125F, 1.0F - var5);
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2, var3 - 1, var4);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
boolean var6 = false;
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4)) {
|
||||
var6 = true;
|
||||
}
|
||||
|
||||
if(var6) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
if(var1.getBlockMetadata(var2, var3, var4) != 0) {
|
||||
this.setStateIfMobInteractsWithPlate(var1, var2, var3, var4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
if(var1.getBlockMetadata(var2, var3, var4) != 1) {
|
||||
this.setStateIfMobInteractsWithPlate(var1, var2, var3, var4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setStateIfMobInteractsWithPlate(World var1, int var2, int var3, int var4) {
|
||||
boolean var5 = var1.getBlockMetadata(var2, var3, var4) == 1;
|
||||
boolean var6 = false;
|
||||
float var7 = 2.0F / 16.0F;
|
||||
List var8 = null;
|
||||
if(this.triggerMobType == EnumMobType.everything) {
|
||||
var8 = var1.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var7), (double)((float)(var2 + 1) - var7), (double)var3 + 0.25D, (double)((float)(var4 + 1) - var7)));
|
||||
}
|
||||
|
||||
if(this.triggerMobType == EnumMobType.mobs) {
|
||||
var8 = var1.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var7), (double)((float)(var2 + 1) - var7), (double)var3 + 0.25D, (double)((float)(var4 + 1) - var7)));
|
||||
}
|
||||
|
||||
if(this.triggerMobType == EnumMobType.players) {
|
||||
var8 = var1.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBoxFromPool((double)((float)var2 + var7), (double)var3, (double)((float)var4 + var7), (double)((float)(var2 + 1) - var7), (double)var3 + 0.25D, (double)((float)(var4 + 1) - var7)));
|
||||
}
|
||||
|
||||
if(var8.size() > 0) {
|
||||
var6 = true;
|
||||
}
|
||||
|
||||
if(var6 && !var5) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 1);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.1D, (double)var4 + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
}
|
||||
|
||||
if(!var6 && var5) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 0);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.1D, (double)var4 + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
}
|
||||
|
||||
if(var6) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var5 > 0) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
}
|
||||
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
boolean var5 = var1.getBlockMetadata(var2, var3, var4) == 1;
|
||||
float var6 = 1.0F / 16.0F;
|
||||
if(var5) {
|
||||
this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 0.03125F, 1.0F - var6);
|
||||
} else {
|
||||
this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 1.0F / 16.0F, 1.0F - var6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return var1.getBlockMetadata(var2, var3, var4) > 0;
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) {
|
||||
return var1.getBlockMetadata(var2, var3, var4) == 0 ? false : var5 == 1;
|
||||
}
|
||||
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender() {
|
||||
float var1 = 0.5F;
|
||||
float var2 = 2.0F / 16.0F;
|
||||
float var3 = 0.5F;
|
||||
this.setBlockBounds(0.5F - var1, 0.5F - var2, 0.5F - var3, 0.5F + var1, 0.5F + var2, 0.5F + var3);
|
||||
}
|
||||
|
||||
public int getMobilityFlag() {
|
||||
return 1;
|
||||
}
|
||||
}
|
45
src/net/minecraft/src/BlockPumpkin.java
Normal file
45
src/net/minecraft/src/BlockPumpkin.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockPumpkin extends Block {
|
||||
private boolean blockType;
|
||||
|
||||
protected BlockPumpkin(int var1, int var2, boolean var3) {
|
||||
super(var1, Material.pumpkin);
|
||||
this.blockIndexInTexture = var2;
|
||||
this.setTickOnLoad(true);
|
||||
this.blockType = var3;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
if(var1 == 1) {
|
||||
return this.blockIndexInTexture;
|
||||
} else if(var1 == 0) {
|
||||
return this.blockIndexInTexture;
|
||||
} else {
|
||||
int var3 = this.blockIndexInTexture + 1 + 16;
|
||||
if(this.blockType) {
|
||||
++var3;
|
||||
}
|
||||
|
||||
return var2 == 2 && var1 == 2 ? var3 : (var2 == 3 && var1 == 5 ? var3 : (var2 == 0 && var1 == 3 ? var3 : (var2 == 1 && var1 == 4 ? var3 : this.blockIndexInTexture + 16)));
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture : (var1 == 0 ? this.blockIndexInTexture : (var1 == 3 ? this.blockIndexInTexture + 1 + 16 : this.blockIndexInTexture + 16));
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockId(var2, var3, var4);
|
||||
return (var5 == 0 || Block.blocksList[var5].blockMaterial.getIsGroundCover()) && var1.isBlockNormalCube(var2, var3 - 1, var4);
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) {
|
||||
int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6);
|
||||
}
|
||||
}
|
250
src/net/minecraft/src/BlockRail.java
Normal file
250
src/net/minecraft/src/BlockRail.java
Normal file
|
@ -0,0 +1,250 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockRail extends Block {
|
||||
private final boolean isPowered;
|
||||
|
||||
public static final boolean isRailBlockAt(World var0, int var1, int var2, int var3) {
|
||||
int var4 = var0.getBlockId(var1, var2, var3);
|
||||
return var4 == Block.rail.blockID || var4 == Block.railPowered.blockID || var4 == Block.railDetector.blockID;
|
||||
}
|
||||
|
||||
public static final boolean isRailBlock(int var0) {
|
||||
return var0 == Block.rail.blockID || var0 == Block.railPowered.blockID || var0 == Block.railDetector.blockID;
|
||||
}
|
||||
|
||||
protected BlockRail(int var1, int var2, boolean var3) {
|
||||
super(var1, var2, Material.circuits);
|
||||
this.isPowered = var3;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F / 16.0F, 1.0F);
|
||||
}
|
||||
|
||||
public boolean getIsPowered() {
|
||||
return this.isPowered;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
return super.collisionRayTrace(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var5 >= 2 && var5 <= 5) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 10.0F / 16.0F, 1.0F);
|
||||
} else {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F / 16.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
if(this.isPowered) {
|
||||
if(this.blockID == Block.railPowered.blockID && (var2 & 8) == 0) {
|
||||
return this.blockIndexInTexture - 16;
|
||||
}
|
||||
} else if(var2 >= 6) {
|
||||
return this.blockIndexInTexture - 16;
|
||||
}
|
||||
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2, var3 - 1, var4);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
this.func_4031_h(var1, var2, var3, var4, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var6;
|
||||
if(this.isPowered) {
|
||||
var7 = var6 & 7;
|
||||
}
|
||||
|
||||
boolean var8 = false;
|
||||
if(!var1.isBlockNormalCube(var2, var3 - 1, var4)) {
|
||||
var8 = true;
|
||||
}
|
||||
|
||||
if(var7 == 2 && !var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
var8 = true;
|
||||
}
|
||||
|
||||
if(var7 == 3 && !var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
var8 = true;
|
||||
}
|
||||
|
||||
if(var7 == 4 && !var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
var8 = true;
|
||||
}
|
||||
|
||||
if(var7 == 5 && !var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
var8 = true;
|
||||
}
|
||||
|
||||
if(var8) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else if(this.blockID == Block.railPowered.blockID) {
|
||||
boolean var9 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4) || var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4);
|
||||
var9 = var9 || this.func_27044_a(var1, var2, var3, var4, var6, true, 0) || this.func_27044_a(var1, var2, var3, var4, var6, false, 0);
|
||||
boolean var10 = false;
|
||||
if(var9 && (var6 & 8) == 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var7 | 8);
|
||||
var10 = true;
|
||||
} else if(!var9 && (var6 & 8) != 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var7);
|
||||
var10 = true;
|
||||
}
|
||||
|
||||
if(var10) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
if(var7 == 2 || var7 == 3 || var7 == 4 || var7 == 5) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
}
|
||||
}
|
||||
} else if(var5 > 0 && Block.blocksList[var5].canProvidePower() && !this.isPowered && RailLogic.getNAdjacentTracks(new RailLogic(this, var1, var2, var3, var4)) == 3) {
|
||||
this.func_4031_h(var1, var2, var3, var4, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void func_4031_h(World var1, int var2, int var3, int var4, boolean var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
(new RailLogic(this, var1, var2, var3, var4)).func_792_a(var1.isBlockIndirectlyGettingPowered(var2, var3, var4), var5);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean func_27044_a(World var1, int var2, int var3, int var4, int var5, boolean var6, int var7) {
|
||||
if(var7 >= 8) {
|
||||
return false;
|
||||
} else {
|
||||
int var8 = var5 & 7;
|
||||
boolean var9 = true;
|
||||
switch(var8) {
|
||||
case 0:
|
||||
if(var6) {
|
||||
++var4;
|
||||
} else {
|
||||
--var4;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(var6) {
|
||||
--var2;
|
||||
} else {
|
||||
++var2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(var6) {
|
||||
--var2;
|
||||
} else {
|
||||
++var2;
|
||||
++var3;
|
||||
var9 = false;
|
||||
}
|
||||
|
||||
var8 = 1;
|
||||
break;
|
||||
case 3:
|
||||
if(var6) {
|
||||
--var2;
|
||||
++var3;
|
||||
var9 = false;
|
||||
} else {
|
||||
++var2;
|
||||
}
|
||||
|
||||
var8 = 1;
|
||||
break;
|
||||
case 4:
|
||||
if(var6) {
|
||||
++var4;
|
||||
} else {
|
||||
--var4;
|
||||
++var3;
|
||||
var9 = false;
|
||||
}
|
||||
|
||||
var8 = 0;
|
||||
break;
|
||||
case 5:
|
||||
if(var6) {
|
||||
++var4;
|
||||
++var3;
|
||||
var9 = false;
|
||||
} else {
|
||||
--var4;
|
||||
}
|
||||
|
||||
var8 = 0;
|
||||
}
|
||||
|
||||
return this.func_27043_a(var1, var2, var3, var4, var6, var7, var8) ? true : var9 && this.func_27043_a(var1, var2, var3 - 1, var4, var6, var7, var8);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean func_27043_a(World var1, int var2, int var3, int var4, boolean var5, int var6, int var7) {
|
||||
int var8 = var1.getBlockId(var2, var3, var4);
|
||||
if(var8 == Block.railPowered.blockID) {
|
||||
int var9 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var10 = var9 & 7;
|
||||
if(var7 == 1 && (var10 == 0 || var10 == 4 || var10 == 5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(var7 == 0 && (var10 == 1 || var10 == 2 || var10 == 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if((var9 & 8) != 0) {
|
||||
if(!var1.isBlockIndirectlyGettingPowered(var2, var3, var4) && !var1.isBlockIndirectlyGettingPowered(var2, var3 + 1, var4)) {
|
||||
return this.func_27044_a(var1, var2, var3, var4, var9, var5, var6 + 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static boolean isPoweredBlockRail(BlockRail var0) {
|
||||
return var0.isPowered;
|
||||
}
|
||||
}
|
104
src/net/minecraft/src/BlockRedstoneOre.java
Normal file
104
src/net/minecraft/src/BlockRedstoneOre.java
Normal file
|
@ -0,0 +1,104 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockRedstoneOre extends Block {
|
||||
private boolean field_468_a;
|
||||
|
||||
public BlockRedstoneOre(int var1, int var2, boolean var3) {
|
||||
super(var1, var2, Material.rock);
|
||||
if(var3) {
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
this.field_468_a = var3;
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.func_320_h(var1, var2, var3, var4);
|
||||
super.onBlockClicked(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
this.func_320_h(var1, var2, var3, var4);
|
||||
super.onEntityWalking(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.func_320_h(var1, var2, var3, var4);
|
||||
return super.blockActivated(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
private void func_320_h(World var1, int var2, int var3, int var4) {
|
||||
this.func_319_i(var1, var2, var3, var4);
|
||||
if(this.blockID == Block.oreRedstone.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.oreRedstoneGlowing.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(this.blockID == Block.oreRedstoneGlowing.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.oreRedstone.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.redstone.shiftedIndex;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 4 + var1.nextInt(2);
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(this.field_468_a) {
|
||||
this.func_319_i(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void func_319_i(World var1, int var2, int var3, int var4) {
|
||||
Random var5 = var1.rand;
|
||||
double var6 = 1.0D / 16.0D;
|
||||
|
||||
for(int var8 = 0; var8 < 6; ++var8) {
|
||||
double var9 = (double)((float)var2 + var5.nextFloat());
|
||||
double var11 = (double)((float)var3 + var5.nextFloat());
|
||||
double var13 = (double)((float)var4 + var5.nextFloat());
|
||||
if(var8 == 0 && !var1.isBlockOpaqueCube(var2, var3 + 1, var4)) {
|
||||
var11 = (double)(var3 + 1) + var6;
|
||||
}
|
||||
|
||||
if(var8 == 1 && !var1.isBlockOpaqueCube(var2, var3 - 1, var4)) {
|
||||
var11 = (double)(var3 + 0) - var6;
|
||||
}
|
||||
|
||||
if(var8 == 2 && !var1.isBlockOpaqueCube(var2, var3, var4 + 1)) {
|
||||
var13 = (double)(var4 + 1) + var6;
|
||||
}
|
||||
|
||||
if(var8 == 3 && !var1.isBlockOpaqueCube(var2, var3, var4 - 1)) {
|
||||
var13 = (double)(var4 + 0) - var6;
|
||||
}
|
||||
|
||||
if(var8 == 4 && !var1.isBlockOpaqueCube(var2 + 1, var3, var4)) {
|
||||
var9 = (double)(var2 + 1) + var6;
|
||||
}
|
||||
|
||||
if(var8 == 5 && !var1.isBlockOpaqueCube(var2 - 1, var3, var4)) {
|
||||
var9 = (double)(var2 + 0) - var6;
|
||||
}
|
||||
|
||||
if(var9 < (double)var2 || var9 > (double)(var2 + 1) || var11 < 0.0D || var11 > (double)(var3 + 1) || var13 < (double)var4 || var13 > (double)(var4 + 1)) {
|
||||
var1.spawnParticle("reddust", var9, var11, var13, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
186
src/net/minecraft/src/BlockRedstoneRepeater.java
Normal file
186
src/net/minecraft/src/BlockRedstoneRepeater.java
Normal file
|
@ -0,0 +1,186 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockRedstoneRepeater extends Block {
|
||||
public static final double[] field_22024_a = new double[]{-0.0625D, 1.0D / 16.0D, 0.1875D, 0.3125D};
|
||||
private static final int[] field_22023_b = new int[]{1, 2, 3, 4};
|
||||
private final boolean isRepeaterPowered;
|
||||
|
||||
protected BlockRedstoneRepeater(int var1, boolean var2) {
|
||||
super(var1, 6, Material.circuits);
|
||||
this.isRepeaterPowered = var2;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F / 16.0F, 1.0F);
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return !var1.isBlockNormalCube(var2, var3 - 1, var4) ? false : super.canPlaceBlockAt(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World var1, int var2, int var3, int var4) {
|
||||
return !var1.isBlockNormalCube(var2, var3 - 1, var4) ? false : super.canBlockStay(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
boolean var7 = this.func_22022_g(var1, var2, var3, var4, var6);
|
||||
if(this.isRepeaterPowered && !var7) {
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3, var4, Block.redstoneRepeaterIdle.blockID, var6);
|
||||
} else if(!this.isRepeaterPowered) {
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3, var4, Block.redstoneRepeaterActive.blockID, var6);
|
||||
if(!var7) {
|
||||
int var8 = (var6 & 12) >> 2;
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, Block.redstoneRepeaterActive.blockID, field_22023_b[var8] * 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return var1 == 0 ? (this.isRepeaterPowered ? 99 : 115) : (var1 == 1 ? (this.isRepeaterPowered ? 147 : 131) : 5);
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return var5 != 0 && var5 != 1;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return this.getBlockTextureFromSideAndMetadata(var1, 0);
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) {
|
||||
return this.isPoweringTo(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(!this.isRepeaterPowered) {
|
||||
return false;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4) & 3;
|
||||
return var6 == 0 && var5 == 3 ? true : (var6 == 1 && var5 == 4 ? true : (var6 == 2 && var5 == 2 ? true : var6 == 3 && var5 == 5));
|
||||
}
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!this.canBlockStay(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
boolean var7 = this.func_22022_g(var1, var2, var3, var4, var6);
|
||||
int var8 = (var6 & 12) >> 2;
|
||||
if(this.isRepeaterPowered && !var7) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, field_22023_b[var8] * 2);
|
||||
} else if(!this.isRepeaterPowered && var7) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, field_22023_b[var8] * 2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean func_22022_g(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var5 & 3;
|
||||
switch(var6) {
|
||||
case 0:
|
||||
return var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 + 1, 3) || var1.getBlockId(var2, var3, var4 + 1) == Block.redstoneWire.blockID && var1.getBlockMetadata(var2, var3, var4 + 1) > 0;
|
||||
case 1:
|
||||
return var1.isBlockIndirectlyProvidingPowerTo(var2 - 1, var3, var4, 4) || var1.getBlockId(var2 - 1, var3, var4) == Block.redstoneWire.blockID && var1.getBlockMetadata(var2 - 1, var3, var4) > 0;
|
||||
case 2:
|
||||
return var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 - 1, 2) || var1.getBlockId(var2, var3, var4 - 1) == Block.redstoneWire.blockID && var1.getBlockMetadata(var2, var3, var4 - 1) > 0;
|
||||
case 3:
|
||||
return var1.isBlockIndirectlyProvidingPowerTo(var2 + 1, var3, var4, 5) || var1.getBlockId(var2 + 1, var3, var4) == Block.redstoneWire.blockID && var1.getBlockMetadata(var2 + 1, var3, var4) > 0;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = (var6 & 12) >> 2;
|
||||
var7 = var7 + 1 << 2 & 12;
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var7 | var6 & 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canProvidePower() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) {
|
||||
int var6 = ((MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6);
|
||||
boolean var7 = this.func_22022_g(var1, var2, var3, var4, var6);
|
||||
if(var7) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.redstoneRepeater.shiftedIndex;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(this.isRepeaterPowered) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
double var7 = (double)((float)var2 + 0.5F) + (double)(var5.nextFloat() - 0.5F) * 0.2D;
|
||||
double var9 = (double)((float)var3 + 0.4F) + (double)(var5.nextFloat() - 0.5F) * 0.2D;
|
||||
double var11 = (double)((float)var4 + 0.5F) + (double)(var5.nextFloat() - 0.5F) * 0.2D;
|
||||
double var13 = 0.0D;
|
||||
double var15 = 0.0D;
|
||||
if(var5.nextInt(2) == 0) {
|
||||
switch(var6 & 3) {
|
||||
case 0:
|
||||
var15 = -0.3125D;
|
||||
break;
|
||||
case 1:
|
||||
var13 = 0.3125D;
|
||||
break;
|
||||
case 2:
|
||||
var15 = 0.3125D;
|
||||
break;
|
||||
case 3:
|
||||
var13 = -0.3125D;
|
||||
}
|
||||
} else {
|
||||
int var17 = (var6 & 12) >> 2;
|
||||
switch(var6 & 3) {
|
||||
case 0:
|
||||
var15 = field_22024_a[var17];
|
||||
break;
|
||||
case 1:
|
||||
var13 = -field_22024_a[var17];
|
||||
break;
|
||||
case 2:
|
||||
var15 = -field_22024_a[var17];
|
||||
break;
|
||||
case 3:
|
||||
var13 = field_22024_a[var17];
|
||||
}
|
||||
}
|
||||
|
||||
var1.spawnParticle("reddust", var7 + var13, var9, var11 + var15, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
153
src/net/minecraft/src/BlockRedstoneTorch.java
Normal file
153
src/net/minecraft/src/BlockRedstoneTorch.java
Normal file
|
@ -0,0 +1,153 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
private boolean torchActive = false;
|
||||
private static List torchUpdates = new ArrayList();
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return var1 == 1 ? Block.redstoneWire.getBlockTextureFromSideAndMetadata(var1, var2) : super.getBlockTextureFromSideAndMetadata(var1, var2);
|
||||
}
|
||||
|
||||
private boolean checkForBurnout(World var1, int var2, int var3, int var4, boolean var5) {
|
||||
if(var5) {
|
||||
torchUpdates.add(new RedstoneUpdateInfo(var2, var3, var4, var1.getWorldTime()));
|
||||
}
|
||||
|
||||
int var6 = 0;
|
||||
|
||||
for(int var7 = 0; var7 < torchUpdates.size(); ++var7) {
|
||||
RedstoneUpdateInfo var8 = (RedstoneUpdateInfo)torchUpdates.get(var7);
|
||||
if(var8.x == var2 && var8.y == var3 && var8.z == var4) {
|
||||
++var6;
|
||||
if(var6 >= 8) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected BlockRedstoneTorch(int var1, int var2, boolean var3) {
|
||||
super(var1, var2);
|
||||
this.torchActive = var3;
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
if(var1.getBlockMetadata(var2, var3, var4) == 0) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
if(this.torchActive) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
if(this.torchActive) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(!this.torchActive) {
|
||||
return false;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
return var6 == 5 && var5 == 1 ? false : (var6 == 3 && var5 == 3 ? false : (var6 == 4 && var5 == 2 ? false : (var6 == 1 && var5 == 5 ? false : var6 != 2 || var5 != 4)));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean func_30002_h(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
return var5 == 5 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3 - 1, var4, 0) ? true : (var5 == 3 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 - 1, 2) ? true : (var5 == 4 && var1.isBlockIndirectlyProvidingPowerTo(var2, var3, var4 + 1, 3) ? true : (var5 == 1 && var1.isBlockIndirectlyProvidingPowerTo(var2 - 1, var3, var4, 4) ? true : var5 == 2 && var1.isBlockIndirectlyProvidingPowerTo(var2 + 1, var3, var4, 5))));
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
boolean var6 = this.func_30002_h(var1, var2, var3, var4);
|
||||
|
||||
while(torchUpdates.size() > 0 && var1.getWorldTime() - ((RedstoneUpdateInfo)torchUpdates.get(0)).updateTime > 100L) {
|
||||
torchUpdates.remove(0);
|
||||
}
|
||||
|
||||
if(this.torchActive) {
|
||||
if(var6) {
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3, var4, Block.torchRedstoneIdle.blockID, var1.getBlockMetadata(var2, var3, var4));
|
||||
if(this.checkForBurnout(var1, var2, var3, var4, true)) {
|
||||
var1.playSoundEffect((double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), "random.fizz", 0.5F, 2.6F + (var1.rand.nextFloat() - var1.rand.nextFloat()) * 0.8F);
|
||||
|
||||
for(int var7 = 0; var7 < 5; ++var7) {
|
||||
double var8 = (double)var2 + var5.nextDouble() * 0.6D + 0.2D;
|
||||
double var10 = (double)var3 + var5.nextDouble() * 0.6D + 0.2D;
|
||||
double var12 = (double)var4 + var5.nextDouble() * 0.6D + 0.2D;
|
||||
var1.spawnParticle("smoke", var8, var10, var12, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(!var6 && !this.checkForBurnout(var1, var2, var3, var4, false)) {
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3, var4, Block.torchRedstoneActive.blockID, var1.getBlockMetadata(var2, var3, var4));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) {
|
||||
return var5 == 0 ? this.isPoweringTo(var1, var2, var3, var4, var5) : false;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.torchRedstoneActive.blockID;
|
||||
}
|
||||
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(this.torchActive) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
double var7 = (double)((float)var2 + 0.5F) + (double)(var5.nextFloat() - 0.5F) * 0.2D;
|
||||
double var9 = (double)((float)var3 + 0.7F) + (double)(var5.nextFloat() - 0.5F) * 0.2D;
|
||||
double var11 = (double)((float)var4 + 0.5F) + (double)(var5.nextFloat() - 0.5F) * 0.2D;
|
||||
double var13 = (double)0.22F;
|
||||
double var15 = (double)0.27F;
|
||||
if(var6 == 1) {
|
||||
var1.spawnParticle("reddust", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 2) {
|
||||
var1.spawnParticle("reddust", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 3) {
|
||||
var1.spawnParticle("reddust", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 4) {
|
||||
var1.spawnParticle("reddust", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
var1.spawnParticle("reddust", var7, var9, var11, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
371
src/net/minecraft/src/BlockRedstoneWire.java
Normal file
371
src/net/minecraft/src/BlockRedstoneWire.java
Normal file
|
@ -0,0 +1,371 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class BlockRedstoneWire extends Block {
|
||||
private boolean wiresProvidePower = true;
|
||||
private Set field_21031_b = new HashSet();
|
||||
|
||||
public BlockRedstoneWire(int var1, int var2) {
|
||||
super(var1, var2, Material.circuits);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F / 16.0F, 1.0F);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
return 8388608;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2, var3 - 1, var4);
|
||||
}
|
||||
|
||||
private void updateAndPropagateCurrentStrength(World var1, int var2, int var3, int var4) {
|
||||
this.func_21030_a(var1, var2, var3, var4, var2, var3, var4);
|
||||
ArrayList var5 = new ArrayList(this.field_21031_b);
|
||||
this.field_21031_b.clear();
|
||||
|
||||
for(int var6 = 0; var6 < var5.size(); ++var6) {
|
||||
ChunkPosition var7 = (ChunkPosition)var5.get(var6);
|
||||
var1.notifyBlocksOfNeighborChange(var7.x, var7.y, var7.z, this.blockID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void func_21030_a(World var1, int var2, int var3, int var4, int var5, int var6, int var7) {
|
||||
int var8 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var9 = 0;
|
||||
this.wiresProvidePower = false;
|
||||
boolean var10 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4);
|
||||
this.wiresProvidePower = true;
|
||||
int var11;
|
||||
int var12;
|
||||
int var13;
|
||||
if(var10) {
|
||||
var9 = 15;
|
||||
} else {
|
||||
for(var11 = 0; var11 < 4; ++var11) {
|
||||
var12 = var2;
|
||||
var13 = var4;
|
||||
if(var11 == 0) {
|
||||
var12 = var2 - 1;
|
||||
}
|
||||
|
||||
if(var11 == 1) {
|
||||
++var12;
|
||||
}
|
||||
|
||||
if(var11 == 2) {
|
||||
var13 = var4 - 1;
|
||||
}
|
||||
|
||||
if(var11 == 3) {
|
||||
++var13;
|
||||
}
|
||||
|
||||
if(var12 != var5 || var3 != var6 || var13 != var7) {
|
||||
var9 = this.getMaxCurrentStrength(var1, var12, var3, var13, var9);
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var12, var3, var13) && !var1.isBlockNormalCube(var2, var3 + 1, var4)) {
|
||||
if(var12 != var5 || var3 + 1 != var6 || var13 != var7) {
|
||||
var9 = this.getMaxCurrentStrength(var1, var12, var3 + 1, var13, var9);
|
||||
}
|
||||
} else if(!var1.isBlockNormalCube(var12, var3, var13) && (var12 != var5 || var3 - 1 != var6 || var13 != var7)) {
|
||||
var9 = this.getMaxCurrentStrength(var1, var12, var3 - 1, var13, var9);
|
||||
}
|
||||
}
|
||||
|
||||
if(var9 > 0) {
|
||||
--var9;
|
||||
} else {
|
||||
var9 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(var8 != var9) {
|
||||
var1.editingBlocks = true;
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var9);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
var1.editingBlocks = false;
|
||||
|
||||
for(var11 = 0; var11 < 4; ++var11) {
|
||||
var12 = var2;
|
||||
var13 = var4;
|
||||
int var14 = var3 - 1;
|
||||
if(var11 == 0) {
|
||||
var12 = var2 - 1;
|
||||
}
|
||||
|
||||
if(var11 == 1) {
|
||||
++var12;
|
||||
}
|
||||
|
||||
if(var11 == 2) {
|
||||
var13 = var4 - 1;
|
||||
}
|
||||
|
||||
if(var11 == 3) {
|
||||
++var13;
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var12, var3, var13)) {
|
||||
var14 += 2;
|
||||
}
|
||||
|
||||
boolean var15 = false;
|
||||
int var16 = this.getMaxCurrentStrength(var1, var12, var3, var13, -1);
|
||||
var9 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var9 > 0) {
|
||||
--var9;
|
||||
}
|
||||
|
||||
if(var16 >= 0 && var16 != var9) {
|
||||
this.func_21030_a(var1, var12, var3, var13, var2, var3, var4);
|
||||
}
|
||||
|
||||
var16 = this.getMaxCurrentStrength(var1, var12, var14, var13, -1);
|
||||
var9 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var9 > 0) {
|
||||
--var9;
|
||||
}
|
||||
|
||||
if(var16 >= 0 && var16 != var9) {
|
||||
this.func_21030_a(var1, var12, var14, var13, var2, var3, var4);
|
||||
}
|
||||
}
|
||||
|
||||
if(var8 == 0 || var9 == 0) {
|
||||
this.field_21031_b.add(new ChunkPosition(var2, var3, var4));
|
||||
this.field_21031_b.add(new ChunkPosition(var2 - 1, var3, var4));
|
||||
this.field_21031_b.add(new ChunkPosition(var2 + 1, var3, var4));
|
||||
this.field_21031_b.add(new ChunkPosition(var2, var3 - 1, var4));
|
||||
this.field_21031_b.add(new ChunkPosition(var2, var3 + 1, var4));
|
||||
this.field_21031_b.add(new ChunkPosition(var2, var3, var4 - 1));
|
||||
this.field_21031_b.add(new ChunkPosition(var2, var3, var4 + 1));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void notifyWireNeighborsOfNeighborChange(World var1, int var2, int var3, int var4) {
|
||||
if(var1.getBlockId(var2, var3, var4) == this.blockID) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2 - 1, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2 + 1, var3, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 - 1, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3, var4 + 1, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
if(!var1.multiplayerWorld) {
|
||||
this.updateAndPropagateCurrentStrength(var1, var2, var3, var4);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3, var4);
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3, var4);
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3, var4 - 1);
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3, var4 + 1);
|
||||
if(var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3 + 1, var4);
|
||||
} else {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3 - 1, var4);
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3 + 1, var4);
|
||||
} else {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3 - 1, var4);
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 + 1, var4 - 1);
|
||||
} else {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 - 1);
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 + 1, var4 + 1);
|
||||
} else {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 + 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockRemoval(var1, var2, var3, var4);
|
||||
if(!var1.multiplayerWorld) {
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID);
|
||||
var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID);
|
||||
this.updateAndPropagateCurrentStrength(var1, var2, var3, var4);
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3, var4);
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3, var4);
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3, var4 - 1);
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3, var4 + 1);
|
||||
if(var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3 + 1, var4);
|
||||
} else {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 - 1, var3 - 1, var4);
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3 + 1, var4);
|
||||
} else {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2 + 1, var3 - 1, var4);
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 + 1, var4 - 1);
|
||||
} else {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 - 1);
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 + 1, var4 + 1);
|
||||
} else {
|
||||
this.notifyWireNeighborsOfNeighborChange(var1, var2, var3 - 1, var4 + 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private int getMaxCurrentStrength(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(var1.getBlockId(var2, var3, var4) != this.blockID) {
|
||||
return var5;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
return var6 > var5 ? var6 : var5;
|
||||
}
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
boolean var7 = this.canPlaceBlockAt(var1, var2, var3, var4);
|
||||
if(!var7) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var6);
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
this.updateAndPropagateCurrentStrength(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.redstone.shiftedIndex;
|
||||
}
|
||||
|
||||
public boolean isIndirectlyPoweringTo(World var1, int var2, int var3, int var4, int var5) {
|
||||
return !this.wiresProvidePower ? false : this.isPoweringTo(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean isPoweringTo(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(!this.wiresProvidePower) {
|
||||
return false;
|
||||
} else if(var1.getBlockMetadata(var2, var3, var4) == 0) {
|
||||
return false;
|
||||
} else if(var5 == 1) {
|
||||
return true;
|
||||
} else {
|
||||
boolean var6 = isPowerProviderOrWire(var1, var2 - 1, var3, var4, 1) || !var1.isBlockNormalCube(var2 - 1, var3, var4) && isPowerProviderOrWire(var1, var2 - 1, var3 - 1, var4, -1);
|
||||
boolean var7 = isPowerProviderOrWire(var1, var2 + 1, var3, var4, 3) || !var1.isBlockNormalCube(var2 + 1, var3, var4) && isPowerProviderOrWire(var1, var2 + 1, var3 - 1, var4, -1);
|
||||
boolean var8 = isPowerProviderOrWire(var1, var2, var3, var4 - 1, 2) || !var1.isBlockNormalCube(var2, var3, var4 - 1) && isPowerProviderOrWire(var1, var2, var3 - 1, var4 - 1, -1);
|
||||
boolean var9 = isPowerProviderOrWire(var1, var2, var3, var4 + 1, 0) || !var1.isBlockNormalCube(var2, var3, var4 + 1) && isPowerProviderOrWire(var1, var2, var3 - 1, var4 + 1, -1);
|
||||
if(!var1.isBlockNormalCube(var2, var3 + 1, var4)) {
|
||||
if(var1.isBlockNormalCube(var2 - 1, var3, var4) && isPowerProviderOrWire(var1, var2 - 1, var3 + 1, var4, -1)) {
|
||||
var6 = true;
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2 + 1, var3, var4) && isPowerProviderOrWire(var1, var2 + 1, var3 + 1, var4, -1)) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2, var3, var4 - 1) && isPowerProviderOrWire(var1, var2, var3 + 1, var4 - 1, -1)) {
|
||||
var8 = true;
|
||||
}
|
||||
|
||||
if(var1.isBlockNormalCube(var2, var3, var4 + 1) && isPowerProviderOrWire(var1, var2, var3 + 1, var4 + 1, -1)) {
|
||||
var9 = true;
|
||||
}
|
||||
}
|
||||
|
||||
return !var8 && !var7 && !var6 && !var9 && var5 >= 2 && var5 <= 5 ? true : (var5 == 2 && var8 && !var6 && !var7 ? true : (var5 == 3 && var9 && !var6 && !var7 ? true : (var5 == 4 && var6 && !var8 && !var9 ? true : var5 == 5 && var7 && !var8 && !var9)));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canProvidePower() {
|
||||
return this.wiresProvidePower;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var6 > 0) {
|
||||
double var7 = (double)var2 + 0.5D + ((double)var5.nextFloat() - 0.5D) * 0.2D;
|
||||
double var9 = (double)((float)var3 + 1.0F / 16.0F);
|
||||
double var11 = (double)var4 + 0.5D + ((double)var5.nextFloat() - 0.5D) * 0.2D;
|
||||
float var13 = (float)var6 / 15.0F;
|
||||
float var14 = var13 * 0.6F + 0.4F;
|
||||
if(var6 == 0) {
|
||||
var14 = 0.0F;
|
||||
}
|
||||
|
||||
float var15 = var13 * var13 * 0.7F - 0.5F;
|
||||
float var16 = var13 * var13 * 0.6F - 0.7F;
|
||||
if(var15 < 0.0F) {
|
||||
var15 = 0.0F;
|
||||
}
|
||||
|
||||
if(var16 < 0.0F) {
|
||||
var16 = 0.0F;
|
||||
}
|
||||
|
||||
var1.spawnParticle("reddust", var7, var9, var11, (double)var14, (double)var15, (double)var16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean isPowerProviderOrWire(IBlockAccess var0, int var1, int var2, int var3, int var4) {
|
||||
int var5 = var0.getBlockId(var1, var2, var3);
|
||||
if(var5 == Block.redstoneWire.blockID) {
|
||||
return true;
|
||||
} else if(var5 == 0) {
|
||||
return false;
|
||||
} else if(Block.blocksList[var5].canProvidePower()) {
|
||||
return true;
|
||||
} else if(var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID) {
|
||||
return false;
|
||||
} else {
|
||||
int var6 = var0.getBlockMetadata(var1, var2, var3);
|
||||
return var4 == ModelBed.field_22279_b[var6 & 3];
|
||||
}
|
||||
}
|
||||
}
|
73
src/net/minecraft/src/BlockReed.java
Normal file
73
src/net/minecraft/src/BlockReed.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockReed extends Block {
|
||||
protected BlockReed(int var1, int var2) {
|
||||
super(var1, Material.plants);
|
||||
this.blockIndexInTexture = var2;
|
||||
float var3 = 6.0F / 16.0F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 1.0F, 0.5F + var3);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var1.isAirBlock(var2, var3 + 1, var4)) {
|
||||
int var6;
|
||||
for(var6 = 1; var1.getBlockId(var2, var3 - var6, var4) == this.blockID; ++var6) {
|
||||
}
|
||||
|
||||
if(var6 < 3) {
|
||||
int var7 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var7 == 15) {
|
||||
var1.setBlockWithNotify(var2, var3 + 1, var4, this.blockID);
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 0);
|
||||
} else {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var7 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockId(var2, var3 - 1, var4);
|
||||
return var5 == this.blockID ? true : (var5 != Block.grass.blockID && var5 != Block.dirt.blockID ? false : (var1.getBlockMaterial(var2 - 1, var3 - 1, var4) == Material.water ? true : (var1.getBlockMaterial(var2 + 1, var3 - 1, var4) == Material.water ? true : (var1.getBlockMaterial(var2, var3 - 1, var4 - 1) == Material.water ? true : var1.getBlockMaterial(var2, var3 - 1, var4 + 1) == Material.water))));
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
this.checkBlockCoordValid(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
protected final void checkBlockCoordValid(World var1, int var2, int var3, int var4) {
|
||||
if(!this.canBlockStay(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World var1, int var2, int var3, int var4) {
|
||||
return this.canPlaceBlockAt(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.reed.shiftedIndex;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 1;
|
||||
}
|
||||
}
|
60
src/net/minecraft/src/BlockSand.java
Normal file
60
src/net/minecraft/src/BlockSand.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSand extends Block {
|
||||
public static boolean fallInstantly = false;
|
||||
|
||||
public BlockSand(int var1, int var2) {
|
||||
super(var1, var2, Material.sand);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID, this.tickRate());
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
this.tryToFall(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
private void tryToFall(World var1, int var2, int var3, int var4) {
|
||||
if(canFallBelow(var1, var2, var3 - 1, var4) && var3 >= 0) {
|
||||
byte var8 = 32;
|
||||
if(!fallInstantly && var1.checkChunksExist(var2 - var8, var3 - var8, var4 - var8, var2 + var8, var3 + var8, var4 + var8)) {
|
||||
EntityFallingSand var9 = new EntityFallingSand(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F), this.blockID);
|
||||
var1.entityJoinedWorld(var9);
|
||||
} else {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
|
||||
while(canFallBelow(var1, var2, var3 - 1, var4) && var3 > 0) {
|
||||
--var3;
|
||||
}
|
||||
|
||||
if(var3 > 0) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, this.blockID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public static boolean canFallBelow(World var0, int var1, int var2, int var3) {
|
||||
int var4 = var0.getBlockId(var1, var2, var3);
|
||||
if(var4 == 0) {
|
||||
return true;
|
||||
} else if(var4 == Block.fire.blockID) {
|
||||
return true;
|
||||
} else {
|
||||
Material var5 = Block.blocksList[var4].blockMaterial;
|
||||
return var5 == Material.water ? true : var5 == Material.lava;
|
||||
}
|
||||
}
|
||||
}
|
11
src/net/minecraft/src/BlockSandStone.java
Normal file
11
src/net/minecraft/src/BlockSandStone.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockSandStone extends Block {
|
||||
public BlockSandStone(int var1) {
|
||||
super(var1, 192, Material.rock);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture - 16 : (var1 == 0 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture);
|
||||
}
|
||||
}
|
56
src/net/minecraft/src/BlockSapling.java
Normal file
56
src/net/minecraft/src/BlockSapling.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSapling extends BlockFlower {
|
||||
protected BlockSapling(int var1, int var2) {
|
||||
super(var1, var2);
|
||||
float var3 = 0.4F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 2.0F, 0.5F + var3);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
super.updateTick(var1, var2, var3, var4, var5);
|
||||
if(var1.getBlockLightValue(var2, var3 + 1, var4) >= 9 && var5.nextInt(30) == 0) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if((var6 & 8) == 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 | 8);
|
||||
} else {
|
||||
this.growTree(var1, var2, var3, var4, var5);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
var2 &= 3;
|
||||
return var2 == 1 ? 63 : (var2 == 2 ? 79 : super.getBlockTextureFromSideAndMetadata(var1, var2));
|
||||
}
|
||||
|
||||
public void growTree(World var1, int var2, int var3, int var4, Random var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4) & 3;
|
||||
var1.setBlock(var2, var3, var4, 0);
|
||||
Object var7 = null;
|
||||
if(var6 == 1) {
|
||||
var7 = new WorldGenTaiga2();
|
||||
} else if(var6 == 2) {
|
||||
var7 = new WorldGenForest();
|
||||
} else {
|
||||
var7 = new WorldGenTrees();
|
||||
if(var5.nextInt(10) == 0) {
|
||||
var7 = new WorldGenBigTree();
|
||||
}
|
||||
}
|
||||
|
||||
if(!((WorldGenerator)var7).generate(var1, var5, var2, var3, var4)) {
|
||||
var1.setBlockAndMetadata(var2, var3, var4, this.blockID, var6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected int damageDropped(int var1) {
|
||||
return var1 & 3;
|
||||
}
|
||||
}
|
113
src/net/minecraft/src/BlockSign.java
Normal file
113
src/net/minecraft/src/BlockSign.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSign extends BlockContainer {
|
||||
private Class signEntityClass;
|
||||
private boolean isFreestanding;
|
||||
|
||||
protected BlockSign(int var1, Class var2, boolean var3) {
|
||||
super(var1, Material.wood);
|
||||
this.isFreestanding = var3;
|
||||
this.blockIndexInTexture = 4;
|
||||
this.signEntityClass = var2;
|
||||
float var4 = 0.25F;
|
||||
float var5 = 1.0F;
|
||||
this.setBlockBounds(0.5F - var4, 0.0F, 0.5F - var4, 0.5F + var4, var5, 0.5F + var4);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
return super.getSelectedBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
if(!this.isFreestanding) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
float var6 = 9.0F / 32.0F;
|
||||
float var7 = 25.0F / 32.0F;
|
||||
float var8 = 0.0F;
|
||||
float var9 = 1.0F;
|
||||
float var10 = 2.0F / 16.0F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
if(var5 == 2) {
|
||||
this.setBlockBounds(var8, var6, 1.0F - var10, var9, var7, 1.0F);
|
||||
}
|
||||
|
||||
if(var5 == 3) {
|
||||
this.setBlockBounds(var8, var6, 0.0F, var9, var7, var10);
|
||||
}
|
||||
|
||||
if(var5 == 4) {
|
||||
this.setBlockBounds(1.0F - var10, var6, var8, 1.0F, var7, var9);
|
||||
}
|
||||
|
||||
if(var5 == 5) {
|
||||
this.setBlockBounds(0.0F, var6, var8, var10, var7, var9);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected TileEntity getBlockEntity() {
|
||||
try {
|
||||
return (TileEntity)this.signEntityClass.newInstance();
|
||||
} catch (Exception var2) {
|
||||
throw new RuntimeException(var2);
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.sign.shiftedIndex;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
boolean var6 = false;
|
||||
if(this.isFreestanding) {
|
||||
if(!var1.getBlockMaterial(var2, var3 - 1, var4).isSolid()) {
|
||||
var6 = true;
|
||||
}
|
||||
} else {
|
||||
int var7 = var1.getBlockMetadata(var2, var3, var4);
|
||||
var6 = true;
|
||||
if(var7 == 2 && var1.getBlockMaterial(var2, var3, var4 + 1).isSolid()) {
|
||||
var6 = false;
|
||||
}
|
||||
|
||||
if(var7 == 3 && var1.getBlockMaterial(var2, var3, var4 - 1).isSolid()) {
|
||||
var6 = false;
|
||||
}
|
||||
|
||||
if(var7 == 4 && var1.getBlockMaterial(var2 + 1, var3, var4).isSolid()) {
|
||||
var6 = false;
|
||||
}
|
||||
|
||||
if(var7 == 5 && var1.getBlockMaterial(var2 - 1, var3, var4).isSolid()) {
|
||||
var6 = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(var6) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
|
||||
}
|
||||
}
|
82
src/net/minecraft/src/BlockSnow.java
Normal file
82
src/net/minecraft/src/BlockSnow.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSnow extends Block {
|
||||
protected BlockSnow(int var1, int var2) {
|
||||
super(var1, var2, Material.snow);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F / 16.0F, 1.0F);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4) & 7;
|
||||
return var5 >= 3 ? AxisAlignedBB.getBoundingBoxFromPool((double)var2 + this.minX, (double)var3 + this.minY, (double)var4 + this.minZ, (double)var2 + this.maxX, (double)((float)var3 + 0.5F), (double)var4 + this.maxZ) : null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4) & 7;
|
||||
float var6 = (float)(2 * (1 + var5)) / 16.0F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var6, 1.0F);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockId(var2, var3 - 1, var4);
|
||||
return var5 != 0 && Block.blocksList[var5].isOpaqueCube() ? var1.getBlockMaterial(var2, var3 - 1, var4).getIsSolid() : false;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
this.func_314_h(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
private boolean func_314_h(World var1, int var2, int var3, int var4) {
|
||||
if(!this.canPlaceBlockAt(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) {
|
||||
int var7 = Item.snowball.shiftedIndex;
|
||||
float var8 = 0.7F;
|
||||
double var9 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D;
|
||||
double var11 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D;
|
||||
double var13 = (double)(var1.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D;
|
||||
EntityItem var15 = new EntityItem(var1, (double)var3 + var9, (double)var4 + var11, (double)var5 + var13, new ItemStack(var7, 1, 0));
|
||||
var15.delayBeforeCanPickup = 10;
|
||||
var1.entityJoinedWorld(var15);
|
||||
var1.setBlockWithNotify(var3, var4, var5, 0);
|
||||
var2.addStat(StatList.mineBlockStatArray[this.blockID], 1);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.snowball.shiftedIndex;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var1.getSavedLightValue(EnumSkyBlock.Block, var2, var3, var4) > 11) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return var5 == 1 ? true : super.shouldSideBeRendered(var1, var2, var3, var4, var5);
|
||||
}
|
||||
}
|
26
src/net/minecraft/src/BlockSnowBlock.java
Normal file
26
src/net/minecraft/src/BlockSnowBlock.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSnowBlock extends Block {
|
||||
protected BlockSnowBlock(int var1, int var2) {
|
||||
super(var1, var2, Material.builtSnow);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.snowball.shiftedIndex;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(var1.getSavedLightValue(EnumSkyBlock.Block, var2, var3, var4) > 11) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
17
src/net/minecraft/src/BlockSoulSand.java
Normal file
17
src/net/minecraft/src/BlockSoulSand.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockSoulSand extends Block {
|
||||
public BlockSoulSand(int var1, int var2) {
|
||||
super(var1, var2, Material.sand);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
float var5 = 2.0F / 16.0F;
|
||||
return AxisAlignedBB.getBoundingBoxFromPool((double)var2, (double)var3, (double)var4, (double)(var2 + 1), (double)((float)(var3 + 1) - var5), (double)(var4 + 1));
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
var5.motionX *= 0.4D;
|
||||
var5.motionZ *= 0.4D;
|
||||
}
|
||||
}
|
35
src/net/minecraft/src/BlockSponge.java
Normal file
35
src/net/minecraft/src/BlockSponge.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockSponge extends Block {
|
||||
protected BlockSponge(int var1) {
|
||||
super(var1, Material.sponge);
|
||||
this.blockIndexInTexture = 48;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
byte var5 = 2;
|
||||
|
||||
for(int var6 = var2 - var5; var6 <= var2 + var5; ++var6) {
|
||||
for(int var7 = var3 - var5; var7 <= var3 + var5; ++var7) {
|
||||
for(int var8 = var4 - var5; var8 <= var4 + var5; ++var8) {
|
||||
if(var1.getBlockMaterial(var6, var7, var8) == Material.water) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
byte var5 = 2;
|
||||
|
||||
for(int var6 = var2 - var5; var6 <= var2 + var5; ++var6) {
|
||||
for(int var7 = var3 - var5; var7 <= var3 + var5; ++var7) {
|
||||
for(int var8 = var4 - var5; var8 <= var4 + var5; ++var8) {
|
||||
var1.notifyBlocksOfNeighborChange(var6, var7, var8, var1.getBlockId(var6, var7, var8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
185
src/net/minecraft/src/BlockStairs.java
Normal file
185
src/net/minecraft/src/BlockStairs.java
Normal file
|
@ -0,0 +1,185 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStairs extends Block {
|
||||
private Block modelBlock;
|
||||
|
||||
protected BlockStairs(int var1, Block var2) {
|
||||
super(var1, var2.blockIndexInTexture, var2.blockMaterial);
|
||||
this.modelBlock = var2;
|
||||
this.setHardness(var2.blockHardness);
|
||||
this.setResistance(var2.blockResistance / 3.0F);
|
||||
this.setStepSound(var2.stepSound);
|
||||
this.setLightOpacity(255);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return super.getCollisionBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return super.shouldSideBeRendered(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) {
|
||||
int var7 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var7 == 0) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
} else if(var7 == 1) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 1.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
} else if(var7 == 2) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 0.5F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 1.0F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
} else if(var7 == 3) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
|
||||
super.getCollidingBoundingBoxes(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
this.modelBlock.randomDisplayTick(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.modelBlock.onBlockClicked(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) {
|
||||
this.modelBlock.onBlockDestroyedByPlayer(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public float getBlockBrightness(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
return this.modelBlock.getBlockBrightness(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public float getExplosionResistance(Entity var1) {
|
||||
return this.modelBlock.getExplosionResistance(var1);
|
||||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return this.modelBlock.getRenderBlockPass();
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return this.modelBlock.idDropped(var1, var2);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return this.modelBlock.quantityDropped(var1);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return this.modelBlock.getBlockTextureFromSideAndMetadata(var1, var2);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return this.modelBlock.getBlockTextureFromSide(var1);
|
||||
}
|
||||
|
||||
public int getBlockTexture(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
return this.modelBlock.getBlockTexture(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public int tickRate() {
|
||||
return this.modelBlock.tickRate();
|
||||
}
|
||||
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return this.modelBlock.getSelectedBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void velocityToAddToEntity(World var1, int var2, int var3, int var4, Entity var5, Vec3D var6) {
|
||||
this.modelBlock.velocityToAddToEntity(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public boolean isCollidable() {
|
||||
return this.modelBlock.isCollidable();
|
||||
}
|
||||
|
||||
public boolean canCollideCheck(int var1, boolean var2) {
|
||||
return this.modelBlock.canCollideCheck(var1, var2);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return this.modelBlock.canPlaceBlockAt(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
this.onNeighborBlockChange(var1, var2, var3, var4, 0);
|
||||
this.modelBlock.onBlockAdded(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
|
||||
this.modelBlock.onBlockRemoval(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6) {
|
||||
this.modelBlock.dropBlockAsItemWithChance(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public void onEntityWalking(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
this.modelBlock.onEntityWalking(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
this.modelBlock.updateTick(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
return this.modelBlock.blockActivated(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByExplosion(World var1, int var2, int var3, int var4) {
|
||||
this.modelBlock.onBlockDestroyedByExplosion(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) {
|
||||
int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
if(var6 == 0) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 2);
|
||||
}
|
||||
|
||||
if(var6 == 1) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 1);
|
||||
}
|
||||
|
||||
if(var6 == 2) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 3);
|
||||
}
|
||||
|
||||
if(var6 == 3) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
57
src/net/minecraft/src/BlockStationary.java
Normal file
57
src/net/minecraft/src/BlockStationary.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStationary extends BlockFluid {
|
||||
protected BlockStationary(int var1, Material var2) {
|
||||
super(var1, var2);
|
||||
this.setTickOnLoad(false);
|
||||
if(var2 == Material.lava) {
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
super.onNeighborBlockChange(var1, var2, var3, var4, var5);
|
||||
if(var1.getBlockId(var2, var3, var4) == this.blockID) {
|
||||
this.func_30004_j(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void func_30004_j(World var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
var1.editingBlocks = true;
|
||||
var1.setBlockAndMetadata(var2, var3, var4, this.blockID - 1, var5);
|
||||
var1.markBlocksDirty(var2, var3, var4, var2, var3, var4);
|
||||
var1.scheduleBlockUpdate(var2, var3, var4, this.blockID - 1, this.tickRate());
|
||||
var1.editingBlocks = false;
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
if(this.blockMaterial == Material.lava) {
|
||||
int var6 = var5.nextInt(3);
|
||||
|
||||
for(int var7 = 0; var7 < var6; ++var7) {
|
||||
var2 += var5.nextInt(3) - 1;
|
||||
++var3;
|
||||
var4 += var5.nextInt(3) - 1;
|
||||
int var8 = var1.getBlockId(var2, var3, var4);
|
||||
if(var8 == 0) {
|
||||
if(this.func_301_k(var1, var2 - 1, var3, var4) || this.func_301_k(var1, var2 + 1, var3, var4) || this.func_301_k(var1, var2, var3, var4 - 1) || this.func_301_k(var1, var2, var3, var4 + 1) || this.func_301_k(var1, var2, var3 - 1, var4) || this.func_301_k(var1, var2, var3 + 1, var4)) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, Block.fire.blockID);
|
||||
return;
|
||||
}
|
||||
} else if(Block.blocksList[var8].blockMaterial.getIsSolid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean func_301_k(World var1, int var2, int var3, int var4) {
|
||||
return var1.getBlockMaterial(var2, var3, var4).getBurning();
|
||||
}
|
||||
}
|
71
src/net/minecraft/src/BlockStep.java
Normal file
71
src/net/minecraft/src/BlockStep.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStep extends Block {
|
||||
public static final String[] field_22037_a = new String[]{"stone", "sand", "wood", "cobble"};
|
||||
private boolean blockType;
|
||||
|
||||
public BlockStep(int var1, boolean var2) {
|
||||
super(var1, 6, Material.rock);
|
||||
this.blockType = var2;
|
||||
if(!var2) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
this.setLightOpacity(255);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return var2 == 0 ? (var1 <= 1 ? 6 : 5) : (var2 == 1 ? (var1 == 0 ? 208 : (var1 == 1 ? 176 : 192)) : (var2 == 2 ? 4 : (var2 == 3 ? 16 : 6)));
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return this.getBlockTextureFromSideAndMetadata(var1, 0);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return this.blockType;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
if(this != Block.stairSingle) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
int var5 = var1.getBlockId(var2, var3 - 1, var4);
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var1.getBlockMetadata(var2, var3 - 1, var4);
|
||||
if(var6 == var7) {
|
||||
if(var5 == stairSingle.blockID) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
var1.setBlockAndMetadataWithNotify(var2, var3 - 1, var4, Block.stairDouble.blockID, var6);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.stairSingle.blockID;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return this.blockType ? 2 : 1;
|
||||
}
|
||||
|
||||
protected int damageDropped(int var1) {
|
||||
return var1;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return this.blockType;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) {
|
||||
if(this != Block.stairSingle) {
|
||||
super.shouldSideBeRendered(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
return var5 == 1 ? true : (!super.shouldSideBeRendered(var1, var2, var3, var4, var5) ? false : (var5 == 0 ? true : var1.getBlockId(var2, var3, var4) != this.blockID));
|
||||
}
|
||||
}
|
13
src/net/minecraft/src/BlockStone.java
Normal file
13
src/net/minecraft/src/BlockStone.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStone extends Block {
|
||||
public BlockStone(int var1, int var2) {
|
||||
super(var1, var2, Material.rock);
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Block.cobblestone.blockID;
|
||||
}
|
||||
}
|
65
src/net/minecraft/src/BlockTNT.java
Normal file
65
src/net/minecraft/src/BlockTNT.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockTNT extends Block {
|
||||
public BlockTNT(int var1, int var2) {
|
||||
super(var1, var2, Material.tnt);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 0 ? this.blockIndexInTexture + 2 : (var1 == 1 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
super.onBlockAdded(var1, var2, var3, var4);
|
||||
if(var1.isBlockIndirectlyGettingPowered(var2, var3, var4)) {
|
||||
this.onBlockDestroyedByPlayer(var1, var2, var3, var4, 1);
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 > 0 && Block.blocksList[var5].canProvidePower() && var1.isBlockIndirectlyGettingPowered(var2, var3, var4)) {
|
||||
this.onBlockDestroyedByPlayer(var1, var2, var3, var4, 1);
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int quantityDropped(Random var1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByExplosion(World var1, int var2, int var3, int var4) {
|
||||
EntityTNTPrimed var5 = new EntityTNTPrimed(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F));
|
||||
var5.fuse = var1.rand.nextInt(var5.fuse / 4) + var5.fuse / 8;
|
||||
var1.entityJoinedWorld(var5);
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
if((var5 & 1) == 0) {
|
||||
this.dropBlockAsItem_do(var1, var2, var3, var4, new ItemStack(Block.tnt.blockID, 1, 0));
|
||||
} else {
|
||||
EntityTNTPrimed var6 = new EntityTNTPrimed(var1, (double)((float)var2 + 0.5F), (double)((float)var3 + 0.5F), (double)((float)var4 + 0.5F));
|
||||
var1.entityJoinedWorld(var6);
|
||||
var1.playSoundAtEntity(var6, "random.fuse", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var5.getCurrentEquippedItem() != null && var5.getCurrentEquippedItem().itemID == Item.flintAndSteel.shiftedIndex) {
|
||||
var1.setBlockMetadata(var2, var3, var4, 1);
|
||||
}
|
||||
|
||||
super.onBlockClicked(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
return super.blockActivated(var1, var2, var3, var4, var5);
|
||||
}
|
||||
}
|
36
src/net/minecraft/src/BlockTallGrass.java
Normal file
36
src/net/minecraft/src/BlockTallGrass.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockTallGrass extends BlockFlower {
|
||||
protected BlockTallGrass(int var1, int var2) {
|
||||
super(var1, var2);
|
||||
float var3 = 0.4F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.8F, 0.5F + var3);
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
|
||||
return var2 == 1 ? this.blockIndexInTexture : (var2 == 2 ? this.blockIndexInTexture + 16 + 1 : (var2 == 0 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture));
|
||||
}
|
||||
|
||||
public int colorMultiplier(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
int var5 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var5 == 0) {
|
||||
return 16777215;
|
||||
} else {
|
||||
long var6 = (long)(var2 * 3129871 + var4 * 6129781 + var3);
|
||||
var6 = var6 * var6 * 42317861L + var6 * 11L;
|
||||
var2 = (int)((long)var2 + (var6 >> 14 & 31L));
|
||||
var3 = (int)((long)var3 + (var6 >> 19 & 31L));
|
||||
var4 = (int)((long)var4 + (var6 >> 24 & 31L));
|
||||
var1.getWorldChunkManager().func_4069_a(var2, var4, 1, 1);
|
||||
double var8 = var1.getWorldChunkManager().temperature[0];
|
||||
double var10 = var1.getWorldChunkManager().humidity[0];
|
||||
return ColorizerGrass.getGrassColor(var8, var10);
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return var2.nextInt(8) == 0 ? Item.seeds.shiftedIndex : -1;
|
||||
}
|
||||
}
|
170
src/net/minecraft/src/BlockTorch.java
Normal file
170
src/net/minecraft/src/BlockTorch.java
Normal file
|
@ -0,0 +1,170 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockTorch extends Block {
|
||||
protected BlockTorch(int var1, int var2) {
|
||||
super(var1, var2, Material.circuits);
|
||||
this.setTickOnLoad(true);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
private boolean func_31032_h(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2, var3, var4) || var1.getBlockId(var2, var3, var4) == Block.fence.blockID;
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
|
||||
return var1.isBlockNormalCube(var2 - 1, var3, var4) ? true : (var1.isBlockNormalCube(var2 + 1, var3, var4) ? true : (var1.isBlockNormalCube(var2, var3, var4 - 1) ? true : (var1.isBlockNormalCube(var2, var3, var4 + 1) ? true : this.func_31032_h(var1, var2, var3 - 1, var4))));
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
if(var5 == 1 && this.func_31032_h(var1, var2, var3 - 1, var4)) {
|
||||
var6 = 5;
|
||||
}
|
||||
|
||||
if(var5 == 2 && var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
var6 = 4;
|
||||
}
|
||||
|
||||
if(var5 == 3 && var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
var6 = 3;
|
||||
}
|
||||
|
||||
if(var5 == 4 && var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
var6 = 2;
|
||||
}
|
||||
|
||||
if(var5 == 5 && var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
var6 = 1;
|
||||
}
|
||||
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6);
|
||||
}
|
||||
|
||||
public void updateTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
super.updateTick(var1, var2, var3, var4, var5);
|
||||
if(var1.getBlockMetadata(var2, var3, var4) == 0) {
|
||||
this.onBlockAdded(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockAdded(World var1, int var2, int var3, int var4) {
|
||||
if(var1.isBlockNormalCube(var2 - 1, var3, var4)) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 1);
|
||||
} else if(var1.isBlockNormalCube(var2 + 1, var3, var4)) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 2);
|
||||
} else if(var1.isBlockNormalCube(var2, var3, var4 - 1)) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 3);
|
||||
} else if(var1.isBlockNormalCube(var2, var3, var4 + 1)) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 4);
|
||||
} else if(this.func_31032_h(var1, var2, var3 - 1, var4)) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, 5);
|
||||
}
|
||||
|
||||
this.dropTorchIfCantStay(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(this.dropTorchIfCantStay(var1, var2, var3, var4)) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
boolean var7 = false;
|
||||
if(!var1.isBlockNormalCube(var2 - 1, var3, var4) && var6 == 1) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2 + 1, var3, var4) && var6 == 2) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3, var4 - 1) && var6 == 3) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var2, var3, var4 + 1) && var6 == 4) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(!this.func_31032_h(var1, var2, var3 - 1, var4) && var6 == 5) {
|
||||
var7 = true;
|
||||
}
|
||||
|
||||
if(var7) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean dropTorchIfCantStay(World var1, int var2, int var3, int var4) {
|
||||
if(!this.canPlaceBlockAt(var1, var2, var3, var4)) {
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var1.getBlockMetadata(var2, var3, var4));
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) {
|
||||
int var7 = var1.getBlockMetadata(var2, var3, var4) & 7;
|
||||
float var8 = 0.15F;
|
||||
if(var7 == 1) {
|
||||
this.setBlockBounds(0.0F, 0.2F, 0.5F - var8, var8 * 2.0F, 0.8F, 0.5F + var8);
|
||||
} else if(var7 == 2) {
|
||||
this.setBlockBounds(1.0F - var8 * 2.0F, 0.2F, 0.5F - var8, 1.0F, 0.8F, 0.5F + var8);
|
||||
} else if(var7 == 3) {
|
||||
this.setBlockBounds(0.5F - var8, 0.2F, 0.0F, 0.5F + var8, 0.8F, var8 * 2.0F);
|
||||
} else if(var7 == 4) {
|
||||
this.setBlockBounds(0.5F - var8, 0.2F, 1.0F - var8 * 2.0F, 0.5F + var8, 0.8F, 1.0F);
|
||||
} else {
|
||||
var8 = 0.1F;
|
||||
this.setBlockBounds(0.5F - var8, 0.0F, 0.5F - var8, 0.5F + var8, 0.6F, 0.5F + var8);
|
||||
}
|
||||
|
||||
return super.collisionRayTrace(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
double var7 = (double)((float)var2 + 0.5F);
|
||||
double var9 = (double)((float)var3 + 0.7F);
|
||||
double var11 = (double)((float)var4 + 0.5F);
|
||||
double var13 = (double)0.22F;
|
||||
double var15 = (double)0.27F;
|
||||
if(var6 == 1) {
|
||||
var1.spawnParticle("smoke", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 2) {
|
||||
var1.spawnParticle("smoke", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 3) {
|
||||
var1.spawnParticle("smoke", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D);
|
||||
} else if(var6 == 4) {
|
||||
var1.spawnParticle("smoke", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
var1.spawnParticle("smoke", var7, var9, var11, 0.0D, 0.0D, 0.0D);
|
||||
var1.spawnParticle("flame", var7, var9, var11, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
183
src/net/minecraft/src/BlockTrapDoor.java
Normal file
183
src/net/minecraft/src/BlockTrapDoor.java
Normal file
|
@ -0,0 +1,183 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockTrapDoor extends Block {
|
||||
protected BlockTrapDoor(int var1, Material var2) {
|
||||
super(var1, var2);
|
||||
this.blockIndexInTexture = 84;
|
||||
if(var2 == Material.iron) {
|
||||
++this.blockIndexInTexture;
|
||||
}
|
||||
|
||||
float var3 = 0.5F;
|
||||
float var4 = 1.0F;
|
||||
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var4, 0.5F + var3);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
return super.getSelectedBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
return super.getCollisionBoundingBoxFromPool(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
|
||||
this.setBlockBoundsForBlockRender(var1.getBlockMetadata(var2, var3, var4));
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender() {
|
||||
float var1 = 3.0F / 16.0F;
|
||||
this.setBlockBounds(0.0F, 0.5F - var1 / 2.0F, 0.0F, 1.0F, 0.5F + var1 / 2.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void setBlockBoundsForBlockRender(int var1) {
|
||||
float var2 = 3.0F / 16.0F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var2, 1.0F);
|
||||
if(isTrapdoorOpen(var1)) {
|
||||
if((var1 & 3) == 0) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if((var1 & 3) == 1) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2);
|
||||
}
|
||||
|
||||
if((var1 & 3) == 2) {
|
||||
this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if((var1 & 3) == 3) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockClicked(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
this.blockActivated(var1, var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(this.blockMaterial == Material.iron) {
|
||||
return true;
|
||||
} else {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 ^ 4);
|
||||
var1.func_28107_a(var5, 1003, var2, var3, var4, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void onPoweredBlockChange(World var1, int var2, int var3, int var4, boolean var5) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
boolean var7 = (var6 & 4) > 0;
|
||||
if(var7 != var5) {
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6 ^ 4);
|
||||
var1.func_28107_a((EntityPlayer)null, 1003, var2, var3, var4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(!var1.multiplayerWorld) {
|
||||
int var6 = var1.getBlockMetadata(var2, var3, var4);
|
||||
int var7 = var2;
|
||||
int var8 = var4;
|
||||
if((var6 & 3) == 0) {
|
||||
var8 = var4 + 1;
|
||||
}
|
||||
|
||||
if((var6 & 3) == 1) {
|
||||
--var8;
|
||||
}
|
||||
|
||||
if((var6 & 3) == 2) {
|
||||
var7 = var2 + 1;
|
||||
}
|
||||
|
||||
if((var6 & 3) == 3) {
|
||||
--var7;
|
||||
}
|
||||
|
||||
if(!var1.isBlockNormalCube(var7, var3, var8)) {
|
||||
var1.setBlockWithNotify(var2, var3, var4, 0);
|
||||
this.dropBlockAsItem(var1, var2, var3, var4, var6);
|
||||
}
|
||||
|
||||
if(var5 > 0 && Block.blocksList[var5].canProvidePower()) {
|
||||
boolean var9 = var1.isBlockIndirectlyGettingPowered(var2, var3, var4);
|
||||
this.onPoweredBlockChange(var1, var2, var3, var4, var9);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) {
|
||||
this.setBlockBoundsBasedOnState(var1, var2, var3, var4);
|
||||
return super.collisionRayTrace(var1, var2, var3, var4, var5, var6);
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World var1, int var2, int var3, int var4, int var5) {
|
||||
byte var6 = 0;
|
||||
if(var5 == 2) {
|
||||
var6 = 0;
|
||||
}
|
||||
|
||||
if(var5 == 3) {
|
||||
var6 = 1;
|
||||
}
|
||||
|
||||
if(var5 == 4) {
|
||||
var6 = 2;
|
||||
}
|
||||
|
||||
if(var5 == 5) {
|
||||
var6 = 3;
|
||||
}
|
||||
|
||||
var1.setBlockMetadataWithNotify(var2, var3, var4, var6);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockOnSide(World var1, int var2, int var3, int var4, int var5) {
|
||||
if(var5 == 0) {
|
||||
return false;
|
||||
} else if(var5 == 1) {
|
||||
return false;
|
||||
} else {
|
||||
if(var5 == 2) {
|
||||
++var4;
|
||||
}
|
||||
|
||||
if(var5 == 3) {
|
||||
--var4;
|
||||
}
|
||||
|
||||
if(var5 == 4) {
|
||||
++var2;
|
||||
}
|
||||
|
||||
if(var5 == 5) {
|
||||
--var2;
|
||||
}
|
||||
|
||||
return var1.isBlockNormalCube(var2, var3, var4);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isTrapdoorOpen(int var0) {
|
||||
return (var0 & 4) != 0;
|
||||
}
|
||||
}
|
33
src/net/minecraft/src/BlockWeb.java
Normal file
33
src/net/minecraft/src/BlockWeb.java
Normal file
|
@ -0,0 +1,33 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockWeb extends Block {
|
||||
public BlockWeb(int var1, int var2) {
|
||||
super(var1, var2, Material.field_31068_A);
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World var1, int var2, int var3, int var4, Entity var5) {
|
||||
var5.isInWeb = true;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World var1, int var2, int var3, int var4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getRenderType() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int idDropped(int var1, Random var2) {
|
||||
return Item.silk.shiftedIndex;
|
||||
}
|
||||
}
|
21
src/net/minecraft/src/BlockWorkbench.java
Normal file
21
src/net/minecraft/src/BlockWorkbench.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class BlockWorkbench extends Block {
|
||||
protected BlockWorkbench(int var1) {
|
||||
super(var1, Material.wood);
|
||||
this.blockIndexInTexture = 59;
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSide(int var1) {
|
||||
return var1 == 1 ? this.blockIndexInTexture - 16 : (var1 == 0 ? Block.planks.getBlockTextureFromSide(0) : (var1 != 2 && var1 != 4 ? this.blockIndexInTexture : this.blockIndexInTexture + 1));
|
||||
}
|
||||
|
||||
public boolean blockActivated(World var1, int var2, int var3, int var4, EntityPlayer var5) {
|
||||
if(var1.multiplayerWorld) {
|
||||
return true;
|
||||
} else {
|
||||
var5.displayWorkbenchGUI(var2, var3, var4);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
11
src/net/minecraft/src/CanvasCrashReport.java
Normal file
11
src/net/minecraft/src/CanvasCrashReport.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Dimension;
|
||||
|
||||
class CanvasCrashReport extends Canvas {
|
||||
public CanvasCrashReport(int var1) {
|
||||
this.setPreferredSize(new Dimension(var1, var1));
|
||||
this.setMinimumSize(new Dimension(var1, var1));
|
||||
}
|
||||
}
|
380
src/net/minecraft/src/CanvasIsomPreview.java
Normal file
380
src/net/minecraft/src/CanvasIsomPreview.java
Normal file
|
@ -0,0 +1,380 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.BufferStrategy;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class CanvasIsomPreview extends Canvas implements KeyListener, MouseListener, MouseMotionListener, Runnable {
|
||||
private int field_1793_a = 0;
|
||||
private int zoomLevel = 2;
|
||||
private boolean displayHelpText = true;
|
||||
private World worldObj;
|
||||
private File dataFolder = this.getMinecraftDir();
|
||||
private boolean running = true;
|
||||
private List imageBufferList = Collections.synchronizedList(new LinkedList());
|
||||
private IsoImageBuffer[][] imageBuffers = new IsoImageBuffer[64][64];
|
||||
private int field_1785_i;
|
||||
private int field_1784_j;
|
||||
private int xPosition;
|
||||
private int yPosition;
|
||||
|
||||
public File getMinecraftDir() {
|
||||
if(this.dataFolder == null) {
|
||||
this.dataFolder = this.getAppDir("minecraft");
|
||||
}
|
||||
|
||||
return this.dataFolder;
|
||||
}
|
||||
|
||||
public File getAppDir(String var1) {
|
||||
String var2 = System.getProperty("user.home", ".");
|
||||
File var3;
|
||||
switch(OsMap.field_1193_a[getOs().ordinal()]) {
|
||||
case 1:
|
||||
case 2:
|
||||
var3 = new File(var2, '.' + var1 + '/');
|
||||
break;
|
||||
case 3:
|
||||
String var4 = System.getenv("APPDATA");
|
||||
if(var4 != null) {
|
||||
var3 = new File(var4, "." + var1 + '/');
|
||||
} else {
|
||||
var3 = new File(var2, '.' + var1 + '/');
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
var3 = new File(var2, "Library/Application Support/" + var1);
|
||||
break;
|
||||
default:
|
||||
var3 = new File(var2, var1 + '/');
|
||||
}
|
||||
|
||||
if(!var3.exists() && !var3.mkdirs()) {
|
||||
throw new RuntimeException("The working directory could not be created: " + var3);
|
||||
} else {
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
private static EnumOS1 getOs() {
|
||||
String var0 = System.getProperty("os.name").toLowerCase();
|
||||
return var0.contains("win") ? EnumOS1.windows : (var0.contains("mac") ? EnumOS1.macos : (var0.contains("solaris") ? EnumOS1.solaris : (var0.contains("sunos") ? EnumOS1.solaris : (var0.contains("linux") ? EnumOS1.linux : (var0.contains("unix") ? EnumOS1.linux : EnumOS1.unknown)))));
|
||||
}
|
||||
|
||||
public CanvasIsomPreview() {
|
||||
for(int var1 = 0; var1 < 64; ++var1) {
|
||||
for(int var2 = 0; var2 < 64; ++var2) {
|
||||
this.imageBuffers[var1][var2] = new IsoImageBuffer((World)null, var1, var2);
|
||||
}
|
||||
}
|
||||
|
||||
this.addMouseListener(this);
|
||||
this.addMouseMotionListener(this);
|
||||
this.addKeyListener(this);
|
||||
this.setFocusable(true);
|
||||
this.requestFocus();
|
||||
this.setBackground(Color.red);
|
||||
}
|
||||
|
||||
public void loadWorld(String var1) {
|
||||
this.field_1785_i = this.field_1784_j = 0;
|
||||
this.worldObj = new World(new SaveHandler(new File(this.dataFolder, "saves"), var1, false), var1, (new Random()).nextLong());
|
||||
this.worldObj.skylightSubtracted = 0;
|
||||
List var2 = this.imageBufferList;
|
||||
synchronized(var2) {
|
||||
this.imageBufferList.clear();
|
||||
|
||||
for(int var3 = 0; var3 < 64; ++var3) {
|
||||
for(int var4 = 0; var4 < 64; ++var4) {
|
||||
this.imageBuffers[var3][var4].func_888_a(this.worldObj, var3, var4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setTimeOfDay(int var1) {
|
||||
List var2 = this.imageBufferList;
|
||||
synchronized(var2) {
|
||||
this.worldObj.skylightSubtracted = var1;
|
||||
this.imageBufferList.clear();
|
||||
|
||||
for(int var3 = 0; var3 < 64; ++var3) {
|
||||
for(int var4 = 0; var4 < 64; ++var4) {
|
||||
this.imageBuffers[var3][var4].func_888_a(this.worldObj, var3, var4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void func_1272_b() {
|
||||
(new ThreadRunIsoClient(this)).start();
|
||||
|
||||
for(int var1 = 0; var1 < 8; ++var1) {
|
||||
(new Thread(this)).start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
private IsoImageBuffer getImageBuffer(int var1, int var2) {
|
||||
int var3 = var1 & 63;
|
||||
int var4 = var2 & 63;
|
||||
IsoImageBuffer var5 = this.imageBuffers[var3][var4];
|
||||
if(var5.field_1354_c == var1 && var5.field_1353_d == var2) {
|
||||
return var5;
|
||||
} else {
|
||||
List var6 = this.imageBufferList;
|
||||
synchronized(var6) {
|
||||
this.imageBufferList.remove(var5);
|
||||
}
|
||||
|
||||
var5.func_889_a(var1, var2);
|
||||
return var5;
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
TerrainTextureManager var1 = new TerrainTextureManager();
|
||||
|
||||
while(this.running) {
|
||||
IsoImageBuffer var2 = null;
|
||||
List var3 = this.imageBufferList;
|
||||
synchronized(var3) {
|
||||
if(this.imageBufferList.size() > 0) {
|
||||
var2 = (IsoImageBuffer)this.imageBufferList.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
if(var2 != null) {
|
||||
if(this.field_1793_a - var2.field_1350_g < 2) {
|
||||
var1.func_799_a(var2);
|
||||
this.repaint();
|
||||
} else {
|
||||
var2.field_1349_h = false;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(2L);
|
||||
} catch (InterruptedException var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void update(Graphics var1) {
|
||||
}
|
||||
|
||||
public void paint(Graphics var1) {
|
||||
}
|
||||
|
||||
public void showNextBuffer() {
|
||||
BufferStrategy var1 = this.getBufferStrategy();
|
||||
if(var1 == null) {
|
||||
this.createBufferStrategy(2);
|
||||
} else {
|
||||
this.drawScreen((Graphics2D)var1.getDrawGraphics());
|
||||
var1.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreen(Graphics2D var1) {
|
||||
++this.field_1793_a;
|
||||
AffineTransform var2 = var1.getTransform();
|
||||
var1.setClip(0, 0, this.getWidth(), this.getHeight());
|
||||
var1.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
|
||||
var1.translate(this.getWidth() / 2, this.getHeight() / 2);
|
||||
var1.scale((double)this.zoomLevel, (double)this.zoomLevel);
|
||||
var1.translate(this.field_1785_i, this.field_1784_j);
|
||||
if(this.worldObj != null) {
|
||||
ChunkCoordinates var3 = this.worldObj.getSpawnPoint();
|
||||
var1.translate(-(var3.x + var3.z), -(-var3.x + var3.z) + 64);
|
||||
}
|
||||
|
||||
Rectangle var17 = var1.getClipBounds();
|
||||
var1.setColor(new Color(-15724512));
|
||||
var1.fillRect(var17.x, var17.y, var17.width, var17.height);
|
||||
byte var4 = 16;
|
||||
byte var5 = 3;
|
||||
int var6 = var17.x / var4 / 2 - 2 - var5;
|
||||
int var7 = (var17.x + var17.width) / var4 / 2 + 1 + var5;
|
||||
int var8 = var17.y / var4 - 1 - var5 * 2;
|
||||
int var9 = (var17.y + var17.height + 16 + 128) / var4 + 1 + var5 * 2;
|
||||
|
||||
int var10;
|
||||
for(var10 = var8; var10 <= var9; ++var10) {
|
||||
for(int var11 = var6; var11 <= var7; ++var11) {
|
||||
int var12 = var11 - (var10 >> 1);
|
||||
int var13 = var11 + (var10 + 1 >> 1);
|
||||
IsoImageBuffer var14 = this.getImageBuffer(var12, var13);
|
||||
var14.field_1350_g = this.field_1793_a;
|
||||
if(!var14.field_1352_e) {
|
||||
if(!var14.field_1349_h) {
|
||||
var14.field_1349_h = true;
|
||||
this.imageBufferList.add(var14);
|
||||
}
|
||||
} else {
|
||||
var14.field_1349_h = false;
|
||||
if(!var14.field_1351_f) {
|
||||
int var15 = var11 * var4 * 2 + (var10 & 1) * var4;
|
||||
int var16 = var10 * var4 - 128 - 16;
|
||||
var1.drawImage(var14.field_1348_a, var15, var16, (ImageObserver)null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.displayHelpText) {
|
||||
var1.setTransform(var2);
|
||||
var10 = this.getHeight() - 32 - 4;
|
||||
var1.setColor(new Color(Integer.MIN_VALUE, true));
|
||||
var1.fillRect(4, this.getHeight() - 32 - 4, this.getWidth() - 8, 32);
|
||||
var1.setColor(Color.WHITE);
|
||||
String var18 = "F1 - F5: load levels | 0-9: Set time of day | Space: return to spawn | Double click: zoom | Escape: hide this text";
|
||||
var1.drawString(var18, this.getWidth() / 2 - var1.getFontMetrics().stringWidth(var18) / 2, var10 + 20);
|
||||
}
|
||||
|
||||
var1.dispose();
|
||||
}
|
||||
|
||||
public void mouseDragged(MouseEvent var1) {
|
||||
int var2 = var1.getX() / this.zoomLevel;
|
||||
int var3 = var1.getY() / this.zoomLevel;
|
||||
this.field_1785_i += var2 - this.xPosition;
|
||||
this.field_1784_j += var3 - this.yPosition;
|
||||
this.xPosition = var2;
|
||||
this.yPosition = var3;
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public void mouseMoved(MouseEvent var1) {
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent var1) {
|
||||
if(var1.getClickCount() == 2) {
|
||||
this.zoomLevel = 3 - this.zoomLevel;
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent var1) {
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent var1) {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent var1) {
|
||||
int var2 = var1.getX() / this.zoomLevel;
|
||||
int var3 = var1.getY() / this.zoomLevel;
|
||||
this.xPosition = var2;
|
||||
this.yPosition = var3;
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent var1) {
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent var1) {
|
||||
if(var1.getKeyCode() == 48) {
|
||||
this.setTimeOfDay(11);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 49) {
|
||||
this.setTimeOfDay(10);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 50) {
|
||||
this.setTimeOfDay(9);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 51) {
|
||||
this.setTimeOfDay(7);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 52) {
|
||||
this.setTimeOfDay(6);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 53) {
|
||||
this.setTimeOfDay(5);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 54) {
|
||||
this.setTimeOfDay(3);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 55) {
|
||||
this.setTimeOfDay(2);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 56) {
|
||||
this.setTimeOfDay(1);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 57) {
|
||||
this.setTimeOfDay(0);
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 112) {
|
||||
this.loadWorld("World1");
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 113) {
|
||||
this.loadWorld("World2");
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 114) {
|
||||
this.loadWorld("World3");
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 115) {
|
||||
this.loadWorld("World4");
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 116) {
|
||||
this.loadWorld("World5");
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 32) {
|
||||
this.field_1785_i = this.field_1784_j = 0;
|
||||
}
|
||||
|
||||
if(var1.getKeyCode() == 27) {
|
||||
this.displayHelpText = !this.displayHelpText;
|
||||
}
|
||||
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent var1) {
|
||||
}
|
||||
|
||||
public void keyTyped(KeyEvent var1) {
|
||||
}
|
||||
|
||||
static boolean isRunning(CanvasIsomPreview var0) {
|
||||
return var0.running;
|
||||
}
|
||||
}
|
22
src/net/minecraft/src/CanvasMinecraftApplet.java
Normal file
22
src/net/minecraft/src/CanvasMinecraftApplet.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.awt.Canvas;
|
||||
import net.minecraft.client.MinecraftApplet;
|
||||
|
||||
public class CanvasMinecraftApplet extends Canvas {
|
||||
final MinecraftApplet mcApplet;
|
||||
|
||||
public CanvasMinecraftApplet(MinecraftApplet var1) {
|
||||
this.mcApplet = var1;
|
||||
}
|
||||
|
||||
public synchronized void addNotify() {
|
||||
super.addNotify();
|
||||
this.mcApplet.startMainThread();
|
||||
}
|
||||
|
||||
public synchronized void removeNotify() {
|
||||
this.mcApplet.shutdown();
|
||||
super.removeNotify();
|
||||
}
|
||||
}
|
29
src/net/minecraft/src/CanvasMojangLogo.java
Normal file
29
src/net/minecraft/src/CanvasMojangLogo.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
class CanvasMojangLogo extends Canvas {
|
||||
private BufferedImage logo;
|
||||
|
||||
public CanvasMojangLogo() {
|
||||
try {
|
||||
this.logo = ImageIO.read(PanelCrashReport.class.getResource("/gui/logo.png"));
|
||||
} catch (IOException var2) {
|
||||
}
|
||||
|
||||
byte var1 = 100;
|
||||
this.setPreferredSize(new Dimension(var1, var1));
|
||||
this.setMinimumSize(new Dimension(var1, var1));
|
||||
}
|
||||
|
||||
public void paint(Graphics var1) {
|
||||
super.paint(var1);
|
||||
var1.drawImage(this.logo, this.getWidth() / 2 - this.logo.getWidth() / 2, 32, (ImageObserver)null);
|
||||
}
|
||||
}
|
33
src/net/minecraft/src/ChatAllowedCharacters.java
Normal file
33
src/net/minecraft/src/ChatAllowedCharacters.java
Normal file
|
@ -0,0 +1,33 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class ChatAllowedCharacters {
|
||||
public static final String allowedCharacters = getAllowedCharacters();
|
||||
public static final char[] allowedCharactersArray = new char[]{'/', '\n', '\r', '\t', '\u0000', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':'};
|
||||
|
||||
private static String getAllowedCharacters() {
|
||||
String var0 = "";
|
||||
|
||||
try {
|
||||
BufferedReader var1 = new BufferedReader(new InputStreamReader(ChatAllowedCharacters.class.getResourceAsStream("/font.txt"), "UTF-8"));
|
||||
String var2 = "";
|
||||
|
||||
while(true) {
|
||||
var2 = var1.readLine();
|
||||
if(var2 == null) {
|
||||
var1.close();
|
||||
break;
|
||||
}
|
||||
|
||||
if(!var2.startsWith("#")) {
|
||||
var0 = var0 + var2;
|
||||
}
|
||||
}
|
||||
} catch (Exception var3) {
|
||||
}
|
||||
|
||||
return var0;
|
||||
}
|
||||
}
|
11
src/net/minecraft/src/ChatLine.java
Normal file
11
src/net/minecraft/src/ChatLine.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class ChatLine {
|
||||
public String message;
|
||||
public int updateCounter;
|
||||
|
||||
public ChatLine(String var1) {
|
||||
this.message = var1;
|
||||
this.updateCounter = 0;
|
||||
}
|
||||
}
|
605
src/net/minecraft/src/Chunk.java
Normal file
605
src/net/minecraft/src/Chunk.java
Normal file
|
@ -0,0 +1,605 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class Chunk {
|
||||
public static boolean isLit;
|
||||
public byte[] blocks;
|
||||
public boolean isChunkLoaded;
|
||||
public World worldObj;
|
||||
public NibbleArray data;
|
||||
public NibbleArray skylightMap;
|
||||
public NibbleArray blocklightMap;
|
||||
public byte[] heightMap;
|
||||
public int lowestBlockHeight;
|
||||
public final int xPosition;
|
||||
public final int zPosition;
|
||||
public Map chunkTileEntityMap;
|
||||
public List[] entities;
|
||||
public boolean isTerrainPopulated;
|
||||
public boolean isModified;
|
||||
public boolean neverSave;
|
||||
public boolean hasEntities;
|
||||
public long lastSaveTime;
|
||||
|
||||
public Chunk(World var1, int var2, int var3) {
|
||||
this.chunkTileEntityMap = new HashMap();
|
||||
this.entities = new List[8];
|
||||
this.isTerrainPopulated = false;
|
||||
this.isModified = false;
|
||||
this.hasEntities = false;
|
||||
this.lastSaveTime = 0L;
|
||||
this.worldObj = var1;
|
||||
this.xPosition = var2;
|
||||
this.zPosition = var3;
|
||||
this.heightMap = new byte[256];
|
||||
|
||||
for(int var4 = 0; var4 < this.entities.length; ++var4) {
|
||||
this.entities[var4] = new ArrayList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Chunk(World var1, byte[] var2, int var3, int var4) {
|
||||
this(var1, var3, var4);
|
||||
this.blocks = var2;
|
||||
this.data = new NibbleArray(var2.length);
|
||||
this.skylightMap = new NibbleArray(var2.length);
|
||||
this.blocklightMap = new NibbleArray(var2.length);
|
||||
}
|
||||
|
||||
public boolean isAtLocation(int var1, int var2) {
|
||||
return var1 == this.xPosition && var2 == this.zPosition;
|
||||
}
|
||||
|
||||
public int getHeightValue(int var1, int var2) {
|
||||
return this.heightMap[var2 << 4 | var1] & 255;
|
||||
}
|
||||
|
||||
public void func_1014_a() {
|
||||
}
|
||||
|
||||
public void generateHeightMap() {
|
||||
int var1 = 127;
|
||||
|
||||
for(int var2 = 0; var2 < 16; ++var2) {
|
||||
for(int var3 = 0; var3 < 16; ++var3) {
|
||||
int var4 = 127;
|
||||
|
||||
for(int var5 = var2 << 11 | var3 << 7; var4 > 0 && Block.lightOpacity[this.blocks[var5 + var4 - 1] & 255] == 0; --var4) {
|
||||
}
|
||||
|
||||
this.heightMap[var3 << 4 | var2] = (byte)var4;
|
||||
if(var4 < var1) {
|
||||
var1 = var4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.lowestBlockHeight = var1;
|
||||
this.isModified = true;
|
||||
}
|
||||
|
||||
public void func_1024_c() {
|
||||
int var1 = 127;
|
||||
|
||||
int var2;
|
||||
int var3;
|
||||
for(var2 = 0; var2 < 16; ++var2) {
|
||||
for(var3 = 0; var3 < 16; ++var3) {
|
||||
int var4 = 127;
|
||||
|
||||
int var5;
|
||||
for(var5 = var2 << 11 | var3 << 7; var4 > 0 && Block.lightOpacity[this.blocks[var5 + var4 - 1] & 255] == 0; --var4) {
|
||||
}
|
||||
|
||||
this.heightMap[var3 << 4 | var2] = (byte)var4;
|
||||
if(var4 < var1) {
|
||||
var1 = var4;
|
||||
}
|
||||
|
||||
if(!this.worldObj.worldProvider.hasNoSky) {
|
||||
int var6 = 15;
|
||||
int var7 = 127;
|
||||
|
||||
do {
|
||||
var6 -= Block.lightOpacity[this.blocks[var5 + var7] & 255];
|
||||
if(var6 > 0) {
|
||||
this.skylightMap.setNibble(var2, var7, var3, var6);
|
||||
}
|
||||
|
||||
--var7;
|
||||
} while(var7 > 0 && var6 > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.lowestBlockHeight = var1;
|
||||
|
||||
for(var2 = 0; var2 < 16; ++var2) {
|
||||
for(var3 = 0; var3 < 16; ++var3) {
|
||||
this.func_996_c(var2, var3);
|
||||
}
|
||||
}
|
||||
|
||||
this.isModified = true;
|
||||
}
|
||||
|
||||
public void func_4143_d() {
|
||||
}
|
||||
|
||||
private void func_996_c(int var1, int var2) {
|
||||
int var3 = this.getHeightValue(var1, var2);
|
||||
int var4 = this.xPosition * 16 + var1;
|
||||
int var5 = this.zPosition * 16 + var2;
|
||||
this.func_1020_f(var4 - 1, var5, var3);
|
||||
this.func_1020_f(var4 + 1, var5, var3);
|
||||
this.func_1020_f(var4, var5 - 1, var3);
|
||||
this.func_1020_f(var4, var5 + 1, var3);
|
||||
}
|
||||
|
||||
private void func_1020_f(int var1, int var2, int var3) {
|
||||
int var4 = this.worldObj.getHeightValue(var1, var2);
|
||||
if(var4 > var3) {
|
||||
this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var1, var3, var2, var1, var4, var2);
|
||||
this.isModified = true;
|
||||
} else if(var4 < var3) {
|
||||
this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var1, var4, var2, var1, var3, var2);
|
||||
this.isModified = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void func_1003_g(int var1, int var2, int var3) {
|
||||
int var4 = this.heightMap[var3 << 4 | var1] & 255;
|
||||
int var5 = var4;
|
||||
if(var2 > var4) {
|
||||
var5 = var2;
|
||||
}
|
||||
|
||||
for(int var6 = var1 << 11 | var3 << 7; var5 > 0 && Block.lightOpacity[this.blocks[var6 + var5 - 1] & 255] == 0; --var5) {
|
||||
}
|
||||
|
||||
if(var5 != var4) {
|
||||
this.worldObj.markBlocksDirtyVertical(var1, var3, var5, var4);
|
||||
this.heightMap[var3 << 4 | var1] = (byte)var5;
|
||||
int var7;
|
||||
int var8;
|
||||
int var9;
|
||||
if(var5 < this.lowestBlockHeight) {
|
||||
this.lowestBlockHeight = var5;
|
||||
} else {
|
||||
var7 = 127;
|
||||
|
||||
for(var8 = 0; var8 < 16; ++var8) {
|
||||
for(var9 = 0; var9 < 16; ++var9) {
|
||||
if((this.heightMap[var9 << 4 | var8] & 255) < var7) {
|
||||
var7 = this.heightMap[var9 << 4 | var8] & 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.lowestBlockHeight = var7;
|
||||
}
|
||||
|
||||
var7 = this.xPosition * 16 + var1;
|
||||
var8 = this.zPosition * 16 + var3;
|
||||
if(var5 < var4) {
|
||||
for(var9 = var5; var9 < var4; ++var9) {
|
||||
this.skylightMap.setNibble(var1, var9, var3, 15);
|
||||
}
|
||||
} else {
|
||||
this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var7, var4, var8, var7, var5, var8);
|
||||
|
||||
for(var9 = var4; var9 < var5; ++var9) {
|
||||
this.skylightMap.setNibble(var1, var9, var3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
var9 = 15;
|
||||
|
||||
int var10;
|
||||
for(var10 = var5; var5 > 0 && var9 > 0; this.skylightMap.setNibble(var1, var5, var3, var9)) {
|
||||
--var5;
|
||||
int var11 = Block.lightOpacity[this.getBlockID(var1, var5, var3)];
|
||||
if(var11 == 0) {
|
||||
var11 = 1;
|
||||
}
|
||||
|
||||
var9 -= var11;
|
||||
if(var9 < 0) {
|
||||
var9 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
while(var5 > 0 && Block.lightOpacity[this.getBlockID(var1, var5 - 1, var3)] == 0) {
|
||||
--var5;
|
||||
}
|
||||
|
||||
if(var5 != var10) {
|
||||
this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var7 - 1, var5, var8 - 1, var7 + 1, var10, var8 + 1);
|
||||
}
|
||||
|
||||
this.isModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockID(int var1, int var2, int var3) {
|
||||
return this.blocks[var1 << 11 | var3 << 7 | var2] & 255;
|
||||
}
|
||||
|
||||
public boolean setBlockIDWithMetadata(int var1, int var2, int var3, int var4, int var5) {
|
||||
byte var6 = (byte)var4;
|
||||
int var7 = this.heightMap[var3 << 4 | var1] & 255;
|
||||
int var8 = this.blocks[var1 << 11 | var3 << 7 | var2] & 255;
|
||||
if(var8 == var4 && this.data.getNibble(var1, var2, var3) == var5) {
|
||||
return false;
|
||||
} else {
|
||||
int var9 = this.xPosition * 16 + var1;
|
||||
int var10 = this.zPosition * 16 + var3;
|
||||
this.blocks[var1 << 11 | var3 << 7 | var2] = (byte)(var6 & 255);
|
||||
if(var8 != 0 && !this.worldObj.multiplayerWorld) {
|
||||
Block.blocksList[var8].onBlockRemoval(this.worldObj, var9, var2, var10);
|
||||
}
|
||||
|
||||
this.data.setNibble(var1, var2, var3, var5);
|
||||
if(!this.worldObj.worldProvider.hasNoSky) {
|
||||
if(Block.lightOpacity[var6 & 255] != 0) {
|
||||
if(var2 >= var7) {
|
||||
this.func_1003_g(var1, var2 + 1, var3);
|
||||
}
|
||||
} else if(var2 == var7 - 1) {
|
||||
this.func_1003_g(var1, var2, var3);
|
||||
}
|
||||
|
||||
this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var9, var2, var10, var9, var2, var10);
|
||||
}
|
||||
|
||||
this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Block, var9, var2, var10, var9, var2, var10);
|
||||
this.func_996_c(var1, var3);
|
||||
this.data.setNibble(var1, var2, var3, var5);
|
||||
if(var4 != 0) {
|
||||
Block.blocksList[var4].onBlockAdded(this.worldObj, var9, var2, var10);
|
||||
}
|
||||
|
||||
this.isModified = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setBlockID(int var1, int var2, int var3, int var4) {
|
||||
byte var5 = (byte)var4;
|
||||
int var6 = this.heightMap[var3 << 4 | var1] & 255;
|
||||
int var7 = this.blocks[var1 << 11 | var3 << 7 | var2] & 255;
|
||||
if(var7 == var4) {
|
||||
return false;
|
||||
} else {
|
||||
int var8 = this.xPosition * 16 + var1;
|
||||
int var9 = this.zPosition * 16 + var3;
|
||||
this.blocks[var1 << 11 | var3 << 7 | var2] = (byte)(var5 & 255);
|
||||
if(var7 != 0) {
|
||||
Block.blocksList[var7].onBlockRemoval(this.worldObj, var8, var2, var9);
|
||||
}
|
||||
|
||||
this.data.setNibble(var1, var2, var3, 0);
|
||||
if(Block.lightOpacity[var5 & 255] != 0) {
|
||||
if(var2 >= var6) {
|
||||
this.func_1003_g(var1, var2 + 1, var3);
|
||||
}
|
||||
} else if(var2 == var6 - 1) {
|
||||
this.func_1003_g(var1, var2, var3);
|
||||
}
|
||||
|
||||
this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Sky, var8, var2, var9, var8, var2, var9);
|
||||
this.worldObj.scheduleLightingUpdate(EnumSkyBlock.Block, var8, var2, var9, var8, var2, var9);
|
||||
this.func_996_c(var1, var3);
|
||||
if(var4 != 0 && !this.worldObj.multiplayerWorld) {
|
||||
Block.blocksList[var4].onBlockAdded(this.worldObj, var8, var2, var9);
|
||||
}
|
||||
|
||||
this.isModified = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockMetadata(int var1, int var2, int var3) {
|
||||
return this.data.getNibble(var1, var2, var3);
|
||||
}
|
||||
|
||||
public void setBlockMetadata(int var1, int var2, int var3, int var4) {
|
||||
this.isModified = true;
|
||||
this.data.setNibble(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
public int getSavedLightValue(EnumSkyBlock var1, int var2, int var3, int var4) {
|
||||
return var1 == EnumSkyBlock.Sky ? this.skylightMap.getNibble(var2, var3, var4) : (var1 == EnumSkyBlock.Block ? this.blocklightMap.getNibble(var2, var3, var4) : 0);
|
||||
}
|
||||
|
||||
public void setLightValue(EnumSkyBlock var1, int var2, int var3, int var4, int var5) {
|
||||
this.isModified = true;
|
||||
if(var1 == EnumSkyBlock.Sky) {
|
||||
this.skylightMap.setNibble(var2, var3, var4, var5);
|
||||
} else {
|
||||
if(var1 != EnumSkyBlock.Block) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.blocklightMap.setNibble(var2, var3, var4, var5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getBlockLightValue(int var1, int var2, int var3, int var4) {
|
||||
int var5 = this.skylightMap.getNibble(var1, var2, var3);
|
||||
if(var5 > 0) {
|
||||
isLit = true;
|
||||
}
|
||||
|
||||
var5 -= var4;
|
||||
int var6 = this.blocklightMap.getNibble(var1, var2, var3);
|
||||
if(var6 > var5) {
|
||||
var5 = var6;
|
||||
}
|
||||
|
||||
return var5;
|
||||
}
|
||||
|
||||
public void addEntity(Entity var1) {
|
||||
this.hasEntities = true;
|
||||
int var2 = MathHelper.floor_double(var1.posX / 16.0D);
|
||||
int var3 = MathHelper.floor_double(var1.posZ / 16.0D);
|
||||
if(var2 != this.xPosition || var3 != this.zPosition) {
|
||||
System.out.println("Wrong location! " + var1);
|
||||
Thread.dumpStack();
|
||||
}
|
||||
|
||||
int var4 = MathHelper.floor_double(var1.posY / 16.0D);
|
||||
if(var4 < 0) {
|
||||
var4 = 0;
|
||||
}
|
||||
|
||||
if(var4 >= this.entities.length) {
|
||||
var4 = this.entities.length - 1;
|
||||
}
|
||||
|
||||
var1.addedToChunk = true;
|
||||
var1.chunkCoordX = this.xPosition;
|
||||
var1.chunkCoordY = var4;
|
||||
var1.chunkCoordZ = this.zPosition;
|
||||
this.entities[var4].add(var1);
|
||||
}
|
||||
|
||||
public void removeEntity(Entity var1) {
|
||||
this.removeEntityAtIndex(var1, var1.chunkCoordY);
|
||||
}
|
||||
|
||||
public void removeEntityAtIndex(Entity var1, int var2) {
|
||||
if(var2 < 0) {
|
||||
var2 = 0;
|
||||
}
|
||||
|
||||
if(var2 >= this.entities.length) {
|
||||
var2 = this.entities.length - 1;
|
||||
}
|
||||
|
||||
this.entities[var2].remove(var1);
|
||||
}
|
||||
|
||||
public boolean canBlockSeeTheSky(int var1, int var2, int var3) {
|
||||
return var2 >= (this.heightMap[var3 << 4 | var1] & 255);
|
||||
}
|
||||
|
||||
public TileEntity getChunkBlockTileEntity(int var1, int var2, int var3) {
|
||||
ChunkPosition var4 = new ChunkPosition(var1, var2, var3);
|
||||
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
|
||||
if(var5 == null) {
|
||||
int var6 = this.getBlockID(var1, var2, var3);
|
||||
if(!Block.isBlockContainer[var6]) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BlockContainer var7 = (BlockContainer)Block.blocksList[var6];
|
||||
var7.onBlockAdded(this.worldObj, this.xPosition * 16 + var1, var2, this.zPosition * 16 + var3);
|
||||
var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
|
||||
}
|
||||
|
||||
if(var5 != null && var5.func_31006_g()) {
|
||||
this.chunkTileEntityMap.remove(var4);
|
||||
return null;
|
||||
} else {
|
||||
return var5;
|
||||
}
|
||||
}
|
||||
|
||||
public void addTileEntity(TileEntity var1) {
|
||||
int var2 = var1.xCoord - this.xPosition * 16;
|
||||
int var3 = var1.yCoord;
|
||||
int var4 = var1.zCoord - this.zPosition * 16;
|
||||
this.setChunkBlockTileEntity(var2, var3, var4, var1);
|
||||
if(this.isChunkLoaded) {
|
||||
this.worldObj.loadedTileEntityList.add(var1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setChunkBlockTileEntity(int var1, int var2, int var3, TileEntity var4) {
|
||||
ChunkPosition var5 = new ChunkPosition(var1, var2, var3);
|
||||
var4.worldObj = this.worldObj;
|
||||
var4.xCoord = this.xPosition * 16 + var1;
|
||||
var4.yCoord = var2;
|
||||
var4.zCoord = this.zPosition * 16 + var3;
|
||||
if(this.getBlockID(var1, var2, var3) != 0 && Block.blocksList[this.getBlockID(var1, var2, var3)] instanceof BlockContainer) {
|
||||
var4.func_31004_j();
|
||||
this.chunkTileEntityMap.put(var5, var4);
|
||||
} else {
|
||||
System.out.println("Attempted to place a tile entity where there was no entity tile!");
|
||||
}
|
||||
}
|
||||
|
||||
public void removeChunkBlockTileEntity(int var1, int var2, int var3) {
|
||||
ChunkPosition var4 = new ChunkPosition(var1, var2, var3);
|
||||
if(this.isChunkLoaded) {
|
||||
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.remove(var4);
|
||||
if(var5 != null) {
|
||||
var5.func_31005_i();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onChunkLoad() {
|
||||
this.isChunkLoaded = true;
|
||||
this.worldObj.func_31054_a(this.chunkTileEntityMap.values());
|
||||
|
||||
for(int var1 = 0; var1 < this.entities.length; ++var1) {
|
||||
this.worldObj.func_636_a(this.entities[var1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onChunkUnload() {
|
||||
this.isChunkLoaded = false;
|
||||
Iterator var1 = this.chunkTileEntityMap.values().iterator();
|
||||
|
||||
while(var1.hasNext()) {
|
||||
TileEntity var2 = (TileEntity)var1.next();
|
||||
var2.func_31005_i();
|
||||
}
|
||||
|
||||
for(int var3 = 0; var3 < this.entities.length; ++var3) {
|
||||
this.worldObj.func_632_b(this.entities[var3]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setChunkModified() {
|
||||
this.isModified = true;
|
||||
}
|
||||
|
||||
public void getEntitiesWithinAABBForEntity(Entity var1, AxisAlignedBB var2, List var3) {
|
||||
int var4 = MathHelper.floor_double((var2.minY - 2.0D) / 16.0D);
|
||||
int var5 = MathHelper.floor_double((var2.maxY + 2.0D) / 16.0D);
|
||||
if(var4 < 0) {
|
||||
var4 = 0;
|
||||
}
|
||||
|
||||
if(var5 >= this.entities.length) {
|
||||
var5 = this.entities.length - 1;
|
||||
}
|
||||
|
||||
for(int var6 = var4; var6 <= var5; ++var6) {
|
||||
List var7 = this.entities[var6];
|
||||
|
||||
for(int var8 = 0; var8 < var7.size(); ++var8) {
|
||||
Entity var9 = (Entity)var7.get(var8);
|
||||
if(var9 != var1 && var9.boundingBox.intersectsWith(var2)) {
|
||||
var3.add(var9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void getEntitiesOfTypeWithinAAAB(Class var1, AxisAlignedBB var2, List var3) {
|
||||
int var4 = MathHelper.floor_double((var2.minY - 2.0D) / 16.0D);
|
||||
int var5 = MathHelper.floor_double((var2.maxY + 2.0D) / 16.0D);
|
||||
if(var4 < 0) {
|
||||
var4 = 0;
|
||||
}
|
||||
|
||||
if(var5 >= this.entities.length) {
|
||||
var5 = this.entities.length - 1;
|
||||
}
|
||||
|
||||
for(int var6 = var4; var6 <= var5; ++var6) {
|
||||
List var7 = this.entities[var6];
|
||||
|
||||
for(int var8 = 0; var8 < var7.size(); ++var8) {
|
||||
Entity var9 = (Entity)var7.get(var8);
|
||||
if(var1.isAssignableFrom(var9.getClass()) && var9.boundingBox.intersectsWith(var2)) {
|
||||
var3.add(var9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean needsSaving(boolean var1) {
|
||||
if(this.neverSave) {
|
||||
return false;
|
||||
} else {
|
||||
if(var1) {
|
||||
if(this.hasEntities && this.worldObj.getWorldTime() != this.lastSaveTime) {
|
||||
return true;
|
||||
}
|
||||
} else if(this.hasEntities && this.worldObj.getWorldTime() >= this.lastSaveTime + 600L) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.isModified;
|
||||
}
|
||||
}
|
||||
|
||||
public int setChunkData(byte[] var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8) {
|
||||
int var9;
|
||||
int var10;
|
||||
int var11;
|
||||
int var12;
|
||||
for(var9 = var2; var9 < var5; ++var9) {
|
||||
for(var10 = var4; var10 < var7; ++var10) {
|
||||
var11 = var9 << 11 | var10 << 7 | var3;
|
||||
var12 = var6 - var3;
|
||||
System.arraycopy(var1, var8, this.blocks, var11, var12);
|
||||
var8 += var12;
|
||||
}
|
||||
}
|
||||
|
||||
this.generateHeightMap();
|
||||
|
||||
for(var9 = var2; var9 < var5; ++var9) {
|
||||
for(var10 = var4; var10 < var7; ++var10) {
|
||||
var11 = (var9 << 11 | var10 << 7 | var3) >> 1;
|
||||
var12 = (var6 - var3) / 2;
|
||||
System.arraycopy(var1, var8, this.data.data, var11, var12);
|
||||
var8 += var12;
|
||||
}
|
||||
}
|
||||
|
||||
for(var9 = var2; var9 < var5; ++var9) {
|
||||
for(var10 = var4; var10 < var7; ++var10) {
|
||||
var11 = (var9 << 11 | var10 << 7 | var3) >> 1;
|
||||
var12 = (var6 - var3) / 2;
|
||||
System.arraycopy(var1, var8, this.blocklightMap.data, var11, var12);
|
||||
var8 += var12;
|
||||
}
|
||||
}
|
||||
|
||||
for(var9 = var2; var9 < var5; ++var9) {
|
||||
for(var10 = var4; var10 < var7; ++var10) {
|
||||
var11 = (var9 << 11 | var10 << 7 | var3) >> 1;
|
||||
var12 = (var6 - var3) / 2;
|
||||
System.arraycopy(var1, var8, this.skylightMap.data, var11, var12);
|
||||
var8 += var12;
|
||||
}
|
||||
}
|
||||
|
||||
return var8;
|
||||
}
|
||||
|
||||
public Random func_997_a(long var1) {
|
||||
return new Random(this.worldObj.getRandomSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ var1);
|
||||
}
|
||||
|
||||
public boolean func_21167_h() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void func_25124_i() {
|
||||
ChunkBlockMap.func_26002_a(this.blocks);
|
||||
}
|
||||
}
|
28
src/net/minecraft/src/ChunkBlockMap.java
Normal file
28
src/net/minecraft/src/ChunkBlockMap.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class ChunkBlockMap {
|
||||
private static byte[] field_26003_a = new byte[256];
|
||||
|
||||
public static void func_26002_a(byte[] var0) {
|
||||
for(int var1 = 0; var1 < var0.length; ++var1) {
|
||||
var0[var1] = field_26003_a[var0[var1] & 255];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
for(int var0 = 0; var0 < 256; ++var0) {
|
||||
byte var1 = (byte)var0;
|
||||
if(var1 != 0 && Block.blocksList[var1 & 255] == null) {
|
||||
var1 = 0;
|
||||
}
|
||||
|
||||
field_26003_a[var0] = var1;
|
||||
}
|
||||
} catch (Exception var2) {
|
||||
var2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
146
src/net/minecraft/src/ChunkCache.java
Normal file
146
src/net/minecraft/src/ChunkCache.java
Normal file
|
@ -0,0 +1,146 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class ChunkCache implements IBlockAccess {
|
||||
private int chunkX;
|
||||
private int chunkZ;
|
||||
private Chunk[][] chunkArray;
|
||||
private World worldObj;
|
||||
|
||||
public ChunkCache(World var1, int var2, int var3, int var4, int var5, int var6, int var7) {
|
||||
this.worldObj = var1;
|
||||
this.chunkX = var2 >> 4;
|
||||
this.chunkZ = var4 >> 4;
|
||||
int var8 = var5 >> 4;
|
||||
int var9 = var7 >> 4;
|
||||
this.chunkArray = new Chunk[var8 - this.chunkX + 1][var9 - this.chunkZ + 1];
|
||||
|
||||
for(int var10 = this.chunkX; var10 <= var8; ++var10) {
|
||||
for(int var11 = this.chunkZ; var11 <= var9; ++var11) {
|
||||
this.chunkArray[var10 - this.chunkX][var11 - this.chunkZ] = var1.getChunkFromChunkCoords(var10, var11);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getBlockId(int var1, int var2, int var3) {
|
||||
if(var2 < 0) {
|
||||
return 0;
|
||||
} else if(var2 >= 128) {
|
||||
return 0;
|
||||
} else {
|
||||
int var4 = (var1 >> 4) - this.chunkX;
|
||||
int var5 = (var3 >> 4) - this.chunkZ;
|
||||
if(var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length) {
|
||||
Chunk var6 = this.chunkArray[var4][var5];
|
||||
return var6 == null ? 0 : var6.getBlockID(var1 & 15, var2, var3 & 15);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity getBlockTileEntity(int var1, int var2, int var3) {
|
||||
int var4 = (var1 >> 4) - this.chunkX;
|
||||
int var5 = (var3 >> 4) - this.chunkZ;
|
||||
return this.chunkArray[var4][var5].getChunkBlockTileEntity(var1 & 15, var2, var3 & 15);
|
||||
}
|
||||
|
||||
public float getBrightness(int var1, int var2, int var3, int var4) {
|
||||
int var5 = this.getLightValue(var1, var2, var3);
|
||||
if(var5 < var4) {
|
||||
var5 = var4;
|
||||
}
|
||||
|
||||
return this.worldObj.worldProvider.lightBrightnessTable[var5];
|
||||
}
|
||||
|
||||
public float getLightBrightness(int var1, int var2, int var3) {
|
||||
return this.worldObj.worldProvider.lightBrightnessTable[this.getLightValue(var1, var2, var3)];
|
||||
}
|
||||
|
||||
public int getLightValue(int var1, int var2, int var3) {
|
||||
return this.getLightValueExt(var1, var2, var3, true);
|
||||
}
|
||||
|
||||
public int getLightValueExt(int var1, int var2, int var3, boolean var4) {
|
||||
if(var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) {
|
||||
int var5;
|
||||
int var6;
|
||||
if(var4) {
|
||||
var5 = this.getBlockId(var1, var2, var3);
|
||||
if(var5 == Block.stairSingle.blockID || var5 == Block.tilledField.blockID || var5 == Block.stairCompactPlanks.blockID || var5 == Block.stairCompactCobblestone.blockID) {
|
||||
var6 = this.getLightValueExt(var1, var2 + 1, var3, false);
|
||||
int var7 = this.getLightValueExt(var1 + 1, var2, var3, false);
|
||||
int var8 = this.getLightValueExt(var1 - 1, var2, var3, false);
|
||||
int var9 = this.getLightValueExt(var1, var2, var3 + 1, false);
|
||||
int var10 = this.getLightValueExt(var1, var2, var3 - 1, false);
|
||||
if(var7 > var6) {
|
||||
var6 = var7;
|
||||
}
|
||||
|
||||
if(var8 > var6) {
|
||||
var6 = var8;
|
||||
}
|
||||
|
||||
if(var9 > var6) {
|
||||
var6 = var9;
|
||||
}
|
||||
|
||||
if(var10 > var6) {
|
||||
var6 = var10;
|
||||
}
|
||||
|
||||
return var6;
|
||||
}
|
||||
}
|
||||
|
||||
if(var2 < 0) {
|
||||
return 0;
|
||||
} else if(var2 >= 128) {
|
||||
var5 = 15 - this.worldObj.skylightSubtracted;
|
||||
if(var5 < 0) {
|
||||
var5 = 0;
|
||||
}
|
||||
|
||||
return var5;
|
||||
} else {
|
||||
var5 = (var1 >> 4) - this.chunkX;
|
||||
var6 = (var3 >> 4) - this.chunkZ;
|
||||
return this.chunkArray[var5][var6].getBlockLightValue(var1 & 15, var2, var3 & 15, this.worldObj.skylightSubtracted);
|
||||
}
|
||||
} else {
|
||||
return 15;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockMetadata(int var1, int var2, int var3) {
|
||||
if(var2 < 0) {
|
||||
return 0;
|
||||
} else if(var2 >= 128) {
|
||||
return 0;
|
||||
} else {
|
||||
int var4 = (var1 >> 4) - this.chunkX;
|
||||
int var5 = (var3 >> 4) - this.chunkZ;
|
||||
return this.chunkArray[var4][var5].getBlockMetadata(var1 & 15, var2, var3 & 15);
|
||||
}
|
||||
}
|
||||
|
||||
public Material getBlockMaterial(int var1, int var2, int var3) {
|
||||
int var4 = this.getBlockId(var1, var2, var3);
|
||||
return var4 == 0 ? Material.air : Block.blocksList[var4].blockMaterial;
|
||||
}
|
||||
|
||||
public WorldChunkManager getWorldChunkManager() {
|
||||
return this.worldObj.getWorldChunkManager();
|
||||
}
|
||||
|
||||
public boolean isBlockOpaqueCube(int var1, int var2, int var3) {
|
||||
Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)];
|
||||
return var4 == null ? false : var4.isOpaqueCube();
|
||||
}
|
||||
|
||||
public boolean isBlockNormalCube(int var1, int var2, int var3) {
|
||||
Block var4 = Block.blocksList[this.getBlockId(var1, var2, var3)];
|
||||
return var4 == null ? false : var4.blockMaterial.getIsSolid() && var4.renderAsNormalBlock();
|
||||
}
|
||||
}
|
24
src/net/minecraft/src/ChunkCoordIntPair.java
Normal file
24
src/net/minecraft/src/ChunkCoordIntPair.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class ChunkCoordIntPair {
|
||||
public final int chunkXPos;
|
||||
public final int chunkZPos;
|
||||
|
||||
public ChunkCoordIntPair(int var1, int var2) {
|
||||
this.chunkXPos = var1;
|
||||
this.chunkZPos = var2;
|
||||
}
|
||||
|
||||
public static int chunkXZ2Int(int var0, int var1) {
|
||||
return (var0 < 0 ? Integer.MIN_VALUE : 0) | (var0 & Short.MAX_VALUE) << 16 | (var1 < 0 ? -Short.MIN_VALUE : 0) | var1 & Short.MAX_VALUE;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return chunkXZ2Int(this.chunkXPos, this.chunkZPos);
|
||||
}
|
||||
|
||||
public boolean equals(Object var1) {
|
||||
ChunkCoordIntPair var2 = (ChunkCoordIntPair)var1;
|
||||
return var2.chunkXPos == this.chunkXPos && var2.chunkZPos == this.chunkZPos;
|
||||
}
|
||||
}
|
50
src/net/minecraft/src/ChunkCoordinates.java
Normal file
50
src/net/minecraft/src/ChunkCoordinates.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
public class ChunkCoordinates implements Comparable {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public ChunkCoordinates() {
|
||||
}
|
||||
|
||||
public ChunkCoordinates(int var1, int var2, int var3) {
|
||||
this.x = var1;
|
||||
this.y = var2;
|
||||
this.z = var3;
|
||||
}
|
||||
|
||||
public ChunkCoordinates(ChunkCoordinates var1) {
|
||||
this.x = var1.x;
|
||||
this.y = var1.y;
|
||||
this.z = var1.z;
|
||||
}
|
||||
|
||||
public boolean equals(Object var1) {
|
||||
if(!(var1 instanceof ChunkCoordinates)) {
|
||||
return false;
|
||||
} else {
|
||||
ChunkCoordinates var2 = (ChunkCoordinates)var1;
|
||||
return this.x == var2.x && this.y == var2.y && this.z == var2.z;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.x + this.z << 8 + this.y << 16;
|
||||
}
|
||||
|
||||
public int compareChunkCoordinate(ChunkCoordinates var1) {
|
||||
return this.y == var1.y ? (this.z == var1.z ? this.x - var1.x : this.z - var1.z) : this.y - var1.y;
|
||||
}
|
||||
|
||||
public double getSqDistanceTo(int var1, int var2, int var3) {
|
||||
int var4 = this.x - var1;
|
||||
int var5 = this.y - var2;
|
||||
int var6 = this.z - var3;
|
||||
return Math.sqrt((double)(var4 * var4 + var5 * var5 + var6 * var6));
|
||||
}
|
||||
|
||||
public int compareTo(Object var1) {
|
||||
return this.compareChunkCoordinate((ChunkCoordinates)var1);
|
||||
}
|
||||
}
|
51
src/net/minecraft/src/ChunkFile.java
Normal file
51
src/net/minecraft/src/ChunkFile.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
class ChunkFile implements Comparable {
|
||||
private final File field_22326_a;
|
||||
private final int field_22325_b;
|
||||
private final int field_22327_c;
|
||||
|
||||
public ChunkFile(File var1) {
|
||||
this.field_22326_a = var1;
|
||||
Matcher var2 = ChunkFilePattern.field_22189_a.matcher(var1.getName());
|
||||
if(var2.matches()) {
|
||||
this.field_22325_b = Integer.parseInt(var2.group(1), 36);
|
||||
this.field_22327_c = Integer.parseInt(var2.group(2), 36);
|
||||
} else {
|
||||
this.field_22325_b = 0;
|
||||
this.field_22327_c = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int func_22322_a(ChunkFile var1) {
|
||||
int var2 = this.field_22325_b >> 5;
|
||||
int var3 = var1.field_22325_b >> 5;
|
||||
if(var2 == var3) {
|
||||
int var4 = this.field_22327_c >> 5;
|
||||
int var5 = var1.field_22327_c >> 5;
|
||||
return var4 - var5;
|
||||
} else {
|
||||
return var2 - var3;
|
||||
}
|
||||
}
|
||||
|
||||
public File func_22324_a() {
|
||||
return this.field_22326_a;
|
||||
}
|
||||
|
||||
public int func_22323_b() {
|
||||
return this.field_22325_b;
|
||||
}
|
||||
|
||||
public int func_22321_c() {
|
||||
return this.field_22327_c;
|
||||
}
|
||||
|
||||
public int compareTo(Object var1) {
|
||||
return this.func_22322_a((ChunkFile)var1);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user