mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-12 16:27:36 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23312198a6 | ||
|
|
fa5e2ae4ca | ||
|
|
a8a1547845 | ||
|
|
113e05b7e6 | ||
|
|
080785ad05 | ||
|
|
6c14ca0a1d |
No files matched your search
@@ -1,47 +0,0 @@
|
|||||||
# Simple workflow for deploying static content to GitHub Pages
|
|
||||||
name: Deploy static content to Pages
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Runs on pushes targeting the default branch
|
|
||||||
push:
|
|
||||||
branches: ["gh-pages"]
|
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
# Allow one concurrent deployment
|
|
||||||
concurrency:
|
|
||||||
group: "pages"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Single deploy job since we're just deploying
|
|
||||||
deploy:
|
|
||||||
environment:
|
|
||||||
name: github-pages
|
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Setup Pages
|
|
||||||
uses: actions/configure-pages@v2
|
|
||||||
- name: Generate Index
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
find . -name javadoc -type d -print > index.txt
|
|
||||||
echo feature/doc >> index.txt
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-pages-artifact@v1
|
|
||||||
with:
|
|
||||||
# Upload entire repository
|
|
||||||
path: '.'
|
|
||||||
- name: Deploy to GitHub Pages
|
|
||||||
id: deployment
|
|
||||||
uses: actions/deploy-pages@v1
|
|
||||||
@@ -20,13 +20,16 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
result_hash: ${{ steps.deploy.outputs.hash }}
|
result_hash: ${{ steps.deploy.outputs.hash }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: 8
|
java-version: |
|
||||||
|
8
|
||||||
|
11
|
||||||
|
17
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
|
|
||||||
@@ -51,7 +54,7 @@ jobs:
|
|||||||
echo Nothing to deploy
|
echo Nothing to deploy
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
find . -name javadoc -type d -print | sed 's#^\./\(.*\)/javadoc$#\1#' > index.txt
|
find . -name javadoc -type d -print | sed 's#^\./\(.*\)/javadoc$#\1#' | sort --version-sort --reverse > index.txt
|
||||||
git add index.txt
|
git add index.txt
|
||||||
git config user.name "${GITHUB_ACTOR}"
|
git config user.name "${GITHUB_ACTOR}"
|
||||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
javadoc {
|
javadoc {
|
||||||
|
javadocTool = javaToolchains.javadocToolFor {
|
||||||
|
// Last version with frames, but it also has search
|
||||||
|
languageVersion = JavaLanguageVersion.of(11)
|
||||||
|
vendor = JvmVendorSpec.ADOPTIUM
|
||||||
|
}
|
||||||
|
|
||||||
inputs.file "src/main/javadoc/overview.html"
|
inputs.file "src/main/javadoc/overview.html"
|
||||||
|
|
||||||
include "com/gtnewhorizon/structurelib/alignment/**"
|
include "com/gtnewhorizon/structurelib/alignment/**"
|
||||||
@@ -14,6 +20,7 @@ javadoc {
|
|||||||
overview "src/main/javadoc/overview.html"
|
overview "src/main/javadoc/overview.html"
|
||||||
links 'https://docs.oracle.com/javase/8/docs/api/'
|
links 'https://docs.oracle.com/javase/8/docs/api/'
|
||||||
links 'https://skmedix.github.io/ForgeJavaDocs/javadoc/forge/1.7.10-10.13.4.1614/'
|
links 'https://skmedix.github.io/ForgeJavaDocs/javadoc/forge/1.7.10-10.13.4.1614/'
|
||||||
|
addBooleanOption("-frames", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("com.github.GTNewHorizons:GTNHLib:0.0.10:dev")
|
api("com.github.GTNewHorizons:GTNHLib:0.0.10:dev")
|
||||||
runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.3.25-GTNH:dev")
|
runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.3.46-GTNH:dev")
|
||||||
|
|
||||||
testImplementation(platform('org.junit:junit-bom:5.9.2'))
|
testImplementation(platform('org.junit:junit-bom:5.9.2'))
|
||||||
testImplementation('org.junit.jupiter:junit-jupiter')
|
testImplementation('org.junit.jupiter:junit-jupiter')
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import net.minecraft.client.gui.GuiNewChat;
|
|||||||
import net.minecraft.client.particle.EntityFX;
|
import net.minecraft.client.particle.EntityFX;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.culling.Frustrum;
|
import net.minecraft.client.renderer.culling.Frustrum;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -271,10 +270,6 @@ public class ClientProxy extends CommonProxy {
|
|||||||
private final World w;
|
private final World w;
|
||||||
// these are the block coordinate for e.g. w.getBlock()
|
// these are the block coordinate for e.g. w.getBlock()
|
||||||
private final int x, y, z;
|
private final int x, y, z;
|
||||||
// these are the lower bounds for rendering. the upper bound would be X + size
|
|
||||||
// currently size is fixed to be 0.5
|
|
||||||
// it is not made into a constants because this will allow for easy changing during debug
|
|
||||||
private final double X, Y, Z;
|
|
||||||
private final IIcon[] icons;
|
private final IIcon[] icons;
|
||||||
private short[] tint;
|
private short[] tint;
|
||||||
private boolean renderThrough;
|
private boolean renderThrough;
|
||||||
@@ -286,9 +281,6 @@ public class ClientProxy extends CommonProxy {
|
|||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
X = x + 0.25;
|
|
||||||
Y = y + 0.25;
|
|
||||||
Z = z + 0.25;
|
|
||||||
this.icons = icons;
|
this.icons = icons;
|
||||||
this.tint = tint;
|
this.tint = tint;
|
||||||
}
|
}
|
||||||
@@ -324,10 +316,11 @@ public class ClientProxy extends CommonProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInFrustrum(Frustrum frustrum) {
|
public boolean isInFrustrum(Frustrum frustrum) {
|
||||||
return frustrum.isBoxInFrustum(X, Y, Z, X + 0.5, Y + 0.5, Z + 0.5);
|
return frustrum.isBoxInFrustum(x + 0.25, y + 0.25, z + 0.25, x + 0.75, y + 0.75, z + 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Tessellator tes, double eyeX, double eyeY, double eyeZ) {
|
public void draw(Tessellator tes, double eyeX, double eyeY, double eyeZ, int eyeXint, int eyeYint,
|
||||||
|
int eyeZint) {
|
||||||
double size = 0.5;
|
double size = 0.5;
|
||||||
|
|
||||||
int brightness = w.blockExists(x, 0, z) ? w.getLightBrightnessForSkyBlocks(x, y, z, 0) : 0;
|
int brightness = w.blockExists(x, 0, z) ? w.getLightBrightnessForSkyBlocks(x, y, z, 0) : 0;
|
||||||
@@ -339,6 +332,10 @@ public class ClientProxy extends CommonProxy {
|
|||||||
(int) (tint[2] * 1F),
|
(int) (tint[2] * 1F),
|
||||||
ConfigurationHandler.INSTANCE.getHintTransparency());
|
ConfigurationHandler.INSTANCE.getHintTransparency());
|
||||||
|
|
||||||
|
double X = (x - eyeXint) + 0.25;
|
||||||
|
double Y = (y - eyeYint) + 0.25;
|
||||||
|
double Z = (z - eyeZint) + 0.25;
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
if (icons[i] == null) continue;
|
if (icons[i] == null) continue;
|
||||||
|
|
||||||
@@ -362,7 +359,9 @@ public class ClientProxy extends CommonProxy {
|
|||||||
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
||||||
tes.addVertexWithUV(X, Y, Z, u, v);
|
tes.addVertexWithUV(X, Y, Z, u, v);
|
||||||
tes.addVertexWithUV(X + size, Y, Z, U, v);
|
tes.addVertexWithUV(X + size, Y, Z, U, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z, U, v);
|
||||||
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
||||||
|
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if ((Y + size <= eyeY) != (j == 1)) continue;
|
if ((Y + size <= eyeY) != (j == 1)) continue;
|
||||||
@@ -370,7 +369,9 @@ public class ClientProxy extends CommonProxy {
|
|||||||
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
tes.addVertexWithUV(X, Y + size, Z + size, u, V);
|
tes.addVertexWithUV(X, Y + size, Z + size, u, V);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z + size, U, V);
|
tes.addVertexWithUV(X + size, Y + size, Z + size, U, V);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z + size, U, V);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z, U, v);
|
tes.addVertexWithUV(X + size, Y + size, Z, U, v);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if ((Z >= eyeZ) != (j == 1)) continue;
|
if ((Z >= eyeZ) != (j == 1)) continue;
|
||||||
@@ -378,7 +379,9 @@ public class ClientProxy extends CommonProxy {
|
|||||||
tes.addVertexWithUV(X, Y, Z, U, V);
|
tes.addVertexWithUV(X, Y, Z, U, V);
|
||||||
tes.addVertexWithUV(X, Y + size, Z, U, v);
|
tes.addVertexWithUV(X, Y + size, Z, U, v);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z, u, v);
|
tes.addVertexWithUV(X + size, Y + size, Z, u, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z, u, v);
|
||||||
tes.addVertexWithUV(X + size, Y, Z, u, V);
|
tes.addVertexWithUV(X + size, Y, Z, u, V);
|
||||||
|
tes.addVertexWithUV(X, Y, Z, U, V);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if ((Z <= eyeZ) != (j == 1)) continue;
|
if ((Z <= eyeZ) != (j == 1)) continue;
|
||||||
@@ -386,7 +389,9 @@ public class ClientProxy extends CommonProxy {
|
|||||||
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z + size, U, v);
|
tes.addVertexWithUV(X + size, Y + size, Z + size, U, v);
|
||||||
tes.addVertexWithUV(X, Y + size, Z + size, u, v);
|
tes.addVertexWithUV(X, Y + size, Z + size, u, v);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z + size, u, v);
|
||||||
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
tes.addVertexWithUV(X, Y, Z + size, u, V);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z + size, U, V);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if ((X >= eyeX) != (j == 1)) continue;
|
if ((X >= eyeX) != (j == 1)) continue;
|
||||||
@@ -394,7 +399,9 @@ public class ClientProxy extends CommonProxy {
|
|||||||
tes.addVertexWithUV(X, Y, Z + size, U, V);
|
tes.addVertexWithUV(X, Y, Z + size, U, V);
|
||||||
tes.addVertexWithUV(X, Y + size, Z + size, U, v);
|
tes.addVertexWithUV(X, Y + size, Z + size, U, v);
|
||||||
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
|
tes.addVertexWithUV(X, Y + size, Z, u, v);
|
||||||
tes.addVertexWithUV(X, Y, Z, u, V);
|
tes.addVertexWithUV(X, Y, Z, u, V);
|
||||||
|
tes.addVertexWithUV(X, Y, Z + size, U, V);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if ((X + size <= eyeX) != (j == 1)) continue;
|
if ((X + size <= eyeX) != (j == 1)) continue;
|
||||||
@@ -402,7 +409,9 @@ public class ClientProxy extends CommonProxy {
|
|||||||
tes.addVertexWithUV(X + size, Y, Z, U, V);
|
tes.addVertexWithUV(X + size, Y, Z, U, V);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z, U, v);
|
tes.addVertexWithUV(X + size, Y + size, Z, U, v);
|
||||||
tes.addVertexWithUV(X + size, Y + size, Z + size, u, v);
|
tes.addVertexWithUV(X + size, Y + size, Z + size, u, v);
|
||||||
|
tes.addVertexWithUV(X + size, Y + size, Z + size, u, v);
|
||||||
tes.addVertexWithUV(X + size, Y, Z + size, u, V);
|
tes.addVertexWithUV(X + size, Y, Z + size, u, V);
|
||||||
|
tes.addVertexWithUV(X + size, Y, Z, U, V);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -414,7 +423,7 @@ public class ClientProxy extends CommonProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getSquareDistanceTo(Vec3 point) {
|
public double getSquareDistanceTo(Vec3 point) {
|
||||||
return point.squareDistanceTo(X, Y, Z);
|
return point.squareDistanceTo(x + 0.5, y + 0.5, z + 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,6 +510,7 @@ public class ClientProxy extends CommonProxy {
|
|||||||
+ (entitylivingbase.posY - entitylivingbase.lastTickPosY) * e.partialTicks;
|
+ (entitylivingbase.posY - entitylivingbase.lastTickPosY) * e.partialTicks;
|
||||||
double d2 = entitylivingbase.lastTickPosZ
|
double d2 = entitylivingbase.lastTickPosZ
|
||||||
+ (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * e.partialTicks;
|
+ (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * e.partialTicks;
|
||||||
|
int i0 = (int) d0, i1 = (int) d1, i2 = (int) d2;
|
||||||
frustrum.setPosition(d0, d1, d2);
|
frustrum.setPosition(d0, d1, d2);
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
@@ -513,25 +523,35 @@ public class ClientProxy extends CommonProxy {
|
|||||||
// depth test begin as enabled
|
// depth test begin as enabled
|
||||||
boolean renderThrough = false;
|
boolean renderThrough = false;
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||||
GL11.glTranslated(-RenderManager.renderPosX, -RenderManager.renderPosY, -RenderManager.renderPosZ);
|
GL11.glTranslated(-d0 + i0, -d1 + i1, -d2 + i2);
|
||||||
Tessellator tes = Tessellator.instance;
|
Tessellator tes = Tessellator.instance;
|
||||||
tes.startDrawingQuads();
|
tes.startDrawing(GL11.GL_TRIANGLES);
|
||||||
for (int i = 0, allHintsForRenderSize = allHintsForRender.size(); i < allHintsForRenderSize; i++) {
|
for (int i = 0, allHintsForRenderSize = allHintsForRender.size(), cubeDrawn = 0; i
|
||||||
|
< allHintsForRenderSize; i++, cubeDrawn++) {
|
||||||
HintParticleInfo hint = allHintsForRender.get(i);
|
HintParticleInfo hint = allHintsForRender.get(i);
|
||||||
if (!hint.isInFrustrum(frustrum)) continue;
|
if (!hint.isInFrustrum(frustrum)) continue;
|
||||||
if (renderThrough != hint.renderThrough) {
|
if (renderThrough != hint.renderThrough) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
p.endStartSection("Draw");
|
p.endStartSection("Draw");
|
||||||
tes.draw();
|
tes.draw();
|
||||||
tes.startDrawingQuads();
|
tes.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
cubeDrawn = 0;
|
||||||
p.endStartSection("Prepare");
|
p.endStartSection("Prepare");
|
||||||
}
|
}
|
||||||
if (hint.renderThrough) GL11.glDisable(GL11.GL_DEPTH_TEST);
|
if (hint.renderThrough) GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
else GL11.glEnable(GL11.GL_DEPTH_TEST);
|
else GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
renderThrough = hint.renderThrough;
|
renderThrough = hint.renderThrough;
|
||||||
}
|
}
|
||||||
|
// Minecraft Tessellator draw in batch of 4096. This plays nicely with quads, but for trigs
|
||||||
|
// it might occasionally end up with one half in first batch and the other half in later batch.
|
||||||
|
// so we manually flush the buffer here if that would happen.
|
||||||
|
// 6 faces per particle, 2 trig per face, 3 vertex per trig
|
||||||
|
if ((cubeDrawn + 1) >= 4096 / (6 * 2 * 3)) {
|
||||||
|
tes.draw();
|
||||||
|
tes.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
}
|
||||||
// TODO verify if we need to add eyeHeight
|
// TODO verify if we need to add eyeHeight
|
||||||
hint.draw(tes, d0, d1, d2);
|
hint.draw(tes, d0, d1, d2, i0, i1, i2);
|
||||||
}
|
}
|
||||||
p.endStartSection("Draw");
|
p.endStartSection("Draw");
|
||||||
tes.draw();
|
tes.draw();
|
||||||
|
|||||||
+25
-34
@@ -8,7 +8,9 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
|
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
|
||||||
|
import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment;
|
||||||
import com.gtnewhorizon.structurelib.structure.IItemSource;
|
import com.gtnewhorizon.structurelib.structure.IItemSource;
|
||||||
|
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@@ -41,24 +43,35 @@ public interface IMultiblockInfoContainer<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the structure using
|
* Construct the structure using
|
||||||
* {@link com.gtnewhorizon.structurelib.structure.IStructureElement#survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, java.util.function.Consumer)}
|
* {@link com.gtnewhorizon.structurelib.structure.IStructureElement#survivalPlaceBlock(Object, World, int, int, int, ItemStack, AutoPlaceEnvironment)}
|
||||||
*
|
*
|
||||||
* @return -1 if done, a helping pointer
|
* @return -1 if done, a helping pointer
|
||||||
*/
|
*/
|
||||||
default int survivalConstruct(ItemStack stackSize, int elementBudge, IItemSource source,
|
int survivalConstruct(ItemStack stackSize, int elementBudge, ISurvivalBuildEnvironment env, T tileEntity,
|
||||||
EntityPlayerMP actorProfile, T tileEntity, ExtendedFacing aSide) {
|
ExtendedFacing aSide);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
String[] getDescription(ItemStack stackSize);
|
String[] getDescription(ItemStack stackSize);
|
||||||
|
|
||||||
/**
|
default ISurvivalConstructable toConstructable(T tileEntity, ExtendedFacing aSide) {
|
||||||
* Override this and return {@link #toConstructable(IMultiblockInfoContainer, Object, ExtendedFacing)} if
|
return new ISurvivalConstructable() {
|
||||||
* {@link #survivalConstruct(ItemStack, int, IItemSource, EntityPlayerMP, Object, ExtendedFacing)} isn't a stub
|
|
||||||
*/
|
@Override
|
||||||
default IConstructable toConstructable(T tileEntity, ExtendedFacing aSide) {
|
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
|
||||||
return new IConstructable() {
|
return IMultiblockInfoContainer.this
|
||||||
|
.survivalConstruct(stackSize, elementBudget, env, tileEntity, aSide);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source,
|
||||||
|
EntityPlayerMP actor) {
|
||||||
|
return IMultiblockInfoContainer.this.survivalConstruct(
|
||||||
|
stackSize,
|
||||||
|
elementBudget,
|
||||||
|
ISurvivalBuildEnvironment.create(source, actor),
|
||||||
|
tileEntity,
|
||||||
|
aSide);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void construct(ItemStack stackSize, boolean hintsOnly) {
|
public void construct(ItemStack stackSize, boolean hintsOnly) {
|
||||||
@@ -71,26 +84,4 @@ public interface IMultiblockInfoContainer<T> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static <T> ISurvivalConstructable toConstructable(IMultiblockInfoContainer<T> thiz, T tileEntity,
|
|
||||||
ExtendedFacing aSide) {
|
|
||||||
return new ISurvivalConstructable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source,
|
|
||||||
EntityPlayerMP actor) {
|
|
||||||
return thiz.survivalConstruct(stackSize, elementBudget, source, actor, tileEntity, aSide);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void construct(ItemStack stackSize, boolean hintsOnly) {
|
|
||||||
thiz.construct(stackSize, hintsOnly, tileEntity, aSide);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getStructureDescription(ItemStack stackSize) {
|
|
||||||
return thiz.getDescription(stackSize);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -42,54 +42,54 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A brief index of everything contained
|
* A brief index of everything contained
|
||||||
* <h1>Control blocks</h1> A lot of these might seem to make more sense as a default function on
|
* <h2>Control blocks</h2> A lot of these might seem to make more sense as a default function on
|
||||||
* {@link IStructureElement}. However, in that case javac generic will often fail to infer the type for you, so we have
|
* {@link IStructureElement}. However, in that case javac generic will often fail to infer the type for you, so we have
|
||||||
* to define them as static methods
|
* to define them as static methods
|
||||||
* <h1>If block</h1> Provide if block, allowing downstream call only if user specified conditions are meet (i.e.
|
* <h2>If block</h2> Provide if block, allowing downstream call only if user specified conditions are meet (i.e.
|
||||||
* predicate returns true)
|
* predicate returns true)
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #onlyIf(Predicate, IStructureElement)} and its overloads</li>
|
* <li>{@link #onlyIf(Predicate, IStructureElement)} and its overloads</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <h1>Switch block</h1> Provide switch block, allowing to select a downstream element by using a key or index computed
|
* <h2>Switch block</h2> Provide switch block, allowing to select a downstream element by using a key or index computed
|
||||||
* from trigger item and/or context object.
|
* from trigger item and/or context object.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #partitionBy(Function, IStructureElement[])} and its overloads</li>
|
* <li>{@link #partitionBy(Function, IStructureElement[])} and its overloads</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <h1>Or Chain</h1> Provide a short-circuiting OR chain.
|
* <h2>Or Chain</h2> Provide a short-circuiting OR chain.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #ofChain(IStructureElement[])} and its overloads</li>
|
* <li>{@link #ofChain(IStructureElement[])} and its overloads</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <h2>Side effect</h2> Provide callbacks on various occasion
|
* <h3>Side effect</h3> Provide callbacks on various occasion
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #onElementPass(Consumer, IStructureElement)}: Call an callback upon element check success</li>
|
* <li>{@link #onElementPass(Consumer, IStructureElement)}: Call an callback upon element check success</li>
|
||||||
* <li>{@link #onElementFail(Consumer, IStructureElement)}: Call an callback upon element check failure</li>
|
* <li>{@link #onElementFail(Consumer, IStructureElement)}: Call an callback upon element check failure</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <h1>Other Primitives</h1>
|
* <h2>Other Primitives</h2>
|
||||||
* <h2>Error statement</h2> Unconditionally return false.
|
* <h3>Error statement</h3> Unconditionally return false.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #error()}</li>
|
* <li>{@link #error()}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <h2>Context Object Change</h2> Switch the context object.
|
* <h3>Context Object Change</h3> Switch the context object.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #withContext(IStructureElement)}: switch context to the extended context</li>
|
* <li>{@link #withContext(IStructureElement)}: switch context to the extended context</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <h2>Channel Change</h2> Change the channel. See <a href="{@docRoot}/overview-summary.html#channels">Channels section
|
* <h3>Channel Change</h3> Change the channel. See <a href="{@docRoot}/overview-summary.html#channels">Channels section
|
||||||
* on overview</a> for more information.
|
* on overview</a> for more information.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #withChannel(String, IStructureElement)}: switch channel using
|
* <li>{@link #withChannel(String, IStructureElement)}: switch channel using
|
||||||
* {@link ChannelDataAccessor#withChannel(ItemStack, String)} when a trigger item is present.</li>
|
* {@link ChannelDataAccessor#withChannel(ItemStack, String)} when a trigger item is present.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <h2>Spawn hint particle</h2> Just spawn a hint. Do nothing otherwise. Useful when you want to override the hint
|
* <h3>Spawn hint particle</h3> Just spawn a hint. Do nothing otherwise. Useful when you want to override the hint
|
||||||
* provided by another structure element, or as a fallback to a structure element that is check only.
|
* provided by another structure element, or as a fallback to a structure element that is check only.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #ofHint(int)}, {@link #ofHintDeferred(Supplier)} and its overloads</li>
|
* <li>{@link #ofHint(int)}, {@link #ofHintDeferred(Supplier)} and its overloads</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <h1>Actual Element</h1> These elements are elements that can actually do structure check, spawn hint and do auto
|
* <h2>Actual Element</h2> These elements are elements that can actually do structure check, spawn hint and do auto
|
||||||
* place. Elements listed in above 2 sections are not going to be helpful without elements like these. They also serve
|
* place. Elements listed in above 2 sections are not going to be helpful without elements like these. They also serve
|
||||||
* as a reference implementation for your own custom {@link IStructureElement} implementations.
|
* as a reference implementation for your own custom {@link IStructureElement} implementations.
|
||||||
* <h2>Simple Block Element</h2> These accept one or more different block types in one location.
|
* <h3>Simple Block Element</h3> These accept one or more different block types in one location.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #ofBlock(Block, int, Block, int)}, {@link #ofBlocksFlat(Map, Block, int)},
|
* <li>{@link #ofBlock(Block, int, Block, int)}, {@link #ofBlocksFlat(Map, Block, int)},
|
||||||
* {@link #ofBlocksMap(Map, Block, int)} and their overloads: the most basic form</li>
|
* {@link #ofBlocksMap(Map, Block, int)} and their overloads: the most basic form</li>
|
||||||
@@ -98,7 +98,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||||||
* <li>{@link #isAir()}, {@link #notAir()}: They are supplied by default under the identifier {@code '-'} and
|
* <li>{@link #isAir()}, {@link #notAir()}: They are supplied by default under the identifier {@code '-'} and
|
||||||
* {@code '+'} respectively, but are provided here regardless in case you want to use them as a fallback.</li>
|
* {@code '+'} respectively, but are provided here regardless in case you want to use them as a fallback.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <h2>Complex Block Element</h2> In case your logic on determining which block is accepted is complex, use these.
|
* <h3>Complex Block Element</h3> In case your logic on determining which block is accepted is complex, use these.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #ofBlockAdder(IBlockAdder, Block, int)}, {@link #ofBlockAdderHint(IBlockAdder, Block, int)} and their
|
* <li>{@link #ofBlockAdder(IBlockAdder, Block, int)}, {@link #ofBlockAdderHint(IBlockAdder, Block, int)} and their
|
||||||
* overloads: hands off actual adder logic to an {@link IBlockAdder} you supplied. Save you the boilerplate of querying
|
* overloads: hands off actual adder logic to an {@link IBlockAdder} you supplied. Save you the boilerplate of querying
|
||||||
@@ -110,7 +110,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||||||
* Similar to block adder, but for tile entities.</li>
|
* Similar to block adder, but for tile entities.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <h1>Helper Methods</h1> These don't construct a {@link IStructureElement}, but is helpful to the instantiation or
|
* <h2>Helper Methods</h2> These don't construct a {@link IStructureElement}, but is helpful to the instantiation or
|
||||||
* implementation of these.
|
* implementation of these.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #survivalPlaceBlock(Block, int, World, int, int, int, IItemSource, EntityPlayer, Consumer)} and its
|
* <li>{@link #survivalPlaceBlock(Block, int, World, int, int, int, IItemSource, EntityPlayer, Consumer)} and its
|
||||||
@@ -595,7 +595,7 @@ public class StructureUtility {
|
|||||||
* <b>Example:</b>
|
* <b>Example:</b>
|
||||||
* <p>
|
* <p>
|
||||||
* Assume you have 16 tier, each map to one block's 16 different meta. You will usually want something like this
|
* Assume you have 16 tier, each map to one block's 16 different meta. You will usually want something like this
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* public class Tile extends TileEntity {
|
* public class Tile extends TileEntity {
|
||||||
* private static final Block B = getTargetBlock();
|
* private static final Block B = getTargetBlock();
|
||||||
@@ -2591,7 +2591,7 @@ public class StructureUtility {
|
|||||||
// we will bypass the chatter filter here, as this is a warning that player definitively want to see
|
// we will bypass the chatter filter here, as this is a warning that player definitively want to see
|
||||||
// instead of some false positive error messages like item not find
|
// instead of some false positive error messages like item not find
|
||||||
warnNoExplicitSubChannel(env.getActor());
|
warnNoExplicitSubChannel(env.getActor());
|
||||||
return backing.survivalPlaceBlock(t, world, x, y, z, trigger, env);
|
return backing.survivalPlaceBlock(t, world, x, y, z, newTrigger, env);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
<!DOCTYPE html>
|
||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<TITLE>API Overview</TITLE>
|
<TITLE>API Overview</TITLE>
|
||||||
@@ -219,7 +219,7 @@ whereas all these structure elements are designed without considering channels w
|
|||||||
<pre>
|
<pre>
|
||||||
import com.gtnewhorizon.structurelib.structure.IStructureElement;
|
import com.gtnewhorizon.structurelib.structure.IStructureElement;
|
||||||
|
|
||||||
public class MyHatchElement<T> implements IStructureElement<T> {
|
public class MyHatchElement<T> implements IStructureElement<T> {
|
||||||
//...
|
//...
|
||||||
{@literal @}Override
|
{@literal @}Override
|
||||||
public PlaceResult survivalPlaceBlock(
|
public PlaceResult survivalPlaceBlock(
|
||||||
|
|||||||
Reference in new issue
Block a user