Start migration
This commit is contained in:
parent
6630ce0cab
commit
47ed597358
491 changed files with 12045 additions and 11953 deletions
|
@ -4,23 +4,23 @@ import java.util.List;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.loot.context.LootContextParameters;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.explosion.Explosion;
|
||||
import ru.betterend.blocks.basis.PedestalBlock;
|
||||
import ru.betterend.blocks.entities.EternalPedestalEntity;
|
||||
|
@ -30,14 +30,14 @@ import ru.betterend.rituals.EternalRitual;
|
|||
|
||||
public class EternalPedestal extends PedestalBlock {
|
||||
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
|
||||
|
||||
|
||||
public EternalPedestal() {
|
||||
super(EndBlocks.FLAVOLITE_RUNED_ETERNAL);
|
||||
this.setDefaultState(getDefaultState().with(ACTIVATED, false));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void checkRitual(World world, BlockPos pos) {
|
||||
public void checkRitual(Level world, BlockPos pos) {
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (blockEntity instanceof EternalPedestalEntity) {
|
||||
EternalPedestalEntity pedestal = (EternalPedestalEntity) blockEntity;
|
||||
|
@ -46,7 +46,7 @@ public class EternalPedestal extends PedestalBlock {
|
|||
if (pedestal.hasRitual()) {
|
||||
EternalRitual ritual = pedestal.getRitual();
|
||||
if (ritual.isActive()) {
|
||||
Identifier targetWorld = ritual.getTargetWorldId();
|
||||
ResourceLocation targetWorld = ritual.getTargetWorldId();
|
||||
int portalId;
|
||||
if (targetWorld != null) {
|
||||
portalId = EndPortals.getPortalIdByWorld(targetWorld);
|
||||
|
@ -56,12 +56,12 @@ public class EternalPedestal extends PedestalBlock {
|
|||
ritual.disablePortal(portalId);
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos, updatedState.with(ACTIVATED, false).with(HAS_LIGHT, false));
|
||||
world.setBlockAndUpdate(pos, updatedState.with(ACTIVATED, false).with(HAS_LIGHT, false));
|
||||
} else {
|
||||
ItemStack itemStack = pedestal.getStack(0);
|
||||
Identifier id = Registry.ITEM.getId(itemStack.getItem());
|
||||
ResourceLocation id = Registry.ITEM.getId(itemStack.getItem());
|
||||
if (EndPortals.isAvailableItem(id)) {
|
||||
world.setBlockState(pos, updatedState.with(ACTIVATED, true).with(HAS_LIGHT, true));
|
||||
world.setBlockAndUpdate(pos, updatedState.with(ACTIVATED, true).with(HAS_LIGHT, true));
|
||||
if (pedestal.hasRitual()) {
|
||||
pedestal.getRitual().checkStructure();
|
||||
} else {
|
||||
|
@ -72,42 +72,45 @@ public class EternalPedestal extends PedestalBlock {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||
BlockState updated = super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
|
||||
if (!updated.isOf(this)) return updated;
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world,
|
||||
BlockPos pos, BlockPos posFrom) {
|
||||
BlockState updated = super.updateShape(state, direction, newState, world, pos, posFrom);
|
||||
if (!updated.is(this))
|
||||
return updated;
|
||||
if (!this.isPlaceable(updated)) {
|
||||
return updated.with(ACTIVATED, false);
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getBlastResistance() {
|
||||
return Blocks.BEDROCK.getBlastResistance();
|
||||
return Blocks.BEDROCK.getExplosionResistance();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldDropItemsOnExplosion(Explosion explosion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
if (state.isOf(this)) {
|
||||
BlockProperties.PedestalState currentState = state.get(BlockProperties.PEDESTAL_STATE);
|
||||
if (currentState.equals(BlockProperties.PedestalState.BOTTOM) || currentState.equals(BlockProperties.PedestalState.PILLAR)) {
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
if (state.is(this)) {
|
||||
BlockProperties.PedestalState currentState = state.getValue(BlockProperties.PEDESTAL_STATE);
|
||||
if (currentState.equals(BlockProperties.PedestalState.BOTTOM)
|
||||
|| currentState.equals(BlockProperties.PedestalState.PILLAR)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
}
|
||||
List<ItemStack> drop = Lists.newArrayList();
|
||||
BlockEntity blockEntity = builder.getNullable(LootContextParameters.BLOCK_ENTITY);
|
||||
BlockEntity blockEntity = builder.getNullable(LootContextParams.BLOCK_ENTITY);
|
||||
if (blockEntity instanceof EternalPedestalEntity) {
|
||||
EternalPedestalEntity pedestal = (EternalPedestalEntity) blockEntity;
|
||||
if (!pedestal.isEmpty()) {
|
||||
|
@ -116,10 +119,10 @@ public class EternalPedestal extends PedestalBlock {
|
|||
}
|
||||
return drop;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
super.appendProperties(stateManager);
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateManager) {
|
||||
super.createBlockStateDefinition(stateManager);
|
||||
stateManager.add(ACTIVATED);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue