chorus plant but with broken textures and other stuff broken

This commit is contained in:
HoosierTransfer 2024-06-15 14:23:06 -04:00
parent a192b7b5b7
commit e8fae5b248
19 changed files with 1370646 additions and 45545 deletions

View File

@ -1,4 +1,4 @@
@echo off
title MakeSignedClient
java -cp "desktopRuntime/MakeOfflineDownload.jar;desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"
java -cp "resources/MakeOfflineDownload.jar;resources/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"
pause

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
{
"variants": {
"age=0": { "model": "chorus_flower" },
"age=1": { "model": "chorus_flower" },
"age=2": { "model": "chorus_flower" },
"age=3": { "model": "chorus_flower" },
"age=4": { "model": "chorus_flower" },
"age=5": { "model": "chorus_flower_dead" }
}
}

View File

@ -0,0 +1,69 @@
{
"variants": {
"down=false,east=false,north=false,south=false,up=false,west=false": { "model": "cobblestone_wall_post" },
"down=false,east=false,north=true,south=false,up=false,west=false": { "model": "cobblestone_wall_n" },
"down=false,east=true,north=false,south=false,up=false,west=false": { "model": "cobblestone_wall_n", "y": 90, "uvlock": true },
"down=false,east=false,north=false,south=true,up=false,west=false": { "model": "cobblestone_wall_n", "y": 180, "uvlock": true },
"down=false,east=false,north=false,south=false,up=false,west=true": { "model": "cobblestone_wall_n", "y": 270, "uvlock": true },
"down=false,east=true,north=true,south=false,up=false,west=false": { "model": "cobblestone_wall_ne" },
"down=false,east=true,north=false,south=true,up=false,west=false": { "model": "cobblestone_wall_ne", "y": 90, "uvlock": true },
"down=false,east=false,north=false,south=true,up=false,west=true": { "model": "cobblestone_wall_ne", "y": 180, "uvlock": true },
"down=false,east=false,north=true,south=false,up=false,west=true": { "model": "cobblestone_wall_ne", "y": 270, "uvlock": true },
"down=false,east=false,north=true,south=true,up=false,west=false": { "model": "cobblestone_wall_ns" },
"down=false,east=true,north=false,south=false,up=false,west=true": { "model": "cobblestone_wall_ns", "y": 90, "uvlock": true },
"down=false,east=true,north=true,south=true,up=false,west=false": { "model": "cobblestone_wall_nse" },
"down=false,east=true,north=false,south=true,up=false,west=true": { "model": "cobblestone_wall_nse", "y": 90, "uvlock": true },
"down=false,east=false,north=true,south=true,up=false,west=true": { "model": "cobblestone_wall_nse", "y": 180, "uvlock": true },
"down=false,east=true,north=true,south=false,up=false,west=true": { "model": "cobblestone_wall_nse", "y": 270, "uvlock": true },
"down=false,east=true,north=true,south=true,up=false,west=true": { "model": "cobblestone_wall_nsew" },
"down=false,east=false,north=false,south=false,up=true,west=false": { "model": "cobblestone_wall_post" },
"down=false,east=false,north=true,south=false,up=true,west=false": { "model": "cobblestone_wall_n" },
"down=false,east=true,north=false,south=false,up=true,west=false": { "model": "cobblestone_wall_n", "y": 90, "uvlock": true },
"down=false,east=false,north=false,south=true,up=true,west=false": { "model": "cobblestone_wall_n", "y": 180, "uvlock": true },
"down=false,east=false,north=false,south=false,up=true,west=true": { "model": "cobblestone_wall_n", "y": 270, "uvlock": true },
"down=false,east=true,north=true,south=false,up=true,west=false": { "model": "cobblestone_wall_ne" },
"down=false,east=true,north=false,south=true,up=true,west=false": { "model": "cobblestone_wall_ne", "y": 90, "uvlock": true },
"down=false,east=false,north=false,south=true,up=true,west=true": { "model": "cobblestone_wall_ne", "y": 180, "uvlock": true },
"down=false,east=false,north=true,south=false,up=true,west=true": { "model": "cobblestone_wall_ne", "y": 270, "uvlock": true },
"down=false,east=false,north=true,south=true,up=true,west=false": { "model": "cobblestone_wall_ns_above" },
"down=false,east=true,north=false,south=false,up=true,west=true": { "model": "cobblestone_wall_ns_above", "y": 90, "uvlock": true },
"down=false,east=true,north=true,south=true,up=true,west=false": { "model": "cobblestone_wall_nse" },
"down=false,east=true,north=false,south=true,up=true,west=true": { "model": "cobblestone_wall_nse", "y": 90, "uvlock": true },
"down=false,east=false,north=true,south=true,up=true,west=true": { "model": "cobblestone_wall_nse", "y": 180, "uvlock": true },
"down=false,east=true,north=true,south=false,up=true,west=true": { "model": "cobblestone_wall_nse", "y": 270, "uvlock": true },
"down=false,east=true,north=true,south=true,up=true,west=true": { "model": "cobblestone_wall_nsew" },
"down=true,east=false,north=false,south=false,up=false,west=false": { "model": "cobblestone_wall_post" },
"down=true,east=false,north=true,south=false,up=false,west=false": { "model": "cobblestone_wall_n" },
"down=true,east=true,north=false,south=false,up=false,west=false": { "model": "cobblestone_wall_n", "y": 90, "uvlock": true },
"down=true,east=false,north=false,south=true,up=false,west=false": { "model": "cobblestone_wall_n", "y": 180, "uvlock": true },
"down=true,east=false,north=false,south=false,up=false,west=true": { "model": "cobblestone_wall_n", "y": 270, "uvlock": true },
"down=true,east=true,north=true,south=false,up=false,west=false": { "model": "cobblestone_wall_ne" },
"down=true,east=true,north=false,south=true,up=false,west=false": { "model": "cobblestone_wall_ne", "y": 90, "uvlock": true },
"down=true,east=false,north=false,south=true,up=false,west=true": { "model": "cobblestone_wall_ne", "y": 180, "uvlock": true },
"down=true,east=false,north=true,south=false,up=false,west=true": { "model": "cobblestone_wall_ne", "y": 270, "uvlock": true },
"down=true,east=false,north=true,south=true,up=false,west=false": { "model": "cobblestone_wall_ns" },
"down=true,east=true,north=false,south=false,up=false,west=true": { "model": "cobblestone_wall_ns", "y": 90, "uvlock": true },
"down=true,east=true,north=true,south=true,up=false,west=false": { "model": "cobblestone_wall_nse" },
"down=true,east=true,north=false,south=true,up=false,west=true": { "model": "cobblestone_wall_nse", "y": 90, "uvlock": true },
"down=true,east=false,north=true,south=true,up=false,west=true": { "model": "cobblestone_wall_nse", "y": 180, "uvlock": true },
"down=true,east=true,north=true,south=false,up=false,west=true": { "model": "cobblestone_wall_nse", "y": 270, "uvlock": true },
"down=true,east=true,north=true,south=true,up=false,west=true": { "model": "cobblestone_wall_nsew" },
"down=true,east=false,north=false,south=false,up=true,west=false": { "model": "cobblestone_wall_post" },
"down=true,east=false,north=true,south=false,up=true,west=false": { "model": "cobblestone_wall_n" },
"down=true,east=true,north=false,south=false,up=true,west=false": { "model": "cobblestone_wall_n", "y": 90, "uvlock": true },
"down=true,east=false,north=false,south=true,up=true,west=false": { "model": "cobblestone_wall_n", "y": 180, "uvlock": true },
"down=true,east=false,north=false,south=false,up=true,west=true": { "model": "cobblestone_wall_n", "y": 270, "uvlock": true },
"down=true,east=true,north=true,south=false,up=true,west=false": { "model": "cobblestone_wall_ne" },
"down=true,east=true,north=false,south=true,up=true,west=false": { "model": "cobblestone_wall_ne", "y": 90, "uvlock": true },
"down=true,east=false,north=false,south=true,up=true,west=true": { "model": "cobblestone_wall_ne", "y": 180, "uvlock": true },
"down=true,east=false,north=true,south=false,up=true,west=true": { "model": "cobblestone_wall_ne", "y": 270, "uvlock": true },
"down=true,east=false,north=true,south=true,up=true,west=false": { "model": "cobblestone_wall_ns_above" },
"down=true,east=true,north=false,south=false,up=true,west=true": { "model": "cobblestone_wall_ns_above", "y": 90, "uvlock": true },
"down=true,east=true,north=true,south=true,up=true,west=false": { "model": "cobblestone_wall_nse" },
"down=true,east=true,north=false,south=true,up=true,west=true": { "model": "cobblestone_wall_nse", "y": 90, "uvlock": true },
"down=true,east=false,north=true,south=true,up=true,west=true": { "model": "cobblestone_wall_nse", "y": 180, "uvlock": true },
"down=true,east=true,north=true,south=false,up=true,west=true": { "model": "cobblestone_wall_nse", "y": 270, "uvlock": true },
"down=true,east=true,north=true,south=true,up=true,west=true": { "model": "cobblestone_wall_nsew" }
}
}

View File

@ -0,0 +1,76 @@
{
"textures": {
"texture": "blocks/chorus_flower",
"bottom": "blocks/chorus_plant",
"particle": "blocks/chorus_flower"
},
"elements": [
{
"from": [ 2, 14, 2 ],
"to": [ 14, 16, 14 ],
"faces": {
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" },
"north": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" },
"south": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" },
"west": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" },
"east": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" }
}
},
{
"from": [ 0, 2, 2 ],
"to": [ 2, 14, 14 ],
"faces": {
"down": { "uv": [ 16, 14, 14, 2 ], "texture": "#bottom" },
"up": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" },
"north": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" },
"south": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" },
"west": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" }
}
},
{
"from": [ 2, 2, 0 ],
"to": [ 14, 14, 2 ],
"faces": {
"down": { "uv": [ 14, 2, 2, 0 ], "texture": "#bottom" },
"up": { "uv": [ 2, 0, 14, 2 ], "texture": "#bottom" },
"north": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" },
"west": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" },
"east": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" }
}
},
{
"from": [ 2, 2, 14 ],
"to": [ 14, 14, 16 ],
"faces": {
"down": { "uv": [ 14, 16, 2, 14 ], "texture": "#bottom" },
"up": { "uv": [ 2, 14, 14, 16 ], "texture": "#bottom" },
"south": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" },
"west": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" },
"east": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" }
}
},
{
"from": [ 14, 2, 2 ],
"to": [ 16, 14, 14 ],
"faces": {
"down": { "uv": [ 2, 14, 0, 2 ], "texture": "#bottom" },
"up": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" },
"north": { "uv": [ 0, 2, 2, 14 ], "texture": "#bottom" },
"south": { "uv": [ 14, 2, 16, 14 ], "texture": "#bottom" },
"east": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" }
}
},
{
"from": [ 2, 0, 2 ],
"to": [ 14, 14, 14 ],
"faces": {
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#bottom" },
"down": { "uv": [ 14, 14, 2, 2 ], "texture": "#bottom" },
"north": { "uv": [ 2, 2, 14, 16 ], "texture": "#bottom" },
"south": { "uv": [ 2, 2, 14, 16 ], "texture": "#bottom" },
"west": { "uv": [ 2, 2, 14, 16 ], "texture": "#bottom" },
"east": { "uv": [ 2, 2, 14, 16 ], "texture": "#bottom" }
}
}
]
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/chorus_flower",
"textures": {
"texture": "blocks/chorus_flower_dead",
"bottom": "blocks/chorus_plant",
"particle": "blocks/chorus_flower_dead"
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "block/chorus_flower",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "block/chorus_plant",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

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.4.0";
public static final String projectForkVersion = "0.5.0";
public static final String projectForkVendor = "HoosierTransfer";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@ -25,7 +25,7 @@ public class EaglercraftVersion {
// Updating configuration
public static final boolean enableUpdateService = false;
public static final boolean enableUpdateService = true;
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
public static final int updateBundlePackageVersionInt = 34;
@ -34,7 +34,7 @@ public class EaglercraftVersion {
// public key modulus for official 1.8 updates
public static final BigInteger updateSignatureModulus = new BigInteger(
"14419476194820052109078379102436982757438300194194974078260570958862225232043861026588258585967060437391326494976080031137298500457111529693806931143421725626747051503616606418909609840275122831550688481329699012469742002429706330734797679859799085213517354399295425740214330234086361416936984593337389989505613123225737002654977194421571825036717017788527234114501215218715499682638139386636103589791643964827904791195488978835113700772208317974307363542114867750505953323167521731238542123593257269990619007858952216110012513121779359926747737258698347806747854986471035713105133999027704095451858121831297923962641");
"12088549851624177860210943411753655526838509034327995616720692424931008612895944876178950804800321958658462759341402746623561871401936016063273640247854365676101972751135312958392926810145663068155970896641899900239550667101300685784386254169669408095656719430822905698686750635336744968457512771731599692858855652595492376493019401900777022004925137632047976612790150686906616724035637000868200868976467177296602193750297858734359875260209443581507599782350356643360703727081218369273052261747935073314281655275443613909971524354128310805834911244411349268175047406262508184956239724493043763824375071966003574715449");
// Miscellaneous variables:

View File

@ -71,7 +71,8 @@ public class UpdateService {
}
public static boolean supported() {
return EaglercraftVersion.enableUpdateService && EagRuntime.getConfiguration().allowUpdateSvc()
return EaglercraftVersion.enableUpdateService &&
EagRuntime.getConfiguration().allowUpdateSvc()
&& PlatformUpdateSvc.supported();
}

View File

@ -3,6 +3,8 @@ package net.minecraft.block;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.hoosiertransfer.Alfheim.ILightInfoProvider;
import net.hoosiertransfer.Alfheim.ILightLevelProvider;
@ -492,6 +494,17 @@ public class Block implements ILitBlock {
}
protected static void addCollisionBoxToList(BlockPos pos, AxisAlignedBB entityBox,
List<AxisAlignedBB> collidingBoxes, @Nullable AxisAlignedBB blockBox) {
if (blockBox != null) {
AxisAlignedBB axisalignedbb = blockBox.offset(pos);
if (entityBox.intersectsWith(axisalignedbb)) {
collidingBoxes.add(axisalignedbb);
}
}
}
public AxisAlignedBB getCollisionBoundingBox(World var1, BlockPos blockpos, IBlockState var3) {
return new AxisAlignedBB((double) blockpos.getX() + this.minX, (double) blockpos.getY() + this.minY,
(double) blockpos.getZ() + this.minZ, (double) blockpos.getX() + this.maxX,
@ -1645,6 +1658,13 @@ public class Block implements ILitBlock {
registerEaglerBlock(198, "end_rod", (new BlockEndRod()).setHardness(0.0F).setLightLevel(0.9375F)
.setStepSound(soundTypeWood).setUnlocalizedName("endRod"));
registerEaglerBlock(199, "chorus_plant",
(new BlockChorusPlant()).setHardness(0.4F).setStepSound(soundTypeWood)
.setUnlocalizedName("chorusPlant"));
registerEaglerBlock(200, "chorus_flower",
(new BlockChorusFlower()).setHardness(0.4F).setStepSound(soundTypeWood)
.setUnlocalizedName("chorusFlower"));
Block purpurBlock = (new Block(Material.rock)).setHardness(1.5F).setResistance(10.0F)
.setStepSound(soundTypeStone).setCreativeTab(CreativeTabs.tabBlock).setUnlocalizedName("purpurBlock");
registerEaglerBlock(201, (String) "purpur_block", purpurBlock);

View File

@ -0,0 +1,277 @@
package net.minecraft.block;
import java.util.Random;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.World;
public class BlockChorusFlower extends Block {
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 5);
protected BlockChorusFlower() {
super(Material.plants);
this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)));
this.setCreativeTab(CreativeTabs.tabDecorations);
this.setTickRandomly(true);
}
@Nullable
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return null;
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, EaglercraftRandom rand) {
if (!this.canSurvive(worldIn, pos)) {
worldIn.destroyBlock(pos, true);
} else {
BlockPos blockpos = pos.up();
if (worldIn.isAirBlock(blockpos) && blockpos.getY() < 256) {
int i = ((Integer) state.getValue(AGE)).intValue();
if (i < 5 && rand.nextInt(1) == 0) {
boolean flag = false;
boolean flag1 = false;
Block block = worldIn.getBlockState(pos.down()).getBlock();
if (block == Blocks.end_stone) {
flag = true;
} else if (block == EaglerItems.getEaglerBlock("chorus_plant")) {
int j = 1;
for (int k = 0; k < 4; ++k) {
Block block1 = worldIn.getBlockState(pos.down(j + 1)).getBlock();
if (block1 != EaglerItems.getEaglerBlock("chorus_plant")) {
if (block1 == Blocks.end_stone) {
flag1 = true;
}
break;
}
++j;
}
int i1 = 4;
if (flag1) {
++i1;
}
if (j < 2 || rand.nextInt(i1) >= j) {
flag = true;
}
} else if (block == Blocks.air) {
flag = true;
}
if (flag && areAllNeighborsEmpty(worldIn, blockpos, (EnumFacing) null)
&& worldIn.isAirBlock(pos.up(2))) {
worldIn.setBlockState(pos, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
this.placeGrownFlower(worldIn, blockpos, i);
} else if (i < 4) {
int l = rand.nextInt(4);
boolean flag2 = false;
if (flag1) {
++l;
}
for (int j1 = 0; j1 < l; ++j1) {
EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand);
BlockPos blockpos1 = pos.offset(enumfacing);
if (worldIn.isAirBlock(blockpos1) && worldIn.isAirBlock(blockpos1.down())
&& areAllNeighborsEmpty(worldIn, blockpos1, enumfacing.getOpposite())) {
this.placeGrownFlower(worldIn, blockpos1, i + 1);
flag2 = true;
}
}
if (flag2) {
worldIn.setBlockState(pos, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
} else {
this.placeDeadFlower(worldIn, pos);
}
} else if (i == 4) {
this.placeDeadFlower(worldIn, pos);
}
}
}
}
}
private void placeGrownFlower(World p_185602_1_, BlockPos p_185602_2_, int p_185602_3_) {
p_185602_1_.setBlockState(p_185602_2_, this.getDefaultState().withProperty(AGE, Integer.valueOf(p_185602_3_)),
2);
// TODO: implement soundf
// p_185602_1_.playAuxSFX(1033, p_185602_2_, 0);
}
private void placeDeadFlower(World p_185605_1_, BlockPos p_185605_2_) {
p_185605_1_.setBlockState(p_185605_2_, this.getDefaultState().withProperty(AGE, Integer.valueOf(5)), 2);
// p_185605_1_.playAuxSFX(1034, p_185605_2_, 0);
}
private static boolean areAllNeighborsEmpty(World p_185604_0_, BlockPos p_185604_1_, EnumFacing p_185604_2_) {
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
if (enumfacing != p_185604_2_ && !p_185604_0_.isAirBlock(p_185604_1_.offset(enumfacing))) {
return false;
}
}
return true;
}
public boolean isFullCube() {
return false;
}
public boolean isOpaqueCube() {
return false;
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return super.canPlaceBlockAt(worldIn, pos) && this.canSurvive(worldIn, pos);
}
public void onNeighborBlockChange(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_,
Block p_189540_4_) {
if (!this.canSurvive(p_189540_2_, p_189540_3_)) {
p_189540_2_.scheduleUpdate(p_189540_3_, this, 1);
}
}
public boolean canSurvive(World worldIn, BlockPos pos) {
Block block = worldIn.getBlockState(pos.down()).getBlock();
if (block != EaglerItems.getEaglerBlock("chorus_plant") && block != Blocks.end_stone) {
if (block == Blocks.air) {
int i = 0;
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
Block block1 = worldIn.getBlockState(pos.offset(enumfacing)).getBlock();
if (block1 == EaglerItems.getEaglerBlock("chorus_plant")) {
++i;
} else if (block1 != Blocks.air) {
return false;
}
}
return i == 1;
} else {
return false;
}
} else {
return true;
}
}
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state,
@Nullable TileEntity te) {
super.harvestBlock(worldIn, player, pos, state, te);
spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this)));
}
protected ItemStack createStackedBlock(IBlockState state) {
return null;
}
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta));
}
public int getMetaFromState(IBlockState state) {
return ((Integer) state.getValue(AGE)).intValue();
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { AGE });
}
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
super.onBlockAdded(worldIn, pos, state);
}
public static void generatePlant(World worldIn, BlockPos pos, EaglercraftRandom rand, int p_185603_3_) {
worldIn.setBlockState(pos, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
growTreeRecursive(worldIn, pos, rand, pos, p_185603_3_, 0);
}
private static void growTreeRecursive(World worldIn, BlockPos p_185601_1_, EaglercraftRandom rand,
BlockPos p_185601_3_,
int p_185601_4_, int p_185601_5_) {
int i = rand.nextInt(4) + 1;
if (p_185601_5_ == 0) {
++i;
}
for (int j = 0; j < i; ++j) {
BlockPos blockpos = p_185601_1_.up(j + 1);
if (!areAllNeighborsEmpty(worldIn, blockpos, (EnumFacing) null)) {
return;
}
worldIn.setBlockState(blockpos, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
}
boolean flag = false;
if (p_185601_5_ < 4) {
int l = rand.nextInt(4);
if (p_185601_5_ == 0) {
++l;
}
for (int k = 0; k < l; ++k) {
EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand);
BlockPos blockpos1 = p_185601_1_.up(i).offset(enumfacing);
if (Math.abs(blockpos1.getX() - p_185601_3_.getX()) < p_185601_4_
&& Math.abs(blockpos1.getZ() - p_185601_3_.getZ()) < p_185601_4_
&& worldIn.isAirBlock(blockpos1) && worldIn.isAirBlock(blockpos1.down())
&& areAllNeighborsEmpty(worldIn, blockpos1, enumfacing.getOpposite())) {
flag = true;
worldIn.setBlockState(blockpos1, EaglerItems.getEaglerBlock("chorus_plant").getDefaultState(), 2);
growTreeRecursive(worldIn, blockpos1, rand, p_185601_3_, p_185601_4_, p_185601_5_ + 1);
}
}
}
if (!flag) {
worldIn.setBlockState(p_185601_1_.up(i),
EaglerItems.getEaglerBlock("chorus_plant").getDefaultState().withProperty(AGE, Integer.valueOf(5)),
2);
}
}
}

View File

@ -0,0 +1,221 @@
package net.minecraft.block;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
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.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockChorusPlant extends Block {
public static final PropertyBool NORTH = PropertyBool.create("north");
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool WEST = PropertyBool.create("west");
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool DOWN = PropertyBool.create("down");
protected BlockChorusPlant() {
super(Material.plants);
this.setCreativeTab(CreativeTabs.tabDecorations);
this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false))
.withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false))
.withProperty(WEST, Boolean.valueOf(false)).withProperty(UP, Boolean.valueOf(false))
.withProperty(DOWN, Boolean.valueOf(false)));
}
/**
* Get the actual Block state of this Block at the given position. This applies
* properties not visible in the
* metadata, such as fence connections.
*/
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
Block block = worldIn.getBlockState(pos.down()).getBlock();
Block block1 = worldIn.getBlockState(pos.up()).getBlock();
Block block2 = worldIn.getBlockState(pos.north()).getBlock();
Block block3 = worldIn.getBlockState(pos.east()).getBlock();
Block block4 = worldIn.getBlockState(pos.south()).getBlock();
Block block5 = worldIn.getBlockState(pos.west()).getBlock();
return state
.withProperty(DOWN,
Boolean.valueOf(block == this || block == EaglerItems.getEaglerBlock("chorus_flower")
|| block == Blocks.end_stone))
.withProperty(UP,
Boolean.valueOf(block1 == this || block1 == EaglerItems.getEaglerBlock("chorus_flower")))
.withProperty(NORTH,
Boolean.valueOf(block2 == this || block2 == EaglerItems.getEaglerBlock("chorus_flower")))
.withProperty(EAST,
Boolean.valueOf(block3 == this || block3 == EaglerItems.getEaglerBlock("chorus_flower")))
.withProperty(SOUTH,
Boolean.valueOf(block4 == this || block4 == EaglerItems.getEaglerBlock("chorus_flower")))
.withProperty(WEST,
Boolean.valueOf(block5 == this || block5 == EaglerItems.getEaglerBlock("chorus_flower")));
}
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
state = state.getBlock().getActualState(state, source, pos);
float f = 0.1875F;
float f1 = ((Boolean) state.getValue(WEST)).booleanValue() ? 0.0F : 0.1875F;
float f2 = ((Boolean) state.getValue(DOWN)).booleanValue() ? 0.0F : 0.1875F;
float f3 = ((Boolean) state.getValue(NORTH)).booleanValue() ? 0.0F : 0.1875F;
float f4 = ((Boolean) state.getValue(EAST)).booleanValue() ? 1.0F : 0.8125F;
float f5 = ((Boolean) state.getValue(UP)).booleanValue() ? 1.0F : 0.8125F;
float f6 = ((Boolean) state.getValue(SOUTH)).booleanValue() ? 1.0F : 0.8125F;
return new AxisAlignedBB((double) f1, (double) f2, (double) f3, (double) f4, (double) f5, (double) f6);
}
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos blockpos, IBlockState var3) {
return this.getBoundingBox(var3, world, blockpos);
}
public void addCollisionBoxesToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
state = state.getBlock().getActualState(state, worldIn, pos);
float f = 0.1875F;
float f1 = 0.8125F;
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.1875D, 0.1875D, 0.8125D, 0.8125D, 0.8125D));
if (((Boolean) state.getValue(WEST)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.0D, 0.1875D, 0.1875D, 0.1875D, 0.8125D, 0.8125D));
}
if (((Boolean) state.getValue(EAST)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.8125D, 0.1875D, 0.1875D, 1.0D, 0.8125D, 0.8125D));
}
if (((Boolean) state.getValue(UP)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.8125D, 0.1875D, 0.8125D, 1.0D, 0.8125D));
}
if (((Boolean) state.getValue(DOWN)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.1875D, 0.8125D));
}
if (((Boolean) state.getValue(NORTH)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.1875D, 0.0D, 0.8125D, 0.8125D, 0.1875D));
}
if (((Boolean) state.getValue(SOUTH)).booleanValue()) {
addCollisionBoxToList(pos, entityBox, collidingBoxes,
new AxisAlignedBB(0.1875D, 0.1875D, 0.8125D, 0.8125D, 0.8125D, 1.0D));
}
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state) {
return 0;
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
if (!this.canSurviveAt(worldIn, pos)) {
worldIn.destroyBlock(pos, true);
}
}
@Nullable
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return EaglerItems.getEaglerItem("chorus_fruit");
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random) {
return random.nextInt(2);
}
public boolean isFullCube() {
return false;
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for
* render
*/
public boolean isOpaqueCube() {
return false;
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return super.canPlaceBlockAt(worldIn, pos) ? this.canSurviveAt(worldIn, pos) : false;
}
public void onNeighborBlockChange(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_,
Block p_189540_4_) {
if (!this.canSurviveAt(p_189540_2_, p_189540_3_)) {
p_189540_2_.scheduleUpdate(p_189540_3_, this, 1);
}
}
public boolean canSurviveAt(World wordIn, BlockPos pos) {
boolean flag = wordIn.isAirBlock(pos.up());
boolean flag1 = wordIn.isAirBlock(pos.down());
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
BlockPos blockpos = pos.offset(enumfacing);
Block block = wordIn.getBlockState(blockpos).getBlock();
if (block == this) {
if (!flag && !flag1) {
return false;
}
Block block1 = wordIn.getBlockState(blockpos.down()).getBlock();
if (block1 == this || block1 == Blocks.end_stone) {
return true;
}
}
}
Block block2 = wordIn.getBlockState(pos.down()).getBlock();
return block2 == this || block2 == Blocks.end_stone;
}
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
public boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos,
EnumFacing side) {
Block block = blockAccess.getBlockState(pos.offset(side)).getBlock();
return block != this && block != EaglerItems.getEaglerBlock("chorus_flower")
&& (side != EnumFacing.DOWN || block != Blocks.end_stone);
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { NORTH, EAST, SOUTH, WEST, UP, DOWN });
}
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
return false;
}
}

View File

@ -137,6 +137,12 @@ public class AxisAlignedBB {
this.maxZ + z);
}
public AxisAlignedBB offset(BlockPos pos) {
return new AxisAlignedBB(this.minX + (double) pos.getX(), this.minY + (double) pos.getY(),
this.minZ + (double) pos.getZ(), this.maxX + (double) pos.getX(), this.maxY + (double) pos.getY(),
this.maxZ + (double) pos.getZ());
}
/**
* +
* if instance and the argument bounding boxes overlap in the Y