Skip to content

Commit

Permalink
Update for latest forge for 1.10.2 and stable mappings (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
jriwanek authored and bonii-xx committed Dec 31, 2016
1 parent 417bdc9 commit be27dc7
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod_version=1.1.3
minecraft_version=1.10.2
forge_version=12.18.1.2084
mappings=snapshot_20160701
forge_version=12.18.3.2185
mappings=stable_29

jei_version=3.7.+
jei_version=3.10.0.+
configurate_version=3.1.1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void renderHealthbar(RenderGameOverlayEvent.Pre event) {
GlStateManager.enableBlend();

EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity();
int health = MathHelper.ceiling_float_int(player.getHealth());
int health = MathHelper.ceil(player.getHealth());
boolean highlight = healthUpdateCounter > (long)updateCounter && (healthUpdateCounter - (long)updateCounter) / 3L %2L == 1L;

if (health < this.playerHealth && player.hurtResistantTime > 0)
Expand All @@ -93,14 +93,14 @@ else if (health > this.playerHealth && player.hurtResistantTime > 0)

IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH);
float healthMax = (float)attrMaxHealth.getAttributeValue();
float absorb = MathHelper.ceiling_float_int(player.getAbsorptionAmount());
float absorb = MathHelper.ceil(player.getAbsorptionAmount());

// CHANGE: simulate 10 hearts max if there's more, so vanilla only renders one row max
healthMax = Math.min(healthMax, 20f);
health = Math.min(health, 20);
absorb = Math.min(absorb, 20);

int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
int healthRows = MathHelper.ceil((healthMax + absorb) / 2.0F / 10.0F);
int rowHeight = Math.max(10 - (healthRows - 2), 3);

this.rand.setSeed((long)(updateCounter * 312871));
Expand All @@ -116,17 +116,17 @@ else if (health > this.playerHealth && player.hurtResistantTime > 0)
regen = updateCounter % 25;
}

final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int TOP = 9 * (mc.world.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int BACKGROUND = (highlight ? 25 : 16);
int MARGIN = 16;
if (player.isPotionActive(MobEffects.POISON)) MARGIN += 36;
else if (player.isPotionActive(MobEffects.WITHER)) MARGIN += 72;
float absorbRemaining = absorb;

for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
for (int i = MathHelper.ceil((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
{
//int b0 = (highlight ? 1 : 0);
int row = MathHelper.ceiling_float_int((float)(i + 1) / 10.0F) - 1;
int row = MathHelper.ceil((float)(i + 1) / 10.0F) - 1;
int x = left + i % 10 * 8;
int y = top - row * rowHeight;

Expand Down Expand Up @@ -188,7 +188,7 @@ private void renderExtraHearts(int xBasePos, int yBasePos, EntityPlayer player)
// Extra hearts
this.mc.getTextureManager().bindTexture(ICON_HEARTS);

int hp = MathHelper.ceiling_float_int(player.getHealth());
int hp = MathHelper.ceil(player.getHealth());
renderCustomHearts(xBasePos, yBasePos, potionOffset, hp, false);
}

Expand Down Expand Up @@ -228,7 +228,7 @@ private int getPotionOffset(EntityPlayer player) {
if(potion != null) {
potionOffset = 9;
}
if(mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) {
if(mc.world.getWorldInfo().isHardcoreModeEnabled()) {
potionOffset += 27;
}
return potionOffset;
Expand All @@ -240,7 +240,7 @@ private void renderExtraAbsorption(int xBasePos, int yBasePos, EntityPlayer play
// Extra hearts
this.mc.getTextureManager().bindTexture(ICON_ABSORB);

int absorb = MathHelper.ceiling_float_int(player.getAbsorptionAmount());
int absorb = MathHelper.ceil(player.getAbsorptionAmount());
renderCustomHearts(xBasePos, yBasePos, potionOffset, absorb, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private IBlockState convert(BlockData data) {
state = block.getDefaultState();

for(Map.Entry<String, String> entry : data.state.entrySet()) {
Optional<IProperty<?>> property = state.getPropertyNames().stream().filter(iProperty -> entry.getKey().equals(iProperty.getName())).findFirst();
Optional<IProperty<?>> property = state.getPropertyKeys().stream().filter(iProperty -> entry.getKey().equals(iProperty.getName())).findFirst();

if(property.isPresent()) {
state = setProperty(state, property.get(), entry.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ public String translate(String string) {
}

public void openGui(@Nullable ItemStack item) {
if(Minecraft.getMinecraft().thePlayer != null) {
if(Minecraft.getMinecraft().player != null) {
Minecraft.getMinecraft()
.displayGuiScreen(new GuiBook(this, Minecraft.getMinecraft().thePlayer.getStatFileWriter(), item));
.displayGuiScreen(new GuiBook(this, Minecraft.getMinecraft().player.getStatFileWriter(), item));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected void drawContainerName() {
}

protected void drawPlayerInventoryName() {
String localizedName = Minecraft.getMinecraft().thePlayer.inventory.getDisplayName().getUnformattedText();
String localizedName = Minecraft.getMinecraft().player.inventory.getDisplayName().getUnformattedText();
this.fontRendererObj.drawString(localizedName, 8, this.ySize - 96 + 2, 0x404040);
}

Expand Down Expand Up @@ -222,8 +222,8 @@ public void drawSlot(Slot slotIn) {

// update slot positions
if(slotIn instanceof SlotWrapper) {
slotIn.xDisplayPosition = ((SlotWrapper) slotIn).parent.xDisplayPosition;
slotIn.yDisplayPosition = ((SlotWrapper) slotIn).parent.yDisplayPosition;
slotIn.xPos = ((SlotWrapper) slotIn).parent.xPos;
slotIn.yPos = ((SlotWrapper) slotIn).parent.yPos;
}

super.drawSlot(slotIn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public GuiWidgetSlider(GuiElement slider, GuiElement sliderHighlighted, GuiEleme
maxValue = slideBar.h;
increment = 1;

sliderOffset = MathHelper.abs_int(slideBar.w - slider.w) / 2;
sliderOffset = MathHelper.abs(slideBar.w - slider.w) / 2;

isScrolling = false;
isHighlighted = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public static int[] getTextureMatrixCoords(int index, int sprW, int sprH, int se
int totalHeight = segH * 3 + segGH * 2;

return getTextureMatrixCoords((index % (256 / sprW) * sprW) + (sprW / 2 - totalWidth / 2), (MathHelper
.floor_float(index / (256F / sprH)) * sprH) + (sprH / 2 - totalHeight / 2), segW, segH, segGW, segGH, segId);
.floor(index / (256F / sprH)) * sprH) + (sprH / 2 - totalHeight / 2), segW, segH, segGW, segGH, segId);
}

public static int[] getTextureMatrixCoords(int u, int v, int segW, int segH, int segGW, int segGH, int segId) {
int[] coords = new int[4];

int col = segId % 3;
int row = MathHelper.floor_float(segId / 3F);
int row = MathHelper.floor(segId / 3F);

coords[0] = u + col * segW + col * segGW;
coords[1] = v + row * segH + row * segGH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ public void onGuiClosed() {
if(loadingAchievements) {
return;
}
if(mc.thePlayer == null) {
if(mc.player == null) {
return;
}

Expand All @@ -634,9 +634,9 @@ public void onGuiClosed() {
}

if(this.page == -1) {
BookLoader.updateSavedPage(mc.thePlayer, item, "");
BookLoader.updateSavedPage(mc.player, item, "");
} else if(page != null && page.parent != null) {
BookLoader.updateSavedPage(mc.thePlayer, item, page.parent.name + "." + page.name);
BookLoader.updateSavedPage(mc.player, item, page.parent.name + "." + page.name);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void mouseDragged(int clickX, int clickY, int mx, int my, int lastX, int

public void renderToolTip(FontRenderer fontRenderer, ItemStack stack, int x, int y) {
if(stack != null) {
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
List<String> list = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips);

for(int i = 0; i < list.size(); ++i) {
if(i == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public ElementItem(int x, int y, float scale, ItemStack... itemCycle) {
}

public ElementItem(int x, int y, float scale, ItemStack[] itemCycle, String action) {
super(x, y, MathHelper.floor_float(ITEM_SIZE_HARDCODED * scale), MathHelper.floor_float(ITEM_SIZE_HARDCODED * scale));
super(x, y, MathHelper.floor(ITEM_SIZE_HARDCODED * scale), MathHelper.floor(ITEM_SIZE_HARDCODED * scale));

this.itemCycle = itemCycle;
this.scale = scale;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/slimeknights/mantle/config/ExampleSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public void playerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void playerJoinedWorld(TickEvent.ClientTickEvent event) {
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
EntityPlayerSP player = Minecraft.getMinecraft().player;
if(needsRestart) {
player.addChatMessage(new TextComponentString("Configs synced with server. Configs require a restart"));
player.sendMessage(new TextComponentString("Configs synced with server. Configs require a restart"));
}
else {
player.addChatMessage(new TextComponentString("Configs synced with server."));
player.sendMessage(new TextComponentString("Configs synced with server."));
}
MinecraftForge.EVENT_BUS.unregister(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SlotWrapper extends Slot {
public final Slot parent;

public SlotWrapper(Slot slot) {
super(slot.inventory, slot.getSlotIndex(), slot.xDisplayPosition, slot.yDisplayPosition);
super(slot.inventory, slot.getSlotIndex(), slot.xPos, slot.yPos);
this.parent = slot;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public boolean hasValidMaster() {
return false;
}

if(this.worldObj.getBlockState(this.master).getBlock() == this.masterBlock && this.worldObj
if(this.world.getBlockState(this.master).getBlock() == this.masterBlock && this.world
.getBlockState(this.master) == this.state) {
return true;
}
Expand All @@ -55,7 +55,7 @@ public BlockPos getMasterPosition() {
public void overrideMaster(BlockPos pos) {
this.hasMaster = true;
this.master = pos;
this.state = this.worldObj.getBlockState(this.master);
this.state = this.world.getBlockState(this.master);
this.masterBlock = this.state.getBlock();
}

Expand All @@ -73,7 +73,7 @@ public boolean setPotentialMaster(IMasterLogic master, World w, BlockPos pos) {

@Deprecated
public boolean verifyMaster(IMasterLogic logic, BlockPos pos) {
return this.master.equals(pos) && this.worldObj.getBlockState(pos) == this.state && this.worldObj.getBlockState(pos)
return this.master.equals(pos) && this.world.getBlockState(pos) == this.state && this.world.getBlockState(pos)
.getBlock() == this.masterBlock;
}

Expand All @@ -97,7 +97,7 @@ public void invalidateMaster(IMasterLogic master, World w, BlockPos pos) {
@Override
public void notifyMasterOfChange() {
if(this.hasValidMaster()) {
IMasterLogic logic = (IMasterLogic) this.worldObj.getTileEntity(this.master);
IMasterLogic logic = (IMasterLogic) this.world.getTileEntity(this.master);
logic.notifyChange(this, this.pos);
}
}
Expand Down Expand Up @@ -151,20 +151,20 @@ public NBTTagCompound getUpdateTag() {
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
this.readCustomNBT(packet.getNbtCompound());
this.worldObj.notifyLightSet(this.pos);
IBlockState state = worldObj.getBlockState(this.pos);
this.worldObj.notifyBlockUpdate(this.pos, state, state, 3);
this.world.notifyLightSet(this.pos);
IBlockState state = world.getBlockState(this.pos);
this.world.notifyBlockUpdate(this.pos, state, state, 3);
}

@Nonnull
@Override
public World getWorld() {
return this.worldObj;
return this.world;
}

@Deprecated
public boolean setMaster(BlockPos pos) {
if(!this.hasMaster || this.worldObj.getBlockState(this.master) != this.state || (this.worldObj
if(!this.hasMaster || this.world.getBlockState(this.master) != this.state || (this.world
.getBlockState(this.master)
.getBlock() != this.masterBlock)) {
this.overrideMaster(pos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ public ITextComponent getDisplayName() {

/* Supporting methods */
@Override
public boolean isUseableByPlayer(@Nonnull EntityPlayer entityplayer) {
public boolean isUsableByPlayer(@Nonnull EntityPlayer entityplayer) {
// block changed/got broken?
if(worldObj.getTileEntity(pos) != this || worldObj.getBlockState(pos).getBlock() == Blocks.AIR) {
if(world.getTileEntity(pos) != this || world.getBlockState(pos).getBlock() == Blocks.AIR) {
return false;
}

Expand Down

0 comments on commit be27dc7

Please sign in to comment.