diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBookletStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBookletStand.java new file mode 100644 index 000000000..aaa0902d4 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBookletStand.java @@ -0,0 +1,135 @@ +/* + * This file ("BlockBookletStand.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.blocks; + +import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; +import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet; +import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; +import de.ellpeck.actuallyadditions.mod.items.InitItems; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand; +import de.ellpeck.actuallyadditions.mod.util.AssetUtil; +import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; +import net.minecraft.profiler.Profiler; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import javax.annotation.Nonnull; + +@SuppressWarnings("deprecation") +public class BlockBookletStand extends BlockContainerBase implements IHudDisplay{ + + public BlockBookletStand(String name){ + super(Material.WOOD, name); + this.setHarvestLevel("axe", 0); + this.setHardness(1.0F); + this.setResistance(4.0F); + this.setSoundType(SoundType.WOOD); + } + + @Override + public boolean isOpaqueCube(IBlockState state){ + return false; + } + + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ + player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK_STAND.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); + return true; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.RARE; + } + + @Override + public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ + int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; + + if(rotation == 0){ + PosUtil.setMetadata(pos, world, 0, 2); + } + if(rotation == 1){ + PosUtil.setMetadata(pos, world, 3, 2); + } + if(rotation == 2){ + PosUtil.setMetadata(pos, world, 1, 2); + } + if(rotation == 3){ + PosUtil.setMetadata(pos, world, 2, 2); + } + + TileEntityBookletStand tile = (TileEntityBookletStand)world.getTileEntity(pos); + if(tile != null){ + if(tile.assignedPlayer == null){ + tile.assignedPlayer = player.getName(); + tile.markDirty(); + tile.sendUpdate(); + } + } + + super.onBlockPlacedBy(world, pos, state, player, stack); + } + + @Nonnull + @Override + public TileEntity createNewTileEntity(@Nonnull World world, int par2){ + return new TileEntityBookletStand(); + } + + @Override + @SideOnly(Side.CLIENT) + public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ + TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); + if(tile instanceof TileEntityBookletStand){ + EntrySet set = ((TileEntityBookletStand)tile).assignedEntry; + + String strg1; + String strg2; + if(set.entry == null){ + strg1 = "No entry saved! Save one if"; + strg2 = "you are the player who placed it!"; + } + else if(set.chapter == null){ + strg1 = set.entry.getLocalizedName(); + strg2 = "Page "+set.pageInIndex; + } + else{ + strg1 = set.chapter.getLocalizedName(); + strg2 = "Page "+set.page.getID(); + + AssetUtil.renderStackToGui(set.chapter.getDisplayItemStack() != null ? set.chapter.getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+10, 1F); + } + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg1, resolution.getScaledWidth()/2+25, resolution.getScaledHeight()/2+8, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg2, resolution.getScaledWidth()/2+25, resolution.getScaledHeight()/2+18, StringUtil.DECIMAL_COLOR_WHITE); + } + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java index 6246eda72..28dbfdd40 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java @@ -115,9 +115,12 @@ public class InitBlocks{ public static Block blockPillarQuartzStair; public static Block blockPillarQuartzSlab; + public static Block blockBookletStand; + public static void init(){ ModUtil.LOGGER.info("Initializing Blocks..."); + blockBookletStand = new BlockBookletStand("blockBookletStand"); blockItemViewer = new BlockItemViewer("blockItemViewer"); blockFireworkBox = new BlockFireworkBox("blockFireworkBox"); blockMiner = new BlockMiner("blockMiner"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java index 1635ea37d..c9b0821fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java @@ -43,7 +43,7 @@ public enum TheColoredLampColors{ for(int i = 0; i < values().length; i++){ String aName = values()[i].name; if(aName != null){ - if(aName.toLowerCase(Locale.ROOT).equals(actualName.toLowerCase(Locale.ROOT))){ + if(aName.equalsIgnoreCase(actualName)){ return values()[i]; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java index 2ba524ac3..da67629aa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java @@ -43,7 +43,7 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{ for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){ for(String triggerName : cloud.getTriggerNames()){ if(triggerName != null && theCloud.name != null){ - if(triggerName.toLowerCase(Locale.ROOT).equals(theCloud.name.toLowerCase(Locale.ROOT))){ + if(triggerName.equalsIgnoreCase(theCloud.name)){ GlStateManager.pushMatrix(); switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){ case 1: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBookletStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBookletStand.java new file mode 100644 index 000000000..186621476 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBookletStand.java @@ -0,0 +1,75 @@ +/* + * This file ("GuiBookletStand.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.booklet; + +import de.ellpeck.actuallyadditions.mod.network.PacketBookletStandButton; +import de.ellpeck.actuallyadditions.mod.network.PacketHandler; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import javax.annotation.Nonnull; + +@SideOnly(Side.CLIENT) +public class GuiBookletStand extends GuiBooklet{ + + private GuiButton buttonSetPage; + + private TileEntityBookletStand theStand; + + public GuiBookletStand(TileEntityBase theStand){ + super(null, false, false); + this.theStand = (TileEntityBookletStand)theStand; + } + + @Override + public void actionPerformed(GuiButton button){ + if(button == this.buttonSetPage){ + PacketHandler.theNetwork.sendToServer(new PacketBookletStandButton(this.theStand.getPos(), this.theStand.getWorld(), Minecraft.getMinecraft().thePlayer, this.currentEntrySet)); + } + super.actionPerformed(button); + } + + @SuppressWarnings("unchecked") + @Override + public void initGui(){ + super.initGui(); + + //Remove Bookmark Buttons + for(GuiButton bookmarkButton : this.bookmarkButtons){ + bookmarkButton.visible = false; + } + + this.buttonSetPage = new GuiButton(-100, this.guiLeft+this.xSize+10, this.guiTop+10, 100, 20, "Set Page"){ + @Override + public void drawButton(@Nonnull Minecraft mc, int x, int y){ + boolean unicodeBefore = mc.fontRendererObj.getUnicodeFlag(); + mc.fontRendererObj.setUnicodeFlag(false); + super.drawButton(mc, x, y); + mc.fontRendererObj.setUnicodeFlag(unicodeBefore); + } + }; + this.buttonList.add(this.buttonSetPage); + + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if(player != null && player.getName() != null){ + this.buttonSetPage.visible = player.getName().equalsIgnoreCase(this.theStand.assignedPlayer); + } + + //Open the pages the book was assigned + BookletUtils.openIndexEntry(this, this.theStand.assignedEntry.entry, this.theStand.assignedEntry.pageInIndex, true); + BookletUtils.openChapter(this, this.theStand.assignedEntry.chapter, this.theStand.assignedEntry.page); + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index 16e5a235e..80665ee9a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -70,6 +70,7 @@ public class InitBooklet{ //Miscellaneous new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeColorLens), new PageReconstructor(4, LensRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(8, LensRecipeHandler.recipeNetherWart).setNoText()).setImportant(); new BookletChapter("banners", ActuallyAdditionsAPI.entryMisc, new ItemStack(Items.BANNER, 1, 15), new PageTextOnly(1)); + new BookletChapter("bookStand", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBookletStand), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeBookStand).setNoText().setPageStacksWildcard()); new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText()); new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("", OreGen.QUARTZ_MIN).addTextReplacement("", OreGen.QUARTZ_MAX), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText()); new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText().setPageStacksWildcard()).setSpecial(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java index 635a7feae..1844454f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java @@ -85,9 +85,14 @@ public class BlockCrafting{ public static IRecipe recipeLaserRelayItem; public static IRecipe recipeLaserRelayItemWhitelist; public static IRecipe recipeItemInterface; + public static IRecipe recipeBookStand; public static void init(){ + //Book Stand + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockBookletStand), new ItemStack(InitItems.itemBooklet), "plankWood")); + recipeBookStand = RecipeUtil.lastIRecipe(); + //Firework Box if(ConfigCrafting.FIREWORK_BOX.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFireworkBox), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java index 8b3bea59a..b0aa01a77 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet; +import de.ellpeck.actuallyadditions.mod.booklet.GuiBookletStand; import de.ellpeck.actuallyadditions.mod.inventory.gui.*; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.util.ModUtil; @@ -155,6 +156,8 @@ public class GuiHandler implements IGuiHandler{ return new GuiRangedCollector(entityPlayer.inventory, tile, x, y, z, world); case MINER: return new GuiMiner(entityPlayer.inventory, tile); + case BOOK_STAND: + return new GuiBookletStand(tile); case LASER_RELAY_ITEM_WHITELIST: return new GuiLaserRelayItemWhitelist(entityPlayer.inventory, tile); default: @@ -190,6 +193,7 @@ public class GuiHandler implements IGuiHandler{ DIRECTIONAL_BREAKER, RANGED_COLLECTOR, MINER, + BOOK_STAND, LASER_RELAY_ITEM_WHITELIST; public final boolean checkTileEntity; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java index e6613e456..887e65bf3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java @@ -74,7 +74,7 @@ public class SpecialRenderInit{ //Does the player have one of the names from the list? String playerName = event.getEntityPlayer().getName(); if(entry.getKey() != null && playerName != null){ - if(entry.getKey().toLowerCase(Locale.ROOT).equals(playerName.toLowerCase(Locale.ROOT))){ + if(entry.getKey().equalsIgnoreCase(playerName)){ //Render the special Item/Block entry.getValue().render(event.getEntityPlayer(), event.getPartialRenderTick()); break; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketBookletStandButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketBookletStandButton.java new file mode 100644 index 000000000..546c0e182 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketBookletStandButton.java @@ -0,0 +1,94 @@ +/* + * This file ("PacketBookletStandButton.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.network; + +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.internal.IEntrySet; +import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand; +import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; + +public class PacketBookletStandButton implements IMessage{ + + private int worldID; + private int playerID; + + private NBTTagCompound entrySet; + private BlockPos tilePos; + + @SuppressWarnings("unused") + public PacketBookletStandButton(){ + + } + + public PacketBookletStandButton(BlockPos tilePos, World world, EntityPlayer player, IEntrySet set){ + this.tilePos = tilePos; + this.entrySet = set.writeToNBT(); + this.worldID = world.provider.getDimension(); + this.playerID = player.getEntityId(); + } + + @Override + public void fromBytes(ByteBuf buf){ + PacketBuffer buffer = new PacketBuffer(buf); + try{ + this.entrySet = buffer.readNBTTagCompoundFromBuffer(); + this.tilePos = buffer.readBlockPos(); + this.worldID = buffer.readInt(); + this.playerID = buffer.readInt(); + } + catch(Exception e){ + ModUtil.LOGGER.error("Something went wrong trying to receive a TileEntity packet!", e); + } + } + + @Override + public void toBytes(ByteBuf buf){ + PacketBuffer buffer = new PacketBuffer(buf); + + buffer.writeNBTTagCompoundToBuffer(this.entrySet); + buffer.writeBlockPos(this.tilePos); + buffer.writeInt(this.worldID); + buffer.writeInt(this.playerID); + } + + public static class Handler implements IMessageHandler{ + + @Override + public IMessage onMessage(PacketBookletStandButton message, MessageContext ctx){ + World world = DimensionManager.getWorld(message.worldID); + TileEntity tile = world.getTileEntity(message.tilePos); + EntityPlayer player = (EntityPlayer)world.getEntityByID(message.playerID); + + if(player != null && tile instanceof TileEntityBookletStand){ + TileEntityBookletStand stand = (TileEntityBookletStand)tile; + if(player.getName() != null && player.getName().equalsIgnoreCase(stand.assignedPlayer)){ + stand.assignedEntry = EntrySet.readFromNBT(message.entrySet); + stand.markDirty(); + stand.sendUpdate(); + } + } + + return null; + } + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java index 45bd82260..2c3a5fd5b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java @@ -30,5 +30,6 @@ public class PacketHandler{ theNetwork.registerMessage(PacketGuiString.Handler.class, PacketGuiString.class, 2, Side.SERVER); theNetwork.registerMessage(PacketParticle.Handler.class, PacketParticle.class, 3, Side.CLIENT); theNetwork.registerMessage(PacketUpdateTileEntity.Handler.class, PacketUpdateTileEntity.class, 4, Side.CLIENT); + theNetwork.registerMessage(PacketBookletStandButton.Handler.class, PacketBookletStandButton.class, 5, Side.SERVER); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBookletStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBookletStand.java new file mode 100644 index 000000000..4605cd892 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBookletStand.java @@ -0,0 +1,41 @@ +/* + * This file ("TileEntityBookletStand.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.tile; + +import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet; +import net.minecraft.nbt.NBTTagCompound; + +public class TileEntityBookletStand extends TileEntityBase{ + + public EntrySet assignedEntry = new EntrySet(null); + public String assignedPlayer; + + public TileEntityBookletStand(){ + super("bookletStand"); + } + + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ + super.writeSyncableNBT(compound, isForSync); + compound.setTag("SavedEntry", this.assignedEntry.writeToNBT()); + + if(this.assignedPlayer != null){ + compound.setString("Player", this.assignedPlayer); + } + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ + super.readSyncableNBT(compound, isForSync); + this.assignedEntry = EntrySet.readFromNBT(compound.getCompoundTag("SavedEntry")); + this.assignedPlayer = compound.getString("Player"); + } +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index b5591f675..d83eccabb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -21,6 +21,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nonnull; + public abstract class TileEntityLaserRelay extends TileEntityBase{ public static final int MAX_DISTANCE = 15; @@ -53,9 +55,10 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{ super.receiveSyncCompound(compound); } + @Nonnull @Override - public NBTTagCompound getSyncCompound(){ - NBTTagCompound compound = super.getSyncCompound(); + public NBTTagCompound getUpdateTag(){ + NBTTagCompound compound = super.getUpdateTag(); BlockPos thisPos = this.pos; ConcurrentSet connections = LaserRelayConnectionHandler.getInstance().getConnectionsFor(thisPos); diff --git a/src/main/resources/assets/actuallyadditions/blockstates/blockBookletStand.json b/src/main/resources/assets/actuallyadditions/blockstates/blockBookletStand.json new file mode 100644 index 000000000..fa2c48761 --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/blockstates/blockBookletStand.json @@ -0,0 +1,17 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "actuallyadditions:blockBookletStand", + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}], + "meta": { + "0": { "y" : 180 }, + "1": { "y" : 0 }, + "2": { "y" : 90 }, + "3": { "y" : 270 } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index b64e971e9..f9229f5b3 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -207,6 +207,7 @@ tile.actuallyadditions.blockLaserRelayItem.name=Item Laser Relay tile.actuallyadditions.blockLaserRelayItemWhitelist.name=Advanced Item Laser Relay tile.actuallyadditions.blockItemViewer.name=Item Interface tile.actuallyadditions.blockImpureIron.name=Impure Iron +tile.actuallyadditions.blockBookletStand.name=Wall-Mount Manual #ESD tile.actuallyadditions.blockInputter.name=ESD @@ -875,4 +876,8 @@ booklet.actuallyadditions.chapter.banners.name=Additional Banners booklet.actuallyadditions.chapter.banners.text.1=For special items in Actually Additions, there is also special Banner patterns. All of these just require the item next to the banner in the crafting grid with, optionally, a color. You can also combine them with a Shield like normal. The items that have a banner pattern are: The Actually Additions Manual The Phantom Connector The Leaf Blower (not the advanced version) The Drill (only the white one works due to the way banners work) booklet.actuallyadditions.chapter.lushCaves.name=Lush Caves -booklet.actuallyadditions.chapter.lushCaves.text.1=If you have ever done any Cave exploration, you will have probably noticed some caves that have trees and grass inside of them. These can be found at any height underground all over the world, and they can be very valuable when needing wood for torches and tools at some point. If you didn't ever see one before, look on the next page for a picture! \ No newline at end of file +booklet.actuallyadditions.chapter.lushCaves.text.1=If you have ever done any Cave exploration, you will have probably noticed some caves that have trees and grass inside of them. These can be found at any height underground all over the world, and they can be very valuable when needing wood for torches and tools at some point. If you didn't ever see one before, look on the next page for a picture! + +booklet.actuallyadditions.chapter.bookStand.name=Wall-Mount Manual +booklet.actuallyadditions.chapter.bookStand.text.1=The Manual Stand is a block that is supposed to mainly be used on Servers. You can, provided you are the person who placed it down, set a page in the GUI that will open when someone else accesses it by pressing the "Set Page"-button while being on the desired page. The Wall-Mount Manual does not save pages another player navigated to, meaing re-accessing the Manual will cause it to always end up on the page speficied by the placer. +booklet.actuallyadditions.chapter.bookStand.text.2=People were using this not to have to have a manual item on their hotbar. This is not supposed to be used for that, because the Actually Additions Manual has bookmarks and also keeps the page you were on before. This, however, does neither. This was also originally made for Better Than Minecon. But whatever. \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/models/block/blockBookletStand.json b/src/main/resources/assets/actuallyadditions/models/block/blockBookletStand.json new file mode 100644 index 000000000..aac95ee54 --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/models/block/blockBookletStand.json @@ -0,0 +1,459 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "actuallyadditions:blocks/models/modelCoffeeMachine", + "coffeeMachine": "actuallyadditions:blocks/models/modelCoffeeMachine" + }, + "elements": [ + { + "from": [3,0,1], + "to": [13,1,15], + "faces": { + "up": { + "uv": [2.1052632,0.26315784,2.7368422,1.5263159], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [2.999999,0.6842098,5.631579,2.68421], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [4.105262,1.3684217,5.052636,2.6315799], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [2.9473686,0.68421054,6.4210534,1.5263159], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [0,1.3400855,6.8,2.6], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [4.2105265,0.84210527,4.5263147,1.5263158], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [3,1,1], + "to": [13,10,7], + "faces": { + "up": { + "uv": [0.0,0.0,10.0,6.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,10.0,6.0], + "texture": "missingtexture" + }, + "west": { + "uv": [1.3684201,0.47368407,4.105262,1.5263153], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [1.5789478,0.31578958,5.157894,2.8421037], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [2,0,6,3], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [2,0,4,2], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [3,9,1], + "to": [13,11,12], + "faces": { + "up": { + "uv": [9.094739,1.0421052,10.568425,2.094737], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [2.3157897,0.21052635,6.000002,2.9999995], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [8.2,2.6,11.2,3], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [7.6,2.6,9,3], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [7.2,2.6,9,3], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [8.6,2.6,10,3], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [4,11,1], + "to": [12,14,9], + "faces": { + "up": { + "uv": [1.6,3,3.2,4.6], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [0.0,0.0,8.0,8.0], + "texture": "missingtexture" + }, + "west": { + "uv": [10.315789,1,10.4,1.6842105], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [9.684211,1.4736842,10.736842,1.8947369], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [9.326308,1.1271291,10.957892,1.4631579], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [10.2,0.6,10.8,1.2], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [7,8,9.5], + "to": [9,9,11.5], + "faces": { + "up": { + "uv": [0.0,0.0,2.0,2.0], + "texture": "missingtexture" + }, + "down": { + "uv": [9.684211,1.2631578,10.526316,1.8947369], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [9.7263155,1.2736838,10.357892,1.4842103], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [9.7263155,1.0526314,10.357892,2.1052628], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [10.105263,0.84210527,10.526316,1.8947369], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [10.105263,1.0526316,10.526316,1.6842105], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [6,1,9], + "to": [10,2,13], + "faces": { + "up": { + "uv": [7.368421,3.5789473,8,4.2], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [0.0,0.0,4.0,4.0], + "texture": "missingtexture" + }, + "west": { + "uv": [6.947369,3.3684208,7.7894735,4.157895], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [7.3684196,3.2105274,7.999996,4], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [7.578948,3.5789473,8.210525,4.2105265], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [6.968419,3.210528,8.021048,4], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [6,2,8], + "to": [10,7,9], + "faces": { + "up": { + "uv": [7.105263,3.6315806,8.15789,4.2105265], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [7.38947,3.3789477,7.810521,4.1684194], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [7.368421,3.6315784,8,4], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [7.2105265,3.4210534,7.8,4], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [6.915793,3.221051,7.8,4], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [7.526315,3.421054,8,4], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [6,2,13], + "to": [10,7,14], + "faces": { + "up": { + "uv": [7.5789475,3.7894738,8,4], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [6.999999,3.6,7.631578,3.9684215], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [7.368421,3.5789473,8,4], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [7.7894735,3.368421,8,3.7894738], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [7.157894,3.4210515,7.8,4], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [7.2,3.8,8,4], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [5,2,9], + "to": [6,7,13], + "faces": { + "up": { + "uv": [7.2105265,3.157895,7.999999,3.9999993], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [6.7894745,3.578949,7.842106,4], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [6.7684236,3.789474,8.242098,4.000001], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [7.7368455,3.578947,8,4.2], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [7.526315,3.368423,8,4], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [7.5789504,3.3684218,8,4], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [10,2,9], + "to": [11,7,13], + "faces": { + "up": { + "uv": [7.1578946,3.5789473,7.7894735,4], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [7.368421,3.7894738,7.5789475,4], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [7.1578946,3.4210515,7.6,3.8], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [6.9789453,3.2210534,8.031565,4.0105267], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [7.3684235,3.421053,8.210532,3.9999993], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [7.421055,3.210527,7.999999,4], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [4,2,10], + "to": [5,3,12], + "faces": { + "up": { + "uv": [6.778949,3.1894736,7.4105287,3.821053], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [7.2105265,3.210527,7.7894735,4.1578965], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [6.9473686,3.5789473,7.5789475,4], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [0.0,0.0,2.0,1.0], + "texture": "missingtexture" + }, + "north": { + "uv": [7.0000014,3.4210515,7.8,4], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [7.3684244,3.3684216,7.8,4], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [4,5,10], + "to": [5,6,12], + "faces": { + "up": { + "uv": [7.5789456,3.7894752,8.210522,4.2105274], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [7.5789475,3.7894738,8,4], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [6.8947353,3.5789483,7.5263157,3.9999993], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [0.0,0.0,2.0,1.0], + "texture": "missingtexture" + }, + "north": { + "uv": [7.2105207,3.2105284,8.210525,4.2105293], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [7.5789475,3.7894752,8.210524,4.2105284], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [3,3,10], + "to": [4,5,12], + "faces": { + "up": { + "uv": [7.421055,3.4736857,8.000004,4.000002], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [7.368421,3.5789473,8,3.7894738], + "texture": "#coffeeMachine" + }, + "west": { + "uv": [7.5789475,3.5789473,8,3.7894738], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [7.4736843,3.4736855,8.2105255,4.2105255], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [6.9684157,3.178948,7.3894744,4.021053], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [6.978949,3.5999997,7.610526,4.0210524], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [6,10.2,10.8], + "to": [7,11.2,11.8], + "faces": { + "up": { + "uv": [10.315789,2.4,10.4,2.6], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [9.4,2.2,9.8,2.6], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [9.4,2.4,9.6,2.6], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [9.4,2.2,9.8,2.6], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [9.4,2.2,9.8,2.6], + "texture": "#coffeeMachine" + } + } + }, + { + "from": [9,10.2,10.8], + "to": [10,11.2,11.8], + "faces": { + "up": { + "uv": [9.4,2.2,9.8,2.6], + "texture": "#coffeeMachine" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [9.4,2.2,9.8,2.6], + "texture": "#coffeeMachine" + }, + "east": { + "uv": [9.4,2.2,9.8,2.6], + "texture": "#coffeeMachine" + }, + "north": { + "uv": [9.4,2.2,9.8,2.6], + "texture": "#coffeeMachine" + }, + "south": { + "uv": [9.4,2.2,9.8,2.6], + "texture": "#coffeeMachine" + } + } + } + ] +} \ No newline at end of file