Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
Add 'encyclopedia', remove Yttric Steel, add Blunderbuss, new textures
Browse files Browse the repository at this point in the history
  • Loading branch information
Aesen Vismea committed Mar 6, 2015
1 parent 87aa78a commit debf6e2
Show file tree
Hide file tree
Showing 20 changed files with 244 additions and 6 deletions.
41 changes: 41 additions & 0 deletions src/main/java/com/gameminers/farrago/Encyclopedia.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.gameminers.farrago;

import java.util.List;
import java.util.Map;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import org.lwjgl.input.Keyboard;

import com.gameminers.farrago.kahur.KahurIota;
import com.google.common.collect.Maps;


public class Encyclopedia {
private static final Map<Item, String> descriptions = Maps.newHashMap();
public static void init() {
descriptions.put(KahurIota.KAHUR, "A strange weapon that uses everyday items as ammunition. The more complex they are, the more damage they do.");
descriptions.put(FarragoMod.RUBBLE, "Leftover trash from scrapping an object. Can be used as fuel in a furnace, but it will only last until all flammable material is burnt.");
descriptions.put(FarragoMod.VIVID_ORB, "This orb is capable of storing the very essence of a color.");
descriptions.put(Item.getItemFromBlock(FarragoMod.COMBUSTOR), "This machine uses gunpowder or TNT as an alternate, and very fast, way to smelt items.");
descriptions.put(Item.getItemFromBlock(FarragoMod.SCRAPPER), "This machine can break down items and blocks into what was used to craft them. It can only recover metals and gems, however.");
descriptions.put(Item.getItemFromBlock(FarragoMod.NETHER_STAR_BLOCK), "A solid block of Nether Stars. You're either rich or insane.");
descriptions.put(FarragoMod.BLUNDERBUSS, "This somewhat shoddy gun uses gunpowder to detonate cobblestone and fire the shards in the general direction it's pointed in. Good for crowd control.");
}
@SuppressWarnings("unchecked")
public static void process(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips) {
if (descriptions.containsKey(itemStack.getItem())) {
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
toolTip.add("\u00A7bInformation");
String descr = descriptions.get(itemStack.getItem());
toolTip.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(descr, 200));
} else {
toolTip.add("Hold \u00A7b<Shift> \u00A77for more information");
}
}
}

}
34 changes: 30 additions & 4 deletions src/main/java/com/gameminers/farrago/FarragoMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
Expand All @@ -38,7 +39,10 @@
import com.gameminers.farrago.block.BlockCombustor;
import com.gameminers.farrago.block.BlockOre;
import com.gameminers.farrago.block.BlockScrapper;
import com.gameminers.farrago.client.render.RenderBlunderbussProjectile;
import com.gameminers.farrago.entity.EntityBlunderbussProjectile;
import com.gameminers.farrago.gen.YttriumGenerator;
import com.gameminers.farrago.item.ItemBlunderbuss;
import com.gameminers.farrago.item.ItemDust;
import com.gameminers.farrago.item.ItemFondue;
import com.gameminers.farrago.item.ItemIngot;
Expand All @@ -49,6 +53,7 @@
import com.gameminers.farrago.tileentity.TileEntityScrapper;
import com.google.common.collect.Lists;

import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.Mod;
Expand All @@ -63,6 +68,7 @@
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(name="Farrago",modid="farrago",dependencies="required-after:KitchenSink;after:GlassPane",version="0.9")
Expand All @@ -83,6 +89,7 @@ public class FarragoMod {
public static ItemRubble RUBBLE;
public static ItemDust DUST;
public static ItemIngot INGOT;
public static ItemBlunderbuss BLUNDERBUSS;
public static ItemFondue FONDUE;
public static Map<Long, List<IRecipe>> recipes = new HashMap<Long, List<IRecipe>>();

Expand All @@ -108,11 +115,12 @@ public void onInit(FMLInitializationEvent e) {
COMBUSTOR = new BlockCombustor();
SCRAPPER = new BlockScrapper();
ORE = new BlockOre();
NETHER_STAR_BLOCK = new BlockCompressed(MapColor.adobeColor).setBlockTextureName("farrago:nether_star_block").setHardness(20f).setLightLevel(0.5f).setBlockName("nether_star_block");
NETHER_STAR_BLOCK = new BlockCompressed(MapColor.adobeColor).setBlockTextureName("farrago:nether_star_block").setHardness(20f).setLightLevel(0.5f).setBlockName("nether_star_block").setCreativeTab(creativeTab);
NETHER_STAR_BLOCK.setHarvestLevel("pickaxe", 2);
CAQUELON = new Item().setTextureName("farrago:caquelon").setMaxStackSize(1).setUnlocalizedName("caquelon");
VIVID_ORB = new ItemVividOrb();
RUBBLE = new ItemRubble();
BLUNDERBUSS = new ItemBlunderbuss();
DUST = new ItemDust();
INGOT = new ItemIngot();
FONDUE = new ItemFondue();
Expand All @@ -135,12 +143,15 @@ public int getBurnTime(ItemStack fuel) {
GameRegistry.registerBlock(SCRAPPER, "scrapper");
GameRegistry.registerBlock(NETHER_STAR_BLOCK, "netherStarBlock");
GameRegistry.registerBlock(ORE, "watashi");
GameRegistry.registerItem(BLUNDERBUSS, "blunderbuss");
GameRegistry.registerItem(CAQUELON, "caquelon");
GameRegistry.registerItem(RUBBLE, "rubble");
GameRegistry.registerItem(DUST, "dust");
GameRegistry.registerItem(INGOT, "ingot");
GameRegistry.registerItem(FONDUE, "fondue");
GameRegistry.registerItem(VIVID_ORB, "vividOrb");
EntityRegistry.registerModEntity(EntityBlunderbussProjectile.class, "blunderbussShot", 5, this, 64, 12, true);
RenderingRegistry.registerEntityRenderingHandler(EntityBlunderbussProjectile.class, new RenderBlunderbussProjectile());
ORE.registerOres();
DUST.registerOres();
INGOT.registerOres();
Expand All @@ -158,7 +169,7 @@ public int getBurnTime(ItemStack fuel) {
GameRegistry.addSmelting(new ItemStack(DUST, 1, 3), new ItemStack(Items.diamond), 0);
GameRegistry.addSmelting(new ItemStack(DUST, 1, 5), new ItemStack(INGOT, 1, 0), 0);
GameRegistry.addSmelting(new ItemStack(DUST, 1, 6), new ItemStack(INGOT, 1, 1), 0);
GameRegistry.addSmelting(new ItemStack(DUST, 1, 7), new ItemStack(INGOT, 1, 3), 0);
GameRegistry.addSmelting(new ItemStack(DUST, 1, 7), new ItemStack(INGOT, 1, 2), 0);
GameRegistry.addSmelting(new ItemStack(ORE, 1, 0), new ItemStack(INGOT, 1, 0), 0);
GameRegistry.registerWorldGenerator(yttrGen = new YttriumGenerator(), 0);
GameRegistry.addRecipe(new ItemStack(Items.nether_star, 9),
Expand Down Expand Up @@ -261,20 +272,30 @@ public int getBurnTime(ItemStack fuel) {
"III",
"IBI",
"IGI",
'I', "ingotYttriumSteel",
'I', "ingotYttrium",
'B', Blocks.iron_bars,
'G', Items.gunpowder
));
GameRegistry.addRecipe(new ShapedOreRecipe(SCRAPPER,
"III",
"QPQ",
"BDB",
'I', "ingotIron",
'I', "ingotYttrium",
'Q', Items.quartz,
'B', "blockIron",
'D', "gemDiamond",
'P', Blocks.heavy_weighted_pressure_plate
));
GameRegistry.addRecipe(new ShapedOreRecipe(BLUNDERBUSS,
" I ",
"IYG",
" BC",
'I', "ingotIron",
'Y', "ingotYttrium",
'C', "ingotYttriumCopper",
'G', Items.gunpowder,
'B', Items.blaze_rod
));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(DUST, 2, 6), "dustCopper", "dustYttrium"));
OreDictionary.registerOre("dyeRed", new ItemStack(DUST, 1, 5));
for (Iota iota : subMods) {
Expand Down Expand Up @@ -327,6 +348,10 @@ public void onDataSave(ChunkDataEvent.Save e) {
}
private Deque<Chunk> chunksToGen = new ArrayDeque<Chunk>();
@SubscribeEvent
public void onTooltip(ItemTooltipEvent e) {
Encyclopedia.process(e.itemStack, e.entityPlayer, e.toolTip, e.showAdvancedItemTooltips);
}
@SubscribeEvent
public void onDataLoad(ChunkDataEvent.Load e) {
// TODO: Incremental retrogen
if (!"yttrium".equals(e.getData().getString("farrago:RetroGenKey"))) {
Expand Down Expand Up @@ -354,6 +379,7 @@ public void onPostInit(FMLPostInitializationEvent e) {
copperlessEnvironment = true;
log.warn("We are running in a copperless environment; enabling fallback copper dust drops from Yttrium ore");
}
Encyclopedia.init();
}
@EventHandler
public void onAvailable(FMLLoadCompleteEvent e) {
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/gameminers/farrago/client/render/ModelNull.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.gameminers.farrago.client.render;

import net.minecraft.client.model.ModelBase;

public class ModelNull extends ModelBase {

public ModelNull(int w, int h) {
textureWidth = w;
textureHeight = h;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.gameminers.farrago.client.render;

import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

public class RenderBlunderbussProjectile extends Render {
private static final ResourceLocation TEX = new ResourceLocation("textures/blocks/cobblestone.png");
@Override
public void doRender(Entity projectile, double x, double y, double z, float yaw, float partialTicks) {
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glScalef(0.25f, 0.25f, 0.25f);
bindEntityTexture(projectile);
Tessellator tess = Tessellator.instance;
ModelBox box = new ModelBox(new ModelRenderer(new ModelNull(16, 16)), 0, 0, 0f, 0f, 0f, 4, 4, 4, 1f);
box.render(tess, 0.0625f);
GL11.glPopMatrix();
}

@Override
protected ResourceLocation getEntityTexture(Entity projectile) {
return TEX;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.gameminers.farrago.entity;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;

public class EntityBlunderbussProjectile extends EntityThrowable {
public EntityBlunderbussProjectile(World p_i1773_1_) {
super(p_i1773_1_);
}

public EntityBlunderbussProjectile(World world, EntityLivingBase shooter) {
super(world, shooter);
this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch);
this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
this.posY -= 0.10000000149011612D;
this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
this.setPosition(this.posX, this.posY, this.posZ);
this.yOffset = 0.0F;
float f = (rand.nextFloat()*0.8f)+0.2f;
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
this.motionY = (double)(-MathHelper.sin((this.rotationPitch + this.func_70183_g()) / 180.0F * (float)Math.PI) * f);
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.func_70182_d(), 25.0F);
}

public EntityBlunderbussProjectile(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) {
super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
}

@Override
protected void onImpact(MovingObjectPosition pos) {
setDead();
if (!worldObj.isRemote) {
if (pos.entityHit != null && pos.entityHit instanceof EntityLivingBase) {
((EntityLivingBase)pos.entityHit).attackEntityFrom(DamageSource.causeMobDamage(getThrower()), (rand.nextFloat()*1f)+0.6f);
((EntityLivingBase)pos.entityHit).hurtResistantTime = 1;
}
if (worldObj instanceof WorldServer) {
((WorldServer)worldObj).func_147487_a("smoke", pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 1, 0.2f, 0.2f, 0.2f, 0f);
((WorldServer)worldObj).playSoundAtEntity(this, "step.stone", 1.0f, 0.3f);
}
}
}
}
77 changes: 77 additions & 0 deletions src/main/java/com/gameminers/farrago/item/ItemBlunderbuss.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.gameminers.farrago.item;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;

import com.gameminers.farrago.FarragoMod;
import com.gameminers.farrago.entity.EntityBlunderbussProjectile;

public class ItemBlunderbuss extends Item {
public ItemBlunderbuss() {
setUnlocalizedName("blunderbuss");
setTextureName("farrago:blunderbuss");
setCreativeTab(FarragoMod.creativeTab);
}

@Override
public boolean isFull3D() {
return true;
}

@Override
public int getItemStackLimit() {
return 1;
}

@Override
public boolean isDamageable() {
return true;
}

@Override
public int getMaxDamage() {
return 840;
}

@Override
public ItemStack onItemRightClick(ItemStack gun, World world, EntityPlayer player) {
if (player.inventory.hasItem(Items.gunpowder)) {
if (player.inventory.hasItem(Item.getItemFromBlock(Blocks.cobblestone))) {
if (!world.isRemote) {
if (itemRand.nextInt(4) == 1) {
player.inventory.consumeInventoryItem(Items.gunpowder);
player.inventory.consumeInventoryItem(Item.getItemFromBlock(Blocks.cobblestone));
}
if (itemRand.nextInt(12) == 1) {
player.attackEntityFrom(DamageSource.causePlayerDamage(player), 2f);
}
player.inventory.consumeInventoryItem(Item.getItemFromBlock(Blocks.cobblestone));
gun.damageItem(itemRand.nextInt(3)+1, player);
world.playSoundAtEntity(player, "random.break", 1.0F, (itemRand.nextFloat() * 0.8F));
world.playSoundAtEntity(player, "random.explode", 0.6F, (itemRand.nextFloat() * 0.8F + 0.3F));
for (int i = 0; i < itemRand.nextInt(30)+15; i++) {
EntityBlunderbussProjectile proj = new EntityBlunderbussProjectile(world, player);
world.spawnEntityInWorld(proj);
}
}
} else {
if (!world.isRemote) {
world.playSoundAtEntity(player, "random.click", 1.0F, 2.0f);
player.addChatMessage(new ChatComponentText("\u00A7cCan't find any cobblestone."));
}
}
} else {
if (!world.isRemote) {
world.playSoundAtEntity(player, "random.click", 1.0F, 2.0f);
player.addChatMessage(new ChatComponentText("\u00A7cCan't find any gunpowder."));
}
}
return gun;
}
}
1 change: 0 additions & 1 deletion src/main/java/com/gameminers/farrago/item/ItemIngot.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class ItemIngot extends Item {
private String[] ingotTypes = {
"yttrium",
"yttrium_copper",
"yttrium_steel",
"copper"
};
private IIcon[] iconsByDamage = new IIcon[ingotTypes.length];
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/farrago/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ language.name=English
language.region=US
language.code=en_US

item.kahur.name=Kahur
itemGroup.farrago=Farrago

item.kahur.name=Kahur
item.blunderbuss.name=Blunderbuss

tile.combustor.name=Combustor
container.combustor=Combustor

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit debf6e2

Please sign in to comment.