Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ public void init(FMLInitializationEvent event) {
new TESRTrueGreenscreen());
}

GloveRenderer gloveRenderer = new GloveRenderer();
if (ModItems.GLOVE.isEnabled()) {
MinecraftForgeClient.registerItemRenderer(ModItems.GLOVE.get(), new GloveRenderer());
MinecraftForgeClient.registerItemRenderer(ModItems.GLOVE.get(), gloveRenderer);
}
if (ModItems.BOXING_GLOVE.isEnabled()) {
MinecraftForgeClient.registerItemRenderer(ModItems.BOXING_GLOVE.get(), gloveRenderer);
}

if (ModItems.FIRE_BATTERY.isEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.fouristhenumber.utilitiesinexcess.common.items.ItemAnalyzer;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemBedrockiumIngot;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemBoxingGlove;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemBuildersWand;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemCapacityUpgrade;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemChunchunmaru;
Expand Down Expand Up @@ -83,6 +84,7 @@ public enum ModItems {
CHUNCHUNMARU(ChunchunmaruConfig.INSTANCE.enable, new ItemChunchunmaru(), "chunchunmaru"),
CAPACITY_UPGRADE(BlockConfig.filingCabinets.enableFilingCabinets, new ItemCapacityUpgrade(), "capacity_upgrade"),
PAINT_ROLLER(ColoredBlocksConfig.INSTANCE.enablePaintRoller, new ItemPaintRoller(), "paint_roller"),
BOXING_GLOVE(ItemConfig.enableBoxingGlove, new ItemBoxingGlove(), "boxing_glove"),
; // leave trailing semicolon
// spotless:on

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ public static void IMCSender() {
"uie.nei.infopage.colored_blocks.dyeable");
}
}

sendInfoPage("<utilitiesinexcess:boxing_glove>", "uie.nei.infopage.boxing_glove");
}

private static void sendInfoPage(String filter, String page) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.fouristhenumber.utilitiesinexcess.common.items;

import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;

public class ItemBoxingGlove extends Item {

public ItemBoxingGlove() {
super();
this.setTextureName("utilitiesinexcess:boxing_glove");
this.setUnlocalizedName("boxing_glove");
this.setMaxStackSize(1);
}

public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
Vec3 motion = Vec3
.createVectorHelper(player.posX - entity.posX, player.posY - entity.posY, player.posZ - entity.posZ)
.normalize();
entity.motionX -= motion.xCoord * 0.75;
entity.motionY -= motion.yCoord * 0.75;
entity.motionZ -= motion.zCoord * 0.75;

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public void addInformation(ItemStack stack, EntityPlayer player, List<String> to
KeybindUtils.getKeyDisplayNameWithMouse(UtilitiesInExcess.proxy.GLOVE_KEYBIND.getKeybinding())));

tooltip.add(StatCollector.translateToLocal("uie.desc.item.glove.2"));
tooltip.add(StatCollector.translateToLocal("uie.desc.item.glove.3"));
}

public IIcon topIcon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,24 @@ public static void run() {
'a',
Items.diamond_pickaxe);

// Glove
if (ModItems.GLOVE.isEnabled() && RecipeConfig.enableGloveRecipe) {
GameRegistry.addRecipe(
new RecipeGlove(
2,
2,
new ItemStack[] { new ItemStack(Items.string),
new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.string) },
ModItems.GLOVE.newItemStack()));
}

// Boxing Glove
if (ModItems.BOXING_GLOVE.isEnabled() && RecipeConfig.enableBoxingGloveRecipe) {
Object center = ModItems.GLOVE.isEnabled() ? ModItems.GLOVE.get() : Blocks.wool;
addShapedRecipe(ModItems.BOXING_GLOVE, " l ", "lcl", " l ", 'l', Items.leather, 'c', center);
}

// Paint Roller
if (RecipeConfig.enablePaintRollerRecipe) addShapedRecipe(
ModItems.PAINT_ROLLER,
Expand Down Expand Up @@ -1479,18 +1497,6 @@ private static void loadInversionRecipes() {
"iii",
'i',
ModItems.INVERTED_INGOT.newItemStack(1, OreDictionary.WILDCARD_VALUE));

// Glove
if (ModItems.GLOVE.isEnabled() && RecipeConfig.enableGloveRecipe) {
GameRegistry.addRecipe(
new RecipeGlove(
2,
2,
new ItemStack[] { new ItemStack(Items.string),
new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.string) },
ModItems.GLOVE.newItemStack()));
}
}

private static void loadEnderLocusRecipes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.lwjgl.opengl.GL12;

import com.fouristhenumber.utilitiesinexcess.ModItems;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemBoxingGlove;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemGlove;
import com.fouristhenumber.utilitiesinexcess.config.items.ItemConfig;
import com.fouristhenumber.utilitiesinexcess.utils.RenderableCube;
Expand All @@ -33,6 +34,9 @@ public class GloveRenderer implements IItemRenderer {

@Override
public boolean handleRenderType(final ItemStack item, final ItemRenderType type) {
if (item.getItem() instanceof ItemBoxingGlove) {
return type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED;
}
return type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED
|| type == ItemRenderType.INVENTORY;
}
Expand Down Expand Up @@ -137,7 +141,9 @@ public static float[] woolMetaToRGB(int dyeMeta) {

public static Function<EntityPlayer, RenderableCube> getBottomCube = (player) -> bottomCube;

public static void renderGloveAsBauble(int meta, EntityPlayer player) {
public static void renderGloveAsBauble(ItemStack stack, EntityPlayer player) {
boolean boxing = stack.getItem() instanceof ItemBoxingGlove;

int previousTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);

// 0.27 -0.73 1.43 -0.5 0 0 0 1
Expand All @@ -147,17 +153,26 @@ public static void renderGloveAsBauble(int meta, EntityPlayer player) {

mc.renderEngine.bindTexture(gloveTexture);
Tessellator t = Tessellator.instance;
float[] rgb = woolMetaToRGB(meta / 16);
t.startDrawingQuads();
t.setColorOpaque_F(rgb[0], rgb[1], rgb[2]);
if (boxing) {
t.setColorOpaque(160, 0, 0);
} else {
float[] rgb = woolMetaToRGB(stack.getItemDamage() / 16);
t.setColorOpaque_F(rgb[0], rgb[1], rgb[2]);
}
getTopCube.apply(player)
.draw(t, 0, 0, 0, 24, false);
t.draw();

GL11.glTranslatef(0, -0.25F, 0F);
rgb = woolMetaToRGB(meta % 16);
t.startDrawingQuads();
t.setColorOpaque_F(rgb[0], rgb[1], rgb[2]);

if (boxing) {
t.setColorOpaque(90, 0, 8);
} else {
float[] rgb = woolMetaToRGB(stack.getItemDamage() % 16);
t.setColorOpaque_F(rgb[0], rgb[1], rgb[2]);
}
getBottomCube.apply(player)
.draw(t, 0, 0, 0, 24, false);
t.draw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,8 @@ public class RecipeConfig {
@Config.RequiresMcRestart
@Config.DefaultBoolean(true)
public static boolean enablePaintRollerRecipe;

@Config.RequiresMcRestart
@Config.DefaultBoolean(true)
public static boolean enableBoxingGloveRecipe;
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ public static class HeavenlyRing {
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean enableGlove;

@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
@Config.Comment("Different from the regular glove")
public static boolean enableBoxingGlove;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ public enum Mixins implements IMixins {
.setApplyIf(() -> CursedEarthConfig.INSTANCE.enableCursedEarth || CursedEarthConfig.INSTANCE.enableBlessedEarth)
/*.addRequiredMod(TargetedMod.VANILLA)*/),
GLOVE(new MixinBuilder("Implements the Glove's special right click")
.addCommonMixins("minecraft.MixinNetHandlerPlayServer_Glove", "minecraft.MixinItemRenderer_Glove", "minecraft.MixinPlayerControllerMP_Glove")
.addCommonMixins("minecraft.MixinNetHandlerPlayServer_Glove", "minecraft.MixinPlayerControllerMP_Glove")
.setPhase(Phase.EARLY)
.setApplyIf(() -> ItemConfig.enableGlove)
/*.addRequiredMod(TargetedMod.VANILLA)*/),
.setApplyIf(() -> ItemConfig.enableGlove)),
GLOVES_FIRST_PERSON(new MixinBuilder("Allows both gloves to be drawn on the players hand in first person")
.addClientMixins("minecraft.MixinItemRenderer_Gloves")
.setPhase(Phase.EARLY)
.setApplyIf(() -> ItemConfig.enableGlove || ItemConfig.enableBoxingGlove)),
BAUBLE_RENDERS(new MixinBuilder("Renders equipped baubles on the player")
.addCommonMixins("minecraft.MixinModelBiped_Baubles", "minecraft.MixinModelRenderer_Baubles")
.setPhase(Phase.EARLY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import com.fouristhenumber.utilitiesinexcess.common.items.ItemBoxingGlove;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemGlove;
import com.llamalad7.mixinextras.expression.Expression;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;

@Mixin(ItemRenderer.class)
public class MixinItemRenderer_Glove {
public class MixinItemRenderer_Gloves {

@Expression("? != null")
@WrapOperation(method = "renderItemInFirstPerson", at = @At(value = "MIXINEXTRAS:EXPRESSION", ordinal = 5))
Expand All @@ -23,8 +24,10 @@ public class MixinItemRenderer_Glove {

if (player == null) original.call(left, right);

if ((player.getHeldItem() != null && player.getHeldItem()
.getItem() instanceof ItemGlove)) {
if ((player.getHeldItem() != null && (player.getHeldItem()
.getItem() instanceof ItemGlove
|| player.getHeldItem()
.getItem() instanceof ItemBoxingGlove))) {
return false;
}
return original.call(left, right);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import net.minecraft.item.ItemStack;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.fouristhenumber.utilitiesinexcess.common.items.ItemBoxingGlove;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemGlove;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemHeavenlyRing;
import com.fouristhenumber.utilitiesinexcess.common.renderers.GloveRenderer;
Expand Down Expand Up @@ -51,22 +53,23 @@ public class MixinModelBiped_Baubles {

private float uie$heavenlyRingWing = 1;

@Unique
private void uie$doExtraRender(Entity entity, float p_78088_7_) {
ModelBiped thisObject = (ModelBiped) (Object) this;

if (entity == null) return;
if (!(entity instanceof EntityPlayer player)) return;

ItemStack stack = player.getHeldItem();
if (stack == null || !(stack.getItem() instanceof ItemGlove))
if (stack == null || !(stack.getItem() instanceof ItemGlove || stack.getItem() instanceof ItemBoxingGlove))
stack = UIEUtils.getBauble(player, ItemGlove.class);

if (stack != null) {
ItemStack finalStack = stack;
ModelPartRenderHelper.renderBipedPart(
0.0625F,
thisObject.bipedRightArm,
() -> GloveRenderer.renderGloveAsBauble(finalStack.getItemDamage(), player));
() -> GloveRenderer.renderGloveAsBauble(finalStack, player));
}

ItemStack ring = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.fouristhenumber.utilitiesinexcess.common.items.ItemBoxingGlove;
import com.fouristhenumber.utilitiesinexcess.common.items.ItemGlove;
import com.fouristhenumber.utilitiesinexcess.common.renderers.GloveRenderer;
import com.fouristhenumber.utilitiesinexcess.utils.ModelPartRenderHelper;
Expand All @@ -29,15 +30,15 @@ public class MixinModelRenderer_Baubles {
if (player == null) return;

ItemStack stack = player.getHeldItem();
if (stack == null || !(stack.getItem() instanceof ItemGlove))
if (stack == null || !(stack.getItem() instanceof ItemGlove || stack.getItem() instanceof ItemBoxingGlove))
stack = UIEUtils.getBauble(player, ItemGlove.class);

if (stack != null) {
ItemStack finalStack = stack;
ModelPartRenderHelper.renderBipedPart(
0.0625F,
thisObject.modelBipedMain.bipedRightArm,
() -> GloveRenderer.renderGloveAsBauble(finalStack.getItemDamage(), player));
() -> GloveRenderer.renderGloveAsBauble(finalStack, player));
}
}
}
4 changes: 3 additions & 1 deletion src/main/resources/assets/utilitiesinexcess/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ uie.nei.infopage.filing_cabinet.3=The Elite Filing Cabinet has no restrictions w
uie.nei.infopage.filing_cabinet.4=Filing Cabinet Capacity Upgrades will add additional maximum storage to any cabinet.
uie.nei.infopage.colored_blocks.dyeable=Dyed blocks can be dyed any color you want using a paint roller. Now with a new and improved tile entity-free recipe!
uie.nei.infopage.paint_roller=This super advanced paint roller can be used to dye any Utilities in Excess dyed block any color you want. Now with a new and improved tile entity-free recipe!
uie.nei.infopage.boxing_glove=Have you ever wanted a mob to JUST MOVE ALREADY?? Using this revolutionary boxing glove, you can push mobs without angering them. Just don't ask how it works.

#### Blocks
ue_wall.name=%s Wall
Expand Down Expand Up @@ -533,6 +534,8 @@ item.capacity_upgrade.name=Filing Cabinet Capacity Upgrade

item.paint_roller.name=Paint Roller

item.boxing_glove.name=Boxing Glove

### Item Description
uie.desc.item.inverted_ingot.1=This ingot is deteriorating rapidly...
uie.desc.item.inverted_ingot.2=Will implode in %s seconds!
Expand All @@ -559,7 +562,6 @@ uie.desc.item.fire_battery.1=RF %s / %s

uie.desc.item.glove.1=§bPress §r[§6%s§r]§b to activate.
uie.desc.item.glove.2=§9+2,147,483,647 Breeze Projection
uie.desc.item.glove.3=§7§oP.S. Breeze Projection does nothing.

uie.desc.item.chunchunmaru.1=It's a really cool name

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.