forked from AE2-UEL/AE2FluidCraft-Rework
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from asdflj/bookmark
add fluid storage monitor
- Loading branch information
Showing
28 changed files
with
9,826 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/com/glodblock/github/client/render/ItemWalrusRender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.glodblock.github.client.render; | ||
|
||
import com.glodblock.github.FluidCraft; | ||
import com.glodblock.github.common.tile.TileWalrus; | ||
import com.glodblock.github.loader.ItemAndBlockHolder; | ||
import cpw.mods.fml.client.registry.ClientRegistry; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.client.IItemRenderer; | ||
import net.minecraftforge.client.MinecraftForgeClient; | ||
import net.minecraftforge.client.model.AdvancedModelLoader; | ||
import net.minecraftforge.client.model.IModelCustom; | ||
import org.lwjgl.opengl.GL11; | ||
|
||
public class ItemWalrusRender implements IItemRenderer { | ||
IModelCustom modelWalrus = AdvancedModelLoader.loadModel(FluidCraft.resource("models/walrus.obj")); | ||
ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png"); | ||
|
||
public ItemWalrusRender() { | ||
ClientRegistry.bindTileEntitySpecialRenderer(TileWalrus.class, new RenderBlockWalrus()); | ||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ItemAndBlockHolder.WALRUS), this); | ||
} | ||
|
||
@Override | ||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) { | ||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus); | ||
GL11.glPushMatrix(); | ||
switch (type) { | ||
case ENTITY: | ||
break; | ||
case EQUIPPED: | ||
break; | ||
case EQUIPPED_FIRST_PERSON: | ||
GL11.glRotated(180, 0, 1, 0); | ||
GL11.glTranslatef(-1F, 0.5F, -0.5F); | ||
break; | ||
case FIRST_PERSON_MAP: | ||
break; | ||
case INVENTORY: | ||
GL11.glTranslatef(-0.5F, -0.5F, -0.1F); | ||
break; | ||
default: | ||
break; | ||
} | ||
this.modelWalrus.renderAll(); | ||
GL11.glPopMatrix(); | ||
} | ||
|
||
@Override | ||
public boolean shouldUseRenderHelper( | ||
IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) { | ||
return true; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/glodblock/github/client/render/RenderBlockWalrus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.glodblock.github.client.render; | ||
|
||
import com.glodblock.github.FluidCraft; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.client.model.AdvancedModelLoader; | ||
import net.minecraftforge.client.model.IModelCustom; | ||
import org.lwjgl.opengl.GL11; | ||
|
||
public class RenderBlockWalrus extends TileEntitySpecialRenderer { | ||
IModelCustom modelWalrus = AdvancedModelLoader.loadModel(FluidCraft.resource("models/walrus.obj")); | ||
ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png"); | ||
|
||
@Override | ||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) { | ||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus); | ||
GL11.glPushMatrix(); | ||
GL11.glTranslated(x + 0.5, y, z + 0.5); | ||
int orientation = tileentity.getBlockMetadata(); | ||
if (orientation == 4) { | ||
GL11.glRotatef(90, 0, 1, 0); | ||
} else if (orientation == 5) { | ||
GL11.glRotatef(-90, 0, 1, 0); | ||
} else if (orientation == 3) { | ||
GL11.glRotatef(180, 0, 1, 0); | ||
} | ||
this.modelWalrus.renderAll(); | ||
GL11.glPopMatrix(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/glodblock/github/common/block/BaseBlockContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.glodblock.github.common.block; | ||
|
||
import java.util.List; | ||
import net.minecraft.block.BlockContainer; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public abstract class BaseBlockContainer extends BlockContainer { | ||
|
||
public BaseBlockContainer(Material p_i45386_1_) { | ||
super(p_i45386_1_); | ||
} | ||
|
||
public void addInformation( | ||
ItemStack itemStack, EntityPlayer player, List<String> toolTip, boolean advancedToolTips) {} | ||
} |
115 changes: 115 additions & 0 deletions
115
src/main/java/com/glodblock/github/common/block/BlockWalrus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package com.glodblock.github.common.block; | ||
|
||
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown; | ||
|
||
import com.glodblock.github.common.item.BaseItemBlockContainer; | ||
import com.glodblock.github.common.tabs.FluidCraftingTabs; | ||
import com.glodblock.github.common.tile.TileWalrus; | ||
import com.glodblock.github.util.NameConst; | ||
import cpw.mods.fml.common.registry.GameRegistry; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import java.util.List; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.MathHelper; | ||
import net.minecraft.world.IBlockAccess; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.common.util.ForgeDirection; | ||
|
||
public class BlockWalrus extends BaseBlockContainer { | ||
|
||
public BlockWalrus() { | ||
super(Material.clay); | ||
setHardness(2.0F); | ||
setResistance(10.0F); | ||
setBlockName(NameConst.BLOCK_WALRUS); | ||
} | ||
|
||
@Override | ||
public boolean isOpaqueCube() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public TileEntity createNewTileEntity(World world, int meta) { | ||
return new TileWalrus(); | ||
} | ||
|
||
@Override | ||
public int getRenderType() { | ||
return -1; | ||
} | ||
|
||
@Override | ||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) { | ||
int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; | ||
|
||
if (l == 0) { | ||
world.setBlockMetadataWithNotify(x, y, z, 2, 2); | ||
} | ||
|
||
if (l == 1) { | ||
world.setBlockMetadataWithNotify(x, y, z, 5, 2); | ||
} | ||
|
||
if (l == 2) { | ||
world.setBlockMetadataWithNotify(x, y, z, 3, 2); | ||
} | ||
|
||
if (l == 3) { | ||
world.setBlockMetadataWithNotify(x, y, z, 4, 2); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean renderAsNormalBlock() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) { | ||
switch (ForgeDirection.getOrientation(blockAccess.getBlockMetadata(x, y, z))) { | ||
case NORTH: | ||
setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F); | ||
break; | ||
case EAST: | ||
setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F); | ||
break; | ||
case SOUTH: | ||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F); | ||
break; | ||
case WEST: | ||
setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); | ||
break; | ||
default: | ||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); | ||
break; | ||
} | ||
} | ||
|
||
public BlockWalrus register() { | ||
GameRegistry.registerBlock(this, BaseItemBlockContainer.class, NameConst.BLOCK_WALRUS); | ||
GameRegistry.registerTileEntity(TileWalrus.class, NameConst.BLOCK_WALRUS); | ||
setCreativeTab(FluidCraftingTabs.INSTANCE); | ||
return this; | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
public void addInformation( | ||
final ItemStack itemStack, | ||
final EntityPlayer player, | ||
final List<String> toolTip, | ||
final boolean advancedToolTips) { | ||
|
||
if (isShiftKeyDown()) { | ||
toolTip.add(NameConst.i18n(NameConst.TT_WALRUS_DESC)); | ||
} else { | ||
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE)); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/glodblock/github/common/item/BaseItemBlockContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.glodblock.github.common.item; | ||
|
||
import com.glodblock.github.common.block.BaseBlockContainer; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import java.util.List; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemBlock; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class BaseItemBlockContainer extends ItemBlock { | ||
private final BaseBlockContainer blockType; | ||
|
||
public BaseItemBlockContainer(Block id) { | ||
super(id); | ||
this.blockType = (BaseBlockContainer) id; | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
@SuppressWarnings("unchecked") | ||
public void addInformation( | ||
final ItemStack itemStack, final EntityPlayer player, final List toolTip, final boolean advancedToolTips) { | ||
blockType.addInformation(itemStack, player, toolTip, advancedToolTips); | ||
} | ||
} |
Oops, something went wrong.