Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/cover_default_tick_rate' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master committed Dec 26, 2024
2 parents e640d3a + 9af736b commit bb8df0b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/gregtech/api/util/CoverBehaviorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,16 @@ public final int getTickRate(ForgeDirection side, int aCoverID, ISerializableObj
return getTickRateImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}

/**
* Gets the initial tick rate for doCoverThings of the Cover
* <p/>
* Defaults to getTickRate(), override for different initial and minimum tick rates
*/
public final int getDefaultTickRate(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
ICoverable aTileEntity) {
return getDefaultTickRateImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}

/**
* The MC Color of this Lens. -1 for no Color (meaning this isn't a Lens then).
*/
Expand Down Expand Up @@ -760,6 +770,15 @@ protected int getTickRateImpl(ForgeDirection side, int aCoverID, T aCoverVariabl
return 0;
}

/**
* Gets the initial tick rate for doCoverThings of the Cover
* <p/>
* Defaults to getTickRate(), override for different initial and minimum tick rates
*/
protected int getDefaultTickRateImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {
return getTickRateImpl(side, aCoverID, aCoverVariable, aTileEntity);
}

/**
* The MC Color of this Lens. -1 for no Color (meaning this isn't a Lens then).
*/
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gregtech/common/covers/CoverInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public CoverInfo(ForgeDirection side, int aID, ICoverable aTile, ISerializableOb
coverBehavior = GregTechAPI.getCoverBehaviorNew(aID);
coverData = aCoverData == null ? coverBehavior.createDataObject() : aCoverData;
coveredTile = new WeakReference<>(aTile);
tickRateAddition = coverBehavior.getDefaultTickRate(coverSide, coverID, coverData, coveredTile.get())
- this.getMinimumTickRate();
}

public CoverInfo(ICoverable aTile, NBTTagCompound aNBT) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/gregtech/common/covers/CoverItemMeter.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aC

@Override
protected int getTickRateImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable,
ICoverable aTileEntity) {
return 1;
}

@Override
protected int getDefaultTickRateImpl(ForgeDirection side, int aCoverID, ItemMeterData aCoverVariable,
ICoverable aTileEntity) {
return 5;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/gregtech/common/covers/CoverLiquidMeter.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aC

@Override
protected int getTickRateImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable,
ICoverable aTileEntity) {
return 1;
}

@Override
protected int getDefaultTickRateImpl(ForgeDirection side, int aCoverID, LiquidMeterData aCoverVariable,
ICoverable aTileEntity) {
return 5;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public String getDescriptionImpl(ForgeDirection side, int aCoverID, T aCoverVari

@Override
public int getTickRateImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {
return 1;
}

@Override
protected int getDefaultTickRateImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {
return 5;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ protected boolean manipulatesSidedRedstoneOutputImpl(ForgeDirection side, int aC

@Override
public int getTickRateImpl(ForgeDirection side, int aCoverID, ActivityTransmitterData aCoverVariable,
ICoverable aTileEntity) {
return 1;
}

@Override
protected int getDefaultTickRateImpl(ForgeDirection side, int aCoverID, ActivityTransmitterData aCoverVariable,
ICoverable aTileEntity) {
return 5;
}
Expand Down

0 comments on commit bb8df0b

Please sign in to comment.