Browse Source

WIP Diesel Engine, and added my old TODO List for GT6 to the Project

Gregorius Techneticies 3 months ago
parent
commit
7a8341395e
Signed by: Gregorius Techneticies <gregoriustech@gmail.com> GPG Key ID: 4C7DC365E9F99806

+ 1
- 0
.gitignore View File

@@ -16,6 +16,7 @@
16 16
 
17 17
 # Documentation files
18 18
 !/README.md
19
+!/old_todo_list.txt
19 20
 
20 21
 # Build files
21 22
 !/build.gradle

+ 1586
- 0
old_todo_list.txt
File diff suppressed because it is too large
View File


+ 1
- 0
src/main/java/gregapi/data/MT.java View File

@@ -2403,6 +2403,7 @@ public class MT {
2403 2403
 			Graphite                        .addOreByProducts(C                     );
2404 2404
 			CaCO3                           .addOreByProducts(OREMATS.Malachite     );
2405 2405
 			OREMATS.Gypsum                  .addOreByProducts(S                     );
2406
+			OREMATS.Borax                   .addOreByProducts(B                     );
2406 2407
 			Netherrack                      .addOreByProducts(S                     );
2407 2408
 			Flint                           .addOreByProducts(Obsidian              );
2408 2409
 			NaNO3                           .addOreByProducts(KNO3                  , Niter                     );

+ 0
- 2
src/main/java/gregtech/loaders/c/Loader_Recipes_Other.java View File

@@ -837,8 +837,6 @@ public class Loader_Recipes_Other implements Runnable {
837 837
 		RM.Fusion.addRecipe1(F, -8192, 1690, ST.tag(2), FL.array(MT.He_3  .gas   (U  , T), MT.Li_6.liquid(U  , T)), FL.array(MT.He    .gas   (2*U , F)                                                                                 ), ZL_IS                ).setSpecialNumber( 1690L*8192L*16L);
838 838
 		RM.Fusion.addRecipe1(F, -8192,  736, ST.tag(2), FL.array(MT.He    .gas   (U  , T), MT.Be_8.liquid(U  , T)), FL.array(MT.C     .liquid(  U , F)                                                                                 ), ZL_IS                ).setSpecialNumber(  736L*8192L*16L);
839 839
 		RM.Fusion.addRecipe1(F, -8192,  716, ST.tag(2), FL.array(MT.He    .gas   (U  , T), MT.C   .liquid(U  , T)), FL.array(MT.O     .gas   (  U , F)                                                                                 ), ZL_IS                ).setSpecialNumber(  716L*8192L*16L);
840
-		
841
-		
842 840
 		RM.Fusion.addRecipe1(F, -8192, 1956, ST.tag(2), FL.array(MT.Ad    .liquid(U  , T), MT.Be_7.liquid(U  , T)), FL.array(MT.W     .liquid(  U , F), MT.He    .gas   (16*U, F), MT.He_3  .gas   (24*U, F), MT.T     .gas   (24*U, F)), OP.dust.mat(MT.Vb, 1)).setSpecialNumber(94956L*8192L*16L);
843 841
 		
844 842
 		

+ 223
- 0
src/main/java/gregtech/tileentity/energy/generators/MultiTileEntityMotorLiquid.java View File

@@ -0,0 +1,223 @@
1
+/**
2
+ * Copyright (c) 2019 Gregorius Techneticies
3
+ *
4
+ * This file is part of GregTech.
5
+ *
6
+ * GregTech is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Lesser General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * GregTech is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public License
17
+ * along with GregTech. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+
20
+package gregtech.tileentity.energy.generators;
21
+
22
+import static gregapi.data.CS.*;
23
+
24
+import java.util.Collection;
25
+import java.util.List;
26
+
27
+import gregapi.code.TagData;
28
+import gregapi.data.FM;
29
+import gregapi.data.LH;
30
+import gregapi.data.LH.Chat;
31
+import gregapi.data.TD;
32
+import gregapi.fluid.FluidTankGT;
33
+import gregapi.old.Textures;
34
+import gregapi.recipes.Recipe;
35
+import gregapi.recipes.Recipe.RecipeMap;
36
+import gregapi.render.BlockTextureDefault;
37
+import gregapi.render.BlockTextureMulti;
38
+import gregapi.render.IIconContainer;
39
+import gregapi.render.ITexture;
40
+import gregapi.tileentity.ITileEntityFunnelAccessible;
41
+import gregapi.tileentity.ITileEntityTapAccessible;
42
+import gregapi.tileentity.base.TileEntityBase09FacingSingle;
43
+import gregapi.tileentity.energy.ITileEntityEnergy;
44
+import gregapi.tileentity.machines.ITileEntityRunningActively;
45
+import gregapi.util.UT;
46
+import net.minecraft.block.Block;
47
+import net.minecraft.entity.Entity;
48
+import net.minecraft.inventory.IInventory;
49
+import net.minecraft.item.ItemStack;
50
+import net.minecraft.nbt.NBTTagCompound;
51
+import net.minecraftforge.fluids.FluidStack;
52
+import net.minecraftforge.fluids.IFluidHandler;
53
+import net.minecraftforge.fluids.IFluidTank;
54
+
55
+/**
56
+ * @author Gregorius Techneticies
57
+ */
58
+public class MultiTileEntityMotorLiquid extends TileEntityBase09FacingSingle implements IFluidHandler, ITileEntityFunnelAccessible, ITileEntityTapAccessible, ITileEntityEnergy, ITileEntityRunningActively {
59
+	protected short mEfficiency = 10000;
60
+	protected long mEnergy = 0, mRate = 1;
61
+	protected boolean mBurning = F, oBurning = F;
62
+	protected TagData mEnergyTypeEmitted = TD.Energy.RU;
63
+	protected RecipeMap mRecipes = FM.Engine;
64
+	protected Recipe mLastRecipe = null;
65
+	protected FluidTankGT mTankInput = new FluidTankGT(1000), mTankOutput = new FluidTankGT(10000);
66
+	
67
+	@Override
68
+	public void readFromNBT2(NBTTagCompound aNBT) {
69
+		super.readFromNBT2(aNBT);
70
+		mEnergy = aNBT.getLong(NBT_ENERGY);
71
+		mBurning = aNBT.getBoolean(NBT_ACTIVE);
72
+		if (aNBT.hasKey(NBT_OUTPUT)) mRate = aNBT.getLong(NBT_OUTPUT);
73
+		if (aNBT.hasKey(NBT_FUELMAP)) mRecipes = RecipeMap.RECIPE_MAPS.get(aNBT.getString(NBT_FUELMAP));
74
+		if (aNBT.hasKey(NBT_EFFICIENCY)) mEfficiency = (short)UT.Code.bind_(0, 10000, aNBT.getShort(NBT_EFFICIENCY));
75
+		if (aNBT.hasKey(NBT_ENERGY_EMITTED)) mEnergyTypeEmitted = TagData.createTagData(aNBT.getString(NBT_ENERGY_EMITTED));
76
+		mTankInput.setCapacity(mRate * 10);
77
+		mTankInput.readFromNBT(aNBT, NBT_TANK);
78
+		mTankOutput.setCapacity(mRate * 100);
79
+		mTankOutput.readFromNBT(aNBT, NBT_TANK_OUT);
80
+	}
81
+	
82
+	@Override
83
+	public void writeToNBT2(NBTTagCompound aNBT) {
84
+		super.writeToNBT2(aNBT);
85
+		UT.NBT.setNumber(aNBT, NBT_ENERGY, mEnergy);
86
+		UT.NBT.setBoolean(aNBT, NBT_ACTIVE, mBurning);
87
+		mTankInput.writeToNBT(aNBT, NBT_TANK);
88
+		mTankOutput.writeToNBT(aNBT, NBT_TANK_OUT);
89
+	}
90
+	
91
+	@Override
92
+	public void addToolTips(List<String> aList, ItemStack aStack, boolean aF3_H) {
93
+		aList.add(Chat.CYAN     + LH.get(LH.RECIPES)        + ": " + Chat.WHITE + LH.get(mRecipes.mNameInternal));
94
+		aList.add(LH.getToolTipEfficiency(mEfficiency));
95
+		LH.addEnergyToolTips(this, aList, null, mEnergyTypeEmitted, null, LH.get(LH.FACE_FRONT));
96
+		aList.add(Chat.DGRAY    + LH.get(LH.TOOL_TO_DETAIL_MAGNIFYINGGLASS));
97
+		super.addToolTips(aList, aStack, aF3_H);
98
+	}
99
+	
100
+	@Override
101
+	public void onTick2(long aTimer, boolean aIsServerSide) {
102
+		if (aIsServerSide) {
103
+			if (mEnergy >= mRate) {
104
+				ITileEntityEnergy.Util.emitEnergyToNetwork(mEnergyTypeEmitted, 1, Math.min(mRate, mEnergy), this);
105
+				mEnergy -= mRate;
106
+			}
107
+			if (mEnergy < mRate * 2) {
108
+				mBurning = F;
109
+				Recipe tRecipe = mRecipes.findRecipe(this, mLastRecipe, T, Long.MAX_VALUE, NI, mTankInput.AS_ARRAY, ZL_IS);
110
+				if (tRecipe != null && tRecipe.isRecipeInputEqual(T, F, mTankInput.AS_ARRAY, ZL_IS)) {
111
+					mBurning = T;
112
+					mLastRecipe = tRecipe;
113
+					mEnergy += UT.Code.units(Math.abs(tRecipe.mEUt * tRecipe.mDuration), 10000, mEfficiency, F);
114
+					while (mEnergy < mRate * 2 && tRecipe.isRecipeInputEqual(T, F, mTankInput.AS_ARRAY, ZL_IS)) {
115
+						mEnergy += UT.Code.units(Math.abs(tRecipe.mEUt * tRecipe.mDuration), 10000, mEfficiency, F);
116
+						if (mTankInput.isEmpty()) break;
117
+					}
118
+				} else {
119
+					mTankInput.setEmpty();
120
+				}
121
+				if (mEnergy < 0) mEnergy = 0;
122
+			}
123
+		}
124
+	}
125
+	
126
+	@Override
127
+	public long onToolClick2(String aTool, long aRemainingDurability, long aQuality, Entity aPlayer, List<String> aChatReturn, IInventory aPlayerInventory, boolean aSneaking, ItemStack aStack, byte aSide, float aHitX, float aHitY, float aHitZ) {
128
+		long rReturn = super.onToolClick2(aTool, aRemainingDurability, aQuality, aPlayer, aChatReturn, aPlayerInventory, aSneaking, aStack, aSide, aHitX, aHitY, aHitZ);
129
+		if (rReturn > 0) return rReturn;
130
+		
131
+		if (isClientSide()) return 0;
132
+		
133
+		if (aTool.equals(TOOL_magnifyingglass)) {
134
+			if (aChatReturn != null) {
135
+				aChatReturn.add(mTankInput .content());
136
+				aChatReturn.add(mTankOutput.content());
137
+			}
138
+			return 1;
139
+		}
140
+		return 0;
141
+	}
142
+	
143
+	@Override
144
+	public boolean onTickCheck(long aTimer) {
145
+		return mBurning != oBurning || super.onTickCheck(aTimer);
146
+	}
147
+	
148
+	@Override
149
+	public void onTickResetChecks(long aTimer, boolean aIsServerSide) {
150
+		super.onTickResetChecks(aTimer, aIsServerSide);
151
+		oBurning = mBurning;
152
+	}
153
+	
154
+	@Override
155
+	public void setVisualData(byte aData) {
156
+		mBurning = ((aData & 1) != 0);
157
+	}
158
+	
159
+	@Override public byte getVisualData() {return (byte)(mBurning?1:0);}
160
+	@Override public byte getDefaultSide() {return SIDE_FRONT;}
161
+	@Override public boolean[] getValidSides() {return SIDES_VALID;}
162
+	
163
+	@Override
164
+	protected IFluidTank getFluidTankFillable2(byte aSide, FluidStack aFluidToFill) {
165
+		return mRecipes.containsInput(aFluidToFill, this, NI) ? mTankInput : null;
166
+	}
167
+	
168
+	@Override
169
+	protected IFluidTank getFluidTankDrainable2(byte aSide, FluidStack aFluidToDrain) {
170
+		return mTankOutput;
171
+	}
172
+	
173
+	@Override
174
+	protected IFluidTank[] getFluidTanks2(byte aSide) {
175
+		return new IFluidTank[] {mTankInput, mTankOutput};
176
+	}
177
+	
178
+	@Override
179
+	public FluidStack tapDrain(byte aSide, int aMaxDrain, boolean aDoDrain) {
180
+		updateInventory();
181
+		return mTankOutput.has() ? mTankOutput.drain(aMaxDrain, aDoDrain) : mTankInput.drain(aMaxDrain, aDoDrain);
182
+	}
183
+	
184
+	@Override
185
+	public int funnelFill(byte aSide, FluidStack aFluid, boolean aDoDrain) {
186
+		updateInventory();
187
+		return mTankInput.fill(aFluid, aDoDrain);
188
+	}
189
+	
190
+	@Override public ITexture getTexture2(Block aBlock, int aRenderPass, byte aSide, boolean[] aShouldSideBeRendered) {return aShouldSideBeRendered[aSide] ? BlockTextureMulti.get(BlockTextureDefault.get(sColoreds[FACING_ROTATIONS[mFacing][aSide]], mRGBa), BlockTextureDefault.get((mBurning?sOverlaysActive:sOverlays)[FACING_ROTATIONS[mFacing][aSide]])): null;}
191
+	
192
+	@Override public ItemStack[] getDefaultInventory(NBTTagCompound aNBT) {return ZL_IS;}
193
+	@Override public boolean canDrop(int aInventorySlot) {return T;}
194
+	
195
+	@Override public boolean isEnergyType(TagData aEnergyType, byte aSide, boolean aEmitting) {return aEmitting && aEnergyType == mEnergyTypeEmitted;}
196
+	@Override public boolean isEnergyEmittingTo(TagData aEnergyType, byte aSide, boolean aTheoretical) {return aSide == mFacing && super.isEnergyEmittingTo(aEnergyType, aSide, aTheoretical);}
197
+	@Override public long getEnergyOffered(TagData aEnergyType, byte aSide, long aSize) {return Math.min(mRate, mEnergy);}
198
+	@Override public long getEnergySizeOutputRecommended(TagData aEnergyType, byte aSide) {return mRate;}
199
+	@Override public long getEnergySizeOutputMin(TagData aEnergyType, byte aSide) {return mRate;}
200
+	@Override public long getEnergySizeOutputMax(TagData aEnergyType, byte aSide) {return mRate;}
201
+	@Override public Collection<TagData> getEnergyTypes(byte aSide) {return mEnergyTypeEmitted.AS_LIST;}
202
+	
203
+	@Override public boolean getStateRunningPassively() {return mBurning;}
204
+	@Override public boolean getStateRunningPossible() {return mBurning;}
205
+	@Override public boolean getStateRunningActively() {return mBurning;}
206
+	
207
+	// Icons
208
+	public static IIconContainer[] sColoreds = new IIconContainer[] {
209
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/colored/front"),
210
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/colored/back"),
211
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/colored/sides"),
212
+	}, sOverlays = new IIconContainer[] {
213
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/overlay/front"),
214
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/overlay/back"),
215
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/overlay/sides"),
216
+	}, sOverlaysActive = new IIconContainer[] {
217
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/overlay_active/front"),
218
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/overlay_active/back"),
219
+		new Textures.BlockIcons.CustomIcon("machines/generators/engine_liquid/overlay_active/sides"),
220
+	};
221
+	
222
+	@Override public String getTileEntityName() {return "gt.multitileentity.generator.engine_liquid";}
223
+}

Loading…
Cancel
Save