mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-17 19:05:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23312198a6 | ||
|
|
fa5e2ae4ca | ||
|
|
a8a1547845 |
No files matched your search
+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')
|
||||||
|
|||||||
@@ -526,7 +526,8 @@ public class ClientProxy extends CommonProxy {
|
|||||||
GL11.glTranslated(-d0 + i0, -d1 + i1, -d2 + i2);
|
GL11.glTranslated(-d0 + i0, -d1 + i1, -d2 + i2);
|
||||||
Tessellator tes = Tessellator.instance;
|
Tessellator tes = Tessellator.instance;
|
||||||
tes.startDrawing(GL11.GL_TRIANGLES);
|
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) {
|
||||||
@@ -534,12 +535,21 @@ public class ClientProxy extends CommonProxy {
|
|||||||
p.endStartSection("Draw");
|
p.endStartSection("Draw");
|
||||||
tes.draw();
|
tes.draw();
|
||||||
tes.startDrawing(GL11.GL_TRIANGLES);
|
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, i0, i1, i2);
|
hint.draw(tes, d0, d1, d2, i0, i1, i2);
|
||||||
}
|
}
|
||||||
|
|||||||
+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);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user