Skip to content

Commit

Permalink
implemented ITEM OVERHAUL
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj42 committed May 15, 2017
1 parent 55a3b01 commit ce4a818
Show file tree
Hide file tree
Showing 116 changed files with 2,192 additions and 2,435 deletions.
19 changes: 6 additions & 13 deletions Bugs and things to do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,28 @@ Note to self: for more little bugs/ideas/concerns, search code for "TODO"
####
I accidently removed the whole "SmashParticle" thing it seems... same with FireParticle...
####
Item->Funiture/Entity conversions still suffer from that wierd glitch when you try to take out a second out from you inv after putting one down; it basically deletes the first one.
####
Not sure, but broken/exploded obsidian brick may drop stone...it looks like stone.
####
Creeper one time, on lava level, w/ me in front of it, exploded, and left behind an odd square that had no texture, and didn't erase after an update to it... update, btw, that was an InfiniteFallTile.
The shift-g cheat totally glitches things up. Not any more than usual, but using it has always created all sorts of weird behavior with the inventory items; especially things like lanterns.
####
Sound effects don't always play when they should; mostly it seems when other sounds should be on at the same time.
####
Many item names don't fit on the black "active item" bar at the bottom.
####

LegacyLoad class is becoming annoying to handle; it should be reimplemented so that it won't have to be changed at all to reflect future updates. This could be done by making it only return values, and not actually reference any current variables. This may prove overcomplicated, though.
####
-----------------------------------------------------------------------------------

****IDEAS(that should probably be implemented)****
****

Make buckets in creative not fill up.
Mention of the title screen the alternate keys you can use to get around.

****

Make respawn without bed += 20 blocks x/y of last spawn.
Ok, so, for the sake of Loading and simplicity, everything that can should use some form of java utility, such as that things that get saved should implement Serializable; at the least, a toString() method should be made that provides all the necessary info to reconstruct that instance.

****

There's a lot to do in the Tile classes... many methods have many unnecessary parameters... and the torch effects account for all the "light" and "torch" static tiles in Tile.java. I think I'll make a HashMap out of that list, as well.

****

Take the random inv item adder methods in Level and DungeonChest, and move them to a public static method in Inventory.java.
Make respawn without bed += 20 blocks x/y of last spawn.

****

Expand Down
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Minicraft+ version 1.9.4
- Prevented Airwizard from being removed during daily entity clear.
* Increased Torch light radius; also, torches now work the same way on the surface as they do in the caves.
+ Added small tweak for creative mode: empty buckets will remain empty, so you can empty the ocean as much as you like. Full buckets remain full, as well.
+ Additional creative mode tweak: "attacking" mob spawner with hand changes the level of mob it spawns.
+ Added missingTexture sprite.
* Changed the name of a couple items (was abbreviated).

Minicraft+ version 1.9.3

Expand Down
4 changes: 4 additions & 0 deletions ideas for new additions.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
-------- Simple Ideas --------
----

Bacon. Just, Bacon.

----

Add world copy option, like rename and delete.

----
Expand Down
66 changes: 32 additions & 34 deletions src/minicraft/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.*;
import java.awt.event.*; // TODO these .*'s are unnecessary.
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
Expand All @@ -23,12 +23,13 @@
import minicraft.gfx.Screen;
import minicraft.gfx.SpriteSheet;
import minicraft.item.FurnitureItem;
import minicraft.item.ListItems;
import minicraft.item.ResourceItem;
import minicraft.item.Items;
import minicraft.item.StackableItem;
import minicraft.item.ToolItem;
import minicraft.item.ToolType;
import minicraft.item.resource.PotionResource;
import minicraft.item.resource.Resource;
import minicraft.item.PotionItem;
import minicraft.item.PotionType;
import minicraft.item.Items;
import minicraft.level.Level;
import minicraft.level.tile.Tile;
import minicraft.saveload.Load;
Expand Down Expand Up @@ -245,7 +246,7 @@ public void resetGame() {
-removes bed
-checks for diff, set if not already
-resets time of day to morning (via setTime())
-re-instantiates ListItems' item list
-re-instantiates Items' item list
-resets level array
-**goes through whole level load process
-resets player score
Expand All @@ -268,8 +269,8 @@ public void resetGame() {
changeTimeOfDay(Time.Morning); // resets tickCount; game starts in the day, so that it's nice and bright.
hasWon = false;

ListItems.items.clear(); //remove all the old item objects
new ListItems(); //make a fresh set
//Items.items.clear(); //remove all the old item objects
//new Items(); //make a fresh set
player = new Player(this, input); //very important that this is AFTER the previous 2 statements.

levels = new Level[6];
Expand Down Expand Up @@ -310,9 +311,7 @@ public void resetGame() {
}

// if resetStartGame is called when not loading a world, add an Iron lantern to level 5, at (984, 984).

FurnitureItem f1 = new FurnitureItem(new Lantern(Lantern.Type.IRON));
Furniture f = f1.furniture;
Furniture f = new Lantern(Lantern.Type.IRON);//Items.get("Iron Lantern").furniture;
f.x = 984;
f.y = 984;
levels[5].add(f);
Expand All @@ -335,7 +334,7 @@ public void resetGame() {
DeadMenu.shouldRespawn = true;

if(WorldGenMenu.get("Theme").equals("Hell")) {
player.inventory.add(new ResourceItem(Resource.lavapotion));
player.inventory.add(Items.get("lava potion"));
}

readyToRenderGameplay = true;
Expand Down Expand Up @@ -455,11 +454,10 @@ public void tick() {
if (input.getKey("3").clicked) changeTimeOfDay(Time.Evening);
if (input.getKey("4").clicked) changeTimeOfDay(Time.Night);

if (input.getKey("shift-g").clicked) {
for (int i = 0; i < ListItems.items.size(); i++) {
player.inventory.add((minicraft.item.Item) ListItems.items.get(i));
}
}
// this should not be needed, since the inventory should not be altered.
/*if (input.getKey("shift-g").clicked) {
Items.fillCreativeInv(player.inventory);
}*/

if(input.getKey("ctrl-h").clicked) player.health--;

Expand Down Expand Up @@ -575,7 +573,7 @@ public void render() {

// this creates the darkness in the caves
//if (!ModeMenu.creative && currentLevel < 4 && (currentLevel < 3 || time > 1)) {
if (currentLevel != 5 && (!ModeMenu.creative || currentLevel >= 3)) {
if (currentLevel != 5 && (currentLevel != 3 || tickCount < dayLength/4 || tickCount > dayLength/2) && (!ModeMenu.creative || currentLevel >= 3)) {
//if (currentLevel < 3) */lightScreen.clear(0); // clears the light screen to a black color
//else lightScreen.clear(255);
lightScreen.clear(0); // this doesn't mean that the pixel will be black; it means that the pixel will be DARK, by default; lightScreen is about light vs. dark, not necessarily a color. just how the light level it has, which is compared with the minimum light values in dither to decide whether to leave the cell alone, or mark it as "dark", which will do different things depending on the game level and time of day.
Expand Down Expand Up @@ -610,7 +608,7 @@ public void render() {
int xo = (getWidth() - ww) / 2 + getParent().getInsets().left;
int yo = (getHeight() - hh) / 2 + getParent().getInsets().top;
g.drawImage(image, xo, yo, ww, hh, null); //draws the image on the window
g.dispose(); // releases any system resources that are using this method. (so we don't have crappy framerates)
g.dispose(); // releases any system items that are using this method. (so we don't have crappy framerates)
bs.show(); // makes the picture visible. (probably)
}

Expand All @@ -623,7 +621,7 @@ private void renderGui() {
}
}
for (int x = 12; x < 29; x++) {
screen.render(x * 7, screen.h - 16 + 1 * 8, 32, Color.get(0, 0, 0, 0), 0);
screen.render(x * 7, screen.h - 16 + 1 * 8, 32, Color.get(0, 0), 0);
}

// player.xx and yy stores previous player position.
Expand Down Expand Up @@ -666,7 +664,7 @@ private void renderGui() {
if (ModeMenu.creative || player.ac >= 10000)
Font.draw(" x" + "^", screen, 84, screen.h - 16, Color.get(0, 333, 444, 555));
else
Font.draw(" x" + player.ac, screen, 84, screen.h - 16, Color.get(0, 555, 555, 555));
Font.draw(" x" + player.ac, screen, 84, screen.h - 16, Color.get(0, 555));
//displays arrow icon
screen.render(10 * 8 + 4, screen.h - 16, 13 + 5 * 32, Color.get(0, 111, 222, 430), 0);

Expand Down Expand Up @@ -709,14 +707,14 @@ private void renderGui() {
seconds %= 60;

int timeCol;
if(scoreTime >= 18000) timeCol = Color.get(0, 555, 555, 555);
else if (scoreTime >= 3600) timeCol = Color.get(330, 555, 555, 555);
else timeCol = Color.get(400, 555, 555, 555);
if(scoreTime >= 18000) timeCol = Color.get(0, 555);
else if (scoreTime >= 3600) timeCol = Color.get(330, 555);
else timeCol = Color.get(400, 555);

Font.draw("Time left " + (hours > 0 ? hours+"h ":"") + minutes + "m " + seconds + "s", screen, 84, screen.h - 190, timeCol);

if(multiplier > 1) {
int multColor = multiplier < 50 ? Color.get(-1, 540, 540, 540) : Color.get(-1, 500, 500, 500);
int multColor = multiplier < 50 ? Color.get(-1, 540) : Color.get(-1, 500);
Font.draw("X" + multiplier, screen, 260, screen.h - 190, multColor);
}
}
Expand All @@ -725,18 +723,18 @@ private void renderGui() {
if (player.activeItem instanceof ToolItem && ((ToolItem)player.activeItem).type == ToolType.FishingRod) {
int dura = ((ToolItem)player.activeItem).dur * 100 / ((ToolItem)player.activeItem).type.durability;
//if (dura > 100) dura = 100;
Font.draw(dura + "%", screen, 164, screen.h - 16, Color.get(0, 30, 30, 30));
Font.draw(dura + "%", screen, 164, screen.h - 16, Color.get(0, 30));
}

/// This renders the potions overlay
if(player.showpotioneffects && player.potioneffects.size() > 0) {
Map.Entry<String, Integer>[] effects = player.potioneffects.entrySet().toArray(new Map.Entry[0]);
Map.Entry<PotionType, Integer>[] effects = player.potioneffects.entrySet().toArray(new Map.Entry[0]);
// the key is potion type, value is remaining potion duration.
for(int i = 0; i < effects.length; i++) {
String pType = effects[i].getKey();
PotionType pType = effects[i].getKey();
int pTime = effects[i].getValue() / normSpeed;
int pcol = Color.get(PotionResource.potionColor(pType), 555, 555, 555);
Font.draw("("+input.getMapping("potionEffects")+" to hide!)", screen, 180, 9, Color.get(0, 555, 555, 555));
int pcol = Color.get(pType.dispColor, 555);
Font.draw("("+input.getMapping("potionEffects")+" to hide!)", screen, 180, 9, Color.get(0, 555));
Font.draw(pType + " (" + (pTime / 60) + ":" + (pTime % 60) + ")", screen, 180, 17 + i * 8, pcol);
}
}
Expand All @@ -757,8 +755,8 @@ private void renderGui() {

// renders armor
int armor = player.armor*10/player.maxArmor;
color = (i <= armor && player.curArmor != null) ? player.curArmor.color : Color.get(-1, -1, -1, -1);
screen.render(i * 8 + 208, screen.h - 8, 3 + 12 * 32, color, 0);
color = (i <= armor && player.curArmor != null) ? player.curArmor.sprite.color : Color.get(-1, -1, -1, -1);
screen.render(i * 8 + 208, screen.h - 8, 3 + 12 * 32, color, 0); // TODO make armoritem do the rendering?

if (player.staminaRechargeDelay > 0) {
// creates the white/gray blinking effect when you run out of stamina.
Expand Down Expand Up @@ -805,9 +803,9 @@ private void renderFocusNagger() {

//renders the focus nagger text with a flash effect...
if ((tickCount / 20) % 2 == 0) // ...medium yellow color
Font.draw(msg, screen, xx, yy, Color.get(5, 333, 333, 333));
Font.draw(msg, screen, xx, yy, Color.get(5, 333));
else // ...bright yellow color
Font.draw(msg, screen, xx, yy, Color.get(5, 555, 555, 555));
Font.draw(msg, screen, xx, yy, Color.get(5, 555));
}

/** This method is called when you interact with stairs, this will give you the transition effect. While changeLevel(int) just changes the level. */
Expand Down
20 changes: 0 additions & 20 deletions src/minicraft/crafting/ArrowRecipe.java

This file was deleted.

Loading

0 comments on commit ce4a818

Please sign in to comment.