Перейти к публикации

Скручивание квантовых генераторов


Рекомендованные сообщения

И так.

Моё предложение - дать возможность квантовым генераторам скручиваться ключом.

Это достаточно легко и быстро.

Я подготовил весь код для замещения кода TileEntity.

<code>

[spoiler]

TileEntityQGLow

[spoiler]

/*     */ package com.prototype.quantumgenerators.common.tiles;
/*     */ 
/*     */ import com.prototype.quantumgenerators.QGeneratorsType;
/*     */ import com.prototype.quantumgenerators.QuantumGenerators;
 
/*     */ import ic2.api.energy.event.EnergyTileLoadEvent;
/*     */ import ic2.api.energy.event.EnergyTileUnloadEvent;
/*     */ import ic2.api.energy.tile.IEnergySource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/*     */ import net.minecraft.nbt.NBTTagCompound;
/*     */ import net.minecraft.tileentity.TileEntity;
/*     */ import net.minecraftforge.common.MinecraftForge;
/*     */ import net.minecraftforge.common.util.ForgeDirection;
/*     */ 
/*     */ public class TileEntityQGLow
/*     */   extends TileEntity
/*     */   implements IEnergySource, IWrenchable
/*     */ {
/*  19 */   private boolean loaded = false;
/*  20 */   private boolean addedToEnergyNet = false;
/*     */   private int lastX;
/*     */   private int lastY;
/*     */   private int lastZ;
/*     */   
/*  25 */   public void validate() { super.validate();
/*  26 */     if ((isInvalid()) || (!this.worldObj.blockExists(this.xCoord, this.yCoord, this.zCoord))) {
/*  27 */       return;
/*     */     }
/*  29 */     onLoaded();
/*     */   }
/*     */   
/*     */   public void invalidate()
/*     */   {
/*  34 */     if (this.loaded) {
/*  35 */       onUnloaded();
/*     */     }
/*  37 */     super.invalidate();
/*     */   }
/*     */   
/*     */   public void onLoaded() {
/*  41 */     if (QuantumGenerators.isSimulating()) {
/*  42 */       MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
/*  43 */       this.addedToEnergyNet = true;
/*     */     }
/*  45 */     this.loaded = true;
/*     */   }
/*     */   
/*     */   public void onChunkUnload()
/*     */   {
/*  50 */     if (this.loaded) {
/*  51 */       onUnloaded();
/*     */     }
/*  53 */     super.onChunkUnload();
/*     */   }
/*     */   
/*     */   public void onUnloaded() {
/*  57 */     if ((QuantumGenerators.isSimulating()) && (this.addedToEnergyNet)) {
/*  58 */       MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
/*  59 */       this.addedToEnergyNet = false;
/*     */     }
/*  61 */     this.loaded = false;
/*     */   }
/*     */   
/*     */   public void updateEntity()
/*     */   {
/*  66 */     super.updateEntity();
/*  67 */     if (this.worldObj.isRemote) {
/*  68 */       return;
/*     */     }
/*  70 */     if (!this.addedToEnergyNet) {
/*  71 */       onLoaded();
/*     */     }
/*  73 */     if ((this.lastX != this.xCoord) || (this.lastY != this.yCoord) || (this.lastZ != this.zCoord)) {
/*  74 */       this.lastX = this.xCoord;
/*  75 */       this.lastY = this.yCoord;
/*  76 */       this.lastZ = this.zCoord;
/*  77 */       onUnloaded();
/*  78 */       onLoaded();
/*     */     }
/*     */   }
/*     */   
/*     */   public void readFromNBT(NBTTagCompound nbt)
/*     */   {
/*  84 */     super.readFromNBT(nbt);
/*  85 */     this.lastX = nbt.getInteger("lastX");
/*  86 */     this.lastY = nbt.getInteger("lastY");
/*  87 */     this.lastZ = nbt.getInteger("lastZ");
/*     */   }
/*     */   
/*     */   public void writeToNBT(NBTTagCompound nbt)
/*     */   {
/*  92 */     super.writeToNBT(nbt);
/*  93 */     if ((nbt.hasKey("lastX")) && (nbt.hasKey("lastY")) && (nbt.hasKey("lastZ"))) {
/*  94 */       this.lastX = nbt.getInteger("lastX");
/*  95 */       this.lastY = nbt.getInteger("lastY");
/*  96 */       this.lastZ = nbt.getInteger("lastZ");
/*     */     }
/*     */   }
/*     */   
/*     */   public double getOfferedEnergy()
/*     */   {
/* 102 */     return QGeneratorsType.LOW.getOutput();
/*     */   }
/*     */   
/*     */ 
/*     */   public void drawEnergy(double amount) {}
/*     */   
/*     */ 
/*     */   public int getSourceTier()
/*     */   {
/* 111 */     return Integer.MAX_VALUE;
/*     */   }
/*     */   
/*     */   public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction)
/*     */   {
/* 116 */     return true;
/*     */   }
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
// TODO Auto-generated method stub
return false;
}
@Override
public short getFacing() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setFacing(short facing) {
// TODO Auto-generated method stub
 
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
// TODO Auto-generated method stub
return true;
}
@Override
public float getWrenchDropRate() {
// TODO Auto-generated method stub
return 0;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
// TODO Auto-generated method stub
return null;
} }
 
[/spoiler]
TileEntityQGNormal
[spoiler]
/*     */ package com.prototype.quantumgenerators.common.tiles;
/*     */ 
/*     */ import com.prototype.quantumgenerators.QGeneratorsType;
/*     */ import com.prototype.quantumgenerators.QuantumGenerators;
 
/*     */ import ic2.api.energy.event.EnergyTileLoadEvent;
/*     */ import ic2.api.energy.event.EnergyTileUnloadEvent;
/*     */ import ic2.api.energy.tile.IEnergySource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/*     */ import net.minecraft.nbt.NBTTagCompound;
/*     */ import net.minecraft.tileentity.TileEntity;
/*     */ import net.minecraftforge.common.MinecraftForge;
/*     */ import net.minecraftforge.common.util.ForgeDirection;
/*     */ 
/*     */ public class TileEntityQGNormal
/*     */   extends TileEntity
/*     */   implements IEnergySource, IWrenchable
/*     */ {
/*  19 */   private boolean loaded = false;
/*  20 */   private boolean addedToEnergyNet = false;
/*     */   private int lastX;
/*     */   private int lastY;
/*     */   private int lastZ;
/*     */   
/*  25 */   public void validate() { super.validate();
/*  26 */     if ((isInvalid()) || (!this.worldObj.blockExists(this.xCoord, this.yCoord, this.zCoord))) {
/*  27 */       return;
/*     */     }
/*  29 */     onLoaded();
/*     */   }
/*     */   
/*     */   public void invalidate()
/*     */   {
/*  34 */     if (this.loaded) {
/*  35 */       onUnloaded();
/*     */     }
/*  37 */     super.invalidate();
/*     */   }
/*     */   
/*     */   public void onLoaded() {
/*  41 */     if (QuantumGenerators.isSimulating()) {
/*  42 */       MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
/*  43 */       this.addedToEnergyNet = true;
/*     */     }
/*  45 */     this.loaded = true;
/*     */   }
/*     */   
/*     */   public void onChunkUnload()
/*     */   {
/*  50 */     if (this.loaded) {
/*  51 */       onUnloaded();
/*     */     }
/*  53 */     super.onChunkUnload();
/*     */   }
/*     */   
/*     */   public void onUnloaded() {
/*  57 */     if ((QuantumGenerators.isSimulating()) && (this.addedToEnergyNet)) {
/*  58 */       MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
/*  59 */       this.addedToEnergyNet = false;
/*     */     }
/*  61 */     this.loaded = false;
/*     */   }
/*     */   
/*     */   public void updateEntity()
/*     */   {
/*  66 */     super.updateEntity();
/*  67 */     if (this.worldObj.isRemote) {
/*  68 */       return;
/*     */     }
/*  70 */     if (!this.addedToEnergyNet) {
/*  71 */       onLoaded();
/*     */     }
/*  73 */     if ((this.lastX != this.xCoord) || (this.lastY != this.yCoord) || (this.lastZ != this.zCoord)) {
/*  74 */       this.lastX = this.xCoord;
/*  75 */       this.lastY = this.yCoord;
/*  76 */       this.lastZ = this.zCoord;
/*  77 */       onUnloaded();
/*  78 */       onLoaded();
/*     */     }
/*     */   }
/*     */   
/*     */   public void readFromNBT(NBTTagCompound nbt)
/*     */   {
/*  84 */     super.readFromNBT(nbt);
/*  85 */     if ((nbt.hasKey("lastX")) && (nbt.hasKey("lastY")) && (nbt.hasKey("lastZ"))) {
/*  86 */       this.lastX = nbt.getInteger("lastX");
/*  87 */       this.lastY = nbt.getInteger("lastY");
/*  88 */       this.lastZ = nbt.getInteger("lastZ");
/*     */     }
/*     */   }
/*     */   
/*     */   public void writeToNBT(NBTTagCompound nbt)
/*     */   {
/*  94 */     super.writeToNBT(nbt);
/*  95 */     nbt.setInteger("lastX", this.lastX);
/*  96 */     nbt.setInteger("lastY", this.lastY);
/*  97 */     nbt.setInteger("lastZ", this.lastZ);
/*     */   }
/*     */   
/*     */   public double getOfferedEnergy()
/*     */   {
/* 102 */     return QGeneratorsType.NORMAL.getOutput();
/*     */   }
/*     */   
/*     */ 
/*     */   public void drawEnergy(double amount) {}
/*     */   
/*     */ 
/*     */   public int getSourceTier()
/*     */   {
/* 111 */     return Integer.MAX_VALUE;
/*     */   }
/*     */   
/*     */   public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction)
/*     */   {
/* 116 */     return true;
/*     */   }
/*     */
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
// TODO Auto-generated method stub
return false;
}
@Override
public short getFacing() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setFacing(short facing) {
// TODO Auto-generated method stub
 
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 0;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return null;
} }
 
 
[/spoiler]
TileEntityQGHigh
[spoiler]
/*     */ package com.prototype.quantumgenerators.common.tiles;
/*     */ 
/*     */ import com.prototype.quantumgenerators.QGeneratorsType;
/*     */ import com.prototype.quantumgenerators.QuantumGenerators;
 
/*     */ import ic2.api.energy.event.EnergyTileLoadEvent;
/*     */ import ic2.api.energy.event.EnergyTileUnloadEvent;
/*     */ import ic2.api.energy.tile.IEnergySource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/*     */ import net.minecraft.nbt.NBTTagCompound;
/*     */ import net.minecraft.tileentity.TileEntity;
/*     */ import net.minecraftforge.common.MinecraftForge;
/*     */ import net.minecraftforge.common.util.ForgeDirection;
/*     */ 
/*     */ public class TileEntityQGHigh
/*     */   extends TileEntity
/*     */   implements IEnergySource, IWrenchable
/*     */ {
/*  19 */   private boolean loaded = false;
/*  20 */   private boolean addedToEnergyNet = false;
/*     */   private int lastX;
/*     */   private int lastY;
/*     */   private int lastZ;
/*     */   
/*  25 */   public void validate() { super.validate();
/*  26 */     if ((isInvalid()) || (!this.worldObj.blockExists(this.xCoord, this.yCoord, this.zCoord))) {
/*  27 */       return;
/*     */     }
/*  29 */     onLoaded();
/*     */   }
/*     */   
/*     */   public void invalidate()
/*     */   {
/*  34 */     if (this.loaded) {
/*  35 */       onUnloaded();
/*     */     }
/*  37 */     super.invalidate();
/*     */   }
/*     */   
/*     */   public void onLoaded() {
/*  41 */     if (QuantumGenerators.isSimulating()) {
/*  42 */       MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
/*  43 */       this.addedToEnergyNet = true;
/*     */     }
/*  45 */     this.loaded = true;
/*     */   }
/*     */   
/*     */   public void onChunkUnload()
/*     */   {
/*  50 */     if (this.loaded) {
/*  51 */       onUnloaded();
/*     */     }
/*  53 */     super.onChunkUnload();
/*     */   }
/*     */   
/*     */   public void onUnloaded() {
/*  57 */     if ((QuantumGenerators.isSimulating()) && (this.addedToEnergyNet)) {
/*  58 */       MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
/*  59 */       this.addedToEnergyNet = false;
/*     */     }
/*  61 */     this.loaded = false;
/*     */   }
/*     */   
/*     */   public void updateEntity()
/*     */   {
/*  66 */     super.updateEntity();
/*  67 */     if (this.worldObj.isRemote) {
/*  68 */       return;
/*     */     }
/*  70 */     if (!this.addedToEnergyNet) {
/*  71 */       onLoaded();
/*     */     }
/*  73 */     if ((this.lastX != this.xCoord) || (this.lastY != this.yCoord) || (this.lastZ != this.zCoord)) {
/*  74 */       this.lastX = this.xCoord;
/*  75 */       this.lastY = this.yCoord;
/*  76 */       this.lastZ = this.zCoord;
/*  77 */       onUnloaded();
/*  78 */       onLoaded();
/*     */     }
/*     */   }
/*     */   
/*     */   public void readFromNBT(NBTTagCompound nbt)
/*     */   {
/*  84 */     super.readFromNBT(nbt);
/*  85 */     this.lastX = nbt.getInteger("lastX");
/*  86 */     this.lastY = nbt.getInteger("lastY");
/*  87 */     this.lastZ = nbt.getInteger("lastZ");
/*     */   }
/*     */   
/*     */   public void writeToNBT(NBTTagCompound nbt)
/*     */   {
/*  92 */     super.writeToNBT(nbt);
/*  93 */     if ((nbt.hasKey("lastX")) && (nbt.hasKey("lastY")) && (nbt.hasKey("lastZ"))) {
/*  94 */       this.lastX = nbt.getInteger("lastX");
/*  95 */       this.lastY = nbt.getInteger("lastY");
/*  96 */       this.lastZ = nbt.getInteger("lastZ");
/*     */     }
/*     */   }
/*     */   
/*     */   public double getOfferedEnergy()
/*     */   {
/* 102 */     return QGeneratorsType.HIGH.getOutput();
/*     */   }
/*     */   
/*     */ 
/*     */   public void drawEnergy(double amount) {}
        
      
        public int getSourceTier()
        {
     return Integer.MAX_VALUE;
   }
  
  public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction)
   {
     return true;
   }
 
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
// TODO Auto-generated method stub
return false;
}
@Override
public short getFacing() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setFacing(short facing) {
// TODO Auto-generated method stub
 
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
// TODO Auto-generated method stub
return true;
}
@Override
public float getWrenchDropRate() {
// TODO Auto-generated method stub
return 0;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
// TODO Auto-generated method stub
return null;
} }
 
 
[/spoiler]
TileEntityQGUltra
[spoiler]
/*     */ package com.prototype.quantumgenerators.common.tiles;
/*     */ 
/*     */ import com.prototype.quantumgenerators.QGeneratorsType;
/*     */ import com.prototype.quantumgenerators.QuantumGenerators;
 
/*     */ import ic2.api.energy.event.EnergyTileLoadEvent;
/*     */ import ic2.api.energy.event.EnergyTileUnloadEvent;
/*     */ import ic2.api.energy.tile.IEnergySource;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/*     */ import net.minecraft.nbt.NBTTagCompound;
/*     */ import net.minecraft.tileentity.TileEntity;
/*     */ import net.minecraftforge.common.MinecraftForge;
/*     */ import net.minecraftforge.common.util.ForgeDirection;
/*     */ 
/*     */ public class TileEntityQGUltra
/*     */   extends TileEntity
/*     */   implements IEnergySource, IWrenchable
/*     */ {
/*  19 */   private boolean loaded = false;
/*  20 */   private boolean addedToEnergyNet = false;
/*     */   private int lastX;
/*     */   private int lastY;
/*     */   private int lastZ;
/*     */   
/*  25 */   public void validate() { super.validate();
/*  26 */     if ((isInvalid()) || (!this.worldObj.blockExists(this.xCoord, this.yCoord, this.zCoord))) {
/*  27 */       return;
/*     */     }
/*  29 */     onLoaded();
/*     */   }
/*     */   
/*     */   public void invalidate()
/*     */   {
/*  34 */     if (this.loaded) {
/*  35 */       onUnloaded();
/*     */     }
/*  37 */     super.invalidate();
/*     */   }
/*     */   
/*     */   public void onLoaded() {
/*  41 */     if (QuantumGenerators.isSimulating()) {
/*  42 */       MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
/*  43 */       this.addedToEnergyNet = true;
/*     */     }
/*  45 */     this.loaded = true;
/*     */   }
/*     */   
/*     */   public void onChunkUnload()
/*     */   {
/*  50 */     if (this.loaded) {
/*  51 */       onUnloaded();
/*     */     }
/*  53 */     super.onChunkUnload();
/*     */   }
/*     */   
/*     */   public void onUnloaded() {
/*  57 */     if ((QuantumGenerators.isSimulating()) && (this.addedToEnergyNet)) {
/*  58 */       MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
/*  59 */       this.addedToEnergyNet = false;
/*     */     }
/*  61 */     this.loaded = false;
/*     */   }
/*     */   
/*     */   public void updateEntity()
/*     */   {
/*  66 */     super.updateEntity();
/*  67 */     if (this.worldObj.isRemote) {
/*  68 */       return;
/*     */     }
/*  70 */     if (!this.addedToEnergyNet) {
/*  71 */       onLoaded();
/*     */     }
/*  73 */     if ((this.lastX != this.xCoord) || (this.lastY != this.yCoord) || (this.lastZ != this.zCoord)) {
/*  74 */       this.lastX = this.xCoord;
/*  75 */       this.lastY = this.yCoord;
/*  76 */       this.lastZ = this.zCoord;
/*  77 */       onUnloaded();
/*  78 */       onLoaded();
/*     */     }
/*     */   }
/*     */   
/*     */   public void readFromNBT(NBTTagCompound nbt)
/*     */   {
/*  84 */     super.readFromNBT(nbt);
/*  85 */     this.lastX = nbt.getInteger("lastX");
/*  86 */     this.lastY = nbt.getInteger("lastY");
/*  87 */     this.lastZ = nbt.getInteger("lastZ");
/*     */   }
/*     */   
/*     */   public void writeToNBT(NBTTagCompound nbt)
/*     */   {
/*  92 */     super.writeToNBT(nbt);
/*  93 */     if ((nbt.hasKey("lastX")) && (nbt.hasKey("lastY")) && (nbt.hasKey("lastZ"))) {
/*  94 */       this.lastX = nbt.getInteger("lastX");
/*  95 */       this.lastY = nbt.getInteger("lastY");
/*  96 */       this.lastZ = nbt.getInteger("lastZ");
/*     */     }
/*     */   }
/*     */   
/*     */   public double getOfferedEnergy()
/*     */   {
/* 102 */     return QGeneratorsType.ULTRA.getOutput();
/*     */   }
/*     */   
/*     */ 
/*     */   public void drawEnergy(double amount) {}
/*     */   
/*     */ 
/*     */   public int getSourceTier()
/*     */   {
/* 111 */     return Integer.MAX_VALUE;
/*     */   }
/*     */   
/*     */   public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction)
/*     */   {
/* 116 */     return true;
/*     */   }
/*     */
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
// TODO Auto-generated method stub
return false;
}
@Override
public short getFacing() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setFacing(short facing) {
// TODO Auto-generated method stub
 
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
// TODO Auto-generated method stub
return true;
}
@Override
public float getWrenchDropRate() {
// TODO Auto-generated method stub
return 0;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
// TODO Auto-generated method stub
return null;
} }
 
 
[/spoiler]
 
 
Или можно просто дописать после "implements IEnergySource" ", IWrenchable"
и в конце файла добавить методы
[spoiler]
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
 
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 0;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return null;
[/spoiler]

[/spoiler]

Ссылка на пак готовых TileEntity.java файлов -

[spoiler]

https://yadi.sk/d/E20i1RHu3MKDh3

[/spoiler]

Возможность скручивания ключом будет более логична для механизмов и это будет более легко для игроков, привыкшим скручивать механизмы ключом.

 

 

Надеюсь, меня "услышит" прототип и добавит эти недостающие части в Quantum Generators.

 

Ссылка на комментарий

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас
  • Сейчас на странице   0 пользователей

    • Нет пользователей, просматривающих эту страницу.
×
×
  • Создать...