mirror of
https://github.com/KAMKEEL/CustomNPC-Gecko-Addon.git
synced 2026-11-13 06:37:35 +00:00
Fixed server compatibility of the mod
This commit is contained in:
1 parent
85c3fb5f8b
commit
fe823736b0
3 files changed
+16
-3
No files matched your search
@@ -9,6 +9,8 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import software.bernie.example.block.tile.BotariumTileEntity;
|
||||
|
||||
@@ -24,4 +26,8 @@ public class CommonProxy {
|
||||
GameRegistry.registerTileEntity(TileEntityCustomModel.class, "custommodeltile");
|
||||
NpcAPI.Instance().addGlobalObject("GeckoAPI", AbstractGeckoAPI.Instance());
|
||||
}
|
||||
|
||||
public World getWorldById(int id){
|
||||
return MinecraftServer.getServer().worldServers[id];
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import com.goodbird.npcgecko.tile.TileEntityCustomModel;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@@ -19,4 +21,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCustomModel.class, new RenderTileCustomModel());
|
||||
}
|
||||
|
||||
public World getWorldById(int id){
|
||||
return Minecraft.getMinecraft().theWorld;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.goodbird.npcgecko.mixin.impl;
|
||||
|
||||
import com.goodbird.npcgecko.CustomNpcPlusGecko;
|
||||
import com.goodbird.npcgecko.tile.TileEntityCustomModel;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -24,9 +25,10 @@ public class TileScriptedMixin {
|
||||
if(compound.hasKey("renderTileTag")){
|
||||
renderTile = new TileEntityCustomModel();
|
||||
NBTTagCompound saveTag = compound.getCompoundTag("renderTileTag");
|
||||
if(MinecraftServer.getServer()!=null && saveTag.hasKey("dimID")){
|
||||
World world = MinecraftServer.getServer().worldServers[saveTag.getInteger("dimID")];
|
||||
renderTile.setWorldObj(world);
|
||||
if(saveTag.hasKey("dimID")){
|
||||
renderTile.setWorldObj(CustomNpcPlusGecko.proxy.getWorldById(saveTag.getInteger("dimID")));
|
||||
}else{
|
||||
renderTile.setWorldObj(CustomNpcPlusGecko.proxy.getWorldById(0));
|
||||
}
|
||||
renderTile.readFromNBT(saveTag);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user