Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated lang, Added some additional properties to a few blocks. #1102

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/ltxprogrammer/changed/ChangedConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Client(ForgeConfigSpec.Builder builder) {
builder.comment("Got a lot of mods? Unique model generation will be limited to minecraft and changed");
fastAndCheapLatexBlocks = builder.define("fastAndCheapLatexBlocks", false);
builder.comment("Specify the location of the transfur meter");
transfurMeterPosition = builder.defineEnum("transfurMeterPosition", TransfurProgressOverlay.Position.HOTBAR_LEFT);
transfurMeterPosition = builder.defineEnum("transfurMeterPosition", TransfurProgressOverlay.Position.BOTTOM_LEFT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
Expand Down Expand Up @@ -48,6 +49,10 @@ public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, Co
return SHAPE;
}

public boolean canSurvive(BlockState p_52783_, LevelReader p_52784_, BlockPos p_52785_) {
return p_52784_.getBlockState(p_52785_.below()).isFaceSturdy(p_52784_, p_52785_.below(), Direction.UP);
}

public VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) {
return Shapes.empty();
}
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/net/ltxprogrammer/changed/block/DroppedOrange.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
Expand Down Expand Up @@ -54,6 +56,16 @@ public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
return List.of(new ItemStack(ChangedItems.ORANGE.get(), state.getValue(ORANGES)));
}

@Override
public void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block source, BlockPos sourcePos, boolean simulate) {
super.neighborChanged(blockState, level, blockPos, source, sourcePos, simulate);
if (!blockState.canSurvive(level, blockPos)) {
BlockEntity blockentity = blockState.hasBlockEntity() ? level.getBlockEntity(blockPos) : null;
dropResources(blockState, level, blockPos, blockentity);
level.removeBlock(blockPos, false);
}
}

@Override
public VoxelShape getInteractionShape(BlockState state, BlockGetter level, BlockPos pos) {
Vec3 vec3 = state.getOffset(level, pos);
Expand Down
55 changes: 47 additions & 8 deletions src/main/java/net/ltxprogrammer/changed/block/DroppedSyringe.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.material.*;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;

public class DroppedSyringe extends Block implements EntityBlock, NonLatexCoverableBlock {
public class DroppedSyringe extends Block implements EntityBlock, NonLatexCoverableBlock, SimpleWaterloggedBlock {
public static final IntegerProperty ROTATION = BlockStateProperties.ROTATION_16;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
protected static final VoxelShape SHAPE = Block.box(3.0D, 0.0D, 3.0D, 13.0D, 2.0D, 13.0D);

public DroppedSyringe() {
super(BlockBehaviour.Properties.of(Material.BUILDABLE_GLASS, MaterialColor.COLOR_LIGHT_GRAY).sound(SoundType.CANDLE).instabreak());
this.registerDefaultState(this.stateDefinition.any().setValue(ROTATION, 0));
this.registerDefaultState(this.stateDefinition.any().setValue(ROTATION, 0).setValue(WATERLOGGED, false));
}

public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
Expand All @@ -51,18 +51,44 @@ public void entityInside(BlockState state, Level level, BlockPos pos, Entity ent
}
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(ROTATION, WATERLOGGED);
}

@Override
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
return SHAPE;
}

@Override
public void neighborChanged(BlockState blockState, Level level, BlockPos pos, Block source, BlockPos sourcePos, boolean simulate) {
super.neighborChanged(blockState, level, pos, source, sourcePos, simulate);
if (!blockState.canSurvive(level, pos)) {
BlockEntity blockentity = blockState.hasBlockEntity() ? level.getBlockEntity(pos) : null;
dropResources(blockState, level, pos, blockentity);
level.getBlockEntity(pos, ChangedBlockEntities.DROPPED_SYRINGE.get()).ifPresent(droppedSyringeBlockEntity -> {
popResource(level, pos, droppedSyringeBlockEntity.getSyringe());
level.removeBlock(pos, false);
});
}
}

@Override
public boolean canSurvive(BlockState p_52783_, LevelReader p_52784_, BlockPos p_52785_) {
return p_52784_.getBlockState(p_52785_.below()).isFaceSturdy(p_52784_, p_52785_.below(), Direction.UP);
}

@Override
public VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) {
return Shapes.empty();
}

@Override
public RenderShape getRenderShape(BlockState p_54559_) {
return super.getRenderShape(p_54559_);
}

@Override
public boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, Player player, boolean willHarvest, FluidState fluid) {
if (!player.isCreative()) {
Expand All @@ -85,20 +111,33 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return new DroppedSyringeBlockEntity(pos, state);
}

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(ROTATION, Mth.floor((double) (context.getRotation() * 16.0F / 360.0F) + 0.5D) & 15);
}

@Override
public BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(ROTATION, rotation.rotate(state.getValue(ROTATION), 16));
}

@Override
public BlockState mirror(BlockState state, Mirror mirror) {
return state.setValue(ROTATION, mirror.mirror(state.getValue(ROTATION), 16));
}

protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(ROTATION);
@Override
public FluidState getFluidState(BlockState state) {
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
}

@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState otherState, LevelAccessor level, BlockPos pos, BlockPos otherPos) {
if (state.getValue(WATERLOGGED)) {
level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
}

return super.updateShape(state, direction, otherState, level, pos, otherPos);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
Expand Down Expand Up @@ -65,6 +66,11 @@ public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p
return SHAPE;
}

@Override
public boolean canSurvive(BlockState p_52783_, LevelReader p_52784_, BlockPos p_52785_) {
return p_52784_.getBlockState(p_52785_.below()).isFaceSturdy(p_52784_, p_52785_.below(), Direction.UP);
}

@Override
public VoxelShape getOcclusionShape(BlockState p_60578_, BlockGetter p_60579_, BlockPos p_60580_) {
return SHAPE;
Expand Down
7 changes: 5 additions & 2 deletions src/main/resources/assets/changed/lang/no_no.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"gamerule.changed:doPale": "Er Pale aktivert",

"key.changed.variant_ability": "Aktiv variantevne",
"key.changed.use_ability": "Bruke variantevne",
"key.changed.use_ability": "Bruk variantevne",
"key.changed.extra_jump": "Ekstra hopp",

"container.changed.extra_hands": "Ekstra hendermeny",
Expand Down Expand Up @@ -553,9 +553,12 @@
"changed:advancements.main.kill_all_latex.title": "Gått berserk",
"changed:advancements.main.kill_all_latex.description": "Drep et av hvert slag av lateksdyr",

"changed:advancements.main.flying.title": "Sprer dine vinger",
"changed:advancements.main.flying.description": "Bruk din flygeevner i 15 sekunder",

"changed.tutorial.select_ability.title": "Velge din evne",
"changed.tutorial.select_ability.description": "Trykk på %s",
"changed.tutorial.use_ability.title": "Bruke din evne",
"changed.tutorial.use_ability.title": "Bruk din evne",
"changed.tutorial.use_ability.description": "Trykk på eller hold %s",

"facility.zone.red_zone": "Rød sone",
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/assets/changed/lang/sv_se.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,12 @@
"changed:advancements.main.kill_all_latex.title": "Blivit bärsärk",
"changed:advancements.main.kill_all_latex.description": "Döda en av varje slags av latexdjur",

"changed:advancements.main.flying.title": "Sprider dina vingar",
"changed:advancements.main.flying.description": "Använd din flygförmågor i 15 sekunder",

"changed.tutorial.select_ability.title": "Välj din förmåga",
"changed.tutorial.select_ability.description": "Tryck %s",
"changed.tutorial.use_ability.title": "Använda din förmåga",
"changed.tutorial.use_ability.title": "Använd din förmåga",
"changed.tutorial.use_ability.description": "Tryck eller håll ned %s",

"facility.zone.red_zone": "Röd zon",
Expand Down