Added the custom mod blocks and more interactions for items and entities
parent
3473dbcffd
commit
1362d67c79
10
justfile
10
justfile
|
@ -9,11 +9,11 @@ setup:
|
|||
just _create-bakups
|
||||
|
||||
[working-directory: './src/minecraft/net/minecraft/src/']
|
||||
_create-bakups:
|
||||
_create-backups:
|
||||
#!/usr/bin/env bash
|
||||
(for file in $(fd --no-ignore ".java"); do
|
||||
(for file in $(fd --no-ignore ".java$"); do
|
||||
[ -e "$file" ] || continue
|
||||
just create-bakup "$file"
|
||||
just _create-backup "$file"
|
||||
done)
|
||||
|
||||
[working-directory: './src/minecraft/net/minecraft/src/']
|
||||
|
@ -27,7 +27,7 @@ _create-backup file:
|
|||
[working-directory: './src/minecraft/net/minecraft/src/']
|
||||
apply-patches:
|
||||
#!/usr/bin/env bash
|
||||
(for file in $(fd --no-ignore ".java.bak"); do
|
||||
(for file in $(fd --no-ignore ".java.bak$"); do
|
||||
core="${file/.bak/}"
|
||||
patch="${core}.patch"
|
||||
rm "$core"
|
||||
|
@ -38,7 +38,7 @@ apply-patches:
|
|||
[working-directory: './src/minecraft/net/minecraft/']
|
||||
create-patches:
|
||||
#!/usr/bin/env bash
|
||||
(for file in $(fd --no-ignore ".java.bak"); do
|
||||
(for file in $(fd --no-ignore ".java.bak$"); do
|
||||
core="${file/.bak/}"
|
||||
|
||||
# check to see if the file has been changed
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- client/Minecraft.java.bak 2025-04-05 22:51:08.900093138 +0300
|
||||
+++ client/Minecraft.java 2025-04-07 01:45:06.894086534 +0300
|
||||
+++ client/Minecraft.java 2025-04-11 20:36:04.899870572 +0300
|
||||
@@ -8,6 +8,7 @@
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
|
@ -18,6 +18,15 @@
|
|||
}
|
||||
catch(LWJGLException lwjglexception)
|
||||
{
|
||||
@@ -1244,7 +1246,7 @@
|
||||
|
||||
public void usePortal()
|
||||
{
|
||||
- System.out.println("Toggling dimension!!");
|
||||
+// System.out.println("Toggling dimension!!");
|
||||
if(thePlayer.dimension == -1)
|
||||
{
|
||||
thePlayer.dimension = 0;
|
||||
@@ -1447,6 +1449,15 @@
|
||||
{
|
||||
sndManager.addMusic(s, file);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- src/EntityChicken.java.bak 2025-04-11 18:43:27.022087337 +0300
|
||||
+++ src/EntityChicken.java 2025-04-11 19:48:08.054836966 +0300
|
||||
@@ -20,7 +20,7 @@
|
||||
destPos = 0.0F;
|
||||
field_755_h = 1.0F;
|
||||
texture = "/mob/chicken.png";
|
||||
- setSize(0.3F, 0.4F);
|
||||
+ setSize(0.3F, 0.7F);
|
||||
health = 4;
|
||||
timeUntilNextEgg = rand.nextInt(6000) + 6000;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
--- src/EntityFireball.java.bak 2025-04-11 18:43:27.129085939 +0300
|
||||
+++ src/EntityFireball.java 2025-04-11 20:45:53.059997257 +0300
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Entity, AxisAlignedBB, MathHelper, EntityLiving,
|
||||
@@ -159,6 +160,14 @@
|
||||
{
|
||||
if(movingobjectposition.entityHit != null)
|
||||
{
|
||||
+ if (ModConfig.ENABLE_GHASTS_INSTA_DEATH.get()) {
|
||||
+ if (movingobjectposition.entityHit.attackEntityFrom(this, 0));
|
||||
+
|
||||
+ this.worldObj.newExplosion((Entity) null, this.posX, this.posY, this.posZ, 1.0F, true);
|
||||
+ this.setEntityDead();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if(!movingobjectposition.entityHit.attackEntityFrom(field_9397_j, 0));
|
||||
}
|
||||
worldObj.newExplosion(null, posX, posY, posZ, 1.0F, true);
|
||||
@@ -229,6 +238,10 @@
|
||||
|
||||
public boolean attackEntityFrom(Entity entity, int i)
|
||||
{
|
||||
+ if (ModConfig.ENABLE_GHASTS_INSTA_DEATH.get() && entity instanceof EntityLiving) {
|
||||
+ this.field_9397_j = (EntityLiving) entity;
|
||||
+ }
|
||||
+
|
||||
setBeenAttacked();
|
||||
if(entity != null)
|
||||
{
|
|
@ -0,0 +1,19 @@
|
|||
--- src/EntityFish.java.bak 2025-04-11 18:43:27.139085808 +0300
|
||||
+++ src/EntityFish.java 2025-04-11 18:59:28.381016877 +0300
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Entity, EntityPlayer, MathHelper, AxisAlignedBB,
|
||||
@@ -374,7 +375,7 @@
|
||||
double d7 = MathHelper.sqrt_double(d1 * d1 + d3 * d3 + d5 * d5);
|
||||
double d9 = 0.10000000000000001D;
|
||||
entityitem.motionX = d1 * d9;
|
||||
- entityitem.motionY = d3 * d9 + (double)MathHelper.sqrt_double(d7) * 0.080000000000000002D;
|
||||
+ entityitem.motionY = d3 * d9 + (double)MathHelper.sqrt_double(d7) * (ModConfig.FIX_FISHING.get() ? 0.05d : 0.080000000000000002D);
|
||||
entityitem.motionZ = d5 * d9;
|
||||
worldObj.entityJoinedWorld(entityitem);
|
||||
angler.addStat(StatList.fishCaughtStat, 1);
|
|
@ -0,0 +1,37 @@
|
|||
--- src/EntityGhast.java.bak 2025-04-11 18:43:27.183085233 +0300
|
||||
+++ src/EntityGhast.java 2025-04-11 20:46:26.204616731 +0300
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
-import java.util.List;
|
||||
-import java.util.Random;
|
||||
+import java.lang.reflect.Field;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
+import net.minecraft.src.finalbeta.WyHelper;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// EntityFlying, IMob, DataWatcher, World,
|
||||
@@ -189,6 +190,22 @@
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+ public boolean attackEntityFrom(Entity entity, int i) {
|
||||
+ if (ModConfig.ENABLE_GHASTS_INSTA_DEATH.get() && entity != null && entity instanceof EntityFireball) {
|
||||
+ try {
|
||||
+ EntityLiving fireballThrower = ((EntityFireball)entity).field_9397_j;
|
||||
+ if (fireballThrower instanceof EntityPlayer) {
|
||||
+ this.attackEntityFrom(fireballThrower, 1_000);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+ return super.attackEntityFrom(entity, i);
|
||||
+ }
|
||||
|
||||
public int courseChangeCooldown;
|
||||
public double waypointX;
|
|
@ -0,0 +1,22 @@
|
|||
--- src/EntityPig.java.bak 2025-04-11 18:43:27.346083105 +0300
|
||||
+++ src/EntityPig.java 2025-04-11 20:18:46.534229227 +0300
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// EntityAnimal, DataWatcher, NBTTagCompound, World,
|
||||
@@ -114,4 +115,11 @@
|
||||
((EntityPlayer)riddenByEntity).triggerAchievement(AchievementList.flyPig);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ protected void dropFewItems() {
|
||||
+ if (ModConfig.FIX_SADDLES_NOT_DROPPING.get() && this.getSaddled()) {
|
||||
+ this.dropItem(Item.saddle.shiftedIndex, 1);
|
||||
+ }
|
||||
+ super.dropFewItems();
|
||||
+ }
|
||||
}
|
|
@ -1,14 +1,36 @@
|
|||
--- src/EntityPlayerSP.java.bak 2025-04-07 01:04:11.632376872 +0300
|
||||
+++ src/EntityPlayerSP.java 2025-04-07 01:27:52.507902587 +0300
|
||||
@@ -6,6 +6,7 @@
|
||||
+++ src/EntityPlayerSP.java 2025-04-11 18:54:39.199641785 +0300
|
||||
@@ -5,7 +5,9 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
+import org.lwjgl.input.Keyboard;
|
||||
import net.minecraft.client.Minecraft;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// EntityPlayer, MouseFilter, Session, MovementInput,
|
||||
@@ -131,6 +132,12 @@
|
||||
@@ -114,6 +116,19 @@
|
||||
|
||||
public void handleKeyPress(int i, boolean flag)
|
||||
{
|
||||
+ if (this.ridingEntity != null && i == Keyboard.KEY_LSHIFT && flag) {
|
||||
+ this.mountEntity(null);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (ModConfig.STACK_DROP.get() && i == mc.gameSettings.keyBindDrop.keyCode && flag && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
+ ItemStack heldItem = this.inventory.getCurrentItem();
|
||||
+ if (heldItem != null && heldItem.stackSize > 0) {
|
||||
+ this.dropPlayerItemWithRandomChoice(this.inventory.decrStackSize(this.inventory.currentItem, heldItem.stackSize), false);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
movementInput.checkKeyForMovementInput(i, flag);
|
||||
}
|
||||
|
||||
@@ -131,6 +146,12 @@
|
||||
|
||||
public void closeScreen()
|
||||
{
|
||||
|
@ -21,7 +43,7 @@
|
|||
super.closeScreen();
|
||||
mc.displayGuiScreen(null);
|
||||
}
|
||||
@@ -143,6 +150,9 @@
|
||||
@@ -143,6 +164,9 @@
|
||||
public void displayGUIChest(IInventory iinventory)
|
||||
{
|
||||
mc.displayGuiScreen(new GuiChest(inventory, iinventory));
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
--- src/EntitySnowball.java.bak 2025-04-11 18:43:27.637079303 +0300
|
||||
+++ src/EntitySnowball.java 2025-04-11 20:45:46.526072271 +0300
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Entity, AxisAlignedBB, EntityLiving, MathHelper,
|
||||
@@ -14,7 +15,6 @@
|
||||
|
||||
public class EntitySnowball extends Entity
|
||||
{
|
||||
-
|
||||
public EntitySnowball(World world)
|
||||
{
|
||||
super(world);
|
||||
@@ -193,7 +193,7 @@
|
||||
if(movingobjectposition != null)
|
||||
{
|
||||
if(movingobjectposition.entityHit != null)
|
||||
- {
|
||||
+ {
|
||||
if(!movingobjectposition.entityHit.attackEntityFrom(thrower, 0));
|
||||
}
|
||||
for(int j = 0; j < 8; j++)
|
|
@ -0,0 +1,35 @@
|
|||
--- src/ItemBow.java.bak 2025-04-11 18:43:28.565067182 +0300
|
||||
+++ src/ItemBow.java 2025-04-11 18:47:58.895659634 +0300
|
||||
@@ -5,6 +5,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Item, EntityPlayer, InventoryPlayer, World,
|
||||
@@ -17,6 +18,14 @@
|
||||
{
|
||||
super(i);
|
||||
maxStackSize = 1;
|
||||
+
|
||||
+ if (ModConfig.FIX_BOW_MODEL.get()) {
|
||||
+ this.setFull3D();
|
||||
+ }
|
||||
+
|
||||
+ if (ModConfig.FIX_BOW_DURABILITY.get()) {
|
||||
+ this.setMaxDamage(385);
|
||||
+ }
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
@@ -27,6 +36,9 @@
|
||||
if(!world.multiplayerWorld)
|
||||
{
|
||||
world.entityJoinedWorld(new EntityArrow(world, entityplayer));
|
||||
+ if (ModConfig.FIX_BOW_DURABILITY.get()) {
|
||||
+ itemstack.damageItem(1, entityplayer);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
return itemstack;
|
|
@ -0,0 +1,21 @@
|
|||
--- src/ItemFood.java.bak 2025-04-11 18:40:24.126476366 +0300
|
||||
+++ src/ItemFood.java 2025-04-11 18:40:55.544065984 +0300
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Item, ItemStack, EntityPlayer, World
|
||||
@@ -21,6 +22,10 @@
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
+ if (ModConfig.DISABLE_EATING_WHEN_MAX_HP.get() && entityplayer.health >= 20) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
itemstack.stackSize--;
|
||||
entityplayer.heal(healAmount);
|
||||
return itemstack;
|
|
@ -0,0 +1,20 @@
|
|||
--- src/ItemSoup.java.bak 2025-04-11 18:43:28.815063916 +0300
|
||||
+++ src/ItemSoup.java 2025-04-11 19:59:30.036452201 +0300
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// ItemFood, ItemStack, Item, World,
|
||||
@@ -19,6 +20,9 @@
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
+ if (ModConfig.DISABLE_EATING_WHEN_MAX_HP.get() && entityplayer.health >= 20) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
super.onItemRightClick(itemstack, world, entityplayer);
|
||||
return new ItemStack(Item.bowlEmpty);
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
--- src/ItemStack.java.bak 2025-04-11 18:43:28.824063799 +0300
|
||||
+++ src/ItemStack.java 2025-04-11 19:45:06.279084205 +0300
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import java.util.Random;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Block, Item, StatList, EntityPlayer,
|
||||
@@ -154,6 +156,12 @@
|
||||
|
||||
public void damageItem(int i, Entity entity)
|
||||
{
|
||||
+ if (ModConfig.ADD_MORE_SOUNDS.get()) {
|
||||
+ if (this.itemDamage + i > this.getMaxDamage()) {
|
||||
+ entity.worldObj.playSoundAtEntity(entity, "random.break", 0.5f, (entity.rand.nextFloat() - entity.rand.nextFloat()) * 0.2F + 1.0F);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if(!isItemStackDamageable())
|
||||
{
|
||||
return;
|
||||
@@ -199,6 +207,10 @@
|
||||
|
||||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
+ if (this.getItem() instanceof ItemAxe && Block.stairSingle.blockID == block.blockID) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
return Item.itemsList[itemID].canHarvestBlock(block);
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
--- src/TileEntityFurnace.java.bak 2025-04-11 18:43:32.031021908 +0300
|
||||
+++ src/TileEntityFurnace.java 2025-04-11 21:05:29.546392660 +0300
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.finalbeta.ModBlock;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// TileEntity, IInventory, ItemStack, NBTTagCompound,
|
||||
@@ -69,6 +71,13 @@
|
||||
return "Furnace";
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Properly saving and loading the fuelTime as otherwise minecraft tries to
|
||||
+ * get it from the fuel item slot, which can be empty...and so the fuel time
|
||||
+ * defaults to 200. By saving it we make sure the fuel time is always
|
||||
+ * correct regardless of the fuel slot contents.
|
||||
+ */
|
||||
+
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.readFromNBT(nbttagcompound);
|
||||
@@ -135,6 +144,14 @@
|
||||
|
||||
public void updateEntity()
|
||||
{
|
||||
+ if (ModConfig.ADD_MORE_SOUNDS.get() && this.furnaceCookTime > 0) {
|
||||
+ if (this.worldObj.getWorldTime() % this.nextRandomTick == 0) {
|
||||
+ float pitch = 0.5f + this.worldObj.rand.nextFloat() / 1.5f;
|
||||
+ this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "sound3.liquid.lavapop", 0.4f, pitch);
|
||||
+ this.nextRandomTick = 20 + this.worldObj.rand.nextInt(20);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
boolean flag = furnaceBurnTime > 0;
|
||||
boolean flag1 = false;
|
||||
if(furnaceBurnTime > 0)
|
||||
@@ -151,6 +168,13 @@
|
||||
flag1 = true;
|
||||
if(furnaceItemStacks[1] != null)
|
||||
{
|
||||
+ if(ModConfig.FIX_FURNACE_LAVA_BUCKET.get()) {
|
||||
+ if(this.furnaceItemStacks[1].itemID == Item.bucketLava.shiftedIndex) {
|
||||
+ this.furnaceItemStacks[1] = new ItemStack(Item.bucketEmpty);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if(furnaceItemStacks[1].getItem().hasContainerItem())
|
||||
{
|
||||
furnaceItemStacks[1] = new ItemStack(furnaceItemStacks[1].getItem().getContainerItem());
|
||||
@@ -250,6 +274,11 @@
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+ if (itemstack.itemID == ModBlock.COAL_BLOCK.blockID) {
|
||||
+ return 16000;
|
||||
+ }
|
||||
+
|
||||
int i = itemstack.getItem().shiftedIndex;
|
||||
if(i < 256 && Block.blocksList[i].blockMaterial == Material.wood)
|
||||
{
|
||||
@@ -289,4 +318,5 @@
|
||||
public int furnaceBurnTime;
|
||||
public int currentItemBurnTime;
|
||||
public int furnaceCookTime;
|
||||
+ private int nextRandomTick = 20;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package net.minecraft.src.finalbeta;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemBlock;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.src.StepSound;
|
||||
|
||||
public class ModBlock extends Block {
|
||||
public static final Block REDSTONE_BLOCK = new ModBlock(100, 176, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setTint(11149858).setBlockName("blockRedstone");
|
||||
public static final Block COAL_BLOCK = new ModBlock(101, 103, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setTint(1118481).setBlockName("blockCoal");
|
||||
|
||||
public static void init() {
|
||||
Item.itemsList[REDSTONE_BLOCK.blockID] = new ItemBlock(REDSTONE_BLOCK.blockID - 256).setItemName("redstoneBlock");
|
||||
Item.itemsList[COAL_BLOCK.blockID] = new ItemBlock(COAL_BLOCK.blockID - 256).setItemName("coalBlock");
|
||||
|
||||
ModLoader.AddName(REDSTONE_BLOCK, "Redstone Block");
|
||||
ModLoader.AddName(COAL_BLOCK, "Coal Block");
|
||||
|
||||
// ModLoader.AddName(Item.itemsList[REDSTONE_BLOCK.blockID], "Redstone Block");
|
||||
// ModLoader.AddName(Item.itemsList[COAL_BLOCK.blockID], "Coal Block");
|
||||
}
|
||||
|
||||
private int tint = 16777215;
|
||||
|
||||
public ModBlock(int i, int j, Material material) {
|
||||
super(i, j, material);
|
||||
}
|
||||
|
||||
public ModBlock setHardness(float f) {
|
||||
return (ModBlock) super.setHardness(f);
|
||||
}
|
||||
|
||||
protected ModBlock setResistance(float f) {
|
||||
return (ModBlock) super.setResistance(f);
|
||||
}
|
||||
|
||||
public ModBlock setStepSound(StepSound stepsound) {
|
||||
return (ModBlock) super.setStepSound(stepsound);
|
||||
}
|
||||
|
||||
public ModBlock setTint(int tint) {
|
||||
this.tint = tint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRenderColor(int i) {
|
||||
return this.tint;
|
||||
}
|
||||
|
||||
public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return this.tint;
|
||||
}
|
||||
}
|
|
@ -2,13 +2,18 @@ package net.minecraft.src;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Logger;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.finalbeta.ModBlock;
|
||||
import net.minecraft.src.finalbeta.ModConfig;
|
||||
import net.minecraft.src.finalbeta.WyHelper;
|
||||
|
||||
public class mod_FinalBeta extends BaseMod {
|
||||
public static final Logger LOGGER = Logger.getLogger("FinalBeta");
|
||||
|
||||
private static final long KEY_PAUSE = 5;
|
||||
private static long keyTimer = 0;
|
||||
|
||||
private static final Block[] PICKAXE_BLOCKS = new Block[]{Block.cobblestone, Block.stairDouble, Block.stairSingle,
|
||||
Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockSteel, Block.oreCoal, Block.blockGold,
|
||||
Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis,
|
||||
|
@ -28,6 +33,7 @@ public class mod_FinalBeta extends BaseMod {
|
|||
Block.slowSand};
|
||||
|
||||
public mod_FinalBeta() {
|
||||
ModBlock.init();
|
||||
ModConfig.instance();
|
||||
ModLoader.SetInGameHook(this, true, false);
|
||||
|
||||
|
@ -49,8 +55,44 @@ public class mod_FinalBeta extends BaseMod {
|
|||
}
|
||||
|
||||
public boolean OnTickInGame(Minecraft minecraft) {
|
||||
|
||||
// DEBUG stuff
|
||||
if (this.canPressKey(Keyboard.KEY_O)) {
|
||||
// minecraft.thePlayer.dropItem(Item.coal.shiftedIndex, 64);
|
||||
// minecraft.thePlayer.dropItem(Item.bucketLava.shiftedIndex, 1);
|
||||
// minecraft.thePlayer.dropItem(Block.oreGold.blockID, 64);
|
||||
// minecraft.thePlayer.dropItem(Block.stoneOvenIdle.blockID, 1);
|
||||
// minecraft.thePlayer.dropItem(ModBlock.COAL_BLOCK.blockID, 1);
|
||||
|
||||
// minecraft.thePlayer.dropItem(ModBlock.REDSTONE_BLOCK.blockID, 1);
|
||||
|
||||
// minecraft.theWorld.setWorldTime(0);
|
||||
}
|
||||
else {
|
||||
if (keyTimer > 0) {
|
||||
keyTimer -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean canPressKey(int key) {
|
||||
if (Keyboard.isRepeatEvent()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Keyboard.isKeyDown(key) && keyTimer > 0) {
|
||||
keyTimer = KEY_PAUSE;
|
||||
return false;
|
||||
}
|
||||
else if (Keyboard.isKeyDown(key) && keyTimer <= 0) {
|
||||
keyTimer = KEY_PAUSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addEffectiveTool(Block[] blocks, Item... tools) {
|
||||
Field field = WyHelper.getField(ItemTool.class, "bk", "blocksEffectiveAgainst");
|
||||
|
|
Loading…
Reference in New Issue