Skip to content

Commit

Permalink
Remove crafting time in creative mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai-Z-JP committed Jun 5, 2021
1 parent f0ab5ce commit 8a1a50c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class TileEntityTrainWorkBench extends TileEntity //implements IInventory
public static final int Max_CraftingTime = 64;
private int craftingTime = 0;
private boolean isCrafting = false;
private boolean isCreative = false;

@Override
public void readFromNBT(NBTTagCompound nbt) {
Expand Down Expand Up @@ -55,7 +56,11 @@ public void updateEntity() {

if (this.isCrafting) {
if (this.craftingTime < Max_CraftingTime) {
++this.craftingTime;
if (this.isCreative) {
this.craftingTime = Max_CraftingTime;
} else {
++this.craftingTime;
}
} else {
this.craftingTime = 0;
this.isCrafting = false;
Expand Down Expand Up @@ -88,6 +93,7 @@ public void setCraftingTime(int par1) {
public void startCrafting(EntityPlayer player, boolean sendPacket) {
this.craftingTime = 0;
this.isCrafting = true;
this.isCreative = NGTUtil.isServer() && player.capabilities.isCreativeMode;

ContainerRTMWorkBench container = (ContainerRTMWorkBench) player.openContainer;
container.startCrafting();
Expand Down

0 comments on commit 8a1a50c

Please sign in to comment.