Merge branch 'master' into 1.10

This commit is contained in:
Tschipp 2017-09-04 18:30:20 +02:00
commit 28b7fdc124
3 changed files with 28 additions and 11 deletions

View File

@ -29,7 +29,7 @@ public class CarryOn {
public static CarryOn instance;
public static final String MODID = "carryon";
public static final String VERSION = "1.4";
public static final String VERSION = "1.4.1";
public static final String NAME = "Carry On";
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
public static final Logger LOGGER = LogManager.getFormatterLogger("CarryOn");

View File

@ -13,6 +13,10 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.ClickEvent;
import net.minecraft.util.text.event.ClickEvent.Action;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@ -107,18 +111,31 @@ public class ItemEvents
{
if (ItemTile.storeTileData(te, world, pos, state.getActualState(world, pos), stack))
{
CarryOn.network.sendTo(new CarrySlotPacket(player.inventory.currentItem), (EntityPlayerMP) player);
if (world.getTileEntity(pos) != null)
IBlockState statee = world.getBlockState(pos);
NBTTagCompound tag = new NBTTagCompound();
tag = world.getTileEntity(pos) != null ? world.getTileEntity(pos).writeToNBT(tag) : new NBTTagCompound();
try
{
TileEntity newtile = world.getTileEntity(pos).getClass().newInstance();
CarryOn.network.sendTo(new CarrySlotPacket(player.inventory.currentItem), (EntityPlayerMP) player);
world.removeTileEntity(pos);
world.setTileEntity(pos, newtile);
world.setBlockToAir(pos);
player.setHeldItem(EnumHand.MAIN_HAND, stack);
event.setUseBlock(Result.DENY);
event.setCanceled(true);
}
catch (Exception e)
{
CarryOn.network.sendTo(new CarrySlotPacket(9), (EntityPlayerMP) player);
world.setBlockState(pos, statee);
if (!tag.hasNoTags())
TileEntity.create(world, tag);
player.addChatMessage(new TextComponentString(TextFormatting.RED + "Error detected. Cannot pick up block."));
TextComponentString s = new TextComponentString(TextFormatting.GOLD + "here");
s.getStyle().setClickEvent(new ClickEvent(Action.OPEN_URL, "https://github.com/Tschipp/CarryOn/issues"));
player.addChatMessage(new TextComponentString(TextFormatting.RED + "Please report this error ").appendSibling(s));
}
world.setBlockToAir(pos);
player.setHeldItem(EnumHand.MAIN_HAND, stack);
event.setUseBlock(Result.DENY);
event.setCanceled(true);
}

View File

@ -2,7 +2,7 @@
{
"modid" : "carryon",
"name" : "Carry On",
"version" : "1.4", "mcversion" : "1.10.2",
"version" : "1.4.1", "mcversion" : "1.10.2",
"url" : "",
"credits" : "Tschipp, Purplicious_Cow, cy4n",
"authorList" : ["Tschipp, Purplicious_Cow, cy4n"],