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 00000000..98d78d68 Binary files /dev/null and b/src/main/resources/assets/tfmg/textures/block/img.png differ 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 98d78d68..51dacf0f 100644 Binary files a/src/main/resources/assets/tfmg/textures/block/steel_pipes.png and b/src/main/resources/assets/tfmg/textures/block/steel_pipes.png differ