1
0
Fork 0
This commit is contained in:
HoosierTransfer 2024-05-28 15:20:58 -04:00
parent 2e72406727
commit 7846ef5481
43 changed files with 2553 additions and 689 deletions

View File

@ -0,0 +1,10 @@
{
"variants": {
"age=0": { "model": "chorus_flower" },
"age=1": { "model": "chorus_flower" },
"age=2": { "model": "chorus_flower" },
"age=3": { "model": "chorus_flower" },
"age=4": { "model": "chorus_flower" },
"age=5": { "model": "chorus_flower_dead" }
}
}

View File

@ -0,0 +1,70 @@
{
"multipart": [
{ "when": { "north": true },
"apply": { "model": "chorus_plant_side" }
},
{ "when": { "east": true },
"apply": { "model": "chorus_plant_side", "y": 90, "uvlock": true }
},
{ "when": { "south": true },
"apply": { "model": "chorus_plant_side", "y": 180, "uvlock": true }
},
{ "when": { "west": true },
"apply": { "model": "chorus_plant_side", "y": 270, "uvlock": true }
},
{ "when": { "up": true },
"apply": { "model": "chorus_plant_side", "x": 270, "uvlock": true }
},
{ "when": { "down": true },
"apply": { "model": "chorus_plant_side", "x": 90, "uvlock": true }
},
{ "when": { "north": false },
"apply": [
{ "model": "chorus_plant_noside", "weight": 2 },
{ "model": "chorus_plant_noside1" },
{ "model": "chorus_plant_noside2" },
{ "model": "chorus_plant_noside3" }
]
},
{ "when": { "east": false },
"apply": [
{ "model": "chorus_plant_noside1", "y": 90, "uvlock": true },
{ "model": "chorus_plant_noside2", "y": 90, "uvlock": true },
{ "model": "chorus_plant_noside3", "y": 90, "uvlock": true },
{ "model": "chorus_plant_noside", "weight": 2, "y": 90, "uvlock": true }
]
},
{ "when": { "south": false },
"apply": [
{ "model": "chorus_plant_noside2", "y": 180, "uvlock": true },
{ "model": "chorus_plant_noside3", "y": 180, "uvlock": true },
{ "model": "chorus_plant_noside", "weight": 2, "y": 180, "uvlock": true },
{ "model": "chorus_plant_noside1", "y": 180, "uvlock": true }
]
},
{ "when": { "west": false },
"apply": [
{ "model": "chorus_plant_noside3", "y": 270, "uvlock": true },
{ "model": "chorus_plant_noside", "weight": 2, "y": 270, "uvlock": true },
{ "model": "chorus_plant_noside1", "y": 270, "uvlock": true },
{ "model": "chorus_plant_noside2", "y": 270, "uvlock": true }
]
},
{ "when": { "up": false },
"apply": [
{ "model": "chorus_plant_noside", "weight": 2, "x": 270, "uvlock": true },
{ "model": "chorus_plant_noside3", "x": 270, "uvlock": true },
{ "model": "chorus_plant_noside1", "x": 270, "uvlock": true },
{ "model": "chorus_plant_noside2", "x": 270, "uvlock": true }
]
},
{ "when": { "down": false },
"apply": [
{ "model": "chorus_plant_noside3", "x": 90, "uvlock": true },
{ "model": "chorus_plant_noside2", "x": 90, "uvlock": true },
{ "model": "chorus_plant_noside1", "x": 90, "uvlock": true },
{ "model": "chorus_plant_noside", "weight": 2, "x": 90, "uvlock": true }
]
}
]
}

View File

@ -0,0 +1,76 @@
{
"textures": {
"texture": "blocks/chorus_flower",
"bottom": "blocks/chorus_plant",
"particle": "blocks/chorus_flower"
},
"elements": [
{
"from": [ 2, 14, 2 ],
"to": [ 14, 16, 14 ],
"faces": {
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" },
"north": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" },
"south": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" },
"west": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" },
"east": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" }
}
},
{
"from": [ 0, 2, 2 ],
"to": [ 2, 14, 14 ],
"faces": {
"down": { "uv": [ 16, 14, 14, 2 ], "texture": "#bottom" },
"up": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" },
"north": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" },
"south": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" },
"west": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" }
}
},
{
"from": [ 2, 2, 0 ],
"to": [ 14, 14, 2 ],
"faces": {
"down": { "uv": [ 14, 2, 2, 0 ], "texture": "#bottom" },
"up": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" },
"north": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" },
"west": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" },
"east": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" }
}
},
{
"from": [ 2, 2, 14 ],
"to": [ 14, 14, 16 ],
"faces": {
"down": { "uv": [ 14, 16, 2, 14 ], "texture": "#bottom" },
"up": { "uv": [ 2, 14, 14, 16 ], "texture": "#bottom" },
"south": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" },
"west": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" },
"east": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" }
}
},
{
"from": [ 14, 2, 2 ],
"to": [ 16, 14, 14 ],
"faces": {
"down": { "uv": [ 2, 14, 0, 2 ], "texture": "#bottom" },
"up": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" },
"north": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" },
"south": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" },
"east": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" }
}
},
{
"from": [ 2, 0, 2 ],
"to": [ 14, 14, 14 ],
"faces": {
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#bottom" },
"down": { "uv": [ 14, 14, 2, 2 ], "texture": "#bottom" },
"north": { "uv": [ 2, 2, 14, 16 ], "texture": "#bottom" },
"south": { "uv": [ 2, 2, 14, 16 ], "texture": "#bottom" },
"west": { "uv": [ 2, 2, 14, 16 ], "texture": "#bottom" },
"east": { "uv": [ 2, 2, 14, 16 ], "texture": "#bottom" }
}
}
]
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/chorus_flower",
"textures": {
"texture": "blocks/chorus_flower_dead",
"bottom": "blocks/chorus_plant",
"particle": "blocks/chorus_flower_dead"
}
}

View File

@ -0,0 +1,81 @@
{
"ambientocclusion": false,
"textures": {
"texture": "blocks/chorus_plant",
"inside": "blocks/chorus_plant",
"particle": "blocks/chorus_plant"
},
"elements": [
{ "from": [ 2, 14, 2 ],
"to": [ 14, 16, 14 ],
"faces": {
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture", "cullface":"up" },
"north": { "uv": [ 2, 0, 14, 2 ], "texture": "#texture", "cullface":"up" },
"south": { "uv": [ 2, 0, 14, 2 ], "texture": "#texture", "cullface":"up" },
"west": { "uv": [ 2, 0, 14, 2 ], "texture": "#texture", "cullface":"up" },
"east": { "uv": [ 2, 0, 14, 2 ], "texture": "#texture", "cullface":"up" }
}
},
{ "from": [ 0, 2, 2 ],
"to": [ 2, 14, 14 ],
"faces": {
"down": { "uv": [ 16, 14, 14, 2 ], "texture": "#texture", "cullface":"west" },
"up": { "uv": [ 0, 2, 2, 14 ], "texture": "#texture", "cullface":"west" },
"north": { "uv": [ 14, 2, 16, 14 ], "texture": "#texture", "cullface":"west" },
"south": { "uv": [ 0, 2, 2, 14 ], "texture": "#texture", "cullface":"west" },
"west": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture", "cullface":"west" }
}
},
{ "from": [ 2, 2, 0 ],
"to": [ 14, 14, 2 ],
"faces": {
"down": { "uv": [ 14, 2, 2, 0 ], "texture": "#texture", "cullface":"north" },
"up": { "uv": [ 2, 0, 14, 2 ], "texture": "#texture", "cullface":"north" },
"north": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture", "cullface":"north" },
"west": { "uv": [ 0, 2, 2, 14 ], "texture": "#texture", "cullface":"north" },
"east": { "uv": [ 14, 2, 16, 14 ], "texture": "#texture", "cullface":"north" }
}
},
{ "from": [ 2, 2, 14 ],
"to": [ 14, 14, 16 ],
"faces": {
"down": { "uv": [ 14, 16, 2, 14 ], "texture": "#texture", "cullface":"south" },
"up": { "uv": [ 2, 14, 14, 16 ], "texture": "#texture", "cullface":"south" },
"south": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture", "cullface":"south" },
"west": { "uv": [ 14, 2, 16, 14 ], "texture": "#texture", "cullface":"south" },
"east": { "uv": [ 0, 2, 2, 14 ], "texture": "#texture", "cullface":"south" }
}
},
{ "from": [ 14, 2, 2 ],
"to": [ 16, 14, 14 ],
"faces": {
"down": { "uv": [ 2, 14, 0, 2 ], "texture": "#texture", "cullface":"east" },
"up": { "uv": [ 14, 2, 16, 14 ], "texture": "#texture", "cullface":"east" },
"north": { "uv": [ 0, 2, 2, 14 ], "texture": "#texture", "cullface":"east" },
"south": { "uv": [ 14, 2, 16, 14 ], "texture": "#texture", "cullface":"east" },
"east": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture", "cullface":"east" }
}
},
{ "from": [ 2, 0, 2 ],
"to": [ 14, 2, 14 ],
"faces": {
"down": { "uv": [ 14, 14, 2, 2 ], "texture": "#texture", "cullface":"down" },
"north": { "uv": [ 2, 14, 14, 16 ], "texture": "#texture", "cullface":"down" },
"south": { "uv": [ 2, 14, 14, 16 ], "texture": "#texture", "cullface":"down" },
"west": { "uv": [ 2, 14, 14, 16 ], "texture": "#texture", "cullface":"down" },
"east": { "uv": [ 2, 14, 14, 16 ], "texture": "#texture", "cullface":"down" }
}
},
{ "from": [ 2, 2, 2 ],
"to": [ 14, 14, 14 ],
"faces": {
"down": { "uv": [ 14, 14, 2, 2 ], "texture": "#inside" },
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#inside" },
"north": { "uv": [ 2, 2, 14, 14 ], "texture": "#inside" },
"south": { "uv": [ 2, 2, 14, 14 ], "texture": "#inside" },
"west": { "uv": [ 2, 2, 14, 14 ], "texture": "#inside" },
"east": { "uv": [ 2, 2, 14, 14 ], "texture": "#inside" }
}
}
]
}

View File

@ -0,0 +1,16 @@
{
"ambientocclusion": false,
"textures": {
"texture": "blocks/chorus_plant",
"inside": "blocks/chorus_plant",
"particle": "blocks/chorus_plant"
},
"elements": [
{ "from": [ 4, 4, 4 ],
"to": [ 12, 12, 12 ],
"faces": {
"north": { "texture": "#inside" }
}
}
]
}

View File

@ -0,0 +1,26 @@
{
"ambientocclusion": false,
"textures": {
"texture": "blocks/chorus_plant",
"inside": "blocks/chorus_plant",
"particle": "blocks/chorus_plant"
},
"elements": [
{ "from": [ 4, 4, 4 ],
"to": [ 12, 12, 12 ],
"faces": {
"north": { "texture": "#inside" }
}
},
{ "from": [ 4, 4, 3 ],
"to": [ 12, 12, 4 ],
"faces": {
"down": { "texture": "#texture" },
"up": { "texture": "#texture" },
"north": { "texture": "#texture" },
"west": { "texture": "#texture" },
"east": { "texture": "#texture" }
}
}
]
}

View File

@ -0,0 +1,26 @@
{
"ambientocclusion": false,
"textures": {
"texture": "blocks/chorus_plant",
"inside": "blocks/chorus_plant",
"particle": "blocks/chorus_plant"
},
"elements": [
{ "from": [ 4, 4, 4 ],
"to": [ 12, 12, 12 ],
"faces": {
"north": { "texture": "#inside" }
}
},
{ "from": [ 5, 5, 2 ],
"to": [ 11, 11, 4 ],
"faces": {
"down": { "texture": "#texture" },
"up": { "texture": "#texture" },
"north": { "texture": "#texture" },
"west": { "texture": "#texture" },
"east": { "texture": "#texture" }
}
}
]
}

View File

@ -0,0 +1,26 @@
{
"ambientocclusion": false,
"textures": {
"texture": "blocks/chorus_plant",
"inside": "blocks/chorus_plant",
"particle": "blocks/chorus_plant"
},
"elements": [
{ "from": [ 4, 4, 4 ],
"to": [ 12, 12, 12 ],
"faces": {
"north": { "texture": "#inside" }
}
},
{ "from": [ 4, 4, 3 ],
"to": [ 12, 12, 4 ],
"faces": {
"down": { "texture": "#texture" },
"up": { "texture": "#texture" },
"north": { "texture": "#texture" },
"west": { "texture": "#texture" },
"east": { "texture": "#texture" }
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"ambientocclusion": false,
"textures": {
"texture": "blocks/chorus_plant",
"inside": "blocks/chorus_plant",
"particle": "blocks/chorus_plant"
},
"elements": [
{ "from": [ 4, 4, 0 ],
"to": [ 12, 12, 4 ],
"faces": {
"down": { "texture": "#texture" },
"up": { "texture": "#texture" },
"north": { "texture": "#texture", "cullface":"north" },
"west": { "texture": "#texture" },
"east": { "texture": "#texture" }
}
}
]
}

View File

@ -0,0 +1,3 @@
{
"parent": "block/chorus_flower"
}

View File

@ -0,0 +1,3 @@
{
"parent": "block/chorus_plant"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

View File

@ -23,14 +23,21 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
/** /**
* Copyright (c) 2024 lax1dude. All Rights Reserved. * Copyright (c) 2024 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -42,11 +49,11 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
private static final Map<ResourceLocation, HighPolyMesh> meshCache = new HashMap(); private static final Map<ResourceLocation, HighPolyMesh> meshCache = new HashMap();
public static HighPolyMesh getEaglerMesh(ResourceLocation meshLoc) { public static HighPolyMesh getEaglerMesh(ResourceLocation meshLoc) {
if(meshLoc.cachedPointerType == ResourceLocation.CACHED_POINTER_EAGLER_MESH) { if (meshLoc.cachedPointerType == ResourceLocation.CACHED_POINTER_EAGLER_MESH) {
return (HighPolyMesh)meshLoc.cachedPointer; return (HighPolyMesh) meshLoc.cachedPointer;
} }
HighPolyMesh theMesh = meshCache.get(meshLoc); HighPolyMesh theMesh = meshCache.get(meshLoc);
if(theMesh == null) { if (theMesh == null) {
theMesh = new HighPolyMesh(); theMesh = new HighPolyMesh();
reloadMesh(meshLoc, theMesh, Minecraft.getMinecraft().getResourceManager()); reloadMesh(meshLoc, theMesh, Minecraft.getMinecraft().getResourceManager());
} }
@ -55,25 +62,26 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
return theMesh; return theMesh;
} }
private static void reloadMesh(ResourceLocation meshLoc, HighPolyMesh meshStruct, IResourceManager resourceManager) { private static void reloadMesh(ResourceLocation meshLoc, HighPolyMesh meshStruct,
IResourceManager resourceManager) {
IntBuffer up1 = null; IntBuffer up1 = null;
try { try {
int intsOfVertex, intsOfIndex, intsTotal, stride; int intsOfVertex, intsOfIndex, intsTotal, stride;
try(DataInputStream dis = new DataInputStream(resourceManager.getResource(meshLoc).getInputStream())) { try (DataInputStream dis = new DataInputStream(resourceManager.getResource(meshLoc).getInputStream())) {
byte[] header = new byte[8]; byte[] header = new byte[8];
dis.read(header); dis.read(header);
if(!Arrays.equals(header, new byte[] { (byte) 33, (byte) 69, (byte) 65, (byte) 71, (byte) 36, if (!Arrays.equals(header, new byte[] { (byte) 33, (byte) 69, (byte) 65, (byte) 71, (byte) 36,
(byte) 109, (byte) 100, (byte) 108 })) { (byte) 109, (byte) 100, (byte) 108 })) {
throw new IOException("File is not an eaglercraft high-poly mesh!"); throw new IOException("File is not an eaglercraft high-poly mesh!");
} }
char CT = (char)dis.read(); char CT = (char) dis.read();
if(CT == 'C') { if (CT == 'C') {
meshStruct.hasTexture = false; meshStruct.hasTexture = false;
}else if(CT == 'T') { } else if (CT == 'T') {
meshStruct.hasTexture = true; meshStruct.hasTexture = true;
}else { } else {
throw new IOException("Unsupported mesh type '" + CT + "'!"); throw new IOException("Unsupported mesh type '" + CT + "'!");
} }
@ -82,7 +90,7 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
meshStruct.vertexCount = dis.readInt(); meshStruct.vertexCount = dis.readInt();
meshStruct.indexCount = dis.readInt(); meshStruct.indexCount = dis.readInt();
int byteIndexCount = meshStruct.indexCount; int byteIndexCount = meshStruct.indexCount;
if(byteIndexCount % 2 != 0) { // must round up to int if (byteIndexCount % 2 != 0) { // must round up to int
byteIndexCount += 1; byteIndexCount += 1;
} }
stride = meshStruct.hasTexture ? 24 : 16; stride = meshStruct.hasTexture ? 24 : 16;
@ -92,24 +100,25 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
intsTotal = intsOfIndex + intsOfVertex; intsTotal = intsOfIndex + intsOfVertex;
up1 = EagRuntime.allocateIntBuffer(intsTotal); up1 = EagRuntime.allocateIntBuffer(intsTotal);
for(int i = 0; i < intsTotal; ++i) { for (int i = 0; i < intsTotal; ++i) {
int ch1 = dis.read(); int ch1 = dis.read();
int ch2 = dis.read(); int ch2 = dis.read();
int ch3 = dis.read(); int ch3 = dis.read();
int ch4 = dis.read(); int ch4 = dis.read();
if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); // rip if ((ch1 | ch2 | ch3 | ch4) < 0)
throw new EOFException(); // rip
up1.put((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)); up1.put((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0));
} }
} }
if(meshStruct.vertexArray == null) { if (meshStruct.vertexArray == null) {
meshStruct.vertexArray = _wglGenVertexArrays(); meshStruct.vertexArray = _wglGenVertexArrays();
} }
if(meshStruct.vertexBuffer == null) { if (meshStruct.vertexBuffer == null) {
meshStruct.vertexBuffer = _wglGenBuffers(); meshStruct.vertexBuffer = _wglGenBuffers();
} }
if(meshStruct.indexBuffer == null) { if (meshStruct.indexBuffer == null) {
meshStruct.indexBuffer = _wglGenBuffers(); meshStruct.indexBuffer = _wglGenBuffers();
} }
@ -128,23 +137,24 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
_wglEnableVertexAttribArray(0); _wglEnableVertexAttribArray(0);
_wglVertexAttribPointer(0, 3, GL_FLOAT, false, stride, 0); _wglVertexAttribPointer(0, 3, GL_FLOAT, false, stride, 0);
if(meshStruct.hasTexture) { if (meshStruct.hasTexture) {
_wglEnableVertexAttribArray(1); _wglEnableVertexAttribArray(1);
_wglVertexAttribPointer(1, 2, GL_FLOAT, false, stride, 16); _wglVertexAttribPointer(1, 2, GL_FLOAT, false, stride, 16);
} }
_wglEnableVertexAttribArray(meshStruct.hasTexture ? 2 : 1); _wglEnableVertexAttribArray(meshStruct.hasTexture ? 2 : 1);
_wglVertexAttribPointer(meshStruct.hasTexture ? 2 : 1, 4, GL_BYTE, true, stride, 12); _wglVertexAttribPointer(meshStruct.hasTexture ? 2 : 1, 4, GL_BYTE, true, stride, 12);
}catch(Throwable ex) {
if(meshStruct.vertexArray != null) { } catch (Throwable ex) {
if (meshStruct.vertexArray != null) {
_wglDeleteVertexArrays(meshStruct.vertexArray); _wglDeleteVertexArrays(meshStruct.vertexArray);
meshStruct.vertexArray = null; meshStruct.vertexArray = null;
} }
if(meshStruct.vertexBuffer != null) { if (meshStruct.vertexBuffer != null) {
_wglDeleteBuffers(meshStruct.vertexBuffer); _wglDeleteBuffers(meshStruct.vertexBuffer);
meshStruct.vertexBuffer = null; meshStruct.vertexBuffer = null;
} }
if(meshStruct.indexBuffer != null) { if (meshStruct.indexBuffer != null) {
_wglDeleteBuffers(meshStruct.indexBuffer); _wglDeleteBuffers(meshStruct.indexBuffer);
meshStruct.indexBuffer = null; meshStruct.indexBuffer = null;
} }
@ -155,8 +165,8 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
logger.error("Failed to load eaglercraft high-poly mesh: \"{}\"", meshLoc); logger.error("Failed to load eaglercraft high-poly mesh: \"{}\"", meshLoc);
logger.error(ex); logger.error(ex);
}finally { } finally {
if(up1 != null) { if (up1 != null) {
EagRuntime.freeIntBuffer(up1); EagRuntime.freeIntBuffer(up1);
} }
} }
@ -164,7 +174,7 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
@Override @Override
public void onResourceManagerReload(IResourceManager var1) { public void onResourceManagerReload(IResourceManager var1) {
for(Entry<ResourceLocation, HighPolyMesh> meshEntry : meshCache.entrySet()) { for (Entry<ResourceLocation, HighPolyMesh> meshEntry : meshCache.entrySet()) {
reloadMesh(meshEntry.getKey(), meshEntry.getValue(), var1); reloadMesh(meshEntry.getKey(), meshEntry.getValue(), var1);
} }
} }

View File

@ -802,6 +802,22 @@ public class GlStateManager {
} }
} }
public static final void getFloat(int pname, FloatBuffer params) {
switch (pname) {
case GL_MODELVIEW_MATRIX:
modelMatrixStack[modelMatrixStackPointer].store(params);
break;
case GL_PROJECTION_MATRIX:
projectionMatrixStack[projectionMatrixStackPointer].store(params);
break;
case GL_TEXTURE_MATRIX:
textureMatrixStack[activeTexture][textureMatrixStackPointer[activeTexture]].store(params);
break;
default:
throw new UnsupportedOperationException("glGetFloat can only be used to retrieve matricies!");
}
}
public static final void getFloat(int pname, float[] params) { public static final void getFloat(int pname, float[] params) {
switch (pname) { switch (pname) {
case GL_MODELVIEW_MATRIX: case GL_MODELVIEW_MATRIX:

View File

@ -3,6 +3,8 @@ package net.minecraft.block;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems; import net.hoosiertransfer.EaglerItems;
import net.hoosiertransfer.Alfheim.ILightInfoProvider; import net.hoosiertransfer.Alfheim.ILightInfoProvider;
import net.hoosiertransfer.Alfheim.ILightLevelProvider; import net.hoosiertransfer.Alfheim.ILightLevelProvider;
@ -492,6 +494,17 @@ public class Block implements ILitBlock {
} }
protected static void addCollisionBoxToList(BlockPos pos, AxisAlignedBB entityBox,
List<AxisAlignedBB> collidingBoxes, @Nullable AxisAlignedBB blockBox) {
if (blockBox != null) {
AxisAlignedBB axisalignedbb = blockBox.offset(pos);
if (entityBox.intersectsWith(axisalignedbb)) {
collidingBoxes.add(axisalignedbb);
}
}
}
public AxisAlignedBB getCollisionBoundingBox(World var1, BlockPos blockpos, IBlockState var3) { public AxisAlignedBB getCollisionBoundingBox(World var1, BlockPos blockpos, IBlockState var3) {
return new AxisAlignedBB((double) blockpos.getX() + this.minX, (double) blockpos.getY() + this.minY, return new AxisAlignedBB((double) blockpos.getX() + this.minX, (double) blockpos.getY() + this.minY,
(double) blockpos.getZ() + this.minZ, (double) blockpos.getX() + this.maxX, (double) blockpos.getZ() + this.minZ, (double) blockpos.getX() + this.maxX,
@ -1644,6 +1657,12 @@ public class Block implements ILitBlock {
registerEaglerBlock(198, "end_rod", (new BlockEndRod()).setHardness(0.0F).setLightLevel(0.9375F) registerEaglerBlock(198, "end_rod", (new BlockEndRod()).setHardness(0.0F).setLightLevel(0.9375F)
.setStepSound(soundTypeWood).setUnlocalizedName("endRod")); .setStepSound(soundTypeWood).setUnlocalizedName("endRod"));
registerEaglerBlock(199, "chorus_plant",
(new BlockChorusPlant()).setHardness(0.4F).setStepSound(soundTypeWood)
.setUnlocalizedName("chorusPlant"));
registerEaglerBlock(200, "chorus_flower",
(new BlockChorusFlower()).setHardness(0.4F).setStepSound(soundTypeWood)
.setUnlocalizedName("chorusFlower"));
Block purpurBlock = (new Block(Material.rock)).setHardness(1.5F).setResistance(10.0F) Block purpurBlock = (new Block(Material.rock)).setHardness(1.5F).setResistance(10.0F)
.setStepSound(soundTypeStone).setCreativeTab(CreativeTabs.tabBlock).setUnlocalizedName("purpurBlock"); .setStepSound(soundTypeStone).setCreativeTab(CreativeTabs.tabBlock).setUnlocalizedName("purpurBlock");
registerEaglerBlock(201, (String) "purpur_block", purpurBlock); registerEaglerBlock(201, (String) "purpur_block", purpurBlock);
@ -1665,6 +1684,8 @@ public class Block implements ILitBlock {
Block block15 = (new BlockGrassPath()).setHardness(0.65F).setStepSound(soundTypeGrass) Block block15 = (new BlockGrassPath()).setHardness(0.65F).setStepSound(soundTypeGrass)
.setUnlocalizedName("grassPath").disableStats(); .setUnlocalizedName("grassPath").disableStats();
registerEaglerBlock(208, "grass_path", block15); registerEaglerBlock(208, "grass_path", block15);
registerEaglerBlock(209, "end_gateway",
(new BlockEndGateway(Material.portal)).setHardness(-1.0F).setResistance(6000000.0F), false);
blockRegistry.validateKey(); blockRegistry.validateKey();

View File

@ -0,0 +1,277 @@
package net.minecraft.block;
import java.util.Random;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.World;
public class BlockChorusFlower extends Block {
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 5);
protected BlockChorusFlower() {
super(Material.plants);
this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)));
this.setCreativeTab(CreativeTabs.tabDecorations);
this.setTickRandomly(true);
}
@Nullable
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return null;
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, EaglercraftRandom rand) {
if (!this.canSurvive(worldIn, pos)) {
worldIn.destroyBlock(pos, true);
} else {
BlockPos blockpos = pos.up();
if (worldIn.isAirBlock(blockpos) && blockpos.getY() < 256) {
int i = ((Integer) state.getValue(AGE)).intValue();
if (i < 5 && rand.nextInt(1) == 0) {
boolean flag = false;
boolean flag1 = false;
Block block = worldIn.getBlockState(pos.down()).getBlock();
if (block == Blocks.end_stone) {
flag = true;
} else if (block == EaglerItems.getEaglerBlock("chorus_plant")) {
int j = 1;
for (int k = 0; k < 4; ++k) {
Block block1 = worldIn.getBlockState(pos.down(j + 1)).getBlock();
if (block1 != EaglerItems.getEaglerBlock("chorus_plant")) {
if (block1 == Blocks.end_stone) {
flag1 = true;
}
break;
}
++j;
}
int i1 = 4;
if (flag1) {
++i1;
}
if (j < 2 || rand.nextInt(i1) >= j) {
flag = true;
}
} else if (block == Blocks.air) {
flag = true;
}
if (flag && areAllNeighborsEmpty(worldIn, blockpos, (EnumFacing) null)
&& worldIn.isAirBlock(pos.up(2))) {
worldIn.setBlockState(pos, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
this.placeGrownFlower(worldIn, blockpos, i);
} else if (i < 4) {
int l = rand.nextInt(4);
boolean flag2 = false;
if (flag1) {
++l;
}
for (int j1 = 0; j1 < l; ++j1) {
EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand);
BlockPos blockpos1 = pos.offset(enumfacing);
if (worldIn.isAirBlock(blockpos1) && worldIn.isAirBlock(blockpos1.down())
&& areAllNeighborsEmpty(worldIn, blockpos1, enumfacing.getOpposite())) {
this.placeGrownFlower(worldIn, blockpos1, i + 1);
flag2 = true;
}
}
if (flag2) {
worldIn.setBlockState(pos, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
} else {
this.placeDeadFlower(worldIn, pos);
}
} else if (i == 4) {
this.placeDeadFlower(worldIn, pos);
}
}
}
}
}
private void placeGrownFlower(World p_185602_1_, BlockPos p_185602_2_, int p_185602_3_) {
p_185602_1_.setBlockState(p_185602_2_, this.getDefaultState().withProperty(AGE, Integer.valueOf(p_185602_3_)),
2);
// TODO: implement soundf
p_185602_1_.playAuxSFX(1033, p_185602_2_, 0);
}
private void placeDeadFlower(World p_185605_1_, BlockPos p_185605_2_) {
p_185605_1_.setBlockState(p_185605_2_, this.getDefaultState().withProperty(AGE, Integer.valueOf(5)), 2);
p_185605_1_.playAuxSFX(1034, p_185605_2_, 0);
}
private static boolean areAllNeighborsEmpty(World p_185604_0_, BlockPos p_185604_1_, EnumFacing p_185604_2_) {
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
if (enumfacing != p_185604_2_ && !p_185604_0_.isAirBlock(p_185604_1_.offset(enumfacing))) {
return false;
}
}
return true;
}
public boolean isFullCube() {
return false;
}
public boolean isOpaqueCube() {
return false;
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return super.canPlaceBlockAt(worldIn, pos) && this.canSurvive(worldIn, pos);
}
public void onNeighborBlockChange(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_,
Block p_189540_4_) {
if (!this.canSurvive(p_189540_2_, p_189540_3_)) {
p_189540_2_.scheduleUpdate(p_189540_3_, this, 1);
}
}
public boolean canSurvive(World worldIn, BlockPos pos) {
Block block = worldIn.getBlockState(pos.down()).getBlock();
if (block != EaglerItems.getEaglerBlock("chorus_plant") && block != Blocks.end_stone) {
if (block == Blocks.air) {
int i = 0;
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
Block block1 = worldIn.getBlockState(pos.offset(enumfacing)).getBlock();
if (block1 == EaglerItems.getEaglerBlock("chorus_plant")) {
++i;
} else if (block1 != Blocks.air) {
return false;
}
}
return i == 1;
} else {
return false;
}
} else {
return true;
}
}
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state,
@Nullable TileEntity te) {
super.harvestBlock(worldIn, player, pos, state, te);
spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this)));
}
protected ItemStack createStackedBlock(IBlockState state) {
return null;
}
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta));
}
public int getMetaFromState(IBlockState state) {
return ((Integer) state.getValue(AGE)).intValue();
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { AGE });
}
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
super.onBlockAdded(worldIn, pos, state);
}
public static void generatePlant(World worldIn, BlockPos pos, EaglercraftRandom rand, int p_185603_3_) {
worldIn.setBlockState(pos, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
growTreeRecursive(worldIn, pos, rand, pos, p_185603_3_, 0);
}
private static void growTreeRecursive(World worldIn, BlockPos p_185601_1_, EaglercraftRandom rand,
BlockPos p_185601_3_,
int p_185601_4_, int p_185601_5_) {
int i = rand.nextInt(4) + 1;
if (p_185601_5_ == 0) {
++i;
}
for (int j = 0; j < i; ++j) {
BlockPos blockpos = p_185601_1_.up(j + 1);
if (!areAllNeighborsEmpty(worldIn, blockpos, (EnumFacing) null)) {
return;
}
worldIn.setBlockState(blockpos, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
}
boolean flag = false;
if (p_185601_5_ < 4) {
int l = rand.nextInt(4);
if (p_185601_5_ == 0) {
++l;
}
for (int k = 0; k < l; ++k) {
EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand);
BlockPos blockpos1 = p_185601_1_.up(i).offset(enumfacing);
if (Math.abs(blockpos1.getX() - p_185601_3_.getX()) < p_185601_4_
&& Math.abs(blockpos1.getZ() - p_185601_3_.getZ()) < p_185601_4_
&& worldIn.isAirBlock(blockpos1) && worldIn.isAirBlock(blockpos1.down())
&& areAllNeighborsEmpty(worldIn, blockpos1, enumfacing.getOpposite())) {
flag = true;
worldIn.setBlockState(blockpos1, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
growTreeRecursive(worldIn, blockpos1, rand, p_185601_3_, p_185601_4_, p_185601_5_ + 1);
}
}
}
if (!flag) {
worldIn.setBlockState(p_185601_1_.up(i),
EaglerItems.getEaglerBlock("chorus_plant").getDefaultState().withProperty(AGE, Integer.valueOf(5)),
2);
}
}
}

View File

@ -0,0 +1,222 @@
package net.minecraft.block;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.chunk.BlockStateContainer;
public class BlockChorusPlant extends Block {
public static final PropertyBool NORTH = PropertyBool.create("north");
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool WEST = PropertyBool.create("west");
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool DOWN = PropertyBool.create("down");
protected BlockChorusPlant() {
super(Material.plants);
this.setCreativeTab(CreativeTabs.tabDecorations);
this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false))
.withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false))
.withProperty(WEST, Boolean.valueOf(false)).withProperty(UP, Boolean.valueOf(false))
.withProperty(DOWN, Boolean.valueOf(false)));
}
/**
* Get the actual Block state of this Block at the given position. This applies
* properties not visible in the
* metadata, such as fence connections.
*/
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
Block block = worldIn.getBlockState(pos.down()).getBlock();
Block block1 = worldIn.getBlockState(pos.up()).getBlock();
Block block2 = worldIn.getBlockState(pos.north()).getBlock();
Block block3 = worldIn.getBlockState(pos.east()).getBlock();
Block block4 = worldIn.getBlockState(pos.south()).getBlock();
Block block5 = worldIn.getBlockState(pos.west()).getBlock();
return state
.withProperty(DOWN,
Boolean.valueOf(block == this || block == EaglerItems.getEaglerBlock("chorus_flower")
|| block == Blocks.end_stone))
.withProperty(UP,
Boolean.valueOf(block1 == this || block1 == EaglerItems.getEaglerBlock("chorus_flower")))
.withProperty(NORTH,
Boolean.valueOf(block2 == this || block2 == EaglerItems.getEaglerBlock("chorus_flower")))
.withProperty(EAST,
Boolean.valueOf(block3 == this || block3 == EaglerItems.getEaglerBlock("chorus_flower")))
.withProperty(SOUTH,
Boolean.valueOf(block4 == this || block4 == EaglerItems.getEaglerBlock("chorus_flower")))
.withProperty(WEST,
Boolean.valueOf(block5 == this || block5 == EaglerItems.getEaglerBlock("chorus_flower")));
}
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
state = state.getBlock().getActualState(state, source, pos);
float f = 0.1875F;
float f1 = ((Boolean) state.getValue(WEST)).booleanValue() ? 0.0F : 0.1875F;
float f2 = ((Boolean) state.getValue(DOWN)).booleanValue() ? 0.0F : 0.1875F;
float f3 = ((Boolean) state.getValue(NORTH)).booleanValue() ? 0.0F : 0.1875F;
float f4 = ((Boolean) state.getValue(EAST)).booleanValue() ? 1.0F : 0.8125F;
float f5 = ((Boolean) state.getValue(UP)).booleanValue() ? 1.0F : 0.8125F;
float f6 = ((Boolean) state.getValue(SOUTH)).booleanValue() ? 1.0F : 0.8125F;
return new AxisAlignedBB((double) f1, (double) f2, (double) f3, (double) f4, (double) f5, (double) f6);
}
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos blockpos, IBlockState var3) {
return this.getBoundingBox(var3, world, blockpos);
}
public void addCollisionBoxesToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
state = state.getBlock().getActualState(state, worldIn, pos);
float f = 0.1875F;
float f1 = 0.8125F;
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.1875D, 0.1875D, 0.8125D, 0.8125D, 0.8125D));
if (((Boolean) state.getValue(WEST)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.0D, 0.1875D, 0.1875D, 0.1875D, 0.8125D, 0.8125D));
}
if (((Boolean) state.getValue(EAST)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.8125D, 0.1875D, 0.1875D, 1.0D, 0.8125D, 0.8125D));
}
if (((Boolean) state.getValue(UP)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.8125D, 0.1875D, 0.8125D, 1.0D, 0.8125D));
}
if (((Boolean) state.getValue(DOWN)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.1875D, 0.8125D));
}
if (((Boolean) state.getValue(NORTH)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.1875D, 0.0D, 0.8125D, 0.8125D, 0.1875D));
}
if (((Boolean) state.getValue(SOUTH)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.1875D, 0.8125D, 0.8125D, 0.8125D, 1.0D));
}
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state) {
return 0;
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
if (!this.canSurviveAt(worldIn, pos)) {
worldIn.destroyBlock(pos, true);
}
}
@Nullable
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return EaglerItems.getEaglerItem("chorus_fruit");
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random) {
return random.nextInt(2);
}
public boolean isFullCube() {
return false;
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for
* render
*/
public boolean isOpaqueCube() {
return false;
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return super.canPlaceBlockAt(worldIn, pos) ? this.canSurviveAt(worldIn, pos) : false;
}
public void onNeighborBlockChange(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_,
Block p_189540_4_) {
if (!this.canSurviveAt(p_189540_2_, p_189540_3_)) {
p_189540_2_.scheduleUpdate(p_189540_3_, this, 1);
}
}
public boolean canSurviveAt(World wordIn, BlockPos pos) {
boolean flag = wordIn.isAirBlock(pos.up());
boolean flag1 = wordIn.isAirBlock(pos.down());
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
BlockPos blockpos = pos.offset(enumfacing);
Block block = wordIn.getBlockState(blockpos).getBlock();
if (block == this) {
if (!flag && !flag1) {
return false;
}
Block block1 = wordIn.getBlockState(blockpos.down()).getBlock();
if (block1 == this || block1 == Blocks.end_stone) {
return true;
}
}
}
Block block2 = wordIn.getBlockState(pos.down()).getBlock();
return block2 == this || block2 == Blocks.end_stone;
}
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
public boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos,
EnumFacing side) {
Block block = blockAccess.getBlockState(pos.offset(side)).getBlock();
return block != this && block != EaglerItems.getEaglerBlock("chorus_flower")
&& (side != EnumFacing.DOWN || block != Blocks.end_stone);
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { NORTH, EAST, SOUTH, WEST, UP, DOWN });
}
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
return false;
}
}

View File

@ -0,0 +1,96 @@
package net.minecraft.block;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityEndGateway;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockEndGateway extends BlockContainer {
protected BlockEndGateway(Material p_i46687_1_) {
super(p_i46687_1_);
this.setLightLevel(1.0F);
}
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileEntityEndGateway();
}
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, BlockPos blockpos, EnumFacing enumfacing) {
IBlockState iblockstate = iblockaccess.getBlockState(blockpos.offset(enumfacing));
Block block = iblockstate.getBlock();
return !iblockstate.getBlock().isOpaqueCube() && block != EaglerItems.getEaglerBlock("end_gateway");
}
public AxisAlignedBB getCollisionBoundingBox(World var1, BlockPos var2, IBlockState var3) {
return null;
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for
* render
*/
public boolean isOpaqueCube() {
return false;
}
public boolean isFullCube() {
return false;
}
public int quantityDropped(EaglercraftRandom random) {
return 0;
}
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, EaglercraftRandom rand) {
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityEndGateway) {
int i = ((TileEntityEndGateway) tileentity).getParticleAmount();
for (int j = 0; j < i; ++j) {
double d0 = (double) ((float) pos.getX() + rand.nextFloat());
double d1 = (double) ((float) pos.getY() + rand.nextFloat());
double d2 = (double) ((float) pos.getZ() + rand.nextFloat());
double d3 = ((double) rand.nextFloat() - 0.5D) * 0.5D;
double d4 = ((double) rand.nextFloat() - 0.5D) * 0.5D;
double d5 = ((double) rand.nextFloat() - 0.5D) * 0.5D;
int k = rand.nextInt(2) * 2 - 1;
if (rand.nextBoolean()) {
d2 = (double) pos.getZ() + 0.5D + 0.25D * (double) k;
d5 = (double) (rand.nextFloat() * 2.0F * (float) k);
} else {
d0 = (double) pos.getX() + 0.5D + 0.25D * (double) k;
d3 = (double) (rand.nextFloat() * 2.0F * (float) k);
}
worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]);
}
}
}
@Nullable
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
return null;
}
/**
* Get the MapColor for this Block and the given BlockState
*/
public MapColor getMapColor(IBlockState state) {
return MapColor.blackColor;
}
}

View File

@ -31,9 +31,8 @@ public class BlockGrassPath extends Block {
case SOUTH: case SOUTH:
case WEST: case WEST:
case EAST: case EAST:
IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side)); Block block = blockAccess.getBlockState(pos).getBlock();
Block block = iblockstate.getBlock(); return !block.isOpaqueCube() && block != Blocks.farmland
return !iblockstate.getBlock().isOpaqueCube() && block != Blocks.farmland
&& block != EaglerItems.getEaglerBlock("grass_path"); && block != EaglerItems.getEaglerBlock("grass_path");
default: default:
@ -59,11 +58,11 @@ public class BlockGrassPath extends Block {
* Used to determine ambient occlusion and culling when rebuilding chunks for * Used to determine ambient occlusion and culling when rebuilding chunks for
* render * render
*/ */
public boolean isOpaqueCube(IBlockState state) { public boolean isOpaqueCube() {
return false; return false;
} }
public boolean isFullCube(IBlockState state) { public boolean isFullCube() {
return false; return false;
} }

View File

@ -2046,7 +2046,7 @@ public class Minecraft implements IThreadListener {
} }
if (flag) { if (flag) {
int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; int j = 36 + inventoryplayer.currentItem;
this.playerController.sendSlotPacket(inventoryplayer.getStackInSlot(inventoryplayer.currentItem), j); this.playerController.sendSlotPacket(inventoryplayer.getStackInSlot(inventoryplayer.currentItem), j);
} }

View File

@ -202,6 +202,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBanner; import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.tileentity.TileEntityBeacon; import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.tileentity.TileEntityCommandBlock; import net.minecraft.tileentity.TileEntityCommandBlock;
import net.minecraft.tileentity.TileEntityEndGateway;
import net.minecraft.tileentity.TileEntityFlowerPot; import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.tileentity.TileEntitySign; import net.minecraft.tileentity.TileEntitySign;
@ -1161,7 +1162,7 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
|| i == 5 && tileentity instanceof TileEntityFlowerPot || i == 5 && tileentity instanceof TileEntityFlowerPot
|| i == 6 && tileentity instanceof TileEntityBanner || i == 6 && tileentity instanceof TileEntityBanner
// || i == 7 && tileentity instanceof TileEntityStructure // || i == 7 && tileentity instanceof TileEntityStructure
// || i == 8 && tileentity instanceof TileEntityEndGateway || i == 8 && tileentity instanceof TileEntityEndGateway
|| i == 9 && tileentity instanceof TileEntitySign) { || i == 9 && tileentity instanceof TileEntitySign) {
tileentity.readFromNBT(packetIn.getNbtCompound()); tileentity.readFromNBT(packetIn.getNbtCompound());
} }

View File

@ -6,6 +6,7 @@ import java.util.Map.Entry;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite; import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockBed; import net.minecraft.block.BlockBed;
@ -175,7 +176,7 @@ public class BlockModelShapes {
this.registerBuiltInBlocks(new Block[] { Blocks.air, Blocks.flowing_water, Blocks.water, Blocks.flowing_lava, this.registerBuiltInBlocks(new Block[] { Blocks.air, Blocks.flowing_water, Blocks.water, Blocks.flowing_lava,
Blocks.lava, Blocks.piston_extension, Blocks.chest, Blocks.ender_chest, Blocks.trapped_chest, Blocks.lava, Blocks.piston_extension, Blocks.chest, Blocks.ender_chest, Blocks.trapped_chest,
Blocks.standing_sign, Blocks.skull, Blocks.end_portal, Blocks.barrier, Blocks.wall_sign, Blocks.standing_sign, Blocks.skull, Blocks.end_portal, Blocks.barrier, Blocks.wall_sign,
Blocks.wall_banner, Blocks.standing_banner }); Blocks.wall_banner, Blocks.standing_banner, EaglerItems.getEaglerBlock("end_gateway") });
this.registerBlockWithStateMapper(Blocks.stone, (new StateMap.Builder()).withName(BlockStone.VARIANT).build()); this.registerBlockWithStateMapper(Blocks.stone, (new StateMap.Builder()).withName(BlockStone.VARIANT).build());
this.registerBlockWithStateMapper(Blocks.prismarine, this.registerBlockWithStateMapper(Blocks.prismarine,
(new StateMap.Builder()).withName(BlockPrismarine.VARIANT).build()); (new StateMap.Builder()).withName(BlockPrismarine.VARIANT).build());

View File

@ -46,6 +46,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.audio.SoundCategory;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.CompiledChunk;
@ -72,6 +73,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityWitherSkull; import net.minecraft.entity.projectile.EntityWitherSkull;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemDye; import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemRecord;
@ -2490,6 +2492,14 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
return; return;
case 2005: case 2005:
ItemDye.spawnBonemealParticles(this.theWorld, blockpos, j); ItemDye.spawnBonemealParticles(this.theWorld, blockpos, j);
case 3000:
this.theWorld.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, true, (double) blockpos.getX() + 0.5D,
(double) blockpos.getY() + 0.5D, (double) blockpos.getZ() + 0.5D, 0.0D, 0.0D, 0.0D,
new int[0]);
this.theWorld.playSound(blockpos, SoundEvents.BLOCK_END_GATEWAY_SPAWN, SoundCategory.BLOCKS, 10.0F,
(1.0F + (this.theWorld.rand.nextFloat() - this.theWorld.rand.nextFloat()) * 0.2F) * 0.7F,
false);
break;
} }
} }

View File

@ -56,12 +56,12 @@ public class LayerSheepWool implements LayerRenderer<EntitySheep> {
int k = i % j; int k = i % j;
int l = (i + 1) % j; int l = (i + 1) % j;
float f7 = ((float) (entitysheep.ticksExisted % 25) + f2) / 25.0F; float f7 = ((float) (entitysheep.ticksExisted % 25) + f2) / 25.0F;
float[] afloat1 = EntitySheep.func_175513_a(EnumDyeColor.byMetadata(k)); float[] afloat1 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(k));
float[] afloat2 = EntitySheep.func_175513_a(EnumDyeColor.byMetadata(l)); float[] afloat2 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(l));
GlStateManager.color(afloat1[0] * (1.0F - f7) + afloat2[0] * f7, GlStateManager.color(afloat1[0] * (1.0F - f7) + afloat2[0] * f7,
afloat1[1] * (1.0F - f7) + afloat2[1] * f7, afloat1[2] * (1.0F - f7) + afloat2[2] * f7); afloat1[1] * (1.0F - f7) + afloat2[1] * f7, afloat1[2] * (1.0F - f7) + afloat2[2] * f7);
} else { } else {
float[] afloat = EntitySheep.func_175513_a(entitysheep.getFleeceColor()); float[] afloat = EntitySheep.getDyeRgb(entitysheep.getFleeceColor());
GlStateManager.color(afloat[0], afloat[1], afloat[2]); GlStateManager.color(afloat[0], afloat[1], afloat[2]);
} }

View File

@ -49,7 +49,7 @@ public class LayerWolfCollar implements LayerRenderer<EntityWolf> {
if (entitywolf.isTamed() && !entitywolf.isInvisible()) { if (entitywolf.isTamed() && !entitywolf.isInvisible()) {
this.wolfRenderer.bindTexture(WOLF_COLLAR); this.wolfRenderer.bindTexture(WOLF_COLLAR);
EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entitywolf.getCollarColor().getMetadata()); EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entitywolf.getCollarColor().getMetadata());
float[] afloat = EntitySheep.func_175513_a(enumdyecolor); float[] afloat = EntitySheep.getDyeRgb(enumdyecolor);
GlStateManager.color(afloat[0], afloat[1], afloat[2]); GlStateManager.color(afloat[0], afloat[1], afloat[2]);
this.wolfRenderer.getMainModel().render(entitywolf, f, f1, f2, f3, f4, f5); this.wolfRenderer.getMainModel().render(entitywolf, f, f1, f2, f3, f4, f5);
} }

View File

@ -301,6 +301,129 @@ public class TileEntityBeaconRenderer extends TileEntitySpecialRenderer<TileEnti
} }
public static void renderBeamSegment(double p_188205_0_, double p_188205_2_, double p_188205_4_, double p_188205_6_,
double p_188205_8_, double p_188205_10_, int p_188205_12_, int p_188205_13_, float[] p_188205_14_,
double p_188205_15_, double p_188205_17_) {
int i = p_188205_12_ + p_188205_13_;
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 10497);
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 10497);
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE,
GL_ONE, GL_ZERO);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer vertexbuffer = tessellator.getWorldRenderer();
double d0 = p_188205_10_ + p_188205_6_;
double d1 = p_188205_13_ < 0 ? d0 : -d0;
double d2 = MathHelper.frac(d1 * 0.2D - (double) MathHelper.floor_double(d1 * 0.1D));
float f = p_188205_14_[0];
float f1 = p_188205_14_[1];
float f2 = p_188205_14_[2];
double d3 = d0 * 0.025D * -1.5D;
double d4 = 0.5D + Math.cos(d3 + 2.356194490192345D) * p_188205_15_;
double d5 = 0.5D + Math.sin(d3 + 2.356194490192345D) * p_188205_15_;
double d6 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * p_188205_15_;
double d7 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * p_188205_15_;
double d8 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * p_188205_15_;
double d9 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * p_188205_15_;
double d10 = 0.5D + Math.cos(d3 + 5.497787143782138D) * p_188205_15_;
double d11 = 0.5D + Math.sin(d3 + 5.497787143782138D) * p_188205_15_;
double d12 = 0.0D;
double d13 = 1.0D;
double d14 = -1.0D + d2;
double d15 = (double) p_188205_13_ * p_188205_8_ * (0.5D / p_188205_15_) + d14;
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
vertexbuffer.pos(p_188205_0_ + d4, p_188205_2_ + (double) i, p_188205_4_ + d5).tex(1.0D, d15)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d4, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d5).tex(1.0D, d14)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d6, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d7).tex(0.0D, d14)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d6, p_188205_2_ + (double) i, p_188205_4_ + d7).tex(0.0D, d15)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d10, p_188205_2_ + (double) i, p_188205_4_ + d11).tex(1.0D, d15)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d10, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d11).tex(1.0D, d14)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d8, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d9).tex(0.0D, d14)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d8, p_188205_2_ + (double) i, p_188205_4_ + d9).tex(0.0D, d15)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d6, p_188205_2_ + (double) i, p_188205_4_ + d7).tex(1.0D, d15)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d6, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d7).tex(1.0D, d14)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d10, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d11).tex(0.0D, d14)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d10, p_188205_2_ + (double) i, p_188205_4_ + d11).tex(0.0D, d15)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d8, p_188205_2_ + (double) i, p_188205_4_ + d9).tex(1.0D, d15)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d8, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d9).tex(1.0D, d14)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d4, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d5).tex(0.0D, d14)
.color(f, f1, f2, 1.0F).endVertex();
vertexbuffer.pos(p_188205_0_ + d4, p_188205_2_ + (double) i, p_188205_4_ + d5).tex(0.0D, d15)
.color(f, f1, f2, 1.0F).endVertex();
tessellator.draw();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, GL_ONE,
GL_ZERO);
GlStateManager.depthMask(false);
d3 = 0.5D - p_188205_17_;
d4 = 0.5D - p_188205_17_;
d5 = 0.5D + p_188205_17_;
d6 = 0.5D - p_188205_17_;
d7 = 0.5D - p_188205_17_;
d8 = 0.5D + p_188205_17_;
d9 = 0.5D + p_188205_17_;
d10 = 0.5D + p_188205_17_;
d11 = 0.0D;
d12 = 1.0D;
d13 = -1.0D + d2;
d14 = (double) p_188205_13_ * p_188205_8_ + d13;
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
vertexbuffer.pos(p_188205_0_ + d3, p_188205_2_ + (double) i, p_188205_4_ + d4).tex(1.0D, d14)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d3, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d4).tex(1.0D, d13)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d5, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d6).tex(0.0D, d13)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d5, p_188205_2_ + (double) i, p_188205_4_ + d6).tex(0.0D, d14)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d9, p_188205_2_ + (double) i, p_188205_4_ + d10).tex(1.0D, d14)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d9, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d10).tex(1.0D, d13)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d7, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d8).tex(0.0D, d13)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d7, p_188205_2_ + (double) i, p_188205_4_ + d8).tex(0.0D, d14)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d5, p_188205_2_ + (double) i, p_188205_4_ + d6).tex(1.0D, d14)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d5, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d6).tex(1.0D, d13)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d9, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d10).tex(0.0D, d13)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d9, p_188205_2_ + (double) i, p_188205_4_ + d10).tex(0.0D, d14)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d7, p_188205_2_ + (double) i, p_188205_4_ + d8).tex(1.0D, d14)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d7, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d8).tex(1.0D, d13)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d3, p_188205_2_ + (double) p_188205_12_, p_188205_4_ + d4).tex(0.0D, d13)
.color(f, f1, f2, 0.125F).endVertex();
vertexbuffer.pos(p_188205_0_ + d3, p_188205_2_ + (double) i, p_188205_4_ + d4).tex(0.0D, d14)
.color(f, f1, f2, 0.125F).endVertex();
tessellator.draw();
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
}
public boolean func_181055_a() { public boolean func_181055_a() {
return true; return true;
} }

View File

@ -0,0 +1,222 @@
package net.minecraft.client.renderer.tileentity;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ShadersRenderPassFuture;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ShadersRenderPassFuture.PassType;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.tileentity.TileEntityEndGateway;
import net.minecraft.tileentity.TileEntityEndPortal;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
public class TileEntityEndGatewayRenderer extends TileEntitySpecialRenderer<TileEntityEndGateway> {
private static final ResourceLocation END_SKY_TEXTURE = new ResourceLocation("textures/environment/end_sky.png");
private static final ResourceLocation END_PORTAL_TEXTURE = new ResourceLocation("textures/entity/end_portal.png");
private static final ResourceLocation END_GATEWAY_BEAM_TEXTURE = new ResourceLocation(
"textures/entity/end_gateway_beam.png");
private static final EaglercraftRandom RANDOM = new EaglercraftRandom(31100L);
private static final float[] MODELVIEW = new float[16];
private static final float[] PROJECTION = new float[16];
FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
public void renderTileEntityAt(TileEntityEndGateway var1, double d0, double d1, double d2, float var8, int var9) {
if (DeferredStateManager.isInDeferredPass()) {
if (!DeferredStateManager.isInParaboloidPass() && !DeferredStateManager.isEnableShadowRender()
&& DeferredStateManager.forwardCallbackHandler != null) {
DeferredStateManager.forwardCallbackHandler
.push(new ShadersRenderPassFuture((float) d0, (float) d1, (float) d2, var8) {
@Override
public void draw(PassType pass) {
if (pass == PassType.MAIN) {
DeferredStateManager.reportForwardRenderObjectPosition2(x, y, z);
}
DeferredStateManager.setDefaultMaterialConstants();
DeferredStateManager.setRoughnessConstant(0.3f);
DeferredStateManager.setMetalnessConstant(0.3f);
DeferredStateManager.setEmissionConstant(0.9f);
renderTileEntityAt0(var1, d0, d1, d2, var8, var9);
DeferredStateManager.setDefaultMaterialConstants();
DeferredStateManager.setHDRTranslucentPassBlendFunc();
}
});
}
return;
}
renderTileEntityAt0(var1, d0, d1, d2, var8, var9);
}
public void renderTileEntityAt0(TileEntityEndGateway te, double x, double y, double z, float partialTicks,
int destroyStage) {
// ! fix this it looks like shit
GlStateManager.disableFog();
if (te.isSpawning() || te.isCoolingDown()) {
GlStateManager.alphaFunc(516, 0.1F);
this.bindTexture(END_GATEWAY_BEAM_TEXTURE);
float f = te.isSpawning() ? te.getSpawnPercent() : te.getCooldownPercent();
double d0 = te.isSpawning() ? 256.0D - y : 25.0D;
f = MathHelper.sin(f * (float) Math.PI);
int j = MathHelper.floor_double((double) f * d0);
float[] afloat = EntitySheep.getDyeRgb(te.isSpawning() ? EnumDyeColor.MAGENTA : EnumDyeColor.YELLOW);
TileEntityBeaconRenderer.renderBeamSegment(x, y, z, (double) partialTicks, (double) f,
(double) te.getWorld().getTotalWorldTime(), 0, j, afloat, 0.15D, 0.175D);
TileEntityBeaconRenderer.renderBeamSegment(x, y, z, (double) partialTicks, (double) f,
(double) te.getWorld().getTotalWorldTime(), 0, -j, afloat, 0.15D, 0.175D);
}
GlStateManager.disableLighting();
RANDOM.setSeed(31100L);
GlStateManager.getFloat(2982, MODELVIEW);
GlStateManager.getFloat(2983, PROJECTION);
double d1 = x * x + y * y + z * z;
int i;
if (d1 > 36864.0D) {
i = 2;
} else if (d1 > 25600.0D) {
i = 4;
} else if (d1 > 16384.0D) {
i = 6;
} else if (d1 > 9216.0D) {
i = 8;
} else if (d1 > 4096.0D) {
i = 10;
} else if (d1 > 1024.0D) {
i = 12;
} else if (d1 > 576.0D) {
i = 14;
} else if (d1 > 256.0D) {
i = 15;
} else {
i = 16;
}
for (int k = 0; k < i; ++k) {
GlStateManager.pushMatrix();
float f5 = 2.0F / (float) (18 - k);
if (k == 0) {
this.bindTexture(END_SKY_TEXTURE);
f5 = 0.15F;
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA);
}
if (k >= 1) {
this.bindTexture(END_PORTAL_TEXTURE);
}
if (k == 1) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_ONE, GL_ONE);
}
GlStateManager.texGen(GlStateManager.TexGen.S, 9216);
GlStateManager.texGen(GlStateManager.TexGen.T, 9216);
GlStateManager.texGen(GlStateManager.TexGen.R, 9216);
GlStateManager.func_179105_a(GlStateManager.TexGen.S, 9474, this.getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GlStateManager.func_179105_a(GlStateManager.TexGen.T, 9474, this.getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GlStateManager.func_179105_a(GlStateManager.TexGen.R, 9474, this.getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GlStateManager.enableTexGen();
GlStateManager.popMatrix();
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.translate(0.5F, 0.5F, 0.0F);
GlStateManager.scale(0.5F, 0.5F, 1.0F);
float f1 = (float) (k + 1);
GlStateManager.translate(17.0F / f1,
(2.0F + f1 / 1.5F) * ((float) Minecraft.getSystemTime() % 800000.0F / 800000.0F), 0.0F);
GlStateManager.rotate((f1 * f1 * 4321.0F + f1 * 9.0F) * 2.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.scale(4.5F - f1 / 4.0F, 4.5F - f1 / 4.0F, 1.0F);
GlStateManager.multMatrix(PROJECTION);
GlStateManager.multMatrix(MODELVIEW);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer vertexbuffer = tessellator.getWorldRenderer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
float f2 = (RANDOM.nextFloat() * 0.5F + 0.1F) * f5;
float f3 = (RANDOM.nextFloat() * 0.5F + 0.4F) * f5;
float f4 = (RANDOM.nextFloat() * 0.5F + 0.5F) * f5;
if (k == 0) {
f2 = f3 = f4 = 1.0F * f5;
}
if (te.shouldRenderFace(EnumFacing.SOUTH)) {
vertexbuffer.pos(x, y, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y + 1.0D, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x, y + 1.0D, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
}
if (te.shouldRenderFace(EnumFacing.NORTH)) {
vertexbuffer.pos(x, y + 1.0D, z).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y + 1.0D, z).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y, z).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x, y, z).color(f2, f3, f4, 1.0F).endVertex();
}
if (te.shouldRenderFace(EnumFacing.EAST)) {
vertexbuffer.pos(x + 1.0D, y + 1.0D, z).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y + 1.0D, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y, z).color(f2, f3, f4, 1.0F).endVertex();
}
if (te.shouldRenderFace(EnumFacing.WEST)) {
vertexbuffer.pos(x, y, z).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x, y, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x, y + 1.0D, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x, y + 1.0D, z).color(f2, f3, f4, 1.0F).endVertex();
}
if (te.shouldRenderFace(EnumFacing.DOWN)) {
vertexbuffer.pos(x, y, z).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y, z).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x, y, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
}
if (te.shouldRenderFace(EnumFacing.UP)) {
vertexbuffer.pos(x, y + 1.0D, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y + 1.0D, z + 1.0D).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x + 1.0D, y + 1.0D, z).color(f2, f3, f4, 1.0F).endVertex();
vertexbuffer.pos(x, y + 1.0D, z).color(f2, f3, f4, 1.0F).endVertex();
}
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
this.bindTexture(END_SKY_TEXTURE);
}
GlStateManager.disableBlend();
GlStateManager.disableTexGen();
GlStateManager.enableLighting();
GlStateManager.enableFog();
}
private FloatBuffer getBuffer(float p_188193_1_, float p_188193_2_, float p_188193_3_, float p_188193_4_) {
this.buffer.clear();
this.buffer.put(p_188193_1_).put(p_188193_2_).put(p_188193_3_).put(p_188193_4_);
this.buffer.flip();
return this.buffer;
}
public boolean isGlobalRenderer(TileEntityEndGateway te) {
return te.isSpawning() || te.isCoolingDown();
}
}

View File

@ -17,6 +17,7 @@ import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.tileentity.TileEntityBeacon; import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityEnchantmentTable; import net.minecraft.tileentity.TileEntityEnchantmentTable;
import net.minecraft.tileentity.TileEntityEndGateway;
import net.minecraft.tileentity.TileEntityEndPortal; import net.minecraft.tileentity.TileEntityEndPortal;
import net.minecraft.tileentity.TileEntityEnderChest; import net.minecraft.tileentity.TileEntityEnderChest;
import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.tileentity.TileEntityMobSpawner;
@ -81,6 +82,7 @@ public class TileEntityRendererDispatcher {
this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());

View File

@ -79,7 +79,7 @@ public class EntitySheep extends EntityAnimal {
private int sheepTimer; private int sheepTimer;
private EntityAIEatGrass entityAIEatGrass = new EntityAIEatGrass(this); private EntityAIEatGrass entityAIEatGrass = new EntityAIEatGrass(this);
public static float[] func_175513_a(EnumDyeColor dyeColor) { public static float[] getDyeRgb(EnumDyeColor dyeColor) {
return (float[]) DYE_TO_RGB.get(dyeColor); return (float[]) DYE_TO_RGB.get(dyeColor);
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.entity.player; package net.minecraft.entity.player;
import java.util.Arrays;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -55,14 +56,14 @@ public class InventoryPlayer implements IInventory {
* An array of 36 item stacks indicating the main player * An array of 36 item stacks indicating the main player
* inventory (including the visible bar). * inventory (including the visible bar).
*/ */
public ItemStack[] mainInventory = new ItemStack[36]; public final ItemStack[] mainInventory = new ItemStack[36];
/** /**
* + * +
* An array of 4 item stacks containing the currently worn armor * An array of 4 item stacks containing the currently worn armor
* pieces. * pieces.
*/ */
public ItemStack[] armorInventory = new ItemStack[4]; public final ItemStack[] armorInventory = new ItemStack[4];
public ItemStack[] offHandInventory = new ItemStack[1]; public final ItemStack[] offHandInventory = new ItemStack[1];
private final ItemStack[][] allInventories; private final ItemStack[][] allInventories;
@ -76,6 +77,17 @@ public class InventoryPlayer implements IInventory {
this.player = playerIn; this.player = playerIn;
} }
private boolean canMergeStacks(@Nullable ItemStack stack1, ItemStack stack2) {
return stack1 != null && this.stackEqualExact(stack1, stack2) && stack1.isStackable()
&& stack1.stackSize < stack1.getMaxStackSize() && stack1.stackSize < this.getInventoryStackLimit();
}
private boolean stackEqualExact(ItemStack stack1, ItemStack stack2) {
return stack1.getItem() == stack2.getItem()
&& (!stack1.getHasSubtypes() || stack1.getMetadata() == stack2.getMetadata())
&& ItemStack.areItemStackTagsEqual(stack1, stack2);
}
/** /**
* + * +
* Returns the item stack currently held by the player. * Returns the item stack currently held by the player.
@ -118,20 +130,20 @@ public class InventoryPlayer implements IInventory {
* stores an itemstack in the users inventory * stores an itemstack in the users inventory
*/ */
private int storeItemStack(ItemStack itemStackIn) { private int storeItemStack(ItemStack itemStackIn) {
if (this.canMergeStacks(this.getStackInSlot(this.currentItem), itemStackIn)) {
return this.currentItem;
} else if (this.canMergeStacks(this.getStackInSlot(40), itemStackIn)) {
return 40;
} else {
for (int i = 0; i < this.mainInventory.length; ++i) { for (int i = 0; i < this.mainInventory.length; ++i) {
if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() if (this.canMergeStacks(this.mainInventory[i], itemStackIn)) {
&& this.mainInventory[i].isStackable()
&& this.mainInventory[i].stackSize < this.mainInventory[i].getMaxStackSize()
&& this.mainInventory[i].stackSize < this.getInventoryStackLimit()
&& (!this.mainInventory[i].getHasSubtypes()
|| this.mainInventory[i].getMetadata() == itemStackIn.getMetadata())
&& ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn)) {
return i; return i;
} }
} }
return -1; return -1;
} }
}
/** /**
* + * +
@ -293,35 +305,42 @@ public class InventoryPlayer implements IInventory {
Item item = itemStackIn.getItem(); Item item = itemStackIn.getItem();
int i = itemStackIn.stackSize; int i = itemStackIn.stackSize;
int j = this.storeItemStack(itemStackIn); int j = this.storeItemStack(itemStackIn);
if (j < 0) {
if (j == -1) {
j = this.getFirstEmptyStack(); j = this.getFirstEmptyStack();
} }
if (j < 0) { if (j == -1) {
return i; return i;
} else { } else {
if (this.mainInventory[j] == null) { ItemStack itemstack = this.getStackInSlot(j);
this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata());
if (itemstack == null) {
itemstack = new ItemStack(item, 0, itemStackIn.getMetadata());
if (itemStackIn.hasTagCompound()) { if (itemStackIn.hasTagCompound()) {
this.mainInventory[j].setTagCompound((NBTTagCompound) itemStackIn.getTagCompound().copy()); itemstack.setTagCompound((NBTTagCompound) itemStackIn.getTagCompound().copy());
} }
this.setInventorySlotContents(j, itemstack);
} }
int k = i; int k = i;
if (i > this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].stackSize) {
k = this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].stackSize; if (i > itemstack.getMaxStackSize() - itemstack.stackSize) {
k = itemstack.getMaxStackSize() - itemstack.stackSize;
} }
if (k > this.getInventoryStackLimit() - this.mainInventory[j].stackSize) { if (k > this.getInventoryStackLimit() - itemstack.stackSize) {
k = this.getInventoryStackLimit() - this.mainInventory[j].stackSize; k = this.getInventoryStackLimit() - itemstack.stackSize;
} }
if (k == 0) { if (k == 0) {
return i; return i;
} else { } else {
i = i - k; i = i - k;
this.mainInventory[j].stackSize += k; itemstack.stackSize += k;
this.mainInventory[j].animationsToGo = 5; itemstack.animationsToGo = 5;
return i; return i;
} }
} }
@ -548,15 +567,16 @@ public class InventoryPlayer implements IInventory {
* Reads from the given tag list and fills the slots in the * Reads from the given tag list and fills the slots in the
* inventory with the correct items. * inventory with the correct items.
*/ */
public void readFromNBT(NBTTagList parNBTTagList) { public void readFromNBT(NBTTagList nbtTagListIn) {
this.mainInventory = new ItemStack[36]; Arrays.fill(this.mainInventory, (Object) null);
this.armorInventory = new ItemStack[4]; Arrays.fill(this.armorInventory, (Object) null);
this.offHandInventory = new ItemStack[1]; Arrays.fill(this.offHandInventory, (Object) null);
for (int i = 0; i < parNBTTagList.tagCount(); ++i) { for (int i = 0; i < nbtTagListIn.tagCount(); ++i) {
NBTTagCompound nbttagcompound = parNBTTagList.getCompoundTagAt(i); NBTTagCompound nbttagcompound = nbtTagListIn.getCompoundTagAt(i);
int j = nbttagcompound.getByte("Slot") & 255; int j = nbttagcompound.getByte("Slot") & 255;
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound); ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
if (itemstack != null) { if (itemstack != null) {
if (j >= 0 && j < this.mainInventory.length) { if (j >= 0 && j < this.mainInventory.length) {
this.mainInventory[j] = itemstack; this.mainInventory[j] = itemstack;
@ -567,7 +587,6 @@ public class InventoryPlayer implements IInventory {
} }
} }
} }
} }
/** /**

View File

@ -111,7 +111,7 @@ public class RecipesArmorDyes implements IRecipe {
return null; return null;
} }
float[] afloat = EntitySheep.func_175513_a(EnumDyeColor.byDyeDamage(itemstack1.getMetadata())); float[] afloat = EntitySheep.getDyeRgb(EnumDyeColor.byDyeDamage(itemstack1.getMetadata()));
int l1 = (int) (afloat[0] * 255.0F); int l1 = (int) (afloat[0] * 255.0F);
int i2 = (int) (afloat[1] * 255.0F); int i2 = (int) (afloat[1] * 255.0F);
int j2 = (int) (afloat[2] * 255.0F); int j2 = (int) (afloat[2] * 255.0F);

View File

@ -348,5 +348,6 @@ public abstract class TileEntity {
addMapping(TileEntityComparator.class, "Comparator"); addMapping(TileEntityComparator.class, "Comparator");
addMapping(TileEntityFlowerPot.class, "FlowerPot"); addMapping(TileEntityFlowerPot.class, "FlowerPot");
addMapping(TileEntityBanner.class, "Banner"); addMapping(TileEntityBanner.class, "Banner");
addMapping(TileEntityEndGateway.class, "EndGateway");
} }
} }

View File

@ -135,7 +135,7 @@ public class TileEntityBeacon extends TileEntityLockable implements ITickable, I
this.beamSegments.clear(); this.beamSegments.clear();
this.isComplete = true; this.isComplete = true;
TileEntityBeacon.BeamSegment tileentitybeacon$beamsegment = new TileEntityBeacon.BeamSegment( TileEntityBeacon.BeamSegment tileentitybeacon$beamsegment = new TileEntityBeacon.BeamSegment(
EntitySheep.func_175513_a(EnumDyeColor.WHITE)); EntitySheep.getDyeRgb(EnumDyeColor.WHITE));
this.beamSegments.add(tileentitybeacon$beamsegment); this.beamSegments.add(tileentitybeacon$beamsegment);
boolean flag = true; boolean flag = true;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
@ -144,7 +144,7 @@ public class TileEntityBeacon extends TileEntityLockable implements ITickable, I
IBlockState iblockstate = this.worldObj.getBlockState(blockpos$mutableblockpos.func_181079_c(j, i1, l)); IBlockState iblockstate = this.worldObj.getBlockState(blockpos$mutableblockpos.func_181079_c(j, i1, l));
float[] afloat; float[] afloat;
if (iblockstate.getBlock() == Blocks.stained_glass) { if (iblockstate.getBlock() == Blocks.stained_glass) {
afloat = EntitySheep.func_175513_a((EnumDyeColor) iblockstate.getValue(BlockStainedGlass.COLOR)); afloat = EntitySheep.getDyeRgb((EnumDyeColor) iblockstate.getValue(BlockStainedGlass.COLOR));
} else { } else {
if (iblockstate.getBlock() != Blocks.stained_glass_pane) { if (iblockstate.getBlock() != Blocks.stained_glass_pane) {
if (iblockstate.getBlock().getLightOpacity() >= 15 && iblockstate.getBlock() != Blocks.bedrock) { if (iblockstate.getBlock().getLightOpacity() >= 15 && iblockstate.getBlock() != Blocks.bedrock) {
@ -157,7 +157,7 @@ public class TileEntityBeacon extends TileEntityLockable implements ITickable, I
continue; continue;
} }
afloat = EntitySheep.func_175513_a((EnumDyeColor) iblockstate.getValue(BlockStainedGlassPane.COLOR)); afloat = EntitySheep.getDyeRgb((EnumDyeColor) iblockstate.getValue(BlockStainedGlassPane.COLOR));
} }
if (!flag) { if (!flag) {

View File

@ -0,0 +1,272 @@
package net.minecraft.tileentity;
import java.util.List;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderEnd;
import net.minecraft.world.chunk.Chunk;
public class TileEntityEndGateway extends TileEntity implements ITickable {
private static final Logger LOG = LogManager.getLogger();
private long age = 0L;
private int teleportCooldown = 0;
private BlockPos exitPortal;
private boolean exactTeleport;
public void func_189515_b(NBTTagCompound p_189515_1_) {
super.writeToNBT(p_189515_1_);
p_189515_1_.setLong("Age", this.age);
if (this.exitPortal != null) {
p_189515_1_.setTag("ExitPortal", NBTUtil.createPosTag(this.exitPortal));
}
if (this.exactTeleport) {
p_189515_1_.setBoolean("ExactTeleport", this.exactTeleport);
}
}
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
this.age = compound.getLong("Age");
if (compound.hasKey("ExitPortal", 10)) {
this.exitPortal = NBTUtil.getPosFromTag(compound.getCompoundTag("ExitPortal"));
}
this.exactTeleport = compound.getBoolean("ExactTeleport");
}
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
public void update() {
boolean flag = this.isSpawning();
boolean flag1 = this.isCoolingDown();
++this.age;
if (flag1) {
--this.teleportCooldown;
} else if (!this.worldObj.isRemote) {
List<Entity> list = this.worldObj.<Entity>getEntitiesWithinAABB(Entity.class,
new AxisAlignedBB(this.getPos()));
if (!list.isEmpty()) {
this.teleportEntity((Entity) list.get(0));
}
}
if (flag != this.isSpawning() || flag1 != this.isCoolingDown()) {
this.markDirty();
}
}
@Nullable
public S35PacketUpdateTileEntity getDescriptionPacket() {
return new S35PacketUpdateTileEntity(this.pos, 8, this.func_189517_E_());
}
public boolean isSpawning() {
return this.age < 200L;
}
public boolean isCoolingDown() {
return this.teleportCooldown > 0;
}
public float getSpawnPercent() {
return MathHelper.clamp_float((float) this.age / 200.0F, 0.0F, 1.0F);
}
public float getCooldownPercent() {
return 1.0F - MathHelper.clamp_float((float) this.teleportCooldown / 20.0F, 0.0F, 1.0F);
}
public void triggerCooldown() {
if (!this.worldObj.isRemote) {
this.teleportCooldown = 20;
this.worldObj.addBlockEvent(this.getPos(), this.getBlockType(), 1, 0);
this.markDirty();
}
}
public boolean receiveClientEvent(int id, int type) {
if (id == 1) {
this.teleportCooldown = 20;
return true;
} else {
return super.receiveClientEvent(id, type);
}
}
public void teleportEntity(Entity entityIn) {
// TODO: Implement new end
// if (!this.worldObj.isRemote && !this.isCoolingDown()) {
// this.teleportCooldown = 100;
// if (this.exitPortal == null && this.worldObj.provider instanceof
// WorldProviderEnd) {
// this.findExitPortal();
// }
// if (this.exitPortal != null) {
// BlockPos blockpos = this.exactTeleport ? this.exitPortal :
// this.findExitPosition();
// entityIn.setPositionAndUpdate((double) blockpos.getX() + 0.5D, (double)
// blockpos.getY() + 0.5D,
// (double) blockpos.getZ() + 0.5D);
// }
// this.triggerCooldown();
// }
// }
}
private BlockPos findExitPosition() {
// BlockPos blockpos = findHighestBlock(this.worldObj, this.exitPortal, 5,
// false);
// LOG.debug("Best exit position for portal at " + this.exitPortal + " is " +
// blockpos);
// return blockpos.up();
return null;
}
private void findExitPortal() {
// Vec3 vec3d = (new Vec3((double) this.getPos().getX(), 0.0D, (double)
// this.getPos().getZ())).normalize();
// Vec3 vec3d1 = vec3d.scale(1024.0D);
// for (int i = 16; getChunk(this.worldObj, vec3d1).getTopFilledSegment() > 0
// && i-- > 0; vec3d1 = vec3d1.add(vec3d.scale(-16.0D))) {
// LOG.debug("Skipping backwards past nonempty chunk at " + vec3d1);
// }
// for (int j = 16; getChunk(this.worldObj, vec3d1).getTopFilledSegment() == 0
// && j-- > 0; vec3d1 = vec3d1.add(vec3d.scale(16.0D))) {
// LOG.debug("Skipping forward past empty chunk at " + vec3d1);
// }
// LOG.debug("Found chunk at " + vec3d1);
// Chunk chunk = getChunk(this.worldObj, vec3d1);
// this.exitPortal = findSpawnpointInChunk(chunk);
// if (this.exitPortal == null) {
// this.exitPortal = new BlockPos(vec3d1.xCoord + 0.5D, 75.0D, vec3d1.zCoord +
// 0.5D);
// LOG.debug("Failed to find suitable block, settling on " + this.exitPortal);
// (new WorldGenEndIsland()).generate(this.worldObj, new
// EaglercraftRandom(this.exitPortal.toLong()),
// this.exitPortal);
// } else {
// LOG.debug("Found block at " + this.exitPortal);
// }
// this.exitPortal = findHighestBlock(this.worldObj, this.exitPortal, 16, true);
// LOG.debug("Creating portal at " + this.exitPortal);
// this.exitPortal = this.exitPortal.up(10);
// this.createExitPortal(this.exitPortal);
// this.markDirty();
}
private static BlockPos findHighestBlock(World p_184308_0_, BlockPos p_184308_1_, int p_184308_2_,
boolean p_184308_3_) {
BlockPos blockpos = null;
for (int i = -p_184308_2_; i <= p_184308_2_; ++i) {
for (int j = -p_184308_2_; j <= p_184308_2_; ++j) {
if (i != 0 || j != 0 || p_184308_3_) {
for (int k = 255; k > (blockpos == null ? 0 : blockpos.getY()); --k) {
BlockPos blockpos1 = new BlockPos(p_184308_1_.getX() + i, k, p_184308_1_.getZ() + j);
IBlockState iblockstate = p_184308_0_.getBlockState(blockpos1);
if (iblockstate.getBlock().isBlockNormalCube()
&& (p_184308_3_ || iblockstate.getBlock() != Blocks.bedrock)) {
blockpos = blockpos1;
break;
}
}
}
}
}
return blockpos == null ? p_184308_1_ : blockpos;
}
private static Chunk getChunk(World worldIn, Vec3 vec3) {
return worldIn.getChunkFromChunkCoords(MathHelper.floor_double(vec3.xCoord / 16.0D),
MathHelper.floor_double(vec3.zCoord / 16.0D));
}
@Nullable
private static BlockPos findSpawnpointInChunk(Chunk chunkIn) {
BlockPos blockpos = new BlockPos(chunkIn.xPosition * 16, 30, chunkIn.zPosition * 16);
int i = chunkIn.getTopFilledSegment() + 16 - 1;
BlockPos blockpos1 = new BlockPos(chunkIn.xPosition * 16 + 16 - 1, i, chunkIn.zPosition * 16 + 16 - 1);
BlockPos blockpos2 = null;
double d0 = 0.0D;
for (BlockPos blockpos3 : BlockPos.getAllInBox(blockpos, blockpos1)) {
IBlockState iblockstate = chunkIn.getBlockState(blockpos3);
if (iblockstate.getBlock() == Blocks.end_stone
&& !chunkIn.getBlockState(blockpos3.up(1)).getBlock().isBlockNormalCube()
&& !chunkIn.getBlockState(blockpos3.up(2)).getBlock().isBlockNormalCube()) {
double d1 = blockpos3.distanceSqToCenter(0.0D, 0.0D, 0.0D);
if (blockpos2 == null || d1 < d0) {
blockpos2 = blockpos3;
d0 = d1;
}
}
}
return blockpos2;
}
private void createExitPortal(BlockPos posIn) {
// (new WorldGenEndGateway()).generate(this.worldObj, new Random(), posIn);
// TileEntity tileentity = this.worldObj.getTileEntity(posIn);
// if (tileentity instanceof TileEntityEndGateway) {
// TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway)
// tileentity;
// tileentityendgateway.exitPortal = new BlockPos(this.getPos());
// tileentityendgateway.markDirty();
// } else {
// LOG.warn("Couldn\'t save exit portal at " + posIn);
// }
}
public boolean shouldRenderFace(EnumFacing p_184313_1_) {
return this.getBlockType().getDefaultState().getBlock().shouldSideBeRendered(this.worldObj, this.getPos(),
p_184313_1_);
}
public int getParticleAmount() {
int i = 0;
for (EnumFacing enumfacing : EnumFacing.values()) {
i += this.shouldRenderFace(enumfacing) ? 1 : 0;
}
return i;
}
}

View File

@ -55,6 +55,11 @@ public class AxisAlignedBB {
this.maxZ = (double) pos2.getZ(); this.maxZ = (double) pos2.getZ();
} }
public AxisAlignedBB(BlockPos pos) {
this((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), (double) (pos.getX() + 1),
(double) (pos.getY() + 1), (double) (pos.getZ() + 1));
}
/** /**
* + * +
* Adds the coordinates to the bounding box extending it if the * Adds the coordinates to the bounding box extending it if the
@ -137,6 +142,12 @@ public class AxisAlignedBB {
this.maxZ + z); this.maxZ + z);
} }
public AxisAlignedBB offset(BlockPos pos) {
return new AxisAlignedBB(this.minX + (double) pos.getX(), this.minY + (double) pos.getY(),
this.minZ + (double) pos.getZ(), this.maxX + (double) pos.getX(), this.maxY + (double) pos.getY(),
this.maxZ + (double) pos.getZ());
}
/** /**
* + * +
* if instance and the argument bounding boxes overlap in the Y * if instance and the argument bounding boxes overlap in the Y

View File

@ -151,6 +151,10 @@ public class MathHelper {
return (int) FastMath.floor(value); return (int) FastMath.floor(value);
} }
public static double frac(double number) {
return number - Math.floor(number);
}
/** /**
* + * +
* Long version of floor_double * Long version of floor_double

View File

@ -113,6 +113,10 @@ public class Vec3 {
return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z);
} }
public Vec3 scale(double p_186678_1_) {
return new Vec3(this.xCoord * p_186678_1_, this.yCoord * p_186678_1_, this.zCoord * p_186678_1_);
}
/** /**
* + * +
* Euclidean distance between this and the specified vector, * Euclidean distance between this and the specified vector,

View File

@ -869,6 +869,12 @@ public abstract class World implements IBlockAccess, ILightingEngineProvider, IL
soundIn, volume, pitch); soundIn, volume, pitch);
} }
public void playSound(BlockPos pos, SoundEvent soundIn, SoundCategory category, float volume, float pitch,
boolean distanceDelay) {
this.playSound((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, soundIn,
category, volume, pitch, distanceDelay);
}
/** /**
* + * +
* Plays sound to all near players except the player reference * Plays sound to all near players except the player reference