mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
Level::handleMaterialAcceleration uses materials now
This commit is contained in:
parent
5e613268ab
commit
6c7bcf014b
4 changed files with 13 additions and 5 deletions
|
|
@ -404,7 +404,7 @@ class Entity extends Position
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleWaterMovement(){
|
public function handleWaterMovement(){
|
||||||
if($this->level->handleMaterialAcceleration($this->boundingBox->expand(0, -0.4, 0)->contract(0.001, 0.001, 0.001), 0, $this)){
|
if($this->level->handleMaterialAcceleration($this->boundingBox->expand(0, -0.4, 0)->contract(0.001, 0.001, 0.001), Material::$water, $this)){
|
||||||
$this->fallDistance = 0;
|
$this->fallDistance = 0;
|
||||||
$this->inWater = true;
|
$this->inWater = true;
|
||||||
if($this->fire > 0){
|
if($this->fire > 0){
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class ItemEntity extends Entity{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleWaterMovement(){
|
public function handleWaterMovement(){
|
||||||
return $this->level->handleMaterialAcceleration($this->boundingBox, 0, $this);
|
return $this->level->handleMaterialAcceleration($this->boundingBox, Material::$water, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateEntityMovement(){
|
public function updateEntityMovement(){
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,16 @@ class FenceBlock extends TransparentBlock{
|
||||||
|
|
||||||
public static function canConnectTo(Level $level, $x, $y, $z){
|
public static function canConnectTo(Level $level, $x, $y, $z){
|
||||||
$id = $level->level->getBlockID($x, $y, $z);
|
$id = $level->level->getBlockID($x, $y, $z);
|
||||||
|
/*if($id == FENCE || $id == FENCE_GATE) return true;
|
||||||
|
if($id == 0) return false;
|
||||||
|
$mat = StaticBlock::getMaterial($id);
|
||||||
|
if($mat->isSolidBlocking() && tile->isCubeShaped()){ //TODO tile->isCubeShaped
|
||||||
|
return $mat != Material::$vegetable;
|
||||||
|
}
|
||||||
|
return false;*/
|
||||||
|
|
||||||
if($id != FENCE && $id != FENCE_GATE){
|
if($id != FENCE && $id != FENCE_GATE){
|
||||||
return StaticBlock::getIsSolid($id) && $id != PUMPKIN; //TODO check var6 != null && var6.blockMaterial.isOpaque() && var6.renderAsNormalBlock() ? var6.blockMaterial != Material.pumpkin : false;
|
return StaticBlock::getIsSolid($id) && $id != PUMPKIN;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ class Level{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleMaterialAcceleration(AxisAlignedBB $aabb, $materialType, Entity $entity){
|
public function handleMaterialAcceleration(AxisAlignedBB $aabb, Material $material, Entity $entity){
|
||||||
$minX = floor($aabb->minX);
|
$minX = floor($aabb->minX);
|
||||||
$maxX = ceil($aabb->maxX);
|
$maxX = ceil($aabb->maxX);
|
||||||
$minY = floor($aabb->minY);
|
$minY = floor($aabb->minY);
|
||||||
|
|
@ -232,7 +232,8 @@ class Level{
|
||||||
for($y = $minY; $y < $maxY; ++$y){
|
for($y = $minY; $y < $maxY; ++$y){
|
||||||
for($z = $minZ; $z < $maxZ; ++$z){
|
for($z = $minZ; $z < $maxZ; ++$z){
|
||||||
[$block, $meta] = $this->level->getBlock($x, $y, $z);
|
[$block, $meta] = $this->level->getBlock($x, $y, $z);
|
||||||
if(($materialType == 0 && ($block == WATER || $block == STILL_WATER)) || ($materialType == 1 && ($block == LAVA || $block == STILL_LAVA))){ //TODO better material system
|
$mat = StaticBlock::getMaterial($block);
|
||||||
|
if($material == $mat){
|
||||||
$v16 = ($y + 1) - LiquidBlock::getPercentAir($meta);
|
$v16 = ($y + 1) - LiquidBlock::getPercentAir($meta);
|
||||||
if($maxY >= $v16){
|
if($maxY >= $v16){
|
||||||
$appliedVelocity = true;
|
$appliedVelocity = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue