Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Working on #119
Browse files Browse the repository at this point in the history
  • Loading branch information
sameer committed Feb 18, 2016
1 parent da15302 commit 480fd00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 2 additions & 3 deletions patches/net/minecraft/world/storage/MapData.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,13 @@
this.entityplayerObj = p_i2138_2_;

for (int i = 0; i < this.field_76209_b.length; ++i)
@@ -328,20 +348,38 @@
@@ -328,20 +348,37 @@
int i;
int i1;

+ // Spigot start
+ boolean custom = this.mapDataObj.mapView.renderers.size() > 1 || !(this.mapDataObj.mapView.renderers.get(0) instanceof org.bukkit.craftbukkit.map.CraftMapRenderer);
+ if (!custom) return new byte[] {(byte)2, MapData.this.scale};
+ org.bukkit.craftbukkit.map.RenderData render = this.mapDataObj.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayerObj.getBukkitEntity()); // CraftBukkit
+ org.bukkit.craftbukkit.map.RenderData render = (custom) ? this.mapDataObj.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayerObj.getBukkitEntity()) : null; // CraftBukkit
+
if (--this.ticksUntilPlayerLocationMapUpdate < 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bukkit.map.MapCursorCollection;
import org.bukkit.map.MapRenderer;
import org.bukkit.map.MapView;
import net.minecraftforge.cauldron.command.*;

public class CraftMapRenderer extends MapRenderer {

Expand All @@ -20,6 +21,13 @@ public CraftMapRenderer(CraftMapView mapView, net.minecraft.world.storage.MapDat

@Override
public void render(MapView map, MapCanvas canvas, Player player) {
if(CauldronCommand.debug) {
System.out.println("Default Map Render called!");
for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
System.out.println(ste);
} }


// Map
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 128; ++y) {
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class CraftMapView implements MapView {
public MapRenderer defaultRenderer;
public CraftMapView(net.minecraft.world.storage.MapData worldMap) {
this.worldMap = worldMap;
//addRenderer(new CraftMapRenderer(this, worldMap));
addRenderer(new CraftMapRenderer(this, worldMap));
}

public short getId() {
Expand Down Expand Up @@ -119,7 +119,6 @@ private boolean isContextual() {
}

public RenderData render(CraftPlayer player) {
if (renderers.size() == 0) { renderers.add(defaultRenderer); } // Thermos - don't install the default renderer **unless** there is no other option specified by some Bukkit plugin
boolean context = isContextual();
RenderData render = renderCache.get(context ? player : null);

Expand All @@ -141,7 +140,6 @@ public RenderData render(CraftPlayer player) {
canvas = new CraftMapCanvas(this);
canvases.get(renderer).put(renderer.isContextual() ? player : null, canvas);
}

canvas.setBase(render.buffer);
renderer.render(this, canvas, player);

Expand Down

0 comments on commit 480fd00

Please sign in to comment.