Update to 1.12

This commit is contained in:
Tschipp 2017-08-14 09:53:45 +02:00
parent 5ddfc079fc
commit 19b4a4ebd8
7 changed files with 87 additions and 75 deletions

View File

@ -4,7 +4,7 @@ buildscript {
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
@ -19,10 +19,10 @@ compileJava {
}
minecraft {
version = "1.11.2-13.20.1.2386"
version = "1.12-14.21.1.2387"
runDir = "run"
mappings = "snapshot_20161220"
mappings = "snapshot_20170624"
// 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);
EntityItem entityItem = new EntityItem(Minecraft.getMinecraft().world, 0, 0, 0);
entityItem.hoverStart = 0;
entityItem.setEntityItemStack(tileItem);
float rotation = -player.renderYawOffset;
int perspective = Minecraft.getMinecraft().gameSettings.thirdPersonView;
@ -216,7 +212,9 @@ public class RenderEvents
GlStateManager.scale(1, 1, 1);
GlStateManager.popMatrix();
} else {
}
else
{
modelBiped.bipedLeftArm.isHidden = false;
modelBiped.bipedRightArm.isHidden = false;
}
@ -234,14 +232,14 @@ public class RenderEvents
ItemStack stack = player.getHeldItemMainhand();
ModelBiped model = event.getRenderer().getMainModel();
EntityPlayerSP clientPlayer = Minecraft.getMinecraft().player;
ResourceLocation skinLoc = DefaultPlayerSkin.getDefaultSkin(player.getPersistentID());
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
{
model.bipedLeftArm.isHidden = true;
model.bipedRightArm.isHidden = true;
Minecraft.getMinecraft().getTextureManager().bindTexture(skinLoc);
float rotation = -player.renderYawOffset;
ModelRenderer fakeLeftArm = new ModelRenderer(model, 40, 16);

View File

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

View File

@ -45,7 +45,7 @@ public class ItemEvents
if (e instanceof EntityItem)
{
EntityItem eitem = (EntityItem) e;
ItemStack stack = eitem.getEntityItem();
ItemStack stack = eitem.getItem();
Item item = stack.getItem();
if (item == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
{
@ -69,7 +69,7 @@ public class ItemEvents
tile.readFromNBT(ItemTile.getTileData(stack));
tile.setPos(finalPos);
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.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.IntHashMap;
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.SideOnly;
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.Method;
import javax.annotation.Nullable;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
/**
@ -14,63 +16,75 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
*/
public class ReflectionUtil
{
/**
* Get a {@link MethodHandle} for a method.
*
* @param clazz
* The class
* @param methodNames
* The possible names of the method
* @param methodTypes
* The argument types of the method
* @param <T>
* The class
* @return The MethodHandle
*/
public static <T> MethodHandle findMethod(Class<T> clazz, String[] methodNames, Class<?>... methodTypes) {
final Method method = ReflectionHelper.findMethod(clazz, null, methodNames, methodTypes);
try {
return MethodHandles.lookup().unreflect(method);
} catch (IllegalAccessException e) {
throw new ReflectionHelper.UnableToFindMethodException(methodNames, e);
}
}
/**
* Get a {@link MethodHandle} for a method.
*
* @param clazz
* The class
* @param methodNames
* The possible names of the method
* @param methodTypes
* The argument types of the method
* @param <T>
* The class
* @return The MethodHandle
*/
public static MethodHandle findMethod(final Class<?> clazz, final String methodName, @Nullable final String methodObfName, final Class<?>... parameterTypes)
{
final Method method = ReflectionHelper.findMethod(clazz, methodName, methodObfName, parameterTypes);
try
{
return MethodHandles.lookup().unreflect(method);
}
catch (IllegalAccessException e)
{
throw new ReflectionHelper.UnableToFindMethodException(e);
}
}
/**
* Get a {@link MethodHandle} for a field's getter.
*
* @param clazz
* The class
* @param fieldNames
* The possible names of the field
* @return The MethodHandle
*/
public static MethodHandle findFieldGetter(Class<?> clazz, String... fieldNames) {
final Field field = ReflectionHelper.findField(clazz, fieldNames);
/**
* Get a {@link MethodHandle} for a field's getter.
*
* @param clazz
* The class
* @param fieldNames
* The possible names of the field
* @return The MethodHandle
*/
public static MethodHandle findFieldGetter(Class<?> clazz, String... fieldNames)
{
final Field field = ReflectionHelper.findField(clazz, fieldNames);
try {
return MethodHandles.lookup().unreflectGetter(field);
} catch (IllegalAccessException e) {
throw new ReflectionHelper.UnableToAccessFieldException(fieldNames, e);
}
}
try
{
return MethodHandles.lookup().unreflectGetter(field);
}
catch (IllegalAccessException e)
{
throw new ReflectionHelper.UnableToAccessFieldException(fieldNames, e);
}
}
/**
* Get a {@link MethodHandle} for a field's setter.
*
* @param clazz
* The class
* @param fieldNames
* The possible names of the field
* @return The MethodHandle
*/
public static MethodHandle findFieldSetter(Class<?> clazz, String... fieldNames) {
final Field field = ReflectionHelper.findField(clazz, fieldNames);
/**
* Get a {@link MethodHandle} for a field's setter.
*
* @param clazz
* The class
* @param fieldNames
* The possible names of the field
* @return The MethodHandle
*/
public static MethodHandle findFieldSetter(Class<?> clazz, String... fieldNames)
{
final Field field = ReflectionHelper.findField(clazz, fieldNames);
try {
return MethodHandles.lookup().unreflectSetter(field);
} catch (IllegalAccessException e) {
throw new ReflectionHelper.UnableToAccessFieldException(fieldNames, e);
}
}
try
{
return MethodHandles.lookup().unreflectSetter(field);
}
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.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import tschipp.carryon.CarryOn;
import tschipp.carryon.common.config.CarryOnConfig;
@ -39,7 +40,7 @@ public class ItemTile extends Item
{
this.setUnlocalizedName("tile_item");
this.setRegistryName(CarryOn.MODID, "tile_item");
GameRegistry.register(this);
ForgeRegistries.ITEMS.register(this);
this.setMaxStackSize(1);
}
@ -62,7 +63,7 @@ public class ItemTile extends Item
if (hasTileData(stack))
{
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;
Block containedblock = getBlock(stack);
int meta = getMeta(stack);
@ -95,7 +96,7 @@ public class ItemTile extends Item
if(prop instanceof PropertyDirection && this.equal(allowedValues, EnumFacing.VALUES))
{
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);
}
}