Browse Source

Fixed a handful of Fluid related Bugs and OCean Worldgen Loop

Gregorius Techneticies 2 months ago
parent
commit
50c08e6fe9
Signed by: Gregorius Techneticies <gregoriustech@gmail.com> GPG Key ID: 1B693EA14F2FD70F

+ 1
- 0
CHANGELOG.md View File

@@ -11,6 +11,7 @@ Nothing (I tend to only add finished Stuff to the Changelog).
11 11
 
12 12
 6.14.09: (Not released yet, released whenever it needs to be)
13 13
 [COMPAT] Aroma1997's Mining Dimension is now Compatible with my Worldgen.
14
+[FIXED] Infinite Worldgen Loop with Oceans, because I forgot to set the Block Update Flag to 2 during Worldgen, because ofcourse I left it to default when I fixed another Ocean related Bug...
14 15
 [FIXED] Railcraft Crowbars should now be able to remove Covers again, even if they dont use the overlay for technical reasons.
15 16
 [FIXED] Applied Energistics Quartz Cutter in Advanced Crafting Tables.
16 17
 [FIXED] Forestry Backpacks didn't work with Autocollecting Tools, because the Magnetic Autocollect did not throw an Item Collect Event.

+ 26
- 0
src/main/java/gregapi/block/fluid/BlockBaseFluid.java View File

@@ -38,11 +38,13 @@ import gregapi.tileentity.data.ITileEntitySurface;
38 38
 import gregapi.util.ST;
39 39
 import gregapi.util.UT;
40 40
 import gregapi.util.WD;
41
+import gregtech.blocks.fluids.BlockWaterlike;
41 42
 import net.minecraft.block.Block;
42 43
 import net.minecraft.block.material.Material;
43 44
 import net.minecraft.client.renderer.texture.IIconRegister;
44 45
 import net.minecraft.entity.Entity;
45 46
 import net.minecraft.entity.EntityLivingBase;
47
+import net.minecraft.init.Blocks;
46 48
 import net.minecraft.item.ItemBlock;
47 49
 import net.minecraft.potion.PotionEffect;
48 50
 import net.minecraft.tileentity.TileEntity;
@@ -198,6 +200,13 @@ public class BlockBaseFluid extends BlockFluidFinite implements IBlock, IItemGT,
198 200
 				aWorld.scheduleBlockUpdate(aX, tY, aZ, this, tickRate);
199 201
 				return 0;
200 202
 			}
203
+			// Swap with GT6 Water Blocks.
204
+			if (tBlock instanceof BlockWaterlike || tBlock == Blocks.water || tBlock == Blocks.flowing_water) {
205
+				aWorld.setBlock(aX, aY, aZ, tBlock, aWorld.getBlockMetadata(aX, tY, aZ), 3);
206
+				aWorld.setBlock(aX, tY, aZ, this, aAmount - 1, 3);
207
+				aWorld.scheduleBlockUpdate(aX, tY, aZ, this, tickRate);
208
+				return 0;
209
+			}
201 210
 			// Lets just jump up! Make a Fountain!
202 211
 			if (tBlock == NB || displaceIfPossible(aWorld, aX, tY, aZ)) {
203 212
 				// The Block left behind should stay for a bit.
@@ -250,6 +259,16 @@ public class BlockBaseFluid extends BlockFluidFinite implements IBlock, IItemGT,
250 259
 			aWorld.setBlockToAir(aX, aY, aZ);
251 260
 			return 0;
252 261
 		}
262
+		if (mLighterThanWater) {
263
+			tY = aY + 1;
264
+			tBlock = aWorld.getBlock(aX, tY, aZ);
265
+			if (tBlock instanceof BlockWaterlike || tBlock == Blocks.water || tBlock == Blocks.flowing_water) {
266
+				aWorld.setBlock(aX, aY, aZ, tBlock, aWorld.getBlockMetadata(aX, tY, aZ), 3);
267
+				aWorld.setBlock(aX, tY, aZ, this, aAmount - 1, 3);
268
+				aWorld.scheduleBlockUpdate(aX, tY, aZ, this, tickRate);
269
+				return 0;
270
+			}
271
+		}
253 272
 		return aAmount;
254 273
 	}
255 274
 	
@@ -281,12 +300,19 @@ public class BlockBaseFluid extends BlockFluidFinite implements IBlock, IItemGT,
281 300
 	@Override public boolean func_149730_j() {return F;}
282 301
 	@Override public int getRenderType() {return RendererBlockFluid.RENDER_ID;}
283 302
 	
303
+
304
+	public boolean mLighterThanWater = F;
305
+	public BlockBaseFluid setLighterThanWater() {
306
+		mLighterThanWater = T;
307
+		return this;
308
+	}
284 309
 	
285 310
 	public boolean mActLikeWeb = F;
286 311
 	public BlockBaseFluid setWeb() {
287 312
 		mActLikeWeb = T;
288 313
 		return this;
289 314
 	}
315
+	
290 316
 	/** This Function has been named wrong. It should be onEntityOverlapWithBlock */
291 317
 	@Override
292 318
 	public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) {

+ 2
- 2
src/main/java/gregtech/blocks/fluids/BlockOcean.java View File

@@ -53,7 +53,7 @@ public class BlockOcean extends BlockWaterlike {
53 53
 		if (PLACEMENT_ALLOWED) {
54 54
 			aWorld.scheduleBlockUpdate(aX, aY, aZ, this, 10+RNGSUS.nextInt(90));
55 55
 		} else {
56
-			aWorld.setBlockToAir(aX, aY, aZ);
56
+			aWorld.setBlock(aX, aY, aZ, NB, 0, 2);
57 57
 		}
58 58
 	}
59 59
 	
@@ -154,7 +154,7 @@ public class BlockOcean extends BlockWaterlike {
154 154
 		return;
155 155
 	}
156 156
 	
157
-	@Override public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {if (aWorld.getBlock(aX, aY-3, aZ) != this) return LIGHT_OPACITY_NONE; Block tBlock = aWorld.getBlock(aX, aY+1, aZ); return !tBlock.getMaterial().isLiquid() && tBlock.getLightOpacity(aWorld, aX, aY+1, aZ) <= 0 && !WD.visOpq(tBlock) ? 16 : LIGHT_OPACITY_NONE;}
157
+	@Override public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {if (aWorld.getBlock(aX, aY-3, aZ) != this || aWorld.getBlockMetadata(aX, aY, aZ) > 0) return LIGHT_OPACITY_NONE; Block tBlock = aWorld.getBlock(aX, aY+1, aZ); return !tBlock.getMaterial().isLiquid() && tBlock.getLightOpacity(aWorld, aX, aY+1, aZ) <= 0 && !WD.visOpq(tBlock) ? 16 : LIGHT_OPACITY_NONE;}
158 158
 	@Override public IIcon getIcon(int aSide, int aMeta) {return Blocks.water.getIcon(aSide, aMeta);}
159 159
 	@Override @SideOnly(Side.CLIENT) public int getRenderColor(int aMeta) {return 0x00c0c0c0;}
160 160
 	@Override @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int aZ) {return 0x00c0c0c0;}

+ 1
- 1
src/main/java/gregtech/blocks/fluids/BlockSwamp.java View File

@@ -156,7 +156,7 @@ public class BlockSwamp extends BlockWaterlike {
156 156
 		return;
157 157
 	}
158 158
 	
159
-	@Override public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {return LIGHT_OPACITY_MAX;}
159
+	@Override public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {if (aWorld.getBlock(aX, aY+1, aZ) != this || aWorld.getBlockMetadata(aX, aY, aZ) > 0) return LIGHT_OPACITY_WATER; return LIGHT_OPACITY_MAX;}
160 160
 	@Override public IIcon getIcon(int aSide, int aMeta) {return Blocks.water.getIcon(aSide, aMeta);}
161 161
 	@Override public int getRenderColor(int aMeta) {return 0x0000ff00;}
162 162
 	

+ 6
- 6
src/main/java/gregtech/loaders/a/Loader_Blocks.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2020 GregTech-6 Team
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -142,11 +142,11 @@ public class Loader_Blocks implements Runnable {
142 142
 		tNBTList.appendTag(new NBTTagString(ST.regName(BlocksGT.Ocean)));
143 143
 		FMLInterModComms.sendMessage(MD.IC2C.mID, "watergen", UT.NBT.make("blocks", tNBTList));
144 144
 		
145
-		BlocksGT.OilExtraHeavy                                                  = new BlockBaseFluid            ("gt.block.fluid.oil.extraheavy"    , FL.Oil_ExtraHeavy.fluid(), 1000, MaterialOil.instance).addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0).addEffect(Potion.blindness.id, 60, 1).setWeb();
146
-		BlocksGT.OilHeavy                                                       = new BlockBaseFluid            ("gt.block.fluid.oil.heavy"         , FL.Oil_Heavy     .fluid(), 1000, MaterialOil.instance).addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0).addEffect(Potion.blindness.id, 60, 1).setWeb();
147
-		BlocksGT.OilMedium                                                      = new BlockBaseFluid            ("gt.block.fluid.oil.medium"        , FL.Oil_Medium    .fluid(), 1000, MaterialOil.instance).addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0).addEffect(Potion.blindness.id, 60, 1);
148
-		BlocksGT.OilLight                                                       = new BlockBaseFluid            ("gt.block.fluid.oil.light"         , FL.Oil_Light     .fluid(), 1000, MaterialOil.instance).addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0).addEffect(Potion.blindness.id, 60, 1);
149
-		BlocksGT.GasNatural                                                     = new BlockBaseFluid            ("gt.block.fluid.gas.natural"       , FL.Gas_Natural   .fluid(), 1000, MaterialGas.instance).addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0);
145
+		BlocksGT.OilExtraHeavy                                                  = new BlockBaseFluid            ("gt.block.fluid.oil.extraheavy"    , FL.Oil_ExtraHeavy.fluid(), 1000, MaterialOil.instance).setLighterThanWater().addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0).addEffect(Potion.blindness.id, 60, 1).setWeb();
146
+		BlocksGT.OilHeavy                                                       = new BlockBaseFluid            ("gt.block.fluid.oil.heavy"         , FL.Oil_Heavy     .fluid(), 1000, MaterialOil.instance).setLighterThanWater().addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0).addEffect(Potion.blindness.id, 60, 1).setWeb();
147
+		BlocksGT.OilMedium                                                      = new BlockBaseFluid            ("gt.block.fluid.oil.medium"        , FL.Oil_Medium    .fluid(), 1000, MaterialOil.instance).setLighterThanWater().addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0).addEffect(Potion.blindness.id, 60, 1);
148
+		BlocksGT.OilLight                                                       = new BlockBaseFluid            ("gt.block.fluid.oil.light"         , FL.Oil_Light     .fluid(), 1000, MaterialOil.instance).setLighterThanWater().addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0).addEffect(Potion.blindness.id, 60, 1);
149
+		BlocksGT.GasNatural                                                     = new BlockBaseFluid            ("gt.block.fluid.gas.natural"       , FL.Gas_Natural   .fluid(), 1000, MaterialGas.instance).setLighterThanWater().addEffect(Potion.poison.id, 300, 0).addEffect(Potion.confusion.id, 120, 0);
150 150
 		if (COMPAT_TC != null) COMPAT_TC.registerThaumcraftAspectsToItem(ST.make(BlocksGT.OilExtraHeavy , 1, W), F, TC.stack(TC.AQUA, 1), TC.stack(TC.IGNIS, 1), TC.stack(TC.POTENTIA, 3));
151 151
 		if (COMPAT_TC != null) COMPAT_TC.registerThaumcraftAspectsToItem(ST.make(BlocksGT.OilHeavy      , 1, W), F, TC.stack(TC.AQUA, 1), TC.stack(TC.IGNIS, 1), TC.stack(TC.POTENTIA, 2));
152 152
 		if (COMPAT_TC != null) COMPAT_TC.registerThaumcraftAspectsToItem(ST.make(BlocksGT.OilMedium     , 1, W), F, TC.stack(TC.AQUA, 1), TC.stack(TC.IGNIS, 1), TC.stack(TC.POTENTIA, 1));

+ 3
- 2
src/main/java/gregtech/tileentity/misc/MultiTileEntityFluidSpring.java View File

@@ -1,5 +1,5 @@
1 1
 /**
2
- * Copyright (c) 2019 Gregorius Techneticies
2
+ * Copyright (c) 2021 GregTech-6 Team
3 3
  *
4 4
  * This file is part of GregTech.
5 5
  *
@@ -39,6 +39,7 @@ import gregapi.render.ITexture;
39 39
 import gregapi.tileentity.base.TileEntityBase04MultiTileEntities;
40 40
 import gregapi.tileentity.data.ITileEntitySurface;
41 41
 import gregapi.util.UT;
42
+import gregtech.blocks.fluids.BlockWaterlike;
42 43
 import net.minecraft.block.Block;
43 44
 import net.minecraft.init.Blocks;
44 45
 import net.minecraft.nbt.NBTTagCompound;
@@ -125,7 +126,7 @@ public class MultiTileEntityFluidSpring extends TileEntityBase04MultiTileEntitie
125 126
 						} else {
126 127
 							worldObj.setBlock(xCoord, yCoord+1, zCoord, tBlock, 0, 3);
127 128
 						}
128
-					} else if (tAbove.isAir(worldObj, xCoord, yCoord+1, zCoord)) {
129
+					} else if (tAbove instanceof BlockWaterlike || tAbove.isAir(worldObj, xCoord, yCoord+1, zCoord)) {
129 130
 						worldObj.setBlock(xCoord, yCoord+1, zCoord, tBlock, 0, 3);
130 131
 					}
131 132
 				}

+ 1
- 1
src/main/java/gregtech/worldgen/WorldgenOcean.java View File

@@ -67,7 +67,7 @@ public class WorldgenOcean extends WorldgenObject {
67 67
 				
68 68
 				if (tPlacedNone) {
69 69
 					BlockOcean.PLACEMENT_ALLOWED = T;
70
-					aWorld.setBlock(aMinX+tX, tY, aMinZ+tZ, BlocksGT.Ocean);
70
+					aWorld.setBlock(aMinX+tX, tY, aMinZ+tZ, BlocksGT.Ocean, 0, 2);
71 71
 					BlockOcean.PLACEMENT_ALLOWED = T;
72 72
 					tPlacedNone = F;
73 73
 				} else {

+ 1
- 1
src/main/java/gregtech/worldgen/WorldgenRiver.java View File

@@ -67,7 +67,7 @@ public class WorldgenRiver extends WorldgenObject {
67 67
 				
68 68
 				if (tPlacedNone) {
69 69
 					BlockRiver.PLACEMENT_ALLOWED = T;
70
-					aWorld.setBlock(aMinX+tX, tY, aMinZ+tZ, BlocksGT.River);
70
+					aWorld.setBlock(aMinX+tX, tY, aMinZ+tZ, BlocksGT.River, 0, 2);
71 71
 					BlockRiver.PLACEMENT_ALLOWED = T;
72 72
 					tPlacedNone = F;
73 73
 				} else {

+ 1
- 1
src/main/java/gregtech/worldgen/WorldgenSwamp.java View File

@@ -68,7 +68,7 @@ public class WorldgenSwamp extends WorldgenObject {
68 68
 				
69 69
 				if (tPlacedNone) {
70 70
 					BlockSwamp.PLACEMENT_ALLOWED = T;
71
-					aWorld.setBlock(aMinX+tX, tY, aMinZ+tZ, BlocksGT.Swamp);
71
+					aWorld.setBlock(aMinX+tX, tY, aMinZ+tZ, BlocksGT.Swamp, 0, 2);
72 72
 					BlockSwamp.PLACEMENT_ALLOWED = F;
73 73
 					tPlacedNone = F;
74 74
 				} else {

Loading…
Cancel
Save