[1.12.2] Added thaumcraft to blacklist, redone arm rendering
This commit is contained in:
parent
9025c53a35
commit
149fe1978e
|
|
@ -32,7 +32,7 @@ public class CarryOn {
|
||||||
public static CarryOn instance;
|
public static CarryOn instance;
|
||||||
|
|
||||||
public static final String MODID = "carryon";
|
public static final String MODID = "carryon";
|
||||||
public static final String VERSION = "1.9.1";
|
public static final String VERSION = "1.9.2";
|
||||||
public static final String NAME = "Carry On";
|
public static final String NAME = "Carry On";
|
||||||
public static final String ACCEPTED_VERSIONS = "[1.12.2,1.13)";
|
public static final String ACCEPTED_VERSIONS = "[1.12.2,1.13)";
|
||||||
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
|
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import net.minecraft.client.settings.GameSettings;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
@ -291,7 +292,7 @@ public class RenderEntityEvents
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Renders the Block in Third Person
|
* Renders the Entity in Third Person
|
||||||
*/
|
*/
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
@ -307,8 +308,13 @@ public class RenderEntityEvents
|
||||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||||
{
|
{
|
||||||
Entity entity = ItemEntity.getEntity(stack, world);
|
Entity entity = ItemEntity.getEntity(stack, world);
|
||||||
float rotation = -(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
|
float rotation = 0;
|
||||||
|
|
||||||
|
if (player.isRiding() && player.getRidingEntity() instanceof EntityLivingBase)
|
||||||
|
rotation = -(player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialticks);
|
||||||
|
else
|
||||||
|
rotation = -(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
|
||||||
|
|
||||||
if (entity != null)
|
if (entity != null)
|
||||||
{
|
{
|
||||||
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialticks;
|
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialticks;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package tschipp.carryon.client.event;
|
package tschipp.carryon.client.event;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
|
@ -17,13 +18,11 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
|
||||||
import net.minecraft.client.settings.GameSettings;
|
import net.minecraft.client.settings.GameSettings;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
|
@ -35,7 +34,9 @@ import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
||||||
import net.minecraftforge.client.event.MouseEvent;
|
import net.minecraftforge.client.event.MouseEvent;
|
||||||
import net.minecraftforge.client.event.RenderHandEvent;
|
import net.minecraftforge.client.event.RenderHandEvent;
|
||||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||||
|
|
@ -57,10 +58,6 @@ import tschipp.carryon.network.server.SyncKeybindPacket;
|
||||||
public class RenderEvents
|
public class RenderEvents
|
||||||
{
|
{
|
||||||
private static boolean initModels;
|
private static boolean initModels;
|
||||||
private ModelRenderer fakeLeftArm;
|
|
||||||
private ModelRenderer fakeRightArm;
|
|
||||||
private ModelRenderer fakeLeftArmwear;
|
|
||||||
private ModelRenderer fakeRightArmwear;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prevents the Player from scrolling
|
* Prevents the Player from scrolling
|
||||||
|
|
@ -130,7 +127,7 @@ public class RenderEvents
|
||||||
Minecraft.getMinecraft().setIngameFocus();
|
Minecraft.getMinecraft().setIngameFocus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +199,7 @@ public class RenderEvents
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.scale(2.5, 2.5, 2.5);
|
GlStateManager.scale(2.5, 2.5, 2.5);
|
||||||
GlStateManager.translate(0, -0.6, -1);
|
GlStateManager.translate(0, -0.6, -1);
|
||||||
|
|
||||||
if (CarryOnConfig.settings.facePlayer ? !isChest(block) : isChest(block))
|
if (CarryOnConfig.settings.facePlayer ? !isChest(block) : isChest(block))
|
||||||
{
|
{
|
||||||
GlStateManager.rotate(180, 0, 1f, 0);
|
GlStateManager.rotate(180, 0, 1f, 0);
|
||||||
|
|
@ -276,28 +273,6 @@ public class RenderEvents
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (stack.isEmpty() ? true : stack.getItem() != RegistrationHandler.itemEntity)
|
|
||||||
{
|
|
||||||
event.setCanceled(false);
|
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
|
||||||
RenderManager manager = mc.getRenderManager();
|
|
||||||
RenderPlayer renderPlayer = manager.getSkinMap().get(aplayer.getSkinType());
|
|
||||||
ModelPlayer modelPlayer = renderPlayer.getMainModel();
|
|
||||||
|
|
||||||
if (modelPlayer != null)
|
|
||||||
{
|
|
||||||
if (modelPlayer.bipedLeftArm != null && modelPlayer.bipedRightArm != null)
|
|
||||||
{
|
|
||||||
modelPlayer.bipedLeftArm.isHidden = false;
|
|
||||||
modelPlayer.bipedRightArm.isHidden = false;
|
|
||||||
modelPlayer.bipedLeftArmwear.isHidden = false;
|
|
||||||
modelPlayer.bipedRightArmwear.isHidden = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
@ -353,7 +328,12 @@ public class RenderEvents
|
||||||
NBTTagCompound tag = ItemTile.getTileData(stack);
|
NBTTagCompound tag = ItemTile.getTileData(stack);
|
||||||
ItemStack tileItem = ItemTile.getItemStack(stack);
|
ItemStack tileItem = ItemTile.getItemStack(stack);
|
||||||
|
|
||||||
float rotation = -(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
|
float rotation = 0f;
|
||||||
|
|
||||||
|
if (player.isRiding() && player.getRidingEntity() instanceof EntityLivingBase)
|
||||||
|
rotation = -(player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialticks);
|
||||||
|
else
|
||||||
|
rotation = -(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
|
||||||
|
|
||||||
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialticks;
|
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialticks;
|
||||||
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialticks;
|
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialticks;
|
||||||
|
|
@ -444,356 +424,183 @@ public class RenderEvents
|
||||||
* Renders correct arm rotation
|
* Renders correct arm rotation
|
||||||
*/
|
*/
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@SubscribeEvent
|
@SubscribeEvent(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerRenderPre(RenderPlayerEvent.Pre event)
|
public void onEvent(RenderPlayerEvent.Post event)
|
||||||
{
|
{
|
||||||
if (!Loader.isModLoaded("mobends") && CarryOnConfig.settings.renderArms)
|
if (handleMobends())
|
||||||
{
|
{
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
AbstractClientPlayer aplayer = (AbstractClientPlayer) player;
|
EntityPlayerSP clientPlayer = Minecraft.getMinecraft().player;
|
||||||
|
float partialticks = event.getPartialRenderTick();
|
||||||
|
|
||||||
ItemStack stack = player.getHeldItemMainhand();
|
ItemStack stack = player.getHeldItemMainhand();
|
||||||
ModelPlayer model = event.getRenderer().getMainModel();
|
|
||||||
ResourceLocation skinLoc = DefaultPlayerSkin.getDefaultSkin(player.getPersistentID());
|
|
||||||
|
|
||||||
if (!initModels)
|
|
||||||
{
|
|
||||||
this.fakeLeftArm = new ModelRenderer(model, 32, 48);
|
|
||||||
this.fakeRightArm = new ModelRenderer(model, 40, 16);
|
|
||||||
this.fakeLeftArmwear = new ModelRenderer(model, 48, 48);
|
|
||||||
this.fakeRightArmwear = new ModelRenderer(model, 40, 32);
|
|
||||||
initModels = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setArrowCountInEntity(0); // TODO Temporary Fix
|
|
||||||
|
|
||||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||||
{
|
{
|
||||||
CarryOnOverride overrider = ScriptChecker.getOverride(player);
|
ModelPlayer model = event.getRenderer().getMainModel();
|
||||||
if (overrider != null)
|
float rotation = 0;
|
||||||
{
|
|
||||||
if (model.bipedBody.childModels != null && !model.bipedBody.childModels.isEmpty())
|
|
||||||
{
|
|
||||||
for (int k = 0; k < model.bipedBody.childModels.size(); k++)
|
|
||||||
{
|
|
||||||
double[] rotLeft1 = ScriptParseHelper.getXYZArray(overrider.getRenderRotationLeftArm());
|
|
||||||
double[] rotRight1 = ScriptParseHelper.getXYZArray(overrider.getRenderRotationRightArm());
|
|
||||||
|
|
||||||
float rotX = model.bipedBody.childModels.get(k).rotateAngleX;
|
if (player.isRiding() && player.getRidingEntity() instanceof EntityLivingBase)
|
||||||
float rotY = model.bipedBody.childModels.get(k).rotateAngleY;
|
rotation = (player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialticks);
|
||||||
float rotZ = model.bipedBody.childModels.get(k).rotateAngleZ;
|
|
||||||
|
|
||||||
if (rotLeft1[0] == rotX || rotLeft1[1] == rotY || rotRight1[2] == rotZ || rotRight1[0] == rotX || rotRight1[1] == rotY || rotRight1[2] == rotZ || rotX == rotLeft1[0] - 0.7f || rotX == rotRight1[0] - 0.7f)
|
|
||||||
{
|
|
||||||
model.bipedBody.childModels.remove(k);
|
|
||||||
k = k - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
rotation = (player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
|
||||||
if (model.bipedBody.childModels != null && !model.bipedBody.childModels.isEmpty())
|
|
||||||
{
|
|
||||||
for (int k = 0; k < model.bipedBody.childModels.size(); k++)
|
|
||||||
{
|
|
||||||
float chkRot = model.bipedBody.childModels.get(k).rotateAngleX;
|
|
||||||
|
|
||||||
if (chkRot == -0.9001F || chkRot == -1.2001F || chkRot == -1.6001F || chkRot == -1.9001F)
|
AbstractClientPlayer aplayer = (AbstractClientPlayer) player;
|
||||||
{
|
ResourceLocation skinLoc = aplayer.getLocationSkin();
|
||||||
model.bipedBody.childModels.remove(k);
|
|
||||||
k = k - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item item = stack.getItem();
|
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialticks;
|
||||||
|
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialticks;
|
||||||
|
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialticks;
|
||||||
|
|
||||||
model.bipedLeftArm.isHidden = true;
|
double c0 = clientPlayer.lastTickPosX + (clientPlayer.posX - clientPlayer.lastTickPosX) * partialticks;
|
||||||
model.bipedRightArm.isHidden = true;
|
double c1 = clientPlayer.lastTickPosY + (clientPlayer.posY - clientPlayer.lastTickPosY) * partialticks;
|
||||||
model.bipedLeftArmwear.isHidden = true;
|
double c2 = clientPlayer.lastTickPosZ + (clientPlayer.posZ - clientPlayer.lastTickPosZ) * partialticks;
|
||||||
model.bipedRightArmwear.isHidden = true;
|
|
||||||
this.fakeLeftArm.isHidden = false;
|
double xOffset = d0 - c0;
|
||||||
this.fakeLeftArmwear.isHidden = false;
|
double yOffset = d1 - c1;
|
||||||
this.fakeRightArm.isHidden = false;
|
double zOffset = d2 - c2;
|
||||||
this.fakeRightArmwear.isHidden = false;
|
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.translate(xOffset, yOffset, zOffset);
|
||||||
|
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(skinLoc);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(skinLoc);
|
||||||
|
|
||||||
if (aplayer.getSkinType().equals("default"))
|
CarryOnOverride overrider = ScriptChecker.getOverride(player);
|
||||||
{
|
if (overrider != null)
|
||||||
// left arm
|
|
||||||
this.fakeLeftArm.addBox(model.bipedLeftArm.offsetX + 4.2F, model.bipedLeftArm.offsetY, model.bipedLeftArm.offsetZ, 4, 12, 4, .08F);
|
|
||||||
this.fakeLeftArmwear.addBox(model.bipedLeftArm.offsetX + 4.2F, model.bipedLeftArm.offsetY, model.bipedLeftArm.offsetZ, 4, 12, 4, .08F + 0.25F);
|
|
||||||
|
|
||||||
// right arm
|
|
||||||
this.fakeRightArm.addBox(model.bipedRightArm.offsetX - 7.9F, model.bipedRightArm.offsetY, model.bipedRightArm.offsetZ, 4, 12, 4, .08F);
|
|
||||||
this.fakeRightArmwear.addBox(model.bipedRightArm.offsetX - 7.9F, model.bipedRightArm.offsetY, model.bipedRightArm.offsetZ, 4, 12, 4, .08F + 0.25F);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// left arm
|
|
||||||
this.fakeLeftArm.addBox(model.bipedLeftArm.offsetX + 4.2F, model.bipedLeftArm.offsetY, model.bipedLeftArm.offsetZ, 3, 12, 4, .08F);
|
|
||||||
this.fakeLeftArmwear.addBox(model.bipedLeftArm.offsetX + 4.2F, model.bipedLeftArm.offsetY, model.bipedLeftArm.offsetZ, 3, 12, 4, .08F + 0.25F);
|
|
||||||
|
|
||||||
// right arm
|
|
||||||
this.fakeRightArm.addBox(model.bipedRightArm.offsetX - 7.2F, model.bipedRightArm.offsetY, model.bipedRightArm.offsetZ, 3, 12, 4, .08F);
|
|
||||||
this.fakeRightArmwear.addBox(model.bipedRightArm.offsetX - 7.2F, model.bipedRightArm.offsetY, model.bipedRightArm.offsetZ, 3, 12, 4, .08F + 0.25F);
|
|
||||||
}
|
|
||||||
|
|
||||||
CarryOnOverride override = ScriptChecker.getOverride(player);
|
|
||||||
if (override != null)
|
|
||||||
{
|
{
|
||||||
double[] rotLeft = null;
|
double[] rotLeft = null;
|
||||||
double[] rotRight = null;
|
double[] rotRight = null;
|
||||||
if (override.getRenderRotationLeftArm() != null)
|
if (overrider.getRenderRotationLeftArm() != null)
|
||||||
rotLeft = ScriptParseHelper.getXYZArray(override.getRenderRotationLeftArm());
|
rotLeft = ScriptParseHelper.getXYZArray(overrider.getRenderRotationLeftArm());
|
||||||
if (override.getRenderRotationRightArm() != null)
|
if (overrider.getRenderRotationRightArm() != null)
|
||||||
rotRight = ScriptParseHelper.getXYZArray(override.getRenderRotationRightArm());
|
rotRight = ScriptParseHelper.getXYZArray(overrider.getRenderRotationRightArm());
|
||||||
|
|
||||||
boolean renderRight = override.isRenderRightArm();
|
boolean renderRight = overrider.isRenderRightArm();
|
||||||
boolean renderLeft = override.isRenderLeftArm();
|
boolean renderLeft = overrider.isRenderLeftArm();
|
||||||
|
|
||||||
if (!renderRight)
|
if (renderLeft && rotLeft != null)
|
||||||
{
|
{
|
||||||
this.fakeRightArm.isHidden = true;
|
renderArmPost(model.bipedLeftArm, (float) rotLeft[0], (float) rotLeft[2], rotation, false, player.isSneaking());
|
||||||
this.fakeRightArmwear.isHidden = true;
|
renderArmPost(model.bipedLeftArmwear, (float) rotLeft[0], (float) rotLeft[2], rotation, false, player.isSneaking());
|
||||||
model.bipedRightArm.isHidden = false;
|
}
|
||||||
model.bipedRightArmwear.isHidden = false;
|
else if (renderLeft)
|
||||||
|
{
|
||||||
|
renderArmPost(model.bipedLeftArm, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, player.isSneaking());
|
||||||
|
renderArmPost(model.bipedLeftArmwear, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, player.isSneaking());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!renderLeft)
|
if (renderRight && rotRight != null)
|
||||||
{
|
{
|
||||||
this.fakeLeftArm.isHidden = true;
|
renderArmPost(model.bipedRightArm, (float) rotRight[0], (float) rotRight[2], rotation, true, player.isSneaking());
|
||||||
this.fakeLeftArmwear.isHidden = true;
|
renderArmPost(model.bipedRightArmwear, (float) rotRight[0], (float) rotRight[2], rotation, true, player.isSneaking());
|
||||||
model.bipedLeftArm.isHidden = false;
|
}
|
||||||
model.bipedLeftArmwear.isHidden = false;
|
else if (renderRight)
|
||||||
|
{
|
||||||
|
renderArmPost(model.bipedRightArm, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, player.isSneaking());
|
||||||
|
renderArmPost(model.bipedRightArmwear, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, player.isSneaking());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rotLeft != null)
|
|
||||||
{
|
|
||||||
if (!player.isSneaking())
|
|
||||||
{
|
|
||||||
this.fakeLeftArm.rotateAngleX = (float) rotLeft[0];
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = (float) rotLeft[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.fakeLeftArm.rotateAngleX = (float) rotLeft[0] - 0.7f;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = (float) rotLeft[0] - 0.7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fakeLeftArmwear.rotateAngleY = (float) rotLeft[1];
|
|
||||||
this.fakeLeftArmwear.rotateAngleZ = (float) rotLeft[2];
|
|
||||||
this.fakeLeftArm.rotateAngleY = (float) rotLeft[1];
|
|
||||||
this.fakeLeftArm.rotateAngleZ = (float) rotLeft[2];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (item == RegistrationHandler.itemTile)
|
|
||||||
{
|
|
||||||
if (!player.isSneaking())
|
|
||||||
{
|
|
||||||
this.fakeLeftArm.rotateAngleX = -.9001F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = -.9001F;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.fakeLeftArm.rotateAngleX = -1.6001F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = -1.6001F;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!player.isSneaking())
|
|
||||||
{
|
|
||||||
this.fakeLeftArm.rotateAngleX = -1.2001F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = -1.2001F;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.fakeLeftArm.rotateAngleX = -1.9001F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = -1.9001F;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fakeLeftArm.rotateAngleY = 0.15f;
|
|
||||||
this.fakeLeftArmwear.rotateAngleY = 0.15f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rotRight != null)
|
|
||||||
{
|
|
||||||
if (!player.isSneaking())
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = (float) rotRight[0];
|
|
||||||
this.fakeRightArmwear.rotateAngleX = (float) rotRight[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = (float) rotRight[0] - 0.5f;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = (float) rotRight[0] - 0.5f;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fakeRightArmwear.rotateAngleY = (float) rotRight[1];
|
|
||||||
this.fakeRightArmwear.rotateAngleZ = (float) rotRight[2];
|
|
||||||
this.fakeRightArm.rotateAngleY = (float) rotRight[1];
|
|
||||||
this.fakeRightArm.rotateAngleZ = (float) rotRight[2];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (item == RegistrationHandler.itemTile)
|
|
||||||
{
|
|
||||||
if (!player.isSneaking())
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = -.9001F;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = -.9001F;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = -1.6001F;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = -1.6001F;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!player.isSneaking())
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = -1.2001F;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = -1.2001F;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = -1.9001F;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = -1.9001F;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fakeRightArm.rotateAngleY = -0.15f;
|
|
||||||
this.fakeRightArmwear.rotateAngleY = -0.15f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (item == RegistrationHandler.itemTile)
|
renderArmPost(model.bipedRightArm, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, player.isSneaking());
|
||||||
{
|
renderArmPost(model.bipedLeftArm, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, player.isSneaking());
|
||||||
if (!player.isSneaking())
|
renderArmPost(model.bipedLeftArmwear, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, player.isSneaking());
|
||||||
{
|
renderArmPost(model.bipedRightArmwear, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, player.isSneaking());
|
||||||
this.fakeRightArm.rotateAngleX = -.9001F;
|
|
||||||
this.fakeLeftArm.rotateAngleX = -.9001F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = -.9001F;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = -.9001F;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = -1.6001F;
|
|
||||||
this.fakeLeftArm.rotateAngleX = -1.6001F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = -1.6001F;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = -1.6001F;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fakeRightArm.rotateAngleY = 0f;
|
|
||||||
this.fakeLeftArm.rotateAngleY = 0f;
|
|
||||||
this.fakeLeftArmwear.rotateAngleY = 0f;
|
|
||||||
this.fakeRightArmwear.rotateAngleY = 0f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!player.isSneaking())
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = -1.2001F;
|
|
||||||
this.fakeLeftArm.rotateAngleX = -1.2001F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = -1.2001F;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = -1.2001F;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.fakeRightArm.rotateAngleX = -1.9001F;
|
|
||||||
this.fakeLeftArm.rotateAngleX = -1.9001F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleX = -1.9001F;
|
|
||||||
this.fakeRightArmwear.rotateAngleX = -1.9001F;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fakeRightArm.rotateAngleY = -0.15f;
|
|
||||||
this.fakeLeftArm.rotateAngleY = 0.15f;
|
|
||||||
this.fakeLeftArmwear.rotateAngleY = 0.15f;
|
|
||||||
this.fakeRightArmwear.rotateAngleY = -0.15f;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fakeRightArm.rotateAngleZ = 0F;
|
|
||||||
this.fakeLeftArm.rotateAngleZ = 0F;
|
|
||||||
this.fakeLeftArmwear.rotateAngleZ = 0F;
|
|
||||||
this.fakeRightArmwear.rotateAngleZ = 0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
model.bipedBody.addChild(this.fakeLeftArm);
|
|
||||||
model.bipedBody.addChild(this.fakeRightArm);
|
|
||||||
|
|
||||||
if (player.isWearing(EnumPlayerModelParts.LEFT_SLEEVE))
|
|
||||||
{
|
|
||||||
model.bipedBody.addChild(this.fakeLeftArmwear);
|
|
||||||
}
|
|
||||||
if (player.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE))
|
|
||||||
{
|
|
||||||
model.bipedBody.addChild(this.fakeRightArmwear);
|
|
||||||
}
|
}
|
||||||
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hides the vanilla arm for rendering the rotation
|
||||||
|
*/
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@SubscribeEvent(priority = EventPriority.NORMAL)
|
||||||
|
public void onEvent(RenderPlayerEvent.Pre event)
|
||||||
|
{
|
||||||
|
if (handleMobends())
|
||||||
|
{
|
||||||
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
ItemStack stack = player.getHeldItemMainhand();
|
||||||
|
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||||
{
|
{
|
||||||
model.bipedLeftArm.isHidden = false;
|
ModelPlayer model = event.getRenderer().getMainModel();
|
||||||
model.bipedRightArm.isHidden = false;
|
|
||||||
model.bipedLeftArmwear.isHidden = false;
|
|
||||||
model.bipedRightArmwear.isHidden = false;
|
|
||||||
|
|
||||||
CarryOnOverride overrider = ScriptChecker.getOverride(player);
|
CarryOnOverride overrider = ScriptChecker.getOverride(player);
|
||||||
if (overrider != null)
|
if (overrider != null)
|
||||||
{
|
{
|
||||||
if (model.bipedBody.childModels != null && !model.bipedBody.childModels.isEmpty())
|
boolean renderRight = overrider.isRenderRightArm();
|
||||||
|
boolean renderLeft = overrider.isRenderLeftArm();
|
||||||
|
|
||||||
|
if (renderRight)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < model.bipedBody.childModels.size(); k++)
|
renderArmPre(model.bipedRightArm);
|
||||||
{
|
renderArmPre(model.bipedRightArmwear);
|
||||||
double[] rotLeft1 = ScriptParseHelper.getXYZArray(overrider.getRenderRotationLeftArm());
|
}
|
||||||
double[] rotRight1 = ScriptParseHelper.getXYZArray(overrider.getRenderRotationRightArm());
|
|
||||||
|
|
||||||
float rotX = model.bipedBody.childModels.get(k).rotateAngleX;
|
if (renderLeft)
|
||||||
float rotY = model.bipedBody.childModels.get(k).rotateAngleY;
|
{
|
||||||
float rotZ = model.bipedBody.childModels.get(k).rotateAngleZ;
|
renderArmPre(model.bipedLeftArm);
|
||||||
|
renderArmPre(model.bipedLeftArmwear);
|
||||||
if (rotLeft1[0] == rotX || rotLeft1[1] == rotY || rotRight1[2] == rotZ || rotRight1[0] == rotX || rotRight1[1] == rotY || rotRight1[2] == rotZ || rotX == rotLeft1[0] - 0.7f || rotX == rotRight1[0] - 0.7f)
|
|
||||||
{
|
|
||||||
model.bipedBody.childModels.remove(k);
|
|
||||||
k = k - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (model.bipedBody.childModels != null && !model.bipedBody.childModels.isEmpty())
|
renderArmPre(model.bipedRightArm);
|
||||||
{
|
renderArmPre(model.bipedLeftArm);
|
||||||
for (int k = 0; k < model.bipedBody.childModels.size(); k++)
|
renderArmPre(model.bipedLeftArmwear);
|
||||||
{
|
renderArmPre(model.bipedRightArmwear);
|
||||||
float chkRot = model.bipedBody.childModels.get(k).rotateAngleX;
|
|
||||||
|
|
||||||
if (chkRot == -0.9001F || chkRot == -1.2001F || chkRot == -1.6001F || chkRot == -1.9001F)
|
|
||||||
{
|
|
||||||
model.bipedBody.childModels.remove(k);
|
|
||||||
k = k - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.isEmpty() || stack.getItem() != RegistrationHandler.itemTile && stack.getItem() != RegistrationHandler.itemEntity)
|
|
||||||
{
|
|
||||||
model.bipedLeftArm.isHidden = false;
|
|
||||||
model.bipedRightArm.isHidden = false;
|
|
||||||
model.bipedLeftArmwear.isHidden = false;
|
|
||||||
model.bipedRightArmwear.isHidden = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderArmPost(ModelRenderer arm, float x, float z, float rotation, boolean right, boolean sneaking)
|
||||||
|
{
|
||||||
|
arm.isHidden = false;
|
||||||
|
if (right)
|
||||||
|
{
|
||||||
|
arm.rotationPointZ = -MathHelper.sin((float) Math.toRadians(rotation)) * 4.75F;
|
||||||
|
arm.rotationPointX = -MathHelper.cos((float) Math.toRadians(rotation)) * 4.75F;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
arm.rotationPointZ = MathHelper.sin((float) Math.toRadians(rotation)) * 4.75F;
|
||||||
|
arm.rotationPointX = MathHelper.cos((float) Math.toRadians(rotation)) * 4.75F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sneaking)
|
||||||
|
arm.rotationPointY = 20;
|
||||||
|
else
|
||||||
|
arm.rotationPointY = 15;
|
||||||
|
|
||||||
|
arm.rotateAngleX = (float) x;
|
||||||
|
arm.rotateAngleY = (float) -Math.toRadians(rotation);
|
||||||
|
arm.rotateAngleZ = (float) z;
|
||||||
|
arm.renderWithRotation(0.0625F);
|
||||||
|
arm.rotationPointY = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderArmPre(ModelRenderer arm)
|
||||||
|
{
|
||||||
|
arm.isHidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean handleMobends()
|
||||||
|
{
|
||||||
|
if (Loader.isModLoaded("mobends"))
|
||||||
|
{
|
||||||
|
Configuration config = new Configuration(new File(CarryOn.CONFIGURATION_FILE.getPath().substring(0, CarryOn.CONFIGURATION_FILE.getPath().length() - 16), "mobends.cfg"));
|
||||||
|
|
||||||
|
boolean renderPlayer = config.get("animated", "player", true).getBoolean();
|
||||||
|
return !renderPlayer;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isChest(Block block)
|
public static boolean isChest(Block block)
|
||||||
{
|
{
|
||||||
return block == Blocks.CHEST || block == Blocks.ENDER_CHEST || block == Blocks.TRAPPED_CHEST;
|
return block == Blocks.CHEST || block == Blocks.ENDER_CHEST || block == Blocks.TRAPPED_CHEST;
|
||||||
|
|
|
||||||
|
|
@ -17,36 +17,37 @@ import tschipp.carryon.CarryOn;
|
||||||
import tschipp.carryon.common.helper.ReflectionUtil;
|
import tschipp.carryon.common.helper.ReflectionUtil;
|
||||||
|
|
||||||
@Config(modid = CarryOn.MODID)
|
@Config(modid = CarryOn.MODID)
|
||||||
public class CarryOnConfig {
|
public class CarryOnConfig
|
||||||
|
{
|
||||||
|
|
||||||
@Config.LangKey(CarryOn.MODID)
|
@Config.LangKey(CarryOn.MODID)
|
||||||
@Config.Comment("General Mod Settings")
|
@Config.Comment("General Mod Settings")
|
||||||
public static Configs.Settings settings = new Configs.Settings();
|
public static Configs.Settings settings = new Configs.Settings();
|
||||||
|
|
||||||
@Config.LangKey(CarryOn.MODID)
|
@Config.LangKey(CarryOn.MODID)
|
||||||
@Config.Comment("Blacklist for Blocks and Entities")
|
@Config.Comment("Blacklist for Blocks and Entities")
|
||||||
public static Configs.Blacklist blacklist = new Configs.Blacklist();
|
public static Configs.Blacklist blacklist = new Configs.Blacklist();
|
||||||
|
|
||||||
@Config.LangKey(CarryOn.MODID)
|
@Config.LangKey(CarryOn.MODID)
|
||||||
@Config.Comment("Whitelist for Blocks and Entities (useWhitelist must be true!)")
|
@Config.Comment("Whitelist for Blocks and Entities (useWhitelist must be true!)")
|
||||||
public static Configs.WhiteList whitelist = new Configs.WhiteList();
|
public static Configs.WhiteList whitelist = new Configs.WhiteList();
|
||||||
|
|
||||||
@Config.LangKey(CarryOn.MODID)
|
@Config.LangKey(CarryOn.MODID)
|
||||||
@Config.Comment("Model Overrides based on NBT or on Meta. Advanced Users Only!")
|
@Config.Comment("Model Overrides based on NBT or on Meta. Advanced Users Only!")
|
||||||
public static Configs.ModelOverrides modelOverrides = new Configs.ModelOverrides();
|
public static Configs.ModelOverrides modelOverrides = new Configs.ModelOverrides();
|
||||||
|
|
||||||
@Config.LangKey(CarryOn.MODID)
|
@Config.LangKey(CarryOn.MODID)
|
||||||
@Config.Comment("Custom Pickup Conditions for certain blocks. ONLY WORKS WHEN GAMESTAGES IS INSTALLED! Advanced Users Only!")
|
@Config.Comment("Custom Pickup Conditions for certain blocks. ONLY WORKS WHEN GAMESTAGES IS INSTALLED! Advanced Users Only!")
|
||||||
public static Configs.CustomPickupConditions customPickupConditions = new Configs.CustomPickupConditions();
|
public static Configs.CustomPickupConditions customPickupConditions = new Configs.CustomPickupConditions();
|
||||||
|
|
||||||
@Mod.EventBusSubscriber
|
@Mod.EventBusSubscriber
|
||||||
public static class EventHandler {
|
public static class EventHandler
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link ConfigManager#CONFIGS} getter.
|
* The {@link ConfigManager#CONFIGS} getter.
|
||||||
*/
|
*/
|
||||||
private static final MethodHandle CONFIGS_GETTER = ReflectionUtil.findFieldGetter(ConfigManager.class, "CONFIGS");
|
private static final MethodHandle CONFIGS_GETTER = ReflectionUtil.findFieldGetter(ConfigManager.class, "CONFIGS");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link Configuration} instance.
|
* The {@link Configuration} instance.
|
||||||
|
|
@ -61,22 +62,22 @@ public class CarryOnConfig {
|
||||||
*
|
*
|
||||||
* @return The Configuration instance
|
* @return The Configuration instance
|
||||||
*/
|
*/
|
||||||
public static Configuration getConfiguration() {
|
public static Configuration getConfiguration(String modid)
|
||||||
|
{
|
||||||
if (EventHandler.configuration == null)
|
if (EventHandler.configuration == null)
|
||||||
try {
|
try
|
||||||
final String fileName = CarryOn.MODID + ".cfg";
|
{
|
||||||
|
final String fileName = modid + ".cfg";
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Map<String, Configuration> configsMap = (Map<String, Configuration>) EventHandler.CONFIGS_GETTER
|
final Map<String, Configuration> configsMap = (Map<String, Configuration>) EventHandler.CONFIGS_GETTER.invokeExact();
|
||||||
.invokeExact();
|
|
||||||
|
|
||||||
final Optional<Map.Entry<String, Configuration>> entryOptional = configsMap.entrySet().stream()
|
final Optional<Map.Entry<String, Configuration>> entryOptional = configsMap.entrySet().stream().filter(entry -> fileName.equals(new File(entry.getKey()).getName())).findFirst();
|
||||||
.filter(entry -> fileName.equals(new File(entry.getKey()).getName())).findFirst();
|
|
||||||
|
|
||||||
entryOptional
|
entryOptional.ifPresent(stringConfigurationEntry -> EventHandler.configuration = stringConfigurationEntry.getValue());
|
||||||
.ifPresent(stringConfigurationEntry -> EventHandler.configuration = stringConfigurationEntry
|
}
|
||||||
.getValue());
|
catch (Throwable throwable)
|
||||||
} catch (Throwable throwable) {
|
{
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +92,8 @@ public class CarryOnConfig {
|
||||||
* The event
|
* The event
|
||||||
*/
|
*/
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||||
|
{
|
||||||
if (event.getModID().equals(CarryOn.MODID))
|
if (event.getModID().equals(CarryOn.MODID))
|
||||||
ConfigManager.load(CarryOn.MODID, Config.Type.INSTANCE);
|
ConfigManager.load(CarryOn.MODID, Config.Type.INSTANCE);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,13 @@ public class Configs {
|
||||||
"malisisdoors:*",
|
"malisisdoors:*",
|
||||||
"industrialforegoing:*",
|
"industrialforegoing:*",
|
||||||
"minecolonies:*",
|
"minecolonies:*",
|
||||||
|
"thaumcraft:pillar*",
|
||||||
|
"thaumcraft:infernal_furnace",
|
||||||
|
"thaumcraft:placeholder*",
|
||||||
|
"thaumcraft:infusion_matrix",
|
||||||
|
"thaumcraft:golem_builder",
|
||||||
|
"thaumcraft:thaumatorium*",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@Config.RequiresMcRestart()
|
@Config.RequiresMcRestart()
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ import net.minecraft.util.text.event.ClickEvent;
|
||||||
import net.minecraft.util.text.event.ClickEvent.Action;
|
import net.minecraft.util.text.event.ClickEvent.Action;
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
|
||||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||||
|
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||||
|
|
@ -54,9 +54,9 @@ public class ItemEvents
|
||||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||||
public void onBlockClick(PlayerInteractEvent.RightClickBlock event)
|
public void onBlockClick(PlayerInteractEvent.RightClickBlock event)
|
||||||
{
|
{
|
||||||
if(event.isCanceled())
|
if (event.isCanceled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
ItemStack stack = player.getHeldItemMainhand();
|
ItemStack stack = player.getHeldItemMainhand();
|
||||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
|
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
|
||||||
|
|
@ -197,7 +197,7 @@ public class ItemEvents
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void harvestSpeed(BreakEvent event)
|
public void harvestSpeed(BreakEvent event)
|
||||||
{
|
{
|
||||||
|
|
@ -209,8 +209,7 @@ public class ItemEvents
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void playerAttack(LivingAttackEvent event)
|
public void playerAttack(LivingAttackEvent event)
|
||||||
{
|
{
|
||||||
|
|
@ -248,7 +247,6 @@ public class ItemEvents
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
|
|
||||||
|
|
||||||
if (main.isEmpty() && off.isEmpty() && CarryOnKeybinds.isKeyPressed(player))
|
if (main.isEmpty() && off.isEmpty() && CarryOnKeybinds.isKeyPressed(player))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -301,7 +299,7 @@ public class ItemEvents
|
||||||
s.getStyle().setClickEvent(new ClickEvent(Action.OPEN_URL, "https://github.com/Tschipp/CarryOn/issues"));
|
s.getStyle().setClickEvent(new ClickEvent(Action.OPEN_URL, "https://github.com/Tschipp/CarryOn/issues"));
|
||||||
player.sendMessage(new TextComponentString(TextFormatting.RED + "Please report this error ").appendSibling(s));
|
player.sendMessage(new TextComponentString(TextFormatting.RED + "Please report this error ").appendSibling(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -379,4 +377,54 @@ public class ItemEvents
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void dropNonHotbarItems(LivingUpdateEvent event)
|
||||||
|
{
|
||||||
|
EntityLivingBase entity = event.getEntityLiving();
|
||||||
|
if (entity instanceof EntityPlayer && !entity.world.isRemote)
|
||||||
|
{
|
||||||
|
EntityPlayer player = (EntityPlayer) entity;
|
||||||
|
|
||||||
|
boolean hasCarried = player.inventory.hasItemStack(new ItemStack(RegistrationHandler.itemTile)) || player.inventory.hasItemStack(new ItemStack(RegistrationHandler.itemEntity));
|
||||||
|
ItemStack inHand = player.getHeldItemMainhand();
|
||||||
|
|
||||||
|
if (hasCarried)
|
||||||
|
{
|
||||||
|
if (inHand.getItem() != RegistrationHandler.itemTile && inHand.getItem() != RegistrationHandler.itemEntity)
|
||||||
|
{
|
||||||
|
int slotBlock = getSlot(player, RegistrationHandler.itemTile);
|
||||||
|
int slotEntity = getSlot(player, RegistrationHandler.itemEntity);
|
||||||
|
|
||||||
|
EntityItem item = null;
|
||||||
|
if(slotBlock != -1)
|
||||||
|
{
|
||||||
|
ItemStack dropped = player.inventory.removeStackFromSlot(slotBlock);
|
||||||
|
item = new EntityItem(player.world, player.posX, player.posY, player.posZ, dropped);
|
||||||
|
}
|
||||||
|
if(slotEntity != -1)
|
||||||
|
{
|
||||||
|
ItemStack dropped = player.inventory.removeStackFromSlot(slotEntity);
|
||||||
|
item = new EntityItem(player.world, player.posX, player.posY, player.posZ, dropped);
|
||||||
|
}
|
||||||
|
if(item != null)
|
||||||
|
{
|
||||||
|
player.world.spawnEntity(item);
|
||||||
|
CarryOn.network.sendToAllAround(new CarrySlotPacket(9, player.getEntityId()), new TargetPoint(player.world.provider.getDimension(), player.posX, player.posY, player.posZ, 256));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSlot(EntityPlayer player, Item item)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||||
|
{
|
||||||
|
ItemStack stack = player.inventory.getStackInSlot(i);
|
||||||
|
if(stack.getItem() == item)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ public class ScriptReader
|
||||||
public static void preInit(FMLPreInitializationEvent event)
|
public static void preInit(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
CarryOn.CONFIGURATION_FILE = new File(event.getModConfigurationDirectory(), "carryon-scripts/");
|
CarryOn.CONFIGURATION_FILE = new File(event.getModConfigurationDirectory(), "carryon-scripts/");
|
||||||
|
|
||||||
if (!CarryOn.CONFIGURATION_FILE.exists())
|
if (!CarryOn.CONFIGURATION_FILE.exists())
|
||||||
CarryOn.CONFIGURATION_FILE.mkdir();
|
CarryOn.CONFIGURATION_FILE.mkdir();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"ingredient": {
|
|
||||||
"type": "forge:ore_dict",
|
|
||||||
"ore": "enderpearl"
|
|
||||||
},
|
|
||||||
"name": "ENDERPEARL"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ingredient": {
|
|
||||||
"type": "forge:ore_dict",
|
|
||||||
"ore": "gemDiamond"
|
|
||||||
},
|
|
||||||
"name": "GEMDIAMOND"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ingredient": {
|
|
||||||
"type": "forge:ore_dict",
|
|
||||||
"ore": "ingotIron"
|
|
||||||
},
|
|
||||||
"name": "INGOTIRON"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ingredient": {
|
|
||||||
"type": "forge:ore_dict",
|
|
||||||
"ore": "nuggetIron"
|
|
||||||
},
|
|
||||||
"name": "NUGGETIRON"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ingredient": {
|
|
||||||
"type": "forge:ore_dict",
|
|
||||||
"ore": "paper"
|
|
||||||
},
|
|
||||||
"name": "PAPER"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ingredient": {
|
|
||||||
"type": "forge:ore_dict",
|
|
||||||
"ore": "stone"
|
|
||||||
},
|
|
||||||
"name": "STONE"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
Loading…
Reference in New Issue
Block a user