Merge branch '1.12dev' into 1.12

This commit is contained in:
Tschipp 2017-08-14 09:55:59 +02:00
commit c48aeceae4
7 changed files with 87 additions and 75 deletions

View File

@ -4,7 +4,7 @@ buildscript {
maven { url = "http://files.minecraftforge.net/maven" } maven { url = "http://files.minecraftforge.net/maven" }
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
} }
} }
apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'net.minecraftforge.gradle.forge'
@ -19,10 +19,10 @@ compileJava {
} }
minecraft { minecraft {
version = "1.11.2-13.20.1.2386" version = "1.12-14.21.1.2387"
runDir = "run" runDir = "run"
mappings = "snapshot_20161220" mappings = "snapshot_20170624"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
} }

View File

@ -181,10 +181,6 @@ public class RenderEvents
ItemStack tileItem = ItemTile.getItemStack(stack); ItemStack tileItem = ItemTile.getItemStack(stack);
EntityItem entityItem = new EntityItem(Minecraft.getMinecraft().world, 0, 0, 0);
entityItem.hoverStart = 0;
entityItem.setEntityItemStack(tileItem);
float rotation = -player.renderYawOffset; float rotation = -player.renderYawOffset;
int perspective = Minecraft.getMinecraft().gameSettings.thirdPersonView; int perspective = Minecraft.getMinecraft().gameSettings.thirdPersonView;
@ -216,7 +212,9 @@ public class RenderEvents
GlStateManager.scale(1, 1, 1); GlStateManager.scale(1, 1, 1);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} else { }
else
{
modelBiped.bipedLeftArm.isHidden = false; modelBiped.bipedLeftArm.isHidden = false;
modelBiped.bipedRightArm.isHidden = false; modelBiped.bipedRightArm.isHidden = false;
} }
@ -234,14 +232,14 @@ public class RenderEvents
ItemStack stack = player.getHeldItemMainhand(); ItemStack stack = player.getHeldItemMainhand();
ModelBiped model = event.getRenderer().getMainModel(); ModelBiped model = event.getRenderer().getMainModel();
EntityPlayerSP clientPlayer = Minecraft.getMinecraft().player; EntityPlayerSP clientPlayer = Minecraft.getMinecraft().player;
ResourceLocation skinLoc = DefaultPlayerSkin.getDefaultSkin(player.getPersistentID()); ResourceLocation skinLoc = DefaultPlayerSkin.getDefaultSkin(player.getPersistentID());
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack)) if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
{ {
model.bipedLeftArm.isHidden = true; model.bipedLeftArm.isHidden = true;
model.bipedRightArm.isHidden = true; model.bipedRightArm.isHidden = true;
Minecraft.getMinecraft().getTextureManager().bindTexture(skinLoc); Minecraft.getMinecraft().getTextureManager().bindTexture(skinLoc);
float rotation = -player.renderYawOffset; float rotation = -player.renderYawOffset;
ModelRenderer fakeLeftArm = new ModelRenderer(model, 40, 16); ModelRenderer fakeLeftArm = new ModelRenderer(model, 40, 16);

View File

@ -13,20 +13,22 @@ public class GuiFactoryCarryOn implements IModGuiFactory
// Do nothing // Do nothing
} }
/*
@Override @Override
public Class<? extends GuiScreen> mainConfigGuiClass() { public Class<? extends GuiScreen> mainConfigGuiClass() {
return GuiConfigCarryOn.class; return GuiConfigCarryOn.class;
} } */
@Override @Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null; return null;
} }
/*
@Override @Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null; return null;
} } */
@Override @Override

View File

@ -45,7 +45,7 @@ public class ItemEvents
if (e instanceof EntityItem) if (e instanceof EntityItem)
{ {
EntityItem eitem = (EntityItem) e; EntityItem eitem = (EntityItem) e;
ItemStack stack = eitem.getEntityItem(); ItemStack stack = eitem.getItem();
Item item = stack.getItem(); Item item = stack.getItem();
if (item == RegistrationHandler.itemTile && ItemTile.hasTileData(stack)) if (item == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
{ {
@ -69,7 +69,7 @@ public class ItemEvents
tile.readFromNBT(ItemTile.getTileData(stack)); tile.readFromNBT(ItemTile.getTileData(stack));
tile.setPos(finalPos); tile.setPos(finalPos);
ItemTile.clearTileData(stack); ItemTile.clearTileData(stack);
eitem.setEntityItemStack(ItemStack.EMPTY); eitem.setItem(ItemStack.EMPTY);
} }
} }
} }

View File

@ -16,10 +16,7 @@ import net.minecraft.nbt.JsonToNBT;
import net.minecraft.nbt.NBTException; import net.minecraft.nbt.NBTException;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil; import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.IntHashMap;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import tschipp.carryon.common.config.CarryOnConfig; import tschipp.carryon.common.config.CarryOnConfig;

View File

@ -5,6 +5,8 @@ import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import javax.annotation.Nullable;
import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.ReflectionHelper;
/** /**
@ -14,63 +16,75 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
*/ */
public class ReflectionUtil public class ReflectionUtil
{ {
/** /**
* Get a {@link MethodHandle} for a method. * Get a {@link MethodHandle} for a method.
* *
* @param clazz * @param clazz
* The class * The class
* @param methodNames * @param methodNames
* The possible names of the method * The possible names of the method
* @param methodTypes * @param methodTypes
* The argument types of the method * The argument types of the method
* @param <T> * @param <T>
* The class * The class
* @return The MethodHandle * @return The MethodHandle
*/ */
public static <T> MethodHandle findMethod(Class<T> clazz, String[] methodNames, Class<?>... methodTypes) { public static MethodHandle findMethod(final Class<?> clazz, final String methodName, @Nullable final String methodObfName, final Class<?>... parameterTypes)
final Method method = ReflectionHelper.findMethod(clazz, null, methodNames, methodTypes); {
try { final Method method = ReflectionHelper.findMethod(clazz, methodName, methodObfName, parameterTypes);
return MethodHandles.lookup().unreflect(method); try
} catch (IllegalAccessException e) { {
throw new ReflectionHelper.UnableToFindMethodException(methodNames, e); return MethodHandles.lookup().unreflect(method);
} }
} catch (IllegalAccessException e)
{
throw new ReflectionHelper.UnableToFindMethodException(e);
}
}
/** /**
* Get a {@link MethodHandle} for a field's getter. * Get a {@link MethodHandle} for a field's getter.
* *
* @param clazz * @param clazz
* The class * The class
* @param fieldNames * @param fieldNames
* The possible names of the field * The possible names of the field
* @return The MethodHandle * @return The MethodHandle
*/ */
public static MethodHandle findFieldGetter(Class<?> clazz, String... fieldNames) { public static MethodHandle findFieldGetter(Class<?> clazz, String... fieldNames)
final Field field = ReflectionHelper.findField(clazz, fieldNames); {
final Field field = ReflectionHelper.findField(clazz, fieldNames);
try { try
return MethodHandles.lookup().unreflectGetter(field); {
} catch (IllegalAccessException e) { return MethodHandles.lookup().unreflectGetter(field);
throw new ReflectionHelper.UnableToAccessFieldException(fieldNames, e); }
} catch (IllegalAccessException e)
} {
throw new ReflectionHelper.UnableToAccessFieldException(fieldNames, e);
}
}
/** /**
* Get a {@link MethodHandle} for a field's setter. * Get a {@link MethodHandle} for a field's setter.
* *
* @param clazz * @param clazz
* The class * The class
* @param fieldNames * @param fieldNames
* The possible names of the field * The possible names of the field
* @return The MethodHandle * @return The MethodHandle
*/ */
public static MethodHandle findFieldSetter(Class<?> clazz, String... fieldNames) { public static MethodHandle findFieldSetter(Class<?> clazz, String... fieldNames)
final Field field = ReflectionHelper.findField(clazz, fieldNames); {
final Field field = ReflectionHelper.findField(clazz, fieldNames);
try { try
return MethodHandles.lookup().unreflectSetter(field); {
} catch (IllegalAccessException e) { return MethodHandles.lookup().unreflectSetter(field);
throw new ReflectionHelper.UnableToAccessFieldException(fieldNames, e); }
} catch (IllegalAccessException e)
} {
throw new ReflectionHelper.UnableToAccessFieldException(fieldNames, e);
}
}
} }

View File

@ -26,6 +26,7 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import tschipp.carryon.CarryOn; import tschipp.carryon.CarryOn;
import tschipp.carryon.common.config.CarryOnConfig; import tschipp.carryon.common.config.CarryOnConfig;
@ -39,7 +40,7 @@ public class ItemTile extends Item
{ {
this.setUnlocalizedName("tile_item"); this.setUnlocalizedName("tile_item");
this.setRegistryName(CarryOn.MODID, "tile_item"); this.setRegistryName(CarryOn.MODID, "tile_item");
GameRegistry.register(this); ForgeRegistries.ITEMS.register(this);
this.setMaxStackSize(1); this.setMaxStackSize(1);
} }
@ -62,7 +63,7 @@ public class ItemTile extends Item
if (hasTileData(stack)) if (hasTileData(stack))
{ {
Vec3d vec = player.getLookVec(); Vec3d vec = player.getLookVec();
EnumFacing facing2 = EnumFacing.getFacingFromVector((float) vec.xCoord, 0f, (float) vec.zCoord); EnumFacing facing2 = EnumFacing.getFacingFromVector((float) vec.x, 0f, (float) vec.z);
BlockPos pos2 = pos; BlockPos pos2 = pos;
Block containedblock = getBlock(stack); Block containedblock = getBlock(stack);
int meta = getMeta(stack); int meta = getMeta(stack);
@ -95,7 +96,7 @@ public class ItemTile extends Item
if(prop instanceof PropertyDirection && this.equal(allowedValues, EnumFacing.VALUES)) if(prop instanceof PropertyDirection && this.equal(allowedValues, EnumFacing.VALUES))
{ {
hasAllDirection = true; hasAllDirection = true;
facing2 = EnumFacing.getFacingFromVector((float) vec.xCoord, (float) vec.yCoord, (float) vec.zCoord); facing2 = EnumFacing.getFacingFromVector((float) vec.x, (float) vec.y, (float) vec.z);
} }
} }