mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-13 00:47:53 +00:00
Need world obj
This commit is contained in:
1 parent
ce84d5a3e5
commit
c8066d5d2b
2 files changed
+17
-1
No files matched your search
@@ -1,8 +1,10 @@
|
||||
package com.colen.postea.API;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
@@ -37,4 +39,12 @@ public class TileTransformer {
|
||||
public Class<? extends TileEntity> getTileClass() {
|
||||
return tileClass;
|
||||
}
|
||||
|
||||
public void setBlock(NBTTagCompound nbt, World world) {
|
||||
int x = nbt.getInteger("x");
|
||||
int y = nbt.getInteger("y");
|
||||
int z = nbt.getInteger("z");
|
||||
|
||||
Minecraft.getMinecraft().theWorld.setBlock(x, y, z, Blocks.chest);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.colen.postea.API.TileTransformer;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -23,6 +24,10 @@ public class MixinTileEntity {
|
||||
@Shadow
|
||||
private static Map nameToClassMap;
|
||||
|
||||
@Shadow
|
||||
protected World worldObj;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new entity and loads its data from the specified NBT.
|
||||
*/
|
||||
@@ -42,6 +47,7 @@ public class MixinTileEntity {
|
||||
oclass = (Class)nameToClassMap.get(tileEntityStringName);
|
||||
} else {
|
||||
oclass = tileTransformer.getTileClass();
|
||||
tileTransformer.setBlock(nbt, theWorld);
|
||||
tileTransformer.modifyNBT(nbt);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user