mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-29 08:26:37 +01:00
resolved culling issues + crude heater voxel shape
This commit is contained in:
parent
42b78b01eb
commit
7404972cf6
3 changed files with 27 additions and 13 deletions
|
@ -113,7 +113,11 @@ public class AllShapes {
|
|||
|
||||
BASIN_BLOCK_SHAPE = shape(0, 2, 0, 16, 13, 16).erase(2, 5, 2, 14, 14, 14)
|
||||
.add(2, 0, 2, 14, 2, 14)
|
||||
.build(),
|
||||
.build(),
|
||||
HEATER_BLOCK_SHAPE =
|
||||
shape(2, 0, 2, 14, 16, 14).add(0, 0, 0, 16, 2, 16)
|
||||
.erase(3, 5, 3, 13, 16, 13)
|
||||
.build(),
|
||||
CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 22, 16),
|
||||
MECHANICAL_PROCESSOR_SHAPE = shape(VoxelShapes.fullCube()).erase(4, 0, 4, 12, 16, 12)
|
||||
.build(),
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.processing;
|
|||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
|
||||
|
@ -20,6 +21,8 @@ import net.minecraft.util.ActionResultType;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -74,9 +77,15 @@ public class HeaterBlock extends Block implements ITE<HeaterTileEntity> {
|
|||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
ItemStack item = context.getItem();
|
||||
return super.getStateForPlacement(context).with(HAS_BLAZE, item.hasTag() && item.getTag()
|
||||
.contains("has_blaze")
|
||||
&& item.getTag()
|
||||
.getBoolean("has_blaze"));
|
||||
BlockState state = super.getStateForPlacement(context);
|
||||
return (state != null ? state : getDefaultState()).with(HAS_BLAZE,
|
||||
item.hasTag() && item.getTag() != null && item.getTag()
|
||||
.contains("has_blaze") && item.getTag()
|
||||
.getBoolean("has_blaze"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context) {
|
||||
return AllShapes.HEATER_BLOCK_SHAPE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
@ -64,13 +65,15 @@ public class HeaterTileEntity extends SmartTileEntity {
|
|||
}
|
||||
|
||||
boolean tryUpdateFuel(ItemStack itemStack) {
|
||||
int burnTime = itemStack.getItem()
|
||||
int burnTime = itemStack.getItem() == Items.EGG ? 150 : itemStack.getItem()
|
||||
.getBurnTime(itemStack);
|
||||
|
||||
if (burnTime == -1)
|
||||
burnTime = ForgeHooks.getBurnTime(itemStack);
|
||||
int newFuelLevel = (burnTime > burnTimeRemaining ? 1 : 0); // todo: + (itemStack.getItem() == AllItems.SUPER_SPECIAL_FUEL.get() ? 1 : 0);
|
||||
if (newFuelLevel <= fuelLevel) {
|
||||
if (burnTime <= 0)
|
||||
return false;
|
||||
|
||||
int newFuelLevel = 1; // todo: + (itemStack.getItem() == AllItems.SUPER_SPECIAL_FUEL.get() ? 1 : 0);
|
||||
if (newFuelLevel < fuelLevel ^ burnTime <= burnTimeRemaining) {
|
||||
return false;
|
||||
}
|
||||
burnTimeRemaining = burnTime;
|
||||
|
@ -87,11 +90,9 @@ public class HeaterTileEntity extends SmartTileEntity {
|
|||
int newHeatLevel = 1 + fuelLevel;
|
||||
if (newHeatLevel != bufferedHeatLevel) {
|
||||
bufferedHeatLevel = newHeatLevel;
|
||||
// Block block = getBlockState().getBlock();
|
||||
// if (block instanceof HeaterBlock)
|
||||
// ((HeaterBlock) block).setLightLevel();
|
||||
markDirty();
|
||||
sendData();
|
||||
if(world != null)
|
||||
sendData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue