mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-16 18:54:50 +00:00
Kinda there for tile entities, need to change actual block
This commit is contained in:
1 parent
f80424f91d
commit
ce84d5a3e5
10 files changed
+173
-5
No files matched your search
@@ -0,0 +1,40 @@
|
||||
package com.colen.postea.API;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class TileTransformer {
|
||||
|
||||
private final Class<? extends TileEntity> tileClass;
|
||||
private final Function<NBTTagCompound, NBTTagCompound> NBTModifierFunction;
|
||||
|
||||
public TileTransformer(Class<? extends TileEntity> tileClass, Function<NBTTagCompound, NBTTagCompound> NBTModifierFunction) {
|
||||
this.tileClass = tileClass;
|
||||
this.NBTModifierFunction = NBTModifierFunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null) return false;
|
||||
if (o instanceof TileTransformer that) {
|
||||
return (this.tileClass == that.tileClass);
|
||||
} else return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(tileClass);
|
||||
}
|
||||
|
||||
public void modifyNBT(NBTTagCompound nbt) {
|
||||
NBTModifierFunction.apply(nbt);
|
||||
}
|
||||
|
||||
public Class<? extends TileEntity> getTileClass() {
|
||||
return tileClass;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user