Skip to content

Commit

Permalink
Merge branch 'main' into resourcepack
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristofferHolmesland authored Jan 19, 2023
2 parents a70ae83 + 19dd7e5 commit ae7e9a0
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 15 deletions.
6 changes: 4 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ but some sections are changed to compliant this project.
* For localizations, sounds, textures, books
* Does not rule out the possibility of addition of a standard resource manager
* Reapplied the role of seeds (the sameness with same seed)
* Now renders the parent display as background.
* Changed the height requirement on skin images from 32 pixels to 16 pixels.
* Now renders the parent display as background
* Changed the height requirement on skin images from 32 pixels to 16 pixels
* Fixed lights disappearing when out of screen
* Improved player's tile indicator

### Removals

Expand Down
55 changes: 44 additions & 11 deletions src/main/java/minicraft/entity/mob/Player.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,65 @@
package minicraft.entity.mob;

import java.util.HashMap;
import java.util.List;

import org.jetbrains.annotations.Nullable;

import minicraft.core.Game;
import minicraft.core.Updater;
import minicraft.core.World;
import minicraft.core.io.InputHandler;
import minicraft.core.io.Settings;
import minicraft.core.io.Sound;
import minicraft.entity.*;
import minicraft.entity.Arrow;
import minicraft.entity.ClientTickable;
import minicraft.entity.Direction;
import minicraft.entity.Entity;
import minicraft.entity.ItemEntity;
import minicraft.entity.ItemHolder;
import minicraft.entity.furniture.Bed;
import minicraft.entity.furniture.DeathChest;
import minicraft.entity.furniture.Furniture;
import minicraft.entity.furniture.Tnt;
import minicraft.entity.particle.Particle;
import minicraft.entity.particle.TextParticle;
import minicraft.gfx.*;
import minicraft.gfx.Color;
import minicraft.gfx.Point;
import minicraft.gfx.Rectangle;
import minicraft.gfx.Screen;
import minicraft.gfx.Sprite;
import minicraft.gfx.SpriteLinker.LinkedSprite;
import minicraft.gfx.SpriteLinker.SpriteType;
import minicraft.item.*;
import minicraft.item.ArmorItem;
import minicraft.item.FishingData;
import minicraft.item.FishingRodItem;
import minicraft.item.FurnitureItem;
import minicraft.item.Inventory;
import minicraft.item.Item;
import minicraft.item.Items;
import minicraft.item.PotionItem;
import minicraft.item.PotionType;
import minicraft.item.PowerGloveItem;
import minicraft.item.Recipes;
import minicraft.item.StackableItem;
import minicraft.item.TileItem;
import minicraft.item.ToolItem;
import minicraft.item.ToolType;
import minicraft.level.Level;
import minicraft.level.tile.Tile;
import minicraft.level.tile.Tiles;
import minicraft.network.Analytics;
import minicraft.saveload.Save;
import minicraft.screen.*;
import minicraft.screen.AchievementsDisplay;
import minicraft.screen.CraftingDisplay;
import minicraft.screen.InfoDisplay;
import minicraft.screen.LoadingDisplay;
import minicraft.screen.PauseDisplay;
import minicraft.screen.PlayerInvDisplay;
import minicraft.screen.SkinDisplay;
import minicraft.screen.WorldSelectDisplay;
import minicraft.util.Logging;
import minicraft.util.Vector2;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
import java.util.List;

public class Player extends Mob implements ItemHolder, ClientTickable {
protected InputHandler input;
Expand Down Expand Up @@ -768,10 +799,12 @@ public void render(Screen screen) {
}

// Renders indicator for what tile the item will be placed on
if (activeItem instanceof TileItem) {
if (activeItem instanceof TileItem && !isSwimming()) {
Point t = getInteractionTile();

screen.render(t.x * 16 + 4, t.y * 16 + 4, 3, 2, 0, hudSheet.getSheet());
screen.render(t.x * 16, t.y * 16, 3, 2, 0, hudSheet.getSheet());
screen.render(t.x * 16 + 8, t.y * 16, 3, 2, 1, hudSheet.getSheet());
screen.render(t.x * 16, t.y * 16 + 8, 3, 2, 2, hudSheet.getSheet());
screen.render(t.x * 16 + 8, t.y * 16 + 8, 3, 2, 3, hudSheet.getSheet());
}

// Makes the player white if they have just gotten hurt
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/minicraft/item/FishingData.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class FishingData {
public static List<String> getData(String name) {
List<String> data;
try {
data = Load.loadFile("/resources/fishing/" + name + "_loot.txt");
data = Load.loadFile("/resources/data/fishing/" + name + "_loot.txt");
} catch (IOException e) {
e.printStackTrace();
data = new ArrayList<>();
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/minicraft/level/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ public void renderLight(Screen screen, int xScroll, int yScroll, int brightness)
int h = (Screen.h + 15) >> 4;

screen.setOffset(xScroll, yScroll);
int r = 4;

// this specifies the maximum radius that the game will stop rendering the light from the source object once off screen
int r = 8;

List<Entity> entities = getEntitiesInTiles(xo - r, yo - r, w + xo + r, h + yo + r);
for (Entity e: entities) {
Expand Down
Binary file modified src/main/resources/assets/textures/gui/hud.png
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 ae7e9a0

Please sign in to comment.