Skip to content

Commit

Permalink
rename launchpad to jumppad
Browse files Browse the repository at this point in the history
  • Loading branch information
bazke committed Nov 7, 2024
1 parent d29f3f1 commit 44e34b2
Show file tree
Hide file tree
Showing 16 changed files with 245 additions and 247 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/generated/resources/assets/ltextras/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"block.ltextras.imposter_white_concrete_powder": "ɹǝpʍoԀ ǝʇǝɹɔuoƆ ǝʇıɥM ɹǝʇsodɯI",
"block.ltextras.imposter_yellow_concrete_powder": "ɹǝpʍoԀ ǝʇǝɹɔuoƆ ʍoןןǝʎ ɹǝʇsodɯI",
"block.ltextras.infertile_vine": "ǝuıΛ ǝןıʇɹǝɟuI",
"block.ltextras.launchpad": "pɐdɥɔunɐꞀ",
"block.ltextras.jumppad": "pɐԀ dɯnſ",
"block.ltextras.light_blue_concrete_powder_slab": "qɐןS ɹǝpʍoԀ ǝʇǝɹɔuoƆ ǝnןᗺ ʇɥbıꞀ",
"block.ltextras.light_blue_concrete_powder_stairs": "sɹıɐʇS ɹǝpʍoԀ ǝʇǝɹɔuoƆ ǝnןᗺ ʇɥbıꞀ",
"block.ltextras.light_blue_concrete_slab": "qɐןS ǝʇǝɹɔuoƆ ǝnןᗺ ʇɥbıꞀ",
Expand Down
2 changes: 1 addition & 1 deletion src/generated/resources/assets/ltextras/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"block.ltextras.imposter_white_concrete_powder": "Imposter White Concrete Powder",
"block.ltextras.imposter_yellow_concrete_powder": "Imposter Yellow Concrete Powder",
"block.ltextras.infertile_vine": "Infertile Vine",
"block.ltextras.launchpad": "Launchpad",
"block.ltextras.jumppad": "Jump Pad",
"block.ltextras.light_blue_concrete_powder_slab": "Light Blue Concrete Powder Slab",
"block.ltextras.light_blue_concrete_powder_stairs": "Light Blue Concrete Powder Stairs",
"block.ltextras.light_blue_concrete_slab": "Light Blue Concrete Slab",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"parent": "minecraft:block/slab",
"textures": {
"bottom": "ltextras:block/jumppad_bottom",
"particle": "ltextras:block/jumppad_side",
"side": "ltextras:block/jumppad_side",
"top": "ltextras:block/jumppad_top"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"parent": "minecraft:block/slab",
"textures": {
"bottom": "ltextras:block/jumppad_bottom",
"particle": "ltextras:block/jumppad_side",
"side": "ltextras:block/jumppad_side",
"top": "ltextras:block/jumppad_top_nohoriz"
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "ltextras:block/jumppad"
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"entries": [
{
"type": "minecraft:item",
"name": "ltextras:launchpad"
"name": "ltextras:jumppad"
}
],
"rolls": 1.0
}
],
"random_sequence": "ltextras:blocks/launchpad"
"random_sequence": "ltextras:blocks/jumppad"
}
27 changes: 13 additions & 14 deletions src/main/java/com/lovetropics/extras/ExtraBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.client.renderer.BiomeColors;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -47,7 +46,6 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.FenceBlock;
import net.minecraft.world.level.block.HalfTransparentBlock;
import net.minecraft.world.level.block.IronBarsBlock;
import net.minecraft.world.level.block.LadderBlock;
import net.minecraft.world.level.block.PipeBlock;
Expand Down Expand Up @@ -953,31 +951,32 @@ public InteractionResultHolder<ItemStack> use(Level leve, Player player, Interac
.build()
.register();

private static BlockEntry<LaunchpadBlock> LAUNCHPAD = REGISTRATE.block("launchpad", LaunchpadBlock::new)
private static BlockEntry<JumppadBlock> JUMPPAD = REGISTRATE.block("jumppad", JumppadBlock::new)
.lang("Jump Pad")
.initialProperties(() -> Blocks.GRASS_BLOCK)
.blockstate((ctx, prov) -> {
BlockModelBuilder model = prov.models().withExistingParent(ctx.getName(), prov.mcLoc("block/slab"))
.texture("bottom", prov.modLoc("block/launchpad_bottom"))
.texture("side", prov.modLoc("block/launchpad_side"))
.texture("top", prov.modLoc("block/launchpad_top"))
.texture("particle", prov.modLoc("block/launchpad_side"));
.texture("bottom", prov.modLoc("block/jumppad_bottom"))
.texture("side", prov.modLoc("block/jumppad_side"))
.texture("top", prov.modLoc("block/jumppad_top"))
.texture("particle", prov.modLoc("block/jumppad_side"));

BlockModelBuilder noHorizontalPowerModel = prov.models().withExistingParent(ctx.getName() + "_nohoriz", prov.mcLoc("block/slab"))
.texture("bottom", prov.modLoc("block/launchpad_bottom"))
.texture("side", prov.modLoc("block/launchpad_side"))
.texture("top", prov.modLoc("block/launchpad_top_nohoriz"))
.texture("particle", prov.modLoc("block/launchpad_side"));
.texture("bottom", prov.modLoc("block/jumppad_bottom"))
.texture("side", prov.modLoc("block/jumppad_side"))
.texture("top", prov.modLoc("block/jumppad_top_nohoriz"))
.texture("particle", prov.modLoc("block/jumppad_side"));

prov.getVariantBuilder(ctx.get()).forAllStatesExcept(state -> {
Direction direction = state.getValue(LaunchpadBlock.FACING);
boolean noHorizontalPower = state.getValue(LaunchpadBlock.HORIZONTAL_POWER) < 1;
Direction direction = state.getValue(JumppadBlock.FACING);
boolean noHorizontalPower = state.getValue(JumppadBlock.HORIZONTAL_POWER) < 1;
BlockModelBuilder selectedModel = noHorizontalPower ? noHorizontalPowerModel : model;
int rotationY = ((int) direction.toYRot() + 180) % 360;
return ConfiguredModel.builder()
.modelFile(selectedModel)
.rotationY(rotationY)
.build();
}, LaunchpadBlock.VERTICAL_POWER);
}, JumppadBlock.VERTICAL_POWER);

})
.addLayer(() -> RenderType::solid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.mojang.serialization.MapCodec;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
Expand All @@ -17,15 +16,15 @@
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

public class LaunchpadBlock extends HorizontalDirectionalBlock {
public class JumppadBlock extends HorizontalDirectionalBlock {

public static final MapCodec<LaunchpadBlock> CODEC = simpleCodec(LaunchpadBlock::new);
public static final MapCodec<JumppadBlock> CODEC = simpleCodec(JumppadBlock::new);
private static final VoxelShape AABB = Block.box(0.0, 0.0, 0.0, 16.0, 8.0, 16.0);
//Power is divided by 10 since there is no FloatProperty
public static final IntegerProperty VERTICAL_POWER = IntegerProperty.create("vertical_power", 0, 50);
public static final IntegerProperty HORIZONTAL_POWER = IntegerProperty.create("horizontal_power", 0, 50);

public LaunchpadBlock(final Properties properties) {
public JumppadBlock(final Properties properties) {
super(properties);
registerDefaultState(defaultBlockState().setValue(VERTICAL_POWER, 10).setValue(HORIZONTAL_POWER, 10));
}
Expand Down

0 comments on commit 44e34b2

Please sign in to comment.