mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Fix booklet stand not working on servers & crash when initializing booklet
This commit is contained in:
parent
abec9c81af
commit
a99ff70c4d
14 changed files with 52 additions and 15 deletions
|
@ -89,8 +89,8 @@ public class BlockBookletStand extends BlockContainerBase implements IActAddItem
|
||||||
TileEntityBookletStand tile = (TileEntityBookletStand)world.getTileEntity(x, y, z);
|
TileEntityBookletStand tile = (TileEntityBookletStand)world.getTileEntity(x, y, z);
|
||||||
if(tile != null){
|
if(tile != null){
|
||||||
//Assign a UUID
|
//Assign a UUID
|
||||||
if(tile.assignedPlayerUUID == null){
|
if(tile.assignedPlayer == null){
|
||||||
tile.assignedPlayerUUID = player.getUniqueID();
|
tile.assignedPlayer = player.getCommandSenderName();
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ import ellpeck.actuallyadditions.tile.TileEntityBookletStand;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiBookletStand extends GuiBooklet{
|
public class GuiBookletStand extends GuiBooklet{
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ public class GuiBookletStand extends GuiBooklet{
|
||||||
};
|
};
|
||||||
this.buttonList.add(this.buttonSetPage);
|
this.buttonList.add(this.buttonSetPage);
|
||||||
|
|
||||||
this.buttonSetPage.visible = Minecraft.getMinecraft().thePlayer.getUniqueID().equals(this.theStand.assignedPlayerUUID);
|
this.buttonSetPage.visible = Objects.equals(Minecraft.getMinecraft().thePlayer.getCommandSenderName(), this.theStand.assignedPlayer);
|
||||||
|
|
||||||
//Open the pages the book was assigned
|
//Open the pages the book was assigned
|
||||||
BookletUtils.openIndexEntry(this, this.theStand.assignedEntry, this.theStand.assignedPageInIndex, true);
|
BookletUtils.openIndexEntry(this, this.theStand.assignedEntry, this.theStand.assignedPageInIndex, true);
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.booklet.BookletUtils;
|
import ellpeck.actuallyadditions.booklet.BookletUtils;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
||||||
|
@ -58,6 +60,7 @@ public class BookletPage{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public static void renderItem(GuiScreen gui, ItemStack stack, int x, int y, float scale){
|
public static void renderItem(GuiScreen gui, ItemStack stack, int x, int y, float scale){
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
@ -113,19 +116,23 @@ public class BookletPage{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void updateScreen(int ticksElapsed){
|
public void updateScreen(int ticksElapsed){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
protected void renderTooltipAndTransfer(GuiBooklet gui, ItemStack stack, int x, int y, boolean checkAndTransfer, boolean mousePressed){
|
protected void renderTooltipAndTransfer(GuiBooklet gui, ItemStack stack, int x, int y, boolean checkAndTransfer, boolean mousePressed){
|
||||||
boolean flagBefore = gui.mc.fontRenderer.getUnicodeFlag();
|
boolean flagBefore = gui.mc.fontRenderer.getUnicodeFlag();
|
||||||
gui.mc.fontRenderer.setUnicodeFlag(false);
|
gui.mc.fontRenderer.setUnicodeFlag(false);
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.items.InitItems;
|
import ellpeck.actuallyadditions.items.InitItems;
|
||||||
import ellpeck.actuallyadditions.items.ItemCoffee;
|
import ellpeck.actuallyadditions.items.ItemCoffee;
|
||||||
|
@ -28,6 +30,7 @@ public class PageCoffeeRecipe extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
||||||
gui.drawTexturedModalRect(gui.guiLeft+19, gui.guiTop+20, 146, 94, 99, 60);
|
gui.drawTexturedModalRect(gui.guiLeft+19, gui.guiTop+20, 146, 94, 99, 60);
|
||||||
|
@ -35,6 +38,7 @@ public class PageCoffeeRecipe extends BookletPage{
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
String strg = "Coffee Machine Recipe";
|
String strg = "Coffee Machine Recipe";
|
||||||
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
@ -43,6 +45,7 @@ public class PageCrafting extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
if(this.recipes[this.recipePos] != null){
|
if(this.recipes[this.recipePos] != null){
|
||||||
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
||||||
|
@ -52,6 +55,7 @@ public class PageCrafting extends BookletPage{
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
IRecipe recipe = this.recipes[this.recipePos];
|
IRecipe recipe = this.recipes[this.recipePos];
|
||||||
|
|
||||||
|
@ -139,6 +143,7 @@ public class PageCrafting extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void updateScreen(int ticksElapsed){
|
public void updateScreen(int ticksElapsed){
|
||||||
if(ticksElapsed%15 == 0){
|
if(ticksElapsed%15 == 0){
|
||||||
if(this.recipePos+1 >= this.recipes.length){
|
if(this.recipePos+1 >= this.recipes.length){
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||||
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
||||||
|
@ -35,6 +37,7 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
if(recipe != null){
|
if(recipe != null){
|
||||||
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
||||||
|
@ -44,6 +47,7 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
if(recipe == null){
|
if(recipe == null){
|
||||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||||
|
@ -105,6 +109,7 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void updateScreen(int ticksElapsed){
|
public void updateScreen(int ticksElapsed){
|
||||||
if(ticksElapsed%10 == 0){
|
if(ticksElapsed%10 == 0){
|
||||||
List<ItemStack> outputTwos = this.recipe.getRecipeOutputTwos();
|
List<ItemStack> outputTwos = this.recipe.getRecipeOutputTwos();
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
@ -38,6 +40,7 @@ public class PageFurnace extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
if(this.input != null || this.getInputForOutput(this.result) != null){
|
if(this.input != null || this.getInputForOutput(this.result) != null){
|
||||||
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
||||||
|
@ -47,6 +50,7 @@ public class PageFurnace extends BookletPage{
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result);
|
ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result);
|
||||||
if(input == null){
|
if(input == null){
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -26,6 +28,7 @@ public class PagePicture extends PageTextOnly{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
gui.mc.getTextureManager().bindTexture(this.resLoc);
|
gui.mc.getTextureManager().bindTexture(this.resLoc);
|
||||||
gui.drawTexturedModalRect(gui.guiLeft, gui.guiTop, 0, 0, gui.xSize, gui.ySize);
|
gui.drawTexturedModalRect(gui.guiLeft, gui.guiTop, 0, 0, gui.xSize, gui.ySize);
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||||
|
@ -40,6 +42,7 @@ public class PageReconstructor extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void updateScreen(int ticksElapsed){
|
public void updateScreen(int ticksElapsed){
|
||||||
if(ticksElapsed%15 == 0){
|
if(ticksElapsed%15 == 0){
|
||||||
if(this.recipePos+1 >= this.recipes.length){
|
if(this.recipePos+1 >= this.recipes.length){
|
||||||
|
@ -52,6 +55,7 @@ public class PageReconstructor extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
if(this.recipes[this.recipePos] != null){
|
if(this.recipes[this.recipePos] != null){
|
||||||
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
gui.mc.getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
|
||||||
|
@ -61,6 +65,7 @@ public class PageReconstructor extends BookletPage{
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
ReconstructorRecipeHandler.Recipe recipe = this.recipes[this.recipePos];
|
ReconstructorRecipeHandler.Recipe recipe = this.recipes[this.recipePos];
|
||||||
if(recipe == null){
|
if(recipe == null){
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
@ -28,6 +30,7 @@ public class PageTextOnly extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
String text = gui.currentPage.getText();
|
String text = gui.currentPage.getText();
|
||||||
if(text != null && !text.isEmpty()){
|
if(text != null && !text.isEmpty()){
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class ItemDrill extends ItemEnergy{
|
||||||
//Notify the Player and log the Exception
|
//Notify the Player and log the Exception
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
player.addChatComponentMessage(new ChatComponentText("Ouch! That really hurt! You must have done something wrong, don't do that again please!"));
|
player.addChatComponentMessage(new ChatComponentText("Ouch! That really hurt! You must have done something wrong, don't do that again please!"));
|
||||||
ModUtil.LOGGER.error("Player "+player.getDisplayName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.dimensionId+" threw an Exception! Don't let that happen again!");
|
ModUtil.LOGGER.error("Player "+player.getCommandSenderName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.dimensionId+" threw an Exception! Don't let that happen again!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class SpecialRenderInit{
|
||||||
if(!specialList.isEmpty()){
|
if(!specialList.isEmpty()){
|
||||||
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
|
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
|
||||||
//Does the player have one of the names from the list?
|
//Does the player have one of the names from the list?
|
||||||
if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getDisplayName())){
|
if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getCommandSenderName())){
|
||||||
//Render the special Item/Block
|
//Render the special Item/Block
|
||||||
entry.getValue().render(event.entityPlayer);
|
entry.getValue().render(event.entityPlayer);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,6 +24,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class PacketBookletStandButton implements IMessage{
|
public class PacketBookletStandButton implements IMessage{
|
||||||
|
|
||||||
private int tileX;
|
private int tileX;
|
||||||
|
@ -92,7 +94,7 @@ public class PacketBookletStandButton implements IMessage{
|
||||||
EntityPlayer player = (EntityPlayer)world.getEntityByID(message.playerID);
|
EntityPlayer player = (EntityPlayer)world.getEntityByID(message.playerID);
|
||||||
|
|
||||||
if(tile instanceof TileEntityBookletStand){
|
if(tile instanceof TileEntityBookletStand){
|
||||||
if(player.getUniqueID().equals(((TileEntityBookletStand)tile).assignedPlayerUUID)){
|
if(Objects.equals(player.getCommandSenderName(), ((TileEntityBookletStand)tile).assignedPlayer)){
|
||||||
((TileEntityBookletStand)tile).setEntry(message.entryID, message.chapterID, message.pageID, message.pageInIndex);
|
((TileEntityBookletStand)tile).setEntry(message.entryID, message.chapterID, message.pageID, message.pageInIndex);
|
||||||
world.markBlockForUpdate(message.tileX, message.tileY, message.tileZ);
|
world.markBlockForUpdate(message.tileX, message.tileY, message.tileZ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@ import ellpeck.actuallyadditions.booklet.entry.BookletEntry;
|
||||||
import ellpeck.actuallyadditions.booklet.page.BookletPage;
|
import ellpeck.actuallyadditions.booklet.page.BookletPage;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class TileEntityBookletStand extends TileEntityBase{
|
public class TileEntityBookletStand extends TileEntityBase{
|
||||||
|
|
||||||
public BookletChapter assignedChapter;
|
public BookletChapter assignedChapter;
|
||||||
|
@ -25,7 +23,7 @@ public class TileEntityBookletStand extends TileEntityBase{
|
||||||
public BookletEntry assignedEntry;
|
public BookletEntry assignedEntry;
|
||||||
public int assignedPageInIndex;
|
public int assignedPageInIndex;
|
||||||
|
|
||||||
public UUID assignedPlayerUUID;
|
public String assignedPlayer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUpdate(){
|
public boolean canUpdate(){
|
||||||
|
@ -39,9 +37,8 @@ public class TileEntityBookletStand extends TileEntityBase{
|
||||||
compound.setInteger("Page", this.assignedPage == null ? -1 : this.assignedPage.getID());
|
compound.setInteger("Page", this.assignedPage == null ? -1 : this.assignedPage.getID());
|
||||||
compound.setInteger("PageInIndex", this.assignedPageInIndex);
|
compound.setInteger("PageInIndex", this.assignedPageInIndex);
|
||||||
|
|
||||||
if(this.assignedPlayerUUID != null){
|
if(this.assignedPlayer != null){
|
||||||
compound.setLong("PlayerLeastSignificant", this.assignedPlayerUUID.getLeastSignificantBits());
|
compound.setString("Player", this.assignedPlayer);
|
||||||
compound.setLong("PlayerMostSignificant", this.assignedPlayerUUID.getMostSignificantBits());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,9 +46,9 @@ public class TileEntityBookletStand extends TileEntityBase{
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
this.setEntry(compound.getInteger("Entry"), compound.getInteger("Chapter"), compound.getInteger("Page"), compound.getInteger("PageInIndex"));
|
this.setEntry(compound.getInteger("Entry"), compound.getInteger("Chapter"), compound.getInteger("Page"), compound.getInteger("PageInIndex"));
|
||||||
|
|
||||||
long mostSigBits = compound.getLong("PlayerMostSignificant");
|
String player = compound.getString("Player");
|
||||||
if(mostSigBits > 0){
|
if(player != null){
|
||||||
this.assignedPlayerUUID = new UUID(mostSigBits, compound.getLong("PlayerLeastSignificant"));
|
this.assignedPlayer = player;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue