mirror of
https://github.com/TeamMidnightDust/Decorative.git
synced 2025-12-13 03:45:08 +01:00
Decorative 420 - Update to 1.18.2, Fix Bugs
This commit is contained in:
@@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.18.1
|
||||
yarn_mappings=1.18.1+build.22
|
||||
loader_version=0.13.0
|
||||
minecraft_version=1.18.2
|
||||
yarn_mappings=1.18.2+build.2
|
||||
loader_version=0.13.3
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 4.2.0
|
||||
@@ -14,7 +14,7 @@ org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.46.4+1.18
|
||||
fabric_version=0.48.0+1.18.2
|
||||
mod_menu_version = 2.0.0-beta.7
|
||||
midnightlib_version=0.3.1
|
||||
patchouli_version=1.18.1-65-FABRIC
|
||||
midnightlib_version=0.4.0
|
||||
patchouli_version=1.18.2-67-FABRIC
|
||||
|
||||
@@ -13,17 +13,16 @@ import eu.midnightdust.motschen.decorative.init.Pool;
|
||||
import eu.midnightdust.motschen.decorative.init.Signs;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityModelLayerRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.color.block.BlockColorProvider;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.util.DyeColor;
|
||||
|
||||
@SuppressWarnings({"deprecation", "UnstableApiUsage"})
|
||||
public class DecorativeClient implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
@@ -35,26 +34,26 @@ public class DecorativeClient implements ClientModInitializer {
|
||||
EntityModelLayerRegistry.registerModelLayer(CeilingFanBladesModel.CEILING_FAN_MODEL_LAYER, CeilingFanBladesModel::getTexturedModelData);
|
||||
EntityModelLayerRegistry.registerModelLayer(WallClockHandsModel.CLOCK_HANDS_MODEL_LAYER, WallClockHandsModel::getTexturedModelData);
|
||||
|
||||
EntityRendererRegistry.INSTANCE.register(Pool.BEACH_BALL, BeachBallRenderer::new);
|
||||
EntityRendererRegistry.register(Pool.BEACH_BALL, BeachBallRenderer::new);
|
||||
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.WHITE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.WHITE));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.ORANGE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.ORANGE));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.MAGENTA_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.MAGENTA));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.LIGHT_BLUE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIGHT_BLUE));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.YELLOW_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.YELLOW));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.LIME_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIME));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.PINK_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.PINK));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.GRAY_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.GRAY));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.LIGHT_GRAY_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIGHT_GRAY));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.CYAN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.CYAN));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.PURPLE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.PURPLE));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.BLUE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BLUE));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.BROWN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BROWN));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.GREEN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.GREEN));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.RED_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.RED));
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.BLACK_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BLACK));
|
||||
EntityRendererRegistry.register(BathTires.WHITE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.WHITE));
|
||||
EntityRendererRegistry.register(BathTires.ORANGE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.ORANGE));
|
||||
EntityRendererRegistry.register(BathTires.MAGENTA_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.MAGENTA));
|
||||
EntityRendererRegistry.register(BathTires.LIGHT_BLUE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIGHT_BLUE));
|
||||
EntityRendererRegistry.register(BathTires.YELLOW_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.YELLOW));
|
||||
EntityRendererRegistry.register(BathTires.LIME_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIME));
|
||||
EntityRendererRegistry.register(BathTires.PINK_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.PINK));
|
||||
EntityRendererRegistry.register(BathTires.GRAY_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.GRAY));
|
||||
EntityRendererRegistry.register(BathTires.LIGHT_GRAY_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.LIGHT_GRAY));
|
||||
EntityRendererRegistry.register(BathTires.CYAN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.CYAN));
|
||||
EntityRendererRegistry.register(BathTires.PURPLE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.PURPLE));
|
||||
EntityRendererRegistry.register(BathTires.BLUE_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BLUE));
|
||||
EntityRendererRegistry.register(BathTires.BROWN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BROWN));
|
||||
EntityRendererRegistry.register(BathTires.GREEN_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.GREEN));
|
||||
EntityRendererRegistry.register(BathTires.RED_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.RED));
|
||||
EntityRendererRegistry.register(BathTires.BLACK_BATH_TIRE, (context) -> new BathTireRenderer(context, DyeColor.BLACK));
|
||||
|
||||
EntityRendererRegistry.INSTANCE.register(BathTires.DUCK_BATH_TIRE, DuckBathTireRenderer::new);
|
||||
EntityRendererRegistry.register(BathTires.DUCK_BATH_TIRE, DuckBathTireRenderer::new);
|
||||
|
||||
|
||||
registerBlockColor(DecorativeMain.BirdBath, Blocks.WATER);
|
||||
@@ -81,12 +80,12 @@ public class DecorativeClient implements ClientModInitializer {
|
||||
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.WallClock);
|
||||
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(),DecorativeMain.BirdBath);
|
||||
|
||||
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.CeilingFanBlockEntity, CeilingFanRenderer::new);
|
||||
BlockEntityRendererRegistry.register(BlockEntities.CeilingFanBlockEntity, CeilingFanRenderer::new);
|
||||
|
||||
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.ChoppingLogBlockEntity, ChoppingLogBlockEntityRenderer::new);
|
||||
BlockEntityRendererRegistry.register(BlockEntities.ChoppingLogBlockEntity, ChoppingLogBlockEntityRenderer::new);
|
||||
|
||||
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.WallClockBlockEntity, WallClockRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(BlockEntities.DigitalClockBlockEntity, DigitalClockRenderer::new);
|
||||
BlockEntityRendererRegistry.register(BlockEntities.WallClockBlockEntity, WallClockRenderer::new);
|
||||
BlockEntityRendererRegistry.register(BlockEntities.DigitalClockBlockEntity, DigitalClockRenderer::new);
|
||||
}
|
||||
public void registerBlockColor(Block block, Block templateBlock) {
|
||||
ColorProviderRegistry.BLOCK.register((type, pos, world, layer) -> {
|
||||
@@ -94,5 +93,4 @@ public class DecorativeClient implements ClientModInitializer {
|
||||
return provider == null ? -1 : provider.getColor(type, pos, world, layer);
|
||||
}, block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,20 @@ package eu.midnightdust.motschen.decorative.block;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.cauldron.CauldronBehavior;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.PotionUtil;
|
||||
import net.minecraft.potion.Potions;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
@@ -25,6 +33,35 @@ public class BirdBath extends AbstractCauldronBlock {
|
||||
super(FabricBlockSettings.copy(Blocks.WATER_CAULDRON).nonOpaque().sounds(BlockSoundGroup.STONE), CauldronBehavior.WATER_CAULDRON_BEHAVIOR);
|
||||
}
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
ItemStack itemStack = player.getStackInHand(hand);
|
||||
if (itemStack.getItem().equals(Items.WATER_BUCKET) || (itemStack.getItem().equals(Items.POTION) && PotionUtil.getPotion(itemStack).equals(Potions.WATER))) {
|
||||
if (itemStack.getItem().equals(Items.WATER_BUCKET)) {
|
||||
world.setBlockState(pos, state.with(LEVEL, 3));
|
||||
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.BUCKET));
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
else if (!state.get(LEVEL).equals(3)) {
|
||||
world.setBlockState(pos, state.with(LEVEL, state.get(LEVEL) + 1));
|
||||
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.GLASS_BOTTLE));
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (itemStack.getItem().equals(Items.BUCKET) || (itemStack.getItem().equals(Items.GLASS_BOTTLE))) {
|
||||
if (itemStack.getItem().equals(Items.BUCKET) && state.get(LEVEL).equals(3)) {
|
||||
world.setBlockState(pos, state.with(LEVEL, 0));
|
||||
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.WATER_BUCKET));
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
else if (!itemStack.getItem().equals(Items.BUCKET) && !state.get(LEVEL).equals(0)) {
|
||||
world.setBlockState(pos, state.with(LEVEL, state.get(LEVEL) - 1));
|
||||
if (!player.isCreative()) player.setStackInHand(hand, PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER));
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
@Override
|
||||
public boolean isFull(BlockState state) {
|
||||
return state.get(LEVEL) == 3;
|
||||
}
|
||||
|
||||
@@ -7,13 +7,16 @@ import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.passive.PigEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BathTireEntity extends PigEntity {
|
||||
@@ -45,7 +48,7 @@ public class BathTireEntity extends PigEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void swimUpward(Tag<Fluid> fluid) {
|
||||
protected void swimUpward(TagKey<Fluid> fluid) {
|
||||
if (this.getNavigation().canSwim()) {
|
||||
super.swimUpward(fluid);
|
||||
} else {
|
||||
@@ -60,7 +63,7 @@ public class BathTireEntity extends PigEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWalkOnFluid(Fluid fluid) {
|
||||
public boolean canWalkOnFluid(FluidState fluid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -104,7 +107,14 @@ public class BathTireEntity extends PigEntity {
|
||||
|
||||
@Override
|
||||
public ActionResult interactAt(PlayerEntity player, Vec3d hitPos, Hand hand) {
|
||||
if(!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND)
|
||||
if (!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && player.isSneaking())
|
||||
{
|
||||
this.remove(RemovalReason.DISCARDED);
|
||||
System.out.println(Identifier.tryParse(this.getType().getUntranslatedName()));
|
||||
player.setStackInHand(hand, new ItemStack(Registry.ITEM.get(Identifier.tryParse("decorative:"+this.getType().getUntranslatedName()))));
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
else if (!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && !player.isSneaking())
|
||||
{
|
||||
player.startRiding(this,true);
|
||||
return ActionResult.SUCCESS;
|
||||
@@ -120,5 +130,8 @@ public class BathTireEntity extends PigEntity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getXpToDrop(PlayerEntity player) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@ import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.passive.PigEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -46,7 +47,7 @@ public class BeachBallEntity extends PigEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void swimUpward(Tag<Fluid> fluid) {
|
||||
protected void swimUpward(TagKey<Fluid> fluid) {
|
||||
this.setVelocity(this.getVelocity().add(0.0D, 1.0D, 0.0D));
|
||||
}
|
||||
|
||||
@@ -56,7 +57,7 @@ public class BeachBallEntity extends PigEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWalkOnFluid(Fluid fluid) {
|
||||
public boolean canWalkOnFluid(FluidState fluid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,28 +2,35 @@ package eu.midnightdust.motschen.decorative.world;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.structure.rule.BlockMatchRuleTest;
|
||||
import net.minecraft.tag.BiomeTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.decorator.CountPlacementModifier;
|
||||
import net.minecraft.world.gen.decorator.SquarePlacementModifier;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.PlacedFeature;
|
||||
import net.minecraft.world.gen.YOffset;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.placementmodifier.CountPlacementModifier;
|
||||
import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier;
|
||||
import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OreFeatures {
|
||||
public static final ConfiguredFeature<?, ?> ROCKY_ASPHALT_FEATURE = Feature.ORE.configure(new OreFeatureConfig(new BlockMatchRuleTest(Blocks.STONE), DecorativeMain.RockyAsphalt.getDefaultState(), 7));
|
||||
public static final PlacedFeature ROCKY_ASPHALT_PLACED_FEATURE = ROCKY_ASPHALT_FEATURE.withPlacement(SquarePlacementModifier.of());
|
||||
private static final ConfiguredFeature<?, ?> ROCKY_ASPHALT_FEATURE = new ConfiguredFeature<>(Feature.ORE, new OreFeatureConfig(
|
||||
OreConfiguredFeatures.STONE_ORE_REPLACEABLES, DecorativeMain.RockyAsphalt.getDefaultState(),10));
|
||||
public static PlacedFeature ROCKY_ASPHALT_PLACED_FEATURE = new PlacedFeature(
|
||||
RegistryEntry.of(ROCKY_ASPHALT_FEATURE),
|
||||
List.of(
|
||||
CountPlacementModifier.of(40),
|
||||
SquarePlacementModifier.of(),
|
||||
HeightRangePlacementModifier.uniform(YOffset.BOTTOM, YOffset.TOP)
|
||||
));
|
||||
|
||||
public static void init() {
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "rocky_asphalt"), ROCKY_ASPHALT_FEATURE);
|
||||
Registry.register(BuiltinRegistries.PLACED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "placed_rocky_asphalt"), ROCKY_ASPHALT_PLACED_FEATURE);
|
||||
BiomeModifications.addFeature(biome -> (biome.getBiome().getCategory() != Biome.Category.NETHER && biome.getBiome().getCategory() != Biome.Category.THEEND),
|
||||
BiomeModifications.addFeature(biome -> (!biome.hasTag(BiomeTags.IS_NETHER) && !biome.hasTag(BiomeTags.END_CITY_HAS_STRUCTURE)),
|
||||
GenerationStep.Feature.UNDERGROUND_ORES, BuiltinRegistries.PLACED_FEATURE.getKey(OreFeatures.ROCKY_ASPHALT_PLACED_FEATURE).get());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user