fix: research table extension
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Timo Ley 2023-01-13 17:30:04 +01:00
parent 881e51ec6c
commit 0e909e82de
2 changed files with 22 additions and 15 deletions

View File

@ -24,7 +24,7 @@ apply from: './gradle/scripts/mixins.gradle'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = "1.6.0"
version = "1.6.1"
group= "dev.tilera"
archivesBaseName = "auracore"

View File

@ -1,30 +1,37 @@
package dev.tilera.auracore.api.research;
import java.lang.ref.WeakReference;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public abstract class ResearchTableExtension {
public World world;
public int xCoord;
public int yCoord;
public int zCoord;
public WeakReference<IResearchTable> researchTable;
public ResearchTableExtension(IResearchTable researchTable) {
this.world = researchTable.getWorld();
this.xCoord = researchTable.getXCoord();
this.yCoord = researchTable.getYCoord();
this.zCoord = researchTable.getZCoord();
this.researchTable = new WeakReference<>(researchTable);
}
public World getWorld() {
return researchTable.get().getWorld();
}
public int getXCoord() {
return researchTable.get().getXCoord();
}
public int getYCoord() {
return researchTable.get().getYCoord();
}
public int getZCoord() {
return researchTable.get().getZCoord();
}
public IResearchTable getResearchTable() {
TileEntity te = this.world.getTileEntity(this.xCoord, this.yCoord, this.zCoord);
if (te instanceof IResearchTable) {
return (IResearchTable) te;
}
return null;
return researchTable.get();
}
public abstract void writeToNBT(NBTTagCompound nbt);