Skip to content

Commit

Permalink
Update to 1.14.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tyra314 committed Jun 29, 2019
1 parent e56dc14 commit 4e06833
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 184 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.14.2
yarn_mappings=1.14.2+build.3
loader_version=0.4.8+build.154
minecraft_version=1.14.3
yarn_mappings=1.14.3+build.9
loader_version=0.4.8+build.155

# Mod Properties
mod_version = 5.0.5-fabric
mod_version = 5.0.6-fabric
maven_group = hunternif.mc.atlas
archives_base_name = antiqueatlas

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
fabric_version=0.3.0+build.175
fabric_version=0.3.0+build.187
4 changes: 2 additions & 2 deletions src/main/java/hunternif/mc/atlas/RegistrarAntiqueAtlas.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import net.minecraft.util.registry.Registry;

public class RegistrarAntiqueAtlas {
public static final ItemEmptyAtlas EMPTY_ATLAS = new ItemEmptyAtlas(new Item.Settings().itemGroup(ItemGroup.MISC));
public static final ItemAtlas ATLAS = new ItemAtlas(new Item.Settings().stackSize(1));
public static final ItemEmptyAtlas EMPTY_ATLAS = new ItemEmptyAtlas(new Item.Settings().group(ItemGroup.MISC));
public static final ItemAtlas ATLAS = new ItemAtlas(new Item.Settings().maxCount(1));

public static void register() {
// TODO FABRIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.util.Collections;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GuiLighting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;


Expand Down Expand Up @@ -46,8 +46,8 @@ void setTitle(String title) {
this.title = title;
}

public Component getTitle() {
return new TextComponent(title);
public Text getTitle() {
return new LiteralText(title);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


import net.minecraft.client.gui.screen.Screen;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.text.LiteralText;
import org.lwjgl.opengl.GL11;

import java.util.List;
Expand Down Expand Up @@ -57,7 +57,7 @@ interface UiCall {

// TODO
public GuiComponent() {
super(new TextComponent("component"));
super(new LiteralText("component"));
}

/** Set absolute coordinates of the top left corner of this component on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import hunternif.mc.atlas.SettingsConfig;
import hunternif.mc.atlas.api.AtlasAPI;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.text.TranslatableText;

/**
* Puts an skull marker to the player's death spot.
Expand All @@ -14,7 +14,7 @@ public static void onPlayerDeath(PlayerEntity player) {
if (SettingsConfig.gameplay.autoDeathMarker) {
for (int atlasID : AtlasAPI.getPlayerAtlases(player)) {
AtlasAPI.markers.putMarker(player.getEntityWorld(), true, atlasID, "antiqueatlas:tomb",
new TranslatableComponent("gui.antiqueatlas.marker.tomb").append(player.getName()).getString(),
new TranslatableText("gui.antiqueatlas.marker.tomb").append(player.getName()).getString(),
(int)player.x, (int)player.z);
}
}
Expand Down
160 changes: 80 additions & 80 deletions src/main/java/hunternif/mc/atlas/item/ItemAtlas.java
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
package hunternif.mc.atlas.item;

import java.util.ArrayList;
import java.util.Collection;

import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import hunternif.mc.atlas.AntiqueAtlasMod;
import hunternif.mc.atlas.core.AtlasData;
import hunternif.mc.atlas.core.TileInfo;
import hunternif.mc.atlas.marker.MarkersData;
import hunternif.mc.atlas.network.PacketDispatcher;
import hunternif.mc.atlas.network.client.DimensionUpdatePacket;

public class ItemAtlas extends Item {
static final String WORLD_ATLAS_DATA_ID = "aAtlas";

public ItemAtlas(Item.Settings settings) {
super(settings);
}

public int getAtlasID(ItemStack stack) {
return stack.getOrCreateTag().getInt("atlasID");
}

/* @Override
public String i(ItemStack stack) {
return super.XX_1_13_i_XX(stack) + " #" + getAtlasID(stack);
} */

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerIn,
Hand hand) {
ItemStack stack = playerIn.getStackInHand(hand);

if (world.isClient) {
AntiqueAtlasMod.proxy.openAtlasGUI(stack);
}

return new TypedActionResult<>(ActionResult.SUCCESS, stack);
}

@Override
public void onEntityTick(ItemStack stack, World world, Entity entity, int slot, boolean isEquipped) {
AtlasData data = AntiqueAtlasMod.atlasData.getAtlasData(stack, world);
if (data == null || !(entity instanceof PlayerEntity)) return;

int atlasId = ((ItemAtlas) stack.getItem()).getAtlasID(stack);

// On the first run send the map from the server to the client:
PlayerEntity player = (PlayerEntity) entity;
if (!world.isClient && !data.isSyncedOnPlayer(player) && !data.isEmpty()) {
data.syncOnPlayer(atlasId, player);
}

// Same thing with the local markers:
MarkersData markers = AntiqueAtlasMod.markersData.getMarkersData(stack, world);
if (!world.isClient && !markers.isSyncedOnPlayer(player) && !markers.isEmpty()) {
markers.syncOnPlayer(atlasId, player);
}

// Updating map around player
Collection<TileInfo> newTiles = data.updateMapAroundPlayer(player);

if (!world.isClient) {
if (!newTiles.isEmpty()) {
DimensionUpdatePacket packet = new DimensionUpdatePacket(atlasId, player.dimension, newTiles);
PacketDispatcher.sendToAll(((ServerWorld) world).getServer(), packet);
}
}
}

}
package hunternif.mc.atlas.item;

import java.util.Collection;

import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import hunternif.mc.atlas.AntiqueAtlasMod;
import hunternif.mc.atlas.core.AtlasData;
import hunternif.mc.atlas.core.TileInfo;
import hunternif.mc.atlas.marker.MarkersData;
import hunternif.mc.atlas.network.PacketDispatcher;
import hunternif.mc.atlas.network.client.DimensionUpdatePacket;

public class ItemAtlas extends Item {
static final String WORLD_ATLAS_DATA_ID = "aAtlas";

public ItemAtlas(Item.Settings settings) {
super(settings);
}

public int getAtlasID(ItemStack stack) {
return stack.getOrCreateTag().getInt("atlasID");
}

@Override
public Text getName(ItemStack stack) {
return super.getName(stack).append(" #" + getAtlasID(stack));
}

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerIn,
Hand hand) {
ItemStack stack = playerIn.getStackInHand(hand);

if (world.isClient) {
AntiqueAtlasMod.proxy.openAtlasGUI(stack);
}

return new TypedActionResult<>(ActionResult.SUCCESS, stack);
}

@Override
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean isEquipped) {
AtlasData data = AntiqueAtlasMod.atlasData.getAtlasData(stack, world);
if (data == null || !(entity instanceof PlayerEntity)) return;

int atlasId = ((ItemAtlas) stack.getItem()).getAtlasID(stack);

// On the first run send the map from the server to the client:
PlayerEntity player = (PlayerEntity) entity;
if (!world.isClient && !data.isSyncedOnPlayer(player) && !data.isEmpty()) {
data.syncOnPlayer(atlasId, player);
}

// Same thing with the local markers:
MarkersData markers = AntiqueAtlasMod.markersData.getMarkersData(stack, world);
if (!world.isClient && !markers.isSyncedOnPlayer(player) && !markers.isEmpty()) {
markers.syncOnPlayer(atlasId, player);
}

// Updating map around player
Collection<TileInfo> newTiles = data.updateMapAroundPlayer(player);

if (!world.isClient) {
if (!newTiles.isEmpty()) {
DimensionUpdatePacket packet = new DimensionUpdatePacket(atlasId, player.dimension, newTiles);
PacketDispatcher.sendToAll(((ServerWorld) world).getServer(), packet);
}
}
}

}
110 changes: 55 additions & 55 deletions src/main/java/hunternif/mc/atlas/item/ItemEmptyAtlas.java
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
package hunternif.mc.atlas.item;

import hunternif.mc.atlas.AntiqueAtlasMod;
import hunternif.mc.atlas.RegistrarAntiqueAtlas;
import hunternif.mc.atlas.SettingsConfig;
import hunternif.mc.atlas.core.AtlasData;
import hunternif.mc.atlas.marker.MarkersData;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;

public class ItemEmptyAtlas extends Item {
public ItemEmptyAtlas(Item.Settings settings) {
super(settings);
}

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity player,
Hand hand) {
ItemStack stack = player.getStackInHand(hand);
if (world.isClient)
return new TypedActionResult<>(ActionResult.SUCCESS, stack);

int atlasID = AntiqueAtlasMod.getGlobalAtlasData(world).getNextAtlasId();
ItemStack atlasStack = new ItemStack(RegistrarAntiqueAtlas.ATLAS);

atlasStack.getOrCreateTag().putInt("atlasID", atlasID);

AtlasData atlasData = AntiqueAtlasMod.atlasData.getAtlasData(atlasID, world);
atlasData.getDimensionData(player.dimension).setBrowsingPosition(
(int)Math.round(-player.x * SettingsConfig.userInterface.defaultScale),
(int)Math.round(-player.z * SettingsConfig.userInterface.defaultScale),
SettingsConfig.userInterface.defaultScale);
atlasData.markDirty();

MarkersData markersData = AntiqueAtlasMod.markersData.getMarkersData(atlasID, world);
markersData.markDirty();

stack.subtractAmount(1);
if (stack.isEmpty()) {
return new TypedActionResult<>(ActionResult.SUCCESS, atlasStack);
} else {
if (!player.inventory.insertStack(atlasStack.copy())) {
player.dropItem(atlasStack, true);
}

return new TypedActionResult<>(ActionResult.SUCCESS, stack);
}
}
}
package hunternif.mc.atlas.item;

import hunternif.mc.atlas.AntiqueAtlasMod;
import hunternif.mc.atlas.RegistrarAntiqueAtlas;
import hunternif.mc.atlas.SettingsConfig;
import hunternif.mc.atlas.core.AtlasData;
import hunternif.mc.atlas.marker.MarkersData;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;

public class ItemEmptyAtlas extends Item {
public ItemEmptyAtlas(Item.Settings settings) {
super(settings);
}

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity player,
Hand hand) {
ItemStack stack = player.getStackInHand(hand);
if (world.isClient)
return new TypedActionResult<>(ActionResult.SUCCESS, stack);

int atlasID = AntiqueAtlasMod.getGlobalAtlasData(world).getNextAtlasId();
ItemStack atlasStack = new ItemStack(RegistrarAntiqueAtlas.ATLAS);

atlasStack.getOrCreateTag().putInt("atlasID", atlasID);

AtlasData atlasData = AntiqueAtlasMod.atlasData.getAtlasData(atlasID, world);
atlasData.getDimensionData(player.dimension).setBrowsingPosition(
(int)Math.round(-player.x * SettingsConfig.userInterface.defaultScale),
(int)Math.round(-player.z * SettingsConfig.userInterface.defaultScale),
SettingsConfig.userInterface.defaultScale);
atlasData.markDirty();

MarkersData markersData = AntiqueAtlasMod.markersData.getMarkersData(atlasID, world);
markersData.markDirty();

stack.decrement(1);
if (stack.isEmpty()) {
return new TypedActionResult<>(ActionResult.SUCCESS, atlasStack);
} else {
if (!player.inventory.insertStack(atlasStack.copy())) {
player.dropItem(atlasStack, true);
}

return new TypedActionResult<>(ActionResult.SUCCESS, stack);
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/hunternif/mc/atlas/item/RecipeAtlasCloning.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public ItemStack craft(CraftingInventory inv) {
ItemStack newAtlas = new ItemStack(RegistrarAntiqueAtlas.ATLAS, i + 1);
newAtlas.getOrCreateTag().putInt("atlasID", RegistrarAntiqueAtlas.ATLAS.getAtlasID(filledAtlas));

if (filledAtlas.hasDisplayName()) {
newAtlas.setDisplayName(filledAtlas.getDisplayName());
if (filledAtlas.hasCustomName()) {
newAtlas.setCustomName(filledAtlas.getName());
}

return newAtlas;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hunternif/mc/atlas/mixin/MixinInGameHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class MixinInGameHud {
@Shadow
private int scaledHeight;

@Inject(at = @At("TAIL"), method = "draw")
@Inject(at = @At("TAIL"), method = "render")
public void draw(float partial, CallbackInfo info) {
ExportProgressOverlay.INSTANCE.draw(scaledWidth, scaledHeight, partial);
}
Expand Down
Loading

0 comments on commit 4e06833

Please sign in to comment.