a lot of stuff

This commit is contained in:
HoosierTransfer 2024-06-28 20:25:43 -04:00
parent aaa11a11ac
commit ca5e06d9f5
42 changed files with 471 additions and 218 deletions

2
.gitignore vendored
View File

@ -19,6 +19,8 @@ javascript/classes.js
javascript/EaglercraftX_1.8_Offline_en_US.html
javascript/EaglercraftX_1.8_Offline_International.html
javascript/EaglercraftL_1.9_Offline_en_US.html
javascript/EaglercraftL_1.9_Offline_International.html
javascript/classes.js.map
resources/hashes/*
resources/optimizedResources/*
.idea/*

7
CompileEPK.sh Normal file → Executable file
View File

@ -1,2 +1,7 @@
#!/bin/sh
java -jar "desktopRuntime/CompileEPK.jar" "desktopRuntime/resources" "javascript/assets.epk"
cd resources
python optimize.py
cd ..
echo compiling, please wait...
java -jar "resources/CompileEPK.jar" "resources/optimizedResources" "javascript/assets.epk"
echo finished compiling epk

View File

@ -23,8 +23,8 @@ dependencies {
}
teavm.js {
obfuscated = true
sourceMap = false
obfuscated = false
sourceMap = true
targetFileName = "../classes.js"
optimization = org.teavm.gradle.api.OptimizationLevel.AGGRESSIVE
outOfProcess = false

0
gradlew vendored Normal file → Executable file
View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -9,7 +9,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "Eaglercraft Lambda";
public static final String projectForkVersion = "0.5.1";
public static final String projectForkVersion = "0.6.0";
public static final String projectForkVendor = "HoosierTransfer";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";

View File

@ -366,6 +366,10 @@ public class Block implements ILitBlock {
return true;
}
public boolean isFullyOpaque(IBlockState state) {
return state.getBlock().getMaterial().isOpaque() && state.getBlock().isFullCube();
}
public boolean isPassable(IBlockAccess var1, BlockPos var2) {
return !this.blockMaterial.blocksMovement();
}
@ -1230,7 +1234,7 @@ public class Block implements ILitBlock {
registerBlock(6, (String) "sapling",
(new BlockSapling()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("sapling"));
registerBlock(7, (String) "bedrock",
(new Block(Material.rock)).setBlockUnbreakable().setResistance(6000000.0F).setStepSound(soundTypePiston)
(new BlockEmptyDrops(Material.rock)).setBlockUnbreakable().setResistance(6000000.0F).setStepSound(soundTypePiston)
.setUnlocalizedName("bedrock").disableStats().setCreativeTab(CreativeTabs.tabBlock));
registerBlock(8, (String) "flowing_water", (new BlockDynamicLiquid(Material.water)).setHardness(100.0F)
.setLightOpacity(3).setUnlocalizedName("water").disableStats());

View File

@ -1,9 +1,36 @@
package net.minecraft.block;
import java.util.Random;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public class BlockBeetroot extends BlockCrops {
public int getMaxAge() {
return 3;
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, EaglercraftRandom rand)
{
if (rand.nextInt(3) == 0)
{
this.checkAndDropBlock(worldIn, pos, state);
}
else
{
super.updateTick(worldIn, pos, state, rand);
}
}
protected int getBonemealAgeIncrease(World worldIn)
{
return super.getBonemealAgeIncrease(worldIn) / 3;
}
protected Item getSeed() {
return EaglerItems.getEaglerItem("beetroot_seeds");
}

View File

@ -122,16 +122,18 @@ public class BlockCactus extends Block {
}
public boolean canBlockStay(World worldIn, BlockPos pos) {
EnumFacing[] facings = EnumFacing.Plane.HORIZONTAL.facingsArray;
for (int i = 0; i < facings.length; ++i) {
EnumFacing enumfacing = facings[i];
if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getMaterial().isSolid()) {
return false;
}
}
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
Material material = worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getMaterial();
if (material.isSolid() || material == Material.lava)
{
return false;
}
}
Block block = worldIn.getBlockState(pos.down()).getBlock();
return block == Blocks.cactus || block == Blocks.sand;
return block == Blocks.cactus || block == Blocks.sand && !worldIn.getBlockState(pos.up()).getBlock().getMaterial().isLiquid();
}
/**

View File

@ -135,10 +135,34 @@ public class BlockCauldron extends Block {
new ItemStack(Items.bucket));
}
entityplayer.triggerAchievement(StatList.field_181725_I);
entityplayer.triggerAchievement(StatList.CAULDRON_USED);
this.setWaterLevel(world, blockpos, iblockstate, 3);
}
return true;
} else if (item == Items.bucket) {
if (i == 3 && !world.isRemote)
{
if (!entityplayer.capabilities.isCreativeMode)
{
ItemStack heldItem = entityplayer.inventory.getCurrentItem();
--heldItem.stackSize;
if (heldItem.stackSize == 0)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
new ItemStack(Items.water_bucket));
}
else if (!entityplayer.inventory.addItemStackToInventory(new ItemStack(Items.water_bucket)))
{
entityplayer.dropPlayerItemWithRandomChoice(new ItemStack(Items.water_bucket), false);
}
}
entityplayer.addStat(StatList.CAULDRON_USED, 1);
this.setWaterLevel(world, blockpos, iblockstate, 0);
}
return true;
} else if (item == Items.glass_bottle) {
if (i > 0) {

View File

@ -80,14 +80,28 @@ public class BlockCrops extends BlockBush implements IGrowable {
}
public void grow(World worldIn, BlockPos pos, IBlockState state) {
int i = ((Integer) state.getValue(AGE)).intValue() + MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
if (i > 7) {
i = 7;
}
public IBlockState withAge(int age)
{
return this.getDefaultState().withProperty(AGE, Integer.valueOf(age));
}
worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i)), 2);
}
protected int getAge(IBlockState state)
{
return ((Integer)state.getValue(AGE)).intValue();
}
public void grow(World worldIn, BlockPos pos, IBlockState state)
{
int i = this.getAge(state) + this.getBonemealAgeIncrease(worldIn);
int j = this.getMaxAge();
if (i > j)
{
i = j;
}
worldIn.setBlockState(pos, this.withAge(i), 2);
}
protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos) {
float f = 1.0F;
@ -148,6 +162,11 @@ public class BlockCrops extends BlockBush implements IGrowable {
return Items.wheat;
}
public int getMaxAge()
{
return 7;
}
/**
* +
* Spawns this Block's drops into the World as EntityItems.
@ -160,7 +179,7 @@ public class BlockCrops extends BlockBush implements IGrowable {
int k = 3 + i;
for (int l = 0; l < k; ++l) {
if (world.rand.nextInt(15) <= j) {
if (world.rand.nextInt(2 * this.getMaxAge()) <= j) {
spawnAsEntity(world, blockpos, new ItemStack(this.getSeed(), 1, 0));
}
}
@ -192,10 +211,20 @@ public class BlockCrops extends BlockBush implements IGrowable {
return true;
}
protected int getBonemealAgeIncrease(World worldIn)
{
return MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
}
public void grow(World world, EaglercraftRandom var2, BlockPos blockpos, IBlockState iblockstate) {
this.grow(world, blockpos, iblockstate);
}
public boolean isMaxAge(IBlockState state)
{
return ((Integer)state.getValue(AGE)).intValue() >= this.getMaxAge();
}
/**
* +
* Convert the given metadata into a BlockState for this Block

View File

@ -74,25 +74,34 @@ public class BlockDaylightDetector extends BlockContainer {
return ((Integer) iblockstate.getValue(POWER)).intValue();
}
public void updatePower(World worldIn, BlockPos pos) {
if (!worldIn.provider.getHasNoSky()) {
IBlockState iblockstate = worldIn.getBlockState(pos);
int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
float f = worldIn.getCelestialAngleRadians(1.0F);
float f1 = f < 3.1415927F ? 0.0F : 6.2831855F;
f = f + (f1 - f) * 0.2F;
i = Math.round((float) i * MathHelper.cos(f));
i = MathHelper.clamp_int(i, 0, 15);
if (this.inverted) {
i = 15 - i;
}
public void updatePower(World worldIn, BlockPos pos)
{
if (!worldIn.provider.getHasNoSky())
{
IBlockState iblockstate = worldIn.getBlockState(pos);
int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
float f = worldIn.getCelestialAngleRadians(1.0F);
if (((Integer) iblockstate.getValue(POWER)).intValue() != i) {
worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
}
if (this.inverted)
{
i = 15 - i;
}
}
}
if (i > 0 && !this.inverted)
{
float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
f = f + (f1 - f) * 0.2F;
i = Math.round((float)i * MathHelper.cos(f));
}
i = MathHelper.clamp_int(i, 0, 15);
if (((Integer)iblockstate.getValue(POWER)).intValue() != i)
{
worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
}
}
}
public boolean onBlockActivated(World world, BlockPos blockpos, IBlockState iblockstate, EntityPlayer entityplayer,
EnumFacing enumfacing, float f, float f1, float f2) {

View File

@ -82,9 +82,17 @@ public class BlockDeadBush extends BlockBush {
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState var1, EaglercraftRandom var2, int var3) {
return null;
return Items.stick;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(EaglercraftRandom random)
{
return random.nextInt(3);
}
public void harvestBlock(World world, EntityPlayer entityplayer, BlockPos blockpos, IBlockState iblockstate,
TileEntity tileentity) {
if (!world.isRemote && entityplayer.getCurrentEquippedItem() != null

View File

@ -0,0 +1,36 @@
package net.minecraft.block;
import java.util.Random;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
public class BlockEmptyDrops extends Block
{
public BlockEmptyDrops(Material materialIn)
{
super(materialIn);
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(EaglercraftRandom random)
{
return 0;
}
@Nullable
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, EaglercraftRandom rand, int fortune)
{
return null;
}
}

View File

@ -62,7 +62,7 @@ public class BlockEndPortal extends BlockContainer {
}
public void setBlockBoundsBasedOnState(IBlockAccess var1, BlockPos var2) {
float f = 0.0625F;
float f = 0.75F;
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
}

View File

@ -92,22 +92,17 @@ public class BlockFarmland extends Block {
}
/**
* +
* Block's chance to react to a living entity falling on it.
*/
public void onFallenUpon(World world, BlockPos blockpos, Entity entity, float f) {
if (entity instanceof EntityLivingBase) {
if (!world.isRemote && world.rand.nextFloat() < f - 0.5F) {
if (!(entity instanceof EntityPlayer) && !world.getGameRules().getBoolean("mobGriefing")) {
return;
}
* Block's chance to react to a living entity falling on it.
*/
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
{
if (!worldIn.isRemote && worldIn.rand.nextFloat() < fallDistance - 0.5F && entityIn instanceof EntityLivingBase && (entityIn instanceof EntityPlayer || worldIn.getGameRules().getBoolean("mobGriefing")) && entityIn.width * entityIn.width * entityIn.height > 0.512F)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
}
world.setBlockState(blockpos, Blocks.dirt.getDefaultState());
}
super.onFallenUpon(world, blockpos, entity, f);
}
}
super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
}
private boolean hasCrops(World worldIn, BlockPos pos) {
Block block = worldIn.getBlockState(pos.up()).getBlock();

View File

@ -6,6 +6,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -100,4 +101,12 @@ public class BlockHay extends BlockRotatedPillar {
return super.onBlockPlaced(world, blockpos, enumfacing, f, f1, f2, i, entitylivingbase).withProperty(AXIS,
enumfacing.getAxis());
}
/**
* Block's chance to react to a living entity falling on it.
*/
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
{
entityIn.fall(fallDistance, 0.2F);
}
}

View File

@ -44,9 +44,7 @@ import net.minecraft.world.World;
*/
public class BlockLilyPad extends BlockBush {
protected BlockLilyPad() {
float f = 0.5F;
float f1 = 0.015625F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.09375F, 0.9375F);
this.setCreativeTab(CreativeTabs.tabDecorations);
}
@ -92,8 +90,9 @@ public class BlockLilyPad extends BlockBush {
public boolean canBlockStay(World world, BlockPos blockpos, IBlockState var3) {
if (blockpos.getY() >= 0 && blockpos.getY() < 256) {
IBlockState iblockstate = world.getBlockState(blockpos.down());
return iblockstate.getBlock().getMaterial() == Material.water
&& ((Integer) iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0;
Material material = iblockstate.getBlock().getMaterial();
return material == Material.water
&& ((Integer) iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 || material == Material.ice;
} else {
return false;
}

View File

@ -46,15 +46,18 @@ public class BlockPotato extends BlockCrops {
}
/**
* +
* Spawns this Block's drops into the World as EntityItems.
*/
public void dropBlockAsItemWithChance(World world, BlockPos blockpos, IBlockState iblockstate, float f, int i) {
super.dropBlockAsItemWithChance(world, blockpos, iblockstate, f, i);
if (!world.isRemote) {
if (((Integer) iblockstate.getValue(AGE)).intValue() >= 7 && world.rand.nextInt(50) == 0) {
spawnAsEntity(world, blockpos, new ItemStack(Items.poisonous_potato));
}
}
}
* Spawns this Block's drops into the World as EntityItems.
*/
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
if (!worldIn.isRemote)
{
if (this.isMaxAge(state) && worldIn.rand.nextInt(50) == 0)
{
spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato));
}
}
}
}

View File

@ -1,7 +1,6 @@
package net.minecraft.block;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@ -182,7 +181,7 @@ public abstract class BlockRedstoneDiode extends BlockDirectional {
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
return this.canPowerSide(block)
? (block == Blocks.redstone_wire ? ((Integer) iblockstate.getValue(BlockRedstoneWire.POWER)).intValue()
? (block == Blocks.redstone_block ? 15 : block == Blocks.redstone_wire ? ((Integer) iblockstate.getValue(BlockRedstoneWire.POWER)).intValue()
: worldIn.getStrongPower(pos, side))
: 0;
}

View File

@ -210,9 +210,7 @@ public class BlockTrapDoor extends Block {
* Check whether this Block can be placed on the given side
*/
public boolean canPlaceBlockOnSide(World world, BlockPos blockpos, EnumFacing enumfacing) {
// Hoosiertransfer mod
// this is a feature from newer versions of minecraft
return !enumfacing.getAxis().isVertical();
return true;
}
protected static EnumFacing getFacing(int meta) {

View File

@ -6,8 +6,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
@ -88,4 +92,18 @@ public class BlockWeb extends Block {
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
public void harvestBlock(World world, EntityPlayer entityplayer, BlockPos blockpos, IBlockState iblockstate,
TileEntity tileentity) {
ItemStack stack = entityplayer.inventory.getCurrentItem();
if (!world.isRemote && stack != null && stack.getItem() == Items.shears)
{
entityplayer.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
spawnAsEntity(world, blockpos, new ItemStack(Item.getItemFromBlock(this), 1));
}
else
{
super.harvestBlock(world, entityplayer, blockpos, iblockstate, tileentity);
}
}
}

View File

@ -4,6 +4,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ContainerBrewingStand;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
/**
@ -38,6 +39,7 @@ import net.minecraft.util.ResourceLocation;
public class GuiBrewingStand extends GuiContainer {
private static final ResourceLocation brewingStandGuiTextures = new ResourceLocation(
"textures/gui/container/brewing_stand.png");
private static final int[] BUBBLELENGTHS = new int[] {29, 24, 20, 16, 11, 6, 0};
private final InventoryPlayer playerInventory;
private IInventory tileBrewingStand;
@ -52,12 +54,11 @@ public class GuiBrewingStand extends GuiContainer {
* Draw the foreground layer for the GuiContainer (everything in
* front of the items). Args : mouseX, mouseY
*/
protected void drawGuiContainerForegroundLayer(int var1, int var2) {
String s = this.tileBrewingStand.getDisplayName().getUnformattedText();
this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8,
this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String s = this.tileBrewingStand.getDisplayName().getUnformattedText();
this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
}
/**
* +
@ -65,45 +66,36 @@ public class GuiBrewingStand extends GuiContainer {
*/
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(brewingStandGuiTextures);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
int k = this.tileBrewingStand.getField(0);
if (k > 0) {
int l = (int) (28.0F * (1.0F - (float) k / 400.0F));
if (l > 0) {
this.drawTexturedModalRect(i + 97, j + 16, 176, 0, 9, l);
}
this.mc.getTextureManager().bindTexture(brewingStandGuiTextures);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
int k = this.tileBrewingStand.getField(1);
int l = MathHelper.clamp_int((18 * k + 20 - 1) / 20, 0, 18);
int i1 = k / 2 % 7;
switch (i1) {
case 0:
l = 29;
break;
case 1:
l = 24;
break;
case 2:
l = 20;
break;
case 3:
l = 16;
break;
case 4:
l = 11;
break;
case 5:
l = 6;
break;
case 6:
l = 0;
}
if (l > 0)
{
this.drawTexturedModalRect(i + 60, j + 44, 176, 29, l, 4);
}
if (l > 0) {
this.drawTexturedModalRect(i + 65, j + 14 + 29 - l, 185, 29 - l, 12, l);
}
}
int i1 = this.tileBrewingStand.getField(0);
if (i1 > 0)
{
int j1 = (int)(28.0F * (1.0F - (float)i1 / 400.0F));
if (j1 > 0)
{
this.drawTexturedModalRect(i + 97, j + 16, 176, 0, 9, j1);
}
j1 = BUBBLELENGTHS[i1 / 2 % 7];
if (j1 > 0)
{
this.drawTexturedModalRect(i + 63, j + 14 + 29 - j1, 185, 29 - j1, 12, j1);
}
}
}
}

View File

@ -746,6 +746,7 @@ public class RenderItem implements IResourceManagerReloadListener {
this.registerBlock(Blocks.wool, EnumDyeColor.SILVER.getMetadata(), "silver_wool");
this.registerBlock(Blocks.wool, EnumDyeColor.WHITE.getMetadata(), "white_wool");
this.registerBlock(Blocks.wool, EnumDyeColor.YELLOW.getMetadata(), "yellow_wool");
this.registerBlock(Blocks.farmland, "farmland");
this.registerBlock(Blocks.acacia_stairs, "acacia_stairs");
this.registerBlock(Blocks.activator_rail, "activator_rail");
this.registerBlock(Blocks.beacon, "beacon");

View File

@ -73,13 +73,4 @@ public class EnchantmentUntouching extends Enchantment {
public boolean canApplyTogether(Enchantment enchantment) {
return super.canApplyTogether(enchantment) && enchantment.effectId != fortune.effectId;
}
/**
* +
* Determines if this enchantment can be applied to a specific
* ItemStack.
*/
public boolean canApply(ItemStack itemstack) {
return itemstack.getItem() == Items.shears ? true : super.canApply(itemstack);
}
}

View File

@ -1,5 +1,7 @@
package net.minecraft.inventory;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
@ -40,26 +42,31 @@ public class ContainerBrewingStand extends Container {
private final Slot theSlot;
private int brewTime;
/**
* Used to cache the fuel remaining in the brewing stand to send changes to ICrafting listeners.
*/
private int prevFuel;
public ContainerBrewingStand(InventoryPlayer playerInventory, IInventory tileBrewingStandIn) {
this.tileBrewingStand = tileBrewingStandIn;
this.addSlotToContainer(
new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 0, 56, 46));
this.addSlotToContainer(
new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 1, 79, 53));
this.addSlotToContainer(
new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 2, 102, 46));
this.theSlot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(tileBrewingStandIn, 3, 79, 17));
this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 0, 56, 51));
this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 1, 79, 58));
this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 2, 102, 51));
this.theSlot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(tileBrewingStandIn, 3, 79, 17));
this.addSlotToContainer(new ContainerBrewingStand.Fuel(tileBrewingStandIn, 4, 17, 17));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (int k = 0; k < 9; ++k) {
this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
}
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (int k = 0; k < 9; ++k)
{
this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
}
}
public void onCraftGuiOpened(ICrafting icrafting) {
@ -80,9 +87,16 @@ public class ContainerBrewingStand extends Container {
if (this.brewTime != this.tileBrewingStand.getField(0)) {
icrafting.sendProgressBarUpdate(this, 0, this.tileBrewingStand.getField(0));
}
if (this.prevFuel != this.tileBrewingStand.getField(1))
{
icrafting.sendProgressBarUpdate(this, 1, this.tileBrewingStand.getField(1));
}
}
this.brewTime = this.tileBrewingStand.getField(0);
this.prevFuel = this.tileBrewingStand.getField(1);
}
public void updateProgressBar(int i, int j) {
@ -190,4 +204,27 @@ public class ContainerBrewingStand extends Container {
&& (parItemStack.getItem() == Items.potionitem || parItemStack.getItem() == Items.glass_bottle);
}
}
static class Fuel extends Slot
{
public Fuel(IInventory iInventoryIn, int index, int xPosition, int yPosition)
{
super(iInventoryIn, index, xPosition, yPosition);
}
public boolean isItemValid(@Nullable ItemStack stack)
{
return isValidBrewingFuel(stack);
}
public static boolean isValidBrewingFuel(@Nullable ItemStack itemStackIn)
{
return itemStackIn != null && itemStackIn.getItem() == Items.blaze_powder;
}
public int getSlotStackLimit()
{
return 64;
}
}
}

View File

@ -327,7 +327,10 @@ public class ContainerRepair extends Container {
k2 = itemstack2.getRepairCost();
}
k2 = k2 * 2 + 1;
if (b0 != i || b0 == 0)
{
k2 = k2 * 2 + 1;
}
itemstack1.setRepairCost(k2);
EnchantmentHelper.setEnchantments(map, itemstack1);
}

View File

@ -1,6 +1,7 @@
package net.minecraft.item;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
@ -56,19 +57,17 @@ public class ItemAppleGold extends ItemFood {
protected void onFoodEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (!world.isRemote) {
entityplayer.addPotionEffect(new PotionEffect(Potion.absorption.id, 2400, 0));
}
if (itemstack.getMetadata() > 0) {
if (!world.isRemote) {
entityplayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 4));
if (itemstack.getMetadata() > 0) {
entityplayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 400, 1));
entityplayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
entityplayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
}
} else {
super.onFoodEaten(itemstack, world, entityplayer);
}
entityplayer.addPotionEffect(new PotionEffect(Potion.absorption.id, 2400, 3));
} else {
entityplayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 100, 1));
entityplayer.addPotionEffect(new PotionEffect(Potion.absorption.id, 2400, 0));
}
}
}
/**

View File

@ -42,7 +42,7 @@ public class ItemAxe extends ItemTool {
public static void bootstrap() {
EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2,
Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Blocks.melon_block, Blocks.ladder });
Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Blocks.melon_block, Blocks.ladder, Blocks.wooden_button, Blocks.wooden_pressure_plate });
}
protected ItemAxe(Item.ToolMaterial material) {

View File

@ -48,7 +48,7 @@ public class ItemEnderPearl extends Item {
* button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (entityplayer.capabilities.isCreativeMode && world.isRemote
if (world.isRemote
&& !SingleplayerServerController.isClientInEaglerSingleplayerOrLAN()) {
return itemstack;
} else {

View File

@ -6,6 +6,7 @@ import net.minecraft.block.BlockDirt;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
@ -100,6 +101,16 @@ public class ItemHoe extends Item {
}
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
stack.damageItem(1, attacker);
return true;
}
/**
* +
* Returns True is the item is renderer in full 3D when hold.

View File

@ -46,7 +46,7 @@ public class ItemPickaxe extends ItemTool {
Blocks.golden_rail, Blocks.gold_block, Blocks.gold_ore, Blocks.ice, Blocks.iron_block, Blocks.iron_ore,
Blocks.lapis_block, Blocks.lapis_ore, Blocks.lit_redstone_ore, Blocks.mossy_cobblestone,
Blocks.netherrack, Blocks.packed_ice, Blocks.rail, Blocks.redstone_ore, Blocks.sandstone,
Blocks.red_sandstone, Blocks.stone, Blocks.stone_slab });
Blocks.red_sandstone, Blocks.stone, Blocks.stone_slab, Blocks.stone_button, Blocks.stone_pressure_plate });
}
protected ItemPickaxe(Item.ToolMaterial material) {

View File

@ -51,13 +51,13 @@ public class ItemShears extends Item {
*/
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos,
EntityLivingBase playerIn) {
stack.damageItem(1, playerIn);
if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass
&& blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) {
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn);
} else {
stack.damageItem(1, playerIn);
return true;
}
return true;
}
/**

View File

@ -2,6 +2,7 @@ package net.minecraft.item;
import net.minecraft.block.BlockStandingSign;
import net.minecraft.block.BlockWallSign;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@ -53,6 +54,8 @@ public class ItemSign extends Item {
*/
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, BlockPos blockpos,
EnumFacing enumfacing, float var6, float var7, float var8) {
IBlockState iblockstate = world.getBlockState(blockpos);
boolean flag = iblockstate.getBlock().isReplaceable(world, blockpos);
if (enumfacing == EnumFacing.DOWN) {
return false;
} else if (!world.getBlockState(blockpos).getBlock().getMaterial().isSolid()) {
@ -66,6 +69,8 @@ public class ItemSign extends Item {
} else if (world.isRemote) {
return true;
} else {
blockpos = flag ? blockpos.down() : blockpos;
if (enumfacing == EnumFacing.UP) {
int i = MathHelper
.floor_double((double) ((entityplayer.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;

View File

@ -312,8 +312,6 @@ public class CraftingManager {
Items.stick, Character.valueOf('X'), Items.leather });
this.addRecipe(new ItemStack(Items.golden_apple, 1, 0), new Object[] { "###", "#X#", "###",
Character.valueOf('#'), Items.gold_ingot, Character.valueOf('X'), Items.apple });
this.addRecipe(new ItemStack(Items.golden_apple, 1, 1), new Object[] { "###", "#X#", "###",
Character.valueOf('#'), Blocks.gold_block, Character.valueOf('X'), Items.apple });
this.addRecipe(new ItemStack(Items.golden_carrot, 1, 0), new Object[] { "###", "#X#", "###",
Character.valueOf('#'), Items.gold_nugget, Character.valueOf('X'), Items.carrot });
this.addRecipe(new ItemStack(Items.speckled_melon, 1), new Object[] { "###", "#X#", "###",

View File

@ -157,5 +157,8 @@ public class RecipesCrafting {
parCraftingManager.addRecipe(new ItemStack(EaglerItems.getEaglerItem("beetroot_soup"), 1),
new Object[] { "FFF", "FFF", " B ", Character.valueOf('F'),
EaglerItems.getEaglerItem("beetroot"), Character.valueOf('B'), Items.bowl });
parCraftingManager.addRecipe(new ItemStack(EaglerItems.getEaglerBlock("end_rod"), 1),
new Object[] { "B", "P", Character.valueOf('B'),
Items.blaze_rod, Character.valueOf('P'), EaglerItems.getEaglerItem("chorus_fruit_popped")});
}
}

View File

@ -209,7 +209,7 @@ public class StatList {
new ChatComponentTranslation("stat.tradedWithVillager", new Object[0]))).registerStat();
public static StatBase field_181724_H = (new StatBasic("stat.cakeSlicesEaten",
new ChatComponentTranslation("stat.cakeSlicesEaten", new Object[0]))).registerStat();
public static StatBase field_181725_I = (new StatBasic("stat.cauldronFilled",
public static StatBase CAULDRON_USED = (new StatBasic("stat.cauldronFilled",
new ChatComponentTranslation("stat.cauldronFilled", new Object[0]))).registerStat();
public static StatBase field_181726_J = (new StatBasic("stat.cauldronUsed",
new ChatComponentTranslation("stat.cauldronUsed", new Object[0]))).registerStat();

View File

@ -65,7 +65,7 @@ public class TileEntityBeacon extends TileEntityLockable implements ITickable, I
{ Potion.resistance, Potion.jump }, { Potion.damageBoost }, { Potion.regeneration } };
/**
* +
* A list of beam segments for this beacon
* A list of beam segments for this
*/
private final List<TileEntityBeacon.BeamSegment> beamSegments = Lists.newArrayList();
private long beamRenderCounter;

View File

@ -2,6 +2,7 @@ package net.minecraft.tileentity;
import java.util.Arrays;
import java.util.List;
import net.minecraft.block.BlockBrewingStand;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
@ -49,26 +50,25 @@ import net.minecraft.util.ITickable;
*
*/
public class TileEntityBrewingStand extends TileEntityLockable implements ITickable, ISidedInventory {
/**
* +
* an array of the input slot indices
*/
private static final int[] inputSlots = new int[] { 3 };
/**
* +
* an array of the output slot indices
*/
private static final int[] outputSlots = new int[] { 0, 1, 2 };
/** an array of the input slot indices */
private static final int[] SLOTS_FOR_UP = new int[] {3};
private static final int[] SLOTS_FOR_DOWN = new int[] {0, 1, 2, 3};
/** an array of the output slot indices */
private static final int[] OUTPUT_SLOTS = new int[] {0, 1, 2, 4};
/**
* +
* The ItemStacks currently placed in the slots of the brewing
* stand
*/
private ItemStack[] brewingItemStacks = new ItemStack[4];
private ItemStack[] brewingItemStacks = new ItemStack[5];
private int brewTime;
private boolean[] filledSlots;
private Item ingredientID;
private String customName;
private int fuel;
/**
* +
@ -100,46 +100,78 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
}
/**
* +
* Like the old updateEntity(), except more generic.
*/
public void update() {
if (this.brewTime > 0) {
--this.brewTime;
if (this.brewTime == 0) {
this.brewPotions();
this.markDirty();
} else if (!this.canBrew()) {
this.brewTime = 0;
this.markDirty();
} else if (this.ingredientID != this.brewingItemStacks[3].getItem()) {
this.brewTime = 0;
this.markDirty();
}
} else if (this.canBrew()) {
this.brewTime = 400;
this.ingredientID = this.brewingItemStacks[3].getItem();
}
* Like the old updateEntity(), except more generic.
*/
public void update()
{
if (this.fuel <= 0 && this.brewingItemStacks[4] != null && this.brewingItemStacks[4].getItem() == Items.blaze_powder)
{
this.fuel = 20;
--this.brewingItemStacks[4].stackSize;
if (!this.worldObj.isRemote) {
boolean[] aboolean = this.func_174902_m();
if (!Arrays.equals(aboolean, this.filledSlots)) {
this.filledSlots = aboolean;
IBlockState iblockstate = this.worldObj.getBlockState(this.getPos());
if (!(iblockstate.getBlock() instanceof BlockBrewingStand)) {
return;
}
if (this.brewingItemStacks[4].stackSize <= 0)
{
this.brewingItemStacks[4] = null;
}
for (int i = 0; i < BlockBrewingStand.HAS_BOTTLE.length; ++i) {
iblockstate = iblockstate.withProperty(BlockBrewingStand.HAS_BOTTLE[i],
Boolean.valueOf(aboolean[i]));
}
this.markDirty();
}
this.worldObj.setBlockState(this.pos, iblockstate, 2);
}
}
boolean flag = this.canBrew();
boolean flag1 = this.brewTime > 0;
}
if (flag1)
{
--this.brewTime;
boolean flag2 = this.brewTime == 0;
if (flag2 && flag)
{
this.brewPotions();
this.markDirty();
}
else if (!flag)
{
this.brewTime = 0;
this.markDirty();
}
else if (this.ingredientID != this.brewingItemStacks[3].getItem())
{
this.brewTime = 0;
this.markDirty();
}
}
else if (flag && this.fuel > 0)
{
--this.fuel;
this.brewTime = 400;
this.ingredientID = this.brewingItemStacks[3].getItem();
this.markDirty();
}
if (!this.worldObj.isRemote)
{
boolean[] aboolean = this.createFilledSlotsArray();
if (!Arrays.equals(aboolean, this.filledSlots))
{
this.filledSlots = aboolean;
IBlockState iblockstate = this.worldObj.getBlockState(this.getPos());
if (!(iblockstate.getBlock() instanceof BlockBrewingStand))
{
return;
}
for (int i = 0; i < BlockBrewingStand.HAS_BOTTLE.length; ++i)
{
iblockstate = iblockstate.withProperty(BlockBrewingStand.HAS_BOTTLE[i], Boolean.valueOf(aboolean[i]));
}
this.worldObj.setBlockState(this.pos, iblockstate, 2);
}
}
}
private boolean canBrew() {
if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) {
@ -237,6 +269,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
this.customName = nbttagcompound.getString("CustomName");
}
this.fuel = nbttagcompound.getByte("Fuel");
}
public void writeToNBT(NBTTagCompound nbttagcompound) {
@ -258,6 +291,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
nbttagcompound.setString("CustomName", this.customName);
}
nbttagcompound.setByte("Fuel", (byte)this.fuel);
}
/**
@ -345,7 +379,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
: itemstack.getItem() == Items.potionitem || itemstack.getItem() == Items.glass_bottle;
}
public boolean[] func_174902_m() {
public boolean[] createFilledSlotsArray() {
boolean[] aboolean = new boolean[3];
for (int i = 0; i < 3; ++i) {
@ -358,7 +392,7 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
}
public int[] getSlotsForFace(EnumFacing side) {
return side == EnumFacing.UP ? inputSlots : outputSlots;
return side == EnumFacing.UP ? SLOTS_FOR_UP : (side == EnumFacing.DOWN ? SLOTS_FOR_DOWN : OUTPUT_SLOTS);
}
/**
@ -391,6 +425,8 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
switch (i) {
case 0:
return this.brewTime;
case 1:
return this.fuel;
default:
return 0;
}
@ -400,7 +436,9 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka
switch (i) {
case 0:
this.brewTime = j;
default:
break;
case 1:
this.fuel = j;
}
}

View File

@ -43,12 +43,14 @@ public class TileEntityNote extends TileEntity {
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
nbttagcompound.setByte("note", this.note);
nbttagcompound.setBoolean("powered", this.previousRedstoneState);
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
this.note = nbttagcompound.getByte("note");
this.note = (byte) MathHelper.clamp_int(this.note, 0, 24);
this.previousRedstoneState = nbttagcompound.getBoolean("powered");
}
/**

View File

@ -3,12 +3,12 @@ package net.minecraft.world;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -171,7 +171,7 @@ public class Explosion {
double d14 = (double) this.worldObj.getBlockDensity(vec3, entity.getEntityBoundingBox());
double d10 = (1.0D - d12) * d14;
entity.attackEntityFrom(DamageSource.setExplosionSource(this),
(float) ((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) f3 + 1.0D)));
(float) ((int) ((d10 * d10 + d10) / 2.0D * 7.0D * (double) f3 + 1.0D)));
double d11 = EnchantmentProtection.func_92092_a(entity, d10);
entity.motionX += d5 * d11;
entity.motionY += d7 * d11;

View File

@ -17,7 +17,9 @@ import net.hoosiertransfer.Alfheim.ILightingEngineProvider;
import net.hoosiertransfer.Alfheim.lighting.LightingEngine;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import java.util.Set;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.HString;
@ -26,6 +28,8 @@ import java.util.concurrent.Callable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHopper;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.BlockPistonExtension;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.BlockSnow;
import net.minecraft.block.BlockStairs;
@ -2044,6 +2048,8 @@ public abstract class World implements IBlockAccess, ILightingEngineProvider, IL
public static boolean doesBlockHaveSolidTopSurface(IBlockAccess blockAccess, BlockPos pos) {
IBlockState iblockstate = blockAccess.getBlockState(pos);
Block block = iblockstate.getBlock();
if (block instanceof BlockPistonExtension && iblockstate.getValue(BlockPistonExtension.FACING) == EnumFacing.UP) return true;
if (block instanceof BlockPistonBase && (!((Boolean)iblockstate.getValue(BlockPistonBase.EXTENDED)).booleanValue() || iblockstate.getValue(BlockPistonBase.FACING) == EnumFacing.DOWN)) return true;
return block.getMaterial().isOpaque() && block.isFullCube() ? true
: (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP
: (block instanceof BlockSlab