idk anymore 2

This commit is contained in:
DrMangoTea
2023-10-28 14:14:03 +02:00
parent 4ff02250d6
commit 6077e7543c
10 changed files with 51 additions and 43 deletions

View File

@@ -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);

View File

@@ -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<IFluidHandler> 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<IFluidHandler> 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();
//}
}

View File

@@ -149,6 +149,8 @@ public class AirIntakeInstance extends KineticBlockEntityInstance<AirIntakeBlock
public void beginFrame() {
PoseStack msFan = new PoseStack();
TransformStack msrFan = TransformStack.cast(msFan);
msrFan.translate(getInstancePosition());
@@ -193,6 +195,8 @@ public class AirIntakeInstance extends KineticBlockEntityInstance<AirIntakeBlock
if(!blockEntity.isUsedByController) {
if(blockEntity.diameter ==1) {
updateRotation(fan, getFanSpeed());
@@ -205,6 +209,13 @@ public class AirIntakeInstance extends KineticBlockEntityInstance<AirIntakeBlock
fan.delete();
fan_large.setEmptyTransform();
}
if(blockEntity.isUsedByController) {
//updateRotation(fan_medium, getFanSpeed());
fan_medium.setEmptyTransform();
fan.delete();
fan_large.setEmptyTransform();
}
if(blockEntity.diameter ==3) {

View File

@@ -269,8 +269,8 @@ public class CokeOvenBlockEntity extends TFMGMachineBlockEntity implements IWren
itemCapability = LazyOptional.of(() -> new CombinedInvWrapper(controller.inputInventory));
}}}
oldFluidCapability.invalidate();
oldItemCapability.invalidate();
//oldFluidCapability.invalidate();
//oldItemCapability.invalidate();
}
public void setControllers(){
if(!isValid())

View File

@@ -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",

View File

@@ -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",

View File

@@ -1,5 +1,6 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "tfmg:block/diesel_engine_back",
"1": "tfmg:block/diesel_engine_expansion",

View File

@@ -1,5 +1,6 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "tfmg:block/diesel_engine_back",
"1": "tfmg:block/diesel_engine_expansion",

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 B

After

Width:  |  Height:  |  Size: 567 B