Compare commits

...
8 Commits
Author SHA1 Message Date
Martin Robertz fb4c9bde59 update 2024-05-09 10:02:46 +02:00
Oleg Ivanov bd47a39c83 Add config entries for Farming Station particles (#162)
* Decrease number of Farming Station particles

* Set default values for range & number of particles to original
2024-05-08 20:48:35 +02:00
Martin Robertz 43d74c9a7a update 2024-04-24 21:47:04 +02:00
PT400C Jomcraft 6d3a631bb0 Improve FarmingStation portal texture rendering (#157) 2024-04-24 21:26:51 +02:00
Martin Robertz ccdef03296 update 2024-04-18 20:42:39 +02:00
Drathonix 56e163c234 Conduit Replacement Retains Connection Data (#160)
* Replacing Conduits Now maintains all Connection Settings

* Only write/read connection nbt.

* Use Correct Connectionset
2024-04-18 10:24:59 +02:00
Martin Robertz 8ecec5b096 update 2024-02-28 20:07:25 +01:00
boubou19GitHub GTNH Actionsgithub-actions[bot]
4e3fbc7667 Reduce allocation spam in capacitor banks (#155)
* reduce memory allocation

* update dep

* use public

* wrong dep

* spotlessApply (#156)

Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-25 23:26:17 +01:00
16 changed files with 152 additions and 66 deletions

No files matched your search

+11 -11
View File
@@ -1,22 +1,22 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:EnderCore:0.4.1:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.8.4:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.5.19-GTNH:dev')
compileOnly("com.github.GTNewHorizons:GTNHLib:0.2.7:dev")
api('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.9.0:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev')
compileOnly("com.github.GTNewHorizons:GTNHLib:0.2.11:dev")
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:dev')
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
shadowImplementation('cglib:cglib-nodep:3.3.0')
compileOnly('com.github.GTNewHorizons:waila:1.7.0:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-325-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:waila:1.7.3:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-400-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.71:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.5:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.3-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.46.05:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.8:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.5-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.14.1-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.6-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.11-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
@@ -24,5 +24,5 @@ dependencies {
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha29:api') {transitive = false}
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha45:api') {transitive = false}
}
+1 -1
View File
@@ -117,7 +117,7 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
}
@@ -67,7 +67,6 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
if (MicroblocksUtil.supportMicroblocks() && tryAddToMicroblocks(stack, player, world, x, y, z, side)) {
return true;
}
BlockCoord placeAt = Util.canPlaceItem(stack, EnderIO.blockConduitBundle, player, world, x, y, z, side);
if (placeAt != null) {
if (!world.isRemote) {
@@ -84,9 +83,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
stack.stackSize--;
}
return true;
} else {
ForgeDirection dir = ForgeDirection.values()[side];
int placeX = x + dir.offsetX;
int placeY = y + dir.offsetY;
@@ -116,7 +113,6 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
}
}
}
return false;
}
@@ -162,8 +158,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
return false;
}
bundle.removeConduit(existingConduit);
bundle.addConduit(newConduit);
bundle.replaceConduit(existingConduit, newConduit);
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
for (ItemStack drop : existingConduit.getDrops()) {
@@ -49,6 +49,8 @@ public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, II
void addConduit(IConduit conduit);
void replaceConduit(IConduit original, IConduit replacement);
void removeConduit(IConduit conduit);
Collection<IConduit> getConduits();
@@ -404,6 +404,29 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
dirty();
}
@Override
public void replaceConduit(IConduit original, IConduit replacement) {
if (worldObj.isRemote) {
return;
}
// If you're wondering why I am not using conduit.writeToNBT, it is because there is some data that should not
// persist, some of which causes crashes with energy conduits.
NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirection.values().length];
for (ForgeDirection conduitConnection : original.getExternalConnections()) {
NBTTagCompound tag = new NBTTagCompound();
original.writeConnectionSettingsToNBT(conduitConnection, tag);
originalData[conduitConnection.ordinal()] = tag;
}
removeConduit(original);
addConduit(replacement);
for (int i = 0; i < originalData.length; i++) {
NBTTagCompound nbt = originalData[i];
if (nbt != null) {
replacement.readConduitSettingsFromNBT(ForgeDirection.values()[i], nbt);
}
}
}
@Override
public void removeConduit(IConduit conduit) {
if (conduit != null) {
@@ -361,6 +361,8 @@ public final class Config {
"TwilightForest:item.steeleafHoe", "TwilightForest:item.ironwoodHoe", "IC2:itemToolBronzeHoe" };
public static List<ItemStack> farmHoes = new ArrayList<ItemStack>();
public static int farmSaplingReserveAmount = 8;
public static double farmParticlesMaxRange = 64;
public static int farmParticlesCount = 15;
public static int magnetPowerUsePerSecondRF = 1;
public static int magnetPowerCapacityRF = 100000;
@@ -2060,6 +2062,18 @@ public final class Config {
+ "always shear all leaves.")
.getInt(farmSaplingReserveAmount);
farmParticlesMaxRange = config.get(
sectionFarm.name,
"farmParticlesMaxRange",
farmParticlesMaxRange,
"The max range of the farm action particles.").getDouble(farmParticlesMaxRange);
farmParticlesCount = config.get(
sectionFarm.name,
"farmParticlesCount",
farmParticlesCount,
"The number of particles produces by farm action.").getInt(farmParticlesCount);
combustionGeneratorUseOpaqueModel = config
.get(
sectionAesthetic.name,
@@ -129,7 +129,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
nw.setMaxEnergyStoredL(CapBankType.getTypeFromMeta(item.getItemDamage()).getMaxEnergyStored());
nw.setEnergyStored(PowerHandlerUtil.getStoredEnergyForItem(item));
GaugeInfo gi = new GaugeInfo(1, 0);
GaugeInfo gi = GaugeInfo.DEFAULT;
GaugeKey key = new GaugeKey(ForgeDirection.SOUTH, FillGauge.Type.SINGLE);
fillGaugeRenderer.doRender(nw, RenderUtil.BRIGHTNESS_MAX, gi, key);
// key = new GaugeKey(ForgeDirection.EAST, FillGauge.Type.SINGLE);
@@ -1,6 +1,5 @@
package crazypants.enderio.machine.capbank.render;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -32,6 +31,7 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
private static final double HEIGHT = 0.75;
private static final double VERT_BORDER = (1 - HEIGHT) / 2;
private static final double WIDTH = 0.25;
private final Vertex[] newVerts = new Vertex[] { new Vertex(), new Vertex(), new Vertex(), new Vertex() };
enum Type {
SINGLE,
@@ -95,8 +95,8 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
if (ratio <= 0) {
return;
}
double maxY = ratio * info.height;
if (maxY <= info.yPosition) {
double maxY = ratio * info.getHeight();
if (maxY <= info.getyPosition()) {
// empty
return;
}
@@ -105,26 +105,24 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
Tessellator.instance.addTranslation((float) offset.x, (float) offset.y, (float) offset.z);
List<Vertex> verts = levelVertexCache.get(key);
if (maxY >= info.yPosition + 1) {
if (maxY >= info.getyPosition() + 1) {
// full bar
RenderUtil.addVerticesToTessellator(verts, Tessellator.instance);
} else {
// need to render partial bar
double myMaxY = maxY - info.yPosition;
double myMaxY = maxY - info.getyPosition();
if (info.type == Type.BOTTOM || info.type == Type.SINGLE) {
// If we have some power and we are the bottom bit of the display,
// always show at least a little bit in the bar
myMaxY = Math.max(0.2, myMaxY);
}
List<Vertex> newVerts = new ArrayList<Vertex>();
for (Vertex v : verts) {
v = new Vertex(v);
newVerts.add(v);
if (v.y() > myMaxY) {
v.setXYZ(v.x(), myMaxY, v.z());
v.setUV(v.u(), barMinV + (float) (myMaxY * barHeightV));
for (int i = 0; i < verts.size(); i++) {
newVerts[i].set(verts.get(i));
if (newVerts[i].y() > myMaxY) {
newVerts[i].setXYZ(newVerts[i].x(), myMaxY, newVerts[i].z());
newVerts[i].setUV(newVerts[i].u(), barMinV + (float) (myMaxY * barHeightV));
}
}
RenderUtil.addVerticesToTessellator(newVerts, Tessellator.instance);
@@ -136,7 +134,7 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
private GaugeInfo getGaugeInfo(TileCapBank cb, ForgeDirection dir) {
if (!cb.getType().isMultiblock()) {
return new GaugeInfo(1, 0);
return GaugeInfo.DEFAULT;
}
int height = 1;
@@ -240,8 +238,10 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
static class GaugeInfo {
int height;
int yPosition;
public static final GaugeInfo DEFAULT = new GaugeInfo(1, 0);
private int height;
private int yPosition;
Type type;
GaugeInfo(int height, int position) {
@@ -262,6 +262,14 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
}
return Type.MIDDLE;
}
public int getHeight() {
return height;
}
public int getyPosition() {
return yPosition;
}
}
static class GaugeKey {
@@ -21,6 +21,14 @@ import crazypants.enderio.machine.power.PowerDisplayUtil;
public class IoDisplay implements IInfoRenderer {
private float previousAverageInput;
private float previousAverageOutput;
String averageInputText = "0";
String averageOutputText = "0";
HeadingText heading1;
HeadingText heading2;
@Override
public void render(TileCapBank cb, ForgeDirection dir, double x, double y, double z, float partialTick) {
if (dir.offsetY != 0) {
@@ -137,10 +145,8 @@ public class IoDisplay implements IInfoRenderer {
nw.requestPowerUpdate(cb, 20);
HeadingText heading1 = HeadingText.STABLE;
HeadingText heading2 = null;
String text1;
String text2 = "";
heading1 = HeadingText.STABLE;
heading2 = null;
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
float size = 0.15f * Math.min(info.width, info.height);
@@ -150,8 +156,14 @@ public class IoDisplay implements IInfoRenderer {
if (info.height * 3 >= info.width * 4) {
heading1 = HeadingText.INPUT;
heading2 = HeadingText.OUTPUT;
text1 = getChangeText(nw.getAverageInputPerTick(), fr);
text2 = getChangeText(nw.getAverageOutputPerTick(), fr);
if (previousAverageInput != nw.getAverageInputPerTick()) {
averageInputText = getChangeText(nw.getAverageInputPerTick(), fr);
previousAverageInput = nw.getAverageInputPerTick();
}
if (previousAverageOutput != nw.getAverageOutputPerTick()) {
averageOutputText = getChangeText(nw.getAverageOutputPerTick(), fr);
previousAverageOutput = nw.getAverageOutputPerTick();
}
offset = -size * 2.5f;
} else {
int change = Math.round(nw.getAverageChangePerTick());
@@ -160,7 +172,10 @@ public class IoDisplay implements IInfoRenderer {
} else if (change < 0) {
heading1 = HeadingText.LOSS;
}
text1 = getChangeText(change, fr);
if (change != previousAverageInput) {
averageInputText = getChangeText(change, fr);
previousAverageInput = change;
}
offset = -size;
}
@@ -184,9 +199,9 @@ public class IoDisplay implements IInfoRenderer {
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
offset = drawText(heading1, text1, offset, scale, size, fr);
offset = drawText(heading1, averageInputText, offset, scale, size, fr);
if (heading2 != null) {
drawText(heading2, text2, offset, scale, size, fr);
drawText(heading2, averageOutputText, offset, scale, size, fr);
}
GL11.glEnable(GL11.GL_LIGHTING);
@@ -35,7 +35,12 @@ public class FarmingStationRenderer extends TechneMachineRenderer<TileFarmStatio
bb = bb.translate(x, y, z);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.setBrightness(0xF000F0);
CubeRenderer.get().render(bb, override != null ? override : Blocks.portal.getBlockTextureFromSide(1));
IIcon ico = override != null ? override : Blocks.portal.getBlockTextureFromSide(1);
float x1 = ico.getInterpolatedU(3);
float x2 = ico.getInterpolatedU(13);
float y1 = ico.getInterpolatedV(6);
float y2 = ico.getInterpolatedV(10);
CubeRenderer.get().render(bb, x1, x2, y1, y2);
}
}
@@ -9,6 +9,7 @@ import com.enderio.core.common.util.BlockCoord;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.config.Config;
import crazypants.util.ClientUtil;
import io.netty.buffer.ByteBuf;
@@ -51,11 +52,7 @@ public class PacketFarmAction implements IMessage, IMessageHandler<PacketFarmAct
@Override
public IMessage onMessage(PacketFarmAction message, MessageContext ctx) {
for (BlockCoord bc : message.coords) {
for (int i = 0; i < 15; i++) {
ClientUtil.spawnFarmParcticles(rand, bc);
}
}
ClientUtil.spawnFarmParticles(rand, message.coords, Config.farmParticlesCount);
return null;
}
}
@@ -458,8 +458,9 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
IHarvestResult harvest = FarmersCommune.instance.harvestBlock(this, bc, block, meta);
if (harvest != null && harvest.getDrops() != null) {
PacketFarmAction pkt = new PacketFarmAction(harvest.getHarvestedBlocks());
PacketHandler.INSTANCE
.sendToAllAround(pkt, new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, 64));
PacketHandler.INSTANCE.sendToAllAround(
pkt,
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, Config.farmParticlesMaxRange));
for (EntityItem ei : harvest.getDrops()) {
if (ei != null) {
insertHarvestDrop(ei, bc);
@@ -487,7 +488,12 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
inventory[minFirtSlot] = farmerJoe.inventory.mainInventory[0];
PacketHandler.INSTANCE.sendToAllAround(
new PacketFarmAction(bc),
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, 64));
new TargetPoint(
worldObj.provider.dimensionId,
bc.x,
bc.y,
bc.z,
Config.farmParticlesMaxRange));
if (inventory[minFirtSlot] != null && inventory[minFirtSlot].stackSize == 0) {
inventory[minFirtSlot] = null;
}
+33 -12
View File
@@ -1,10 +1,14 @@
package crazypants.util;
import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityPortalFX;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.enderio.core.common.util.BlockCoord;
@@ -47,18 +51,35 @@ public class ClientUtil {
con.readFromNBT(pkt.tc, TileConduitBundle.NBT_VERSION);
}
public static void spawnFarmParcticles(Random rand, BlockCoord bc) {
double xOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
double yOff = 0.5 + (rand.nextDouble() - 0.5) * 0.2;
double zOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
Minecraft.getMinecraft().theWorld.spawnParticle(
"portal",
bc.x + xOff,
bc.y + yOff,
bc.z + zOff,
(rand.nextDouble() - 0.5) * 1.5,
-rand.nextDouble(),
(rand.nextDouble() - 0.5) * 1.5);
public static void spawnFarmParticles(Random rand, List<BlockCoord> coords, int particlesCount) {
// 0 = All, 1 = Decreased, 2 = Minimal
int particleSetting = Minecraft.getMinecraft().gameSettings.particleSetting;
if (particleSetting >= 2 /* Minimal */) {
return;
}
int particles = particleSetting == 0 ? particlesCount /* All */
: (particlesCount / 2) /* Decreased */;
World world = Minecraft.getMinecraft().theWorld;
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
for (BlockCoord bc : coords) {
for (int i = 0; i < particles; i++) {
double xOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
double yOff = 0.5 + (rand.nextDouble() - 0.5) * 0.2;
double zOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
effectRenderer.addEffect(
new EntityPortalFX(
world,
bc.x + xOff,
bc.y + yOff,
bc.z + zOff,
(rand.nextDouble() - 0.5) * 1.5,
-rand.nextDouble(),
(rand.nextDouble() - 0.5) * 1.5));
}
}
}
public static void setTankNBT(PacketCombustionTank message, int x, int y, int z) {