mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Fixed a bug with WorldPos not returning the right thing on clients
This commit is contained in:
parent
11c78bf455
commit
b98e6839e4
4 changed files with 20 additions and 2 deletions
|
@ -30,6 +30,8 @@ import ellpeck.actuallyadditions.util.playerdata.PersistentClientData;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
|
@ -93,6 +95,12 @@ public class ClientProxy implements IProxy{
|
|||
SpecialRenderInit.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld(int worldID){
|
||||
World world = DimensionManager.getWorld(worldID);
|
||||
return world == null ? Minecraft.getMinecraft().theWorld : world;
|
||||
}
|
||||
|
||||
private static void registerRenderer(Class<? extends TileEntity> tileClass, RenderTileEntity tileRender, int renderID){
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(tileClass, tileRender);
|
||||
RenderingRegistry.registerBlockHandler(new RenderInventory(tileRender, renderID));
|
||||
|
|
|
@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.proxy;
|
|||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IProxy{
|
||||
|
||||
|
@ -21,4 +22,6 @@ public interface IProxy{
|
|||
void init(FMLInitializationEvent event);
|
||||
|
||||
void postInit(FMLPostInitializationEvent event);
|
||||
|
||||
World getWorld(int worldID);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ServerProxy implements IProxy{
|
||||
|
@ -32,4 +34,9 @@ public class ServerProxy implements IProxy{
|
|||
public void postInit(FMLPostInitializationEvent event){
|
||||
ModUtil.LOGGER.info("PostInitializing ServerProxy...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld(int worldID){
|
||||
return DimensionManager.getWorld(worldID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
package ellpeck.actuallyadditions.util;
|
||||
|
||||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public class WorldPos{
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class WorldPos{
|
|||
}
|
||||
|
||||
public World getWorld(){
|
||||
return DimensionManager.getWorld(this.worldID);
|
||||
return ActuallyAdditions.proxy.getWorld(this.worldID);
|
||||
}
|
||||
|
||||
public Material getMaterial(){
|
||||
|
|
Loading…
Reference in a new issue