-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from BTW-Community/dev
2.13.4
- Loading branch information
Showing
57 changed files
with
2,803 additions
and
841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
src/minecraft/net/minecraft/src/AddonBlockDirectional.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package net.minecraft.src; | ||
|
||
/** | ||
* Extend this class to enable directional functionality like logs. | ||
* Metadata 0-3 available for different types. | ||
* 4-7 and 8-11 used for orientation of those types. | ||
*/ | ||
public class AddonBlockDirectional extends Block { | ||
public String[] topTextures; | ||
public String[] sideTextures; | ||
|
||
protected AddonBlockDirectional(int id, Material material, String[] topTextures, String[] sideTextures) { | ||
super(id, material); | ||
this.topTextures = topTextures; | ||
this.sideTextures = sideTextures; | ||
} | ||
|
||
public boolean CanRotateOnTurntable(IBlockAccess access, int x, int y, int z) { | ||
return (access.getBlockMetadata(x,y,z) & 12) != 0; | ||
} | ||
|
||
public int RotateMetadataAroundJAxis(int meta, boolean var2) { | ||
int directionMeta = meta & 12; | ||
|
||
if (directionMeta != 0) { | ||
if (directionMeta == 4) { | ||
directionMeta = 8; | ||
} | ||
else if (directionMeta == 8) { | ||
directionMeta = 4; | ||
} | ||
|
||
meta = meta & -13 | directionMeta; | ||
} | ||
|
||
return meta; | ||
} | ||
|
||
|
||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) { | ||
int type = meta & 3; | ||
byte directionMeta = 0; | ||
|
||
switch (side) { | ||
case 0: | ||
case 1: | ||
directionMeta = 0; | ||
break; | ||
case 2: | ||
case 3: | ||
directionMeta = 8; | ||
break; | ||
case 4: | ||
case 5: | ||
directionMeta = 4; | ||
} | ||
|
||
return type | directionMeta; | ||
} | ||
|
||
|
||
public int damageDropped(int meta) { | ||
return meta & 3; | ||
} | ||
|
||
|
||
public static int limitToValidMetadata(int meta) { | ||
return meta & 3; | ||
} | ||
|
||
//CLIENT ONLY | ||
public Icon[] topIcons; | ||
public Icon[] sideIcons; | ||
|
||
public Icon getIcon(int side, int meta) { | ||
int directionMeta = meta & 12; | ||
int type = meta & 3; | ||
|
||
if (directionMeta == 0 && (side == 0 || side == 1) || | ||
directionMeta == 4 && (side == 4 || side == 5) || | ||
directionMeta == 8 && (side == 2 || side == 3)) { | ||
return topIcons[type]; | ||
} | ||
else { | ||
return sideIcons[type]; | ||
} | ||
} | ||
|
||
public void registerIcons(IconRegister register) { | ||
topIcons = new Icon[topTextures.length]; | ||
sideIcons = new Icon[topTextures.length]; | ||
|
||
for (int i = 0; i < topTextures.length; i++) { | ||
topIcons[i] = register.registerIcon(topTextures[i]); | ||
sideIcons[i] = register.registerIcon(sideTextures[i]); | ||
} | ||
} | ||
|
||
public boolean RenderBlock(RenderBlocks render, int x, int y, int z) { | ||
int meta = render.blockAccess.getBlockMetadata(x, y, z); | ||
int directionMeta = meta & 12; | ||
|
||
if (directionMeta == 4) { | ||
render.SetUvRotateTop(1); | ||
render.SetUvRotateBottom(1); | ||
render.SetUvRotateWest(1); | ||
render.SetUvRotateEast(1); | ||
} | ||
else if (directionMeta == 8) { | ||
render.SetUvRotateNorth(1); | ||
render.SetUvRotateSouth(1); | ||
} | ||
|
||
render.setRenderBounds(0D,0D,0D,1D,1D,1D); | ||
render.renderStandardBlock(this, x, y, z); | ||
render.ClearUvRotation(); | ||
return true; | ||
} | ||
} |
Oops, something went wrong.