From 6077e7543cbbcc7d5a158a2203e46e642f7fb57f Mon Sep 17 00:00:00 2001 From: DrMangoTea Date: Sat, 28 Oct 2023 14:14:03 +0200 Subject: [PATCH] idk anymore 2 --- .../diesel/DieselEngineBlockEntity.java | 2 +- .../engines/intake/AirIntakeBlockEntity.java | 71 ++++++++---------- .../engines/intake/AirIntakeInstance.java | 11 +++ .../coke_oven/CokeOvenBlockEntity.java | 4 +- .../models/block/diesel_engine/block.json | 2 +- .../tfmg/models/block/diesel_engine/item.json | 2 +- .../block/diesel_engine_expansion/block.json | 1 + .../block/diesel_engine_expansion/item.json | 1 + .../assets/tfmg/textures/block/img.png | Bin 0 -> 493 bytes .../tfmg/textures/block/steel_pipes.png | Bin 493 -> 567 bytes 10 files changed, 51 insertions(+), 43 deletions(-) create mode 100644 src/main/resources/assets/tfmg/textures/block/img.png diff --git a/src/main/java/com/drmangotea/tfmg/blocks/engines/diesel/DieselEngineBlockEntity.java b/src/main/java/com/drmangotea/tfmg/blocks/engines/diesel/DieselEngineBlockEntity.java index 56d543af..8cf0c807 100644 --- a/src/main/java/com/drmangotea/tfmg/blocks/engines/diesel/DieselEngineBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/blocks/engines/diesel/DieselEngineBlockEntity.java @@ -227,7 +227,7 @@ public class DieselEngineBlockEntity extends SmartBlockEntity implements IHaveGo if(consumptionTimer>=10) { //if(signal!=0) - fuelTank.setFluid(new FluidStack(TFMGFluids.DIESEL.getSource(),airTank.getFluidAmount()-1)); + fuelTank.setFluid(new FluidStack(TFMGFluids.DIESEL.getSource(),fuelTank.getFluidAmount()-1)); consumptionTimer=0; } //airTank.drain(1, IFluidHandler.FluidAction.EXECUTE); diff --git a/src/main/java/com/drmangotea/tfmg/blocks/engines/intake/AirIntakeBlockEntity.java b/src/main/java/com/drmangotea/tfmg/blocks/engines/intake/AirIntakeBlockEntity.java index bf0dd044..f5b7a2d9 100644 --- a/src/main/java/com/drmangotea/tfmg/blocks/engines/intake/AirIntakeBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/blocks/engines/intake/AirIntakeBlockEntity.java @@ -80,14 +80,20 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha if (tankInventory.getFluidAmount() + production <= tankInventory.getCapacity()) { //tankInventory.fill(new FluidStack(TFMGFluids.AIR.getSource(), production), IFluidHandler.FluidAction.EXECUTE); tankInventory.setFluid(new FluidStack(TFMGFluids.AIR.getSource(), production + tankInventory.getFluidAmount())); - if(controller!=null) { - ((AirIntakeBlockEntity) level.getBlockEntity(controller)).setChanged(); - ((AirIntakeBlockEntity) level.getBlockEntity(controller)).sendData(); - } + // if(controller!=null) { + // ((AirIntakeBlockEntity) level.getBlockEntity(controller)).setChanged(); + // ((AirIntakeBlockEntity) level.getBlockEntity(controller)).sendData(); + // } } // } //////////////// + if(isUsedByController) { + refreshCapability(); + sendData(); + setChanged(); + } + if(diameter == 3){ visual_angle.chase(angle, 0.1f, LerpedFloat.Chaser.EXP); @@ -239,8 +245,11 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha - //if(controller!=null) - // refreshCapability(); + if (!fluidCapability.isPresent()) { + refreshCapability(); + sendData(); + setChanged(); + } @@ -251,36 +260,22 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha private void refreshCapability() { - if (this.controller == null) { + IFluidHandler handlerForCapability; + + if (controller == null || controller == this.getBlockPos() + + ) { + handlerForCapability = tankInventory; + } else + if(((AirIntakeBlockEntity) level.getBlockEntity(controller))!=null) { + handlerForCapability = ((AirIntakeBlockEntity) level.getBlockEntity(controller)).tankInventory; + }else handlerForCapability = tankInventory; - return; - } - - - - LazyOptional oldFluidCapability = fluidCapability; - -if(diameter==1&&!isUsedByController){ - - fluidCapability = LazyOptional.of(() -> new CombinedTankWrapper(tankInventory)); - - oldFluidCapability.invalidate(); - - return; -} - - - if(!isController) { - if (controller != getBlockPos()) { - if (level.getBlockEntity(controller) instanceof AirIntakeBlockEntity) - fluidCapability = LazyOptional.of(() -> new CombinedTankWrapper(((AirIntakeBlockEntity) level.getBlockEntity(controller)).tankInventory)); - - } - }else fluidCapability = LazyOptional.of(() -> new CombinedTankWrapper(tankInventory)); - - oldFluidCapability.invalidate(); - + LazyOptional oldCap = fluidCapability; + IFluidHandler finalHandlerForCapability = handlerForCapability; + fluidCapability = LazyOptional.of(() -> finalHandlerForCapability); + //oldCap.invalidate(); } @@ -536,10 +531,10 @@ if(diameter==1&&!isUsedByController){ protected void onFluidStackChanged(FluidStack newFluidStack) { setChanged(); sendData(); - if(controller!=null) { - ((AirIntakeBlockEntity) level.getBlockEntity(controller)).setChanged(); - ((AirIntakeBlockEntity) level.getBlockEntity(controller)).sendData(); - } + //if(((AirIntakeBlockEntity) level.getBlockEntity(controller))!=null) { + // ((AirIntakeBlockEntity) level.getBlockEntity(controller)).setChanged(); + // ((AirIntakeBlockEntity) level.getBlockEntity(controller)).sendData(); + //} } diff --git a/src/main/java/com/drmangotea/tfmg/blocks/engines/intake/AirIntakeInstance.java b/src/main/java/com/drmangotea/tfmg/blocks/engines/intake/AirIntakeInstance.java index 80dc8ed9..8a386e61 100644 --- a/src/main/java/com/drmangotea/tfmg/blocks/engines/intake/AirIntakeInstance.java +++ b/src/main/java/com/drmangotea/tfmg/blocks/engines/intake/AirIntakeInstance.java @@ -149,6 +149,8 @@ public class AirIntakeInstance extends KineticBlockEntityInstance new CombinedInvWrapper(controller.inputInventory)); }}} - oldFluidCapability.invalidate(); - oldItemCapability.invalidate(); + //oldFluidCapability.invalidate(); + //oldItemCapability.invalidate(); } public void setControllers(){ if(!isValid()) diff --git a/src/main/resources/assets/tfmg/models/block/diesel_engine/block.json b/src/main/resources/assets/tfmg/models/block/diesel_engine/block.json index a8bd8291..177ec86d 100644 --- a/src/main/resources/assets/tfmg/models/block/diesel_engine/block.json +++ b/src/main/resources/assets/tfmg/models/block/diesel_engine/block.json @@ -1,6 +1,6 @@ { "credit": "Made with Blockbench", - "parent": "create:block/block", + "parent": "block/block", "textures": { "0": "tfmg:block/diesel_engine_back", "1": "tfmg:block/diesel_engine_front", diff --git a/src/main/resources/assets/tfmg/models/block/diesel_engine/item.json b/src/main/resources/assets/tfmg/models/block/diesel_engine/item.json index a8bd8291..177ec86d 100644 --- a/src/main/resources/assets/tfmg/models/block/diesel_engine/item.json +++ b/src/main/resources/assets/tfmg/models/block/diesel_engine/item.json @@ -1,6 +1,6 @@ { "credit": "Made with Blockbench", - "parent": "create:block/block", + "parent": "block/block", "textures": { "0": "tfmg:block/diesel_engine_back", "1": "tfmg:block/diesel_engine_front", diff --git a/src/main/resources/assets/tfmg/models/block/diesel_engine_expansion/block.json b/src/main/resources/assets/tfmg/models/block/diesel_engine_expansion/block.json index cf844d14..338dad99 100644 --- a/src/main/resources/assets/tfmg/models/block/diesel_engine_expansion/block.json +++ b/src/main/resources/assets/tfmg/models/block/diesel_engine_expansion/block.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "parent": "block/block", "textures": { "0": "tfmg:block/diesel_engine_back", "1": "tfmg:block/diesel_engine_expansion", diff --git a/src/main/resources/assets/tfmg/models/block/diesel_engine_expansion/item.json b/src/main/resources/assets/tfmg/models/block/diesel_engine_expansion/item.json index cf844d14..338dad99 100644 --- a/src/main/resources/assets/tfmg/models/block/diesel_engine_expansion/item.json +++ b/src/main/resources/assets/tfmg/models/block/diesel_engine_expansion/item.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "parent": "block/block", "textures": { "0": "tfmg:block/diesel_engine_back", "1": "tfmg:block/diesel_engine_expansion", diff --git a/src/main/resources/assets/tfmg/textures/block/img.png b/src/main/resources/assets/tfmg/textures/block/img.png new file mode 100644 index 0000000000000000000000000000000000000000..98d78d68012585f782b415a29e843d42908083e1 GIT binary patch literal 493 zcmVtwETh?~MSC2{8NoDg-r< z1XyF-H~|92ladiYMnvA*i5NJJ>IJ0KcP=A9vf0$oh;UvfA;t{EUB*hiqt_Hz<95)|gvw~eFygQEhl z%MFMw+s_GxoX|`}s9)60W`JOf5{FDH0_#d9VAdes3xQk$v(_7drAa4Z4sb70{*sm4AB7sRRM_X`yXSgUmi;A0s9Y)0dgNdcLFU#xWqFwcSK2;dZ0 zXBKEiVZHgi3W3%oP~qnMUITB)s!hmzX%jNx9WW3Jo&uN&)>gfS_>9>!qyDZ0;)~S= j@sv#j4D5rm=pp(B{7W?s4Z`>Y00000NkvXXu0mjf9fZ|c literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/tfmg/textures/block/steel_pipes.png b/src/main/resources/assets/tfmg/textures/block/steel_pipes.png index 98d78d68012585f782b415a29e843d42908083e1..51dacf0fbf05b6bded5678ff5532724c6feef65f 100644 GIT binary patch delta 542 zcmV+(0^$Ab1GfZ_B!B)%L_t(|Ud5I{OT$1AM*FKoP*9|Z6a>Xf4}y46FQNwz9tA-U z(v$w*$P2tWnRc6oBz0j(v%8t^?ab`xWPW{9J-@tGi|?QMd3$$XU0ltp+4*I4JUy)@ zV-Lh09-meKrf0L=01yEHKED?K2Y_$}*jWm82|%RZ-al$X4}a|j01HC^@U4FE&pY!) z0Baxu^r-=S;*Y|{cP%ve15m30z~-R=JeUCZHM-g;*HGd3bYAn|HNenC=z%f-5jG7= zfH8`2699TVjr?c;r4)E_Z^$Tppi>c+0QwZ609#)}gonHZog2|QfIcZGjkN#>@dIJS zF~l*8M#yN)#eWd58~89H?2pFWvJpjRF$M8ML?Ji74M&A>cyv->?8^nn+zLRh0V8B2 zqB(Dl*A0E(pQqqx)BrgJM!*zghh0YoFlyFb-aq)rDKKg~186Nma>B+)Ri@&b^jx02tp2T(UX^idmKU)R;FV0%T`e27e&`d;13sW6nLxe-a`kSaY3FvpE9B gC~U*o)E9_;0Xgo8{ZfD$0{{R307*qoM6N<$g4KiUFaQ7m delta 467 zcmV;^0WAKv1nmQmB!9F?L_t(|UhS5_N&`U*hWk_^C@4}y3WDOL2SL237twIJ0KcP=A9vf0$oh;UvfA; zt{EUB*hiqt_Hz<95)|gvw~eFygQEhl%MFMw+s_GxoX|`}s9)60W`JOf5{FDH0_#d9 zVAdes3xQk$vwzkbfu&7IO)!kinxHf1i+ZAU^SVHKPc@i_kIDLHa~w7B7v9%)^IEV?Q>w^I;qA!2N%St<@XB}30SLj z2;gHG0c=L&lSu)YfM2Y22r$oq=Lp~wSZ5Y!Mq$1Ay-W&$)+JEk=KNj*Z^)`m$b4xN zGT|LC5DT6Hm