ja:tutorial:fluids
Differences
This shows you the differences between two versions of the page.
| ja:tutorial:fluids [2022/08/14 06:21] – created skytomo | ja:tutorial:fluids [2022/08/14 06:23] (current) – インデントの修正 skytomo | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| < | < | ||
| public abstract class TutorialFluid extends class_3609 { | public abstract class TutorialFluid extends class_3609 { | ||
| - | /** | + | |
| - | * @return 指定された流体がこの流体のインスタンスかどうか | + | |
| - | */ | + | |
| - | @Override | + | @Override |
| - | public boolean method_15780(class_3611 fluid) { | + | public boolean method_15780(class_3611 fluid) { |
| - | return fluid == method_15751() || fluid == method_15750(); | + | return fluid == method_15751() || fluid == method_15750(); |
| - | } | + | } |
| - | /** | + | |
| - | * @return 流体が水のように無限かどうか | + | |
| - | */ | + | |
| - | @Override | + | @Override |
| - | protected boolean method_15737() { | + | protected boolean method_15737() { |
| - | return false; | + | return false; |
| - | } | + | } |
| - | /** | + | |
| - | * 液体が交換可能なブロックに流れ込んだときにアクションを実行します。 | + | |
| - | * 水はブロックのルートテーブルを落とします。 | + | |
| * 溶岩は " | * 溶岩は " | ||
| - | */ | + | */ |
| - | @Override | + | @Override |
| - | protected void method_15730(class_1936 world, class_2338 pos, class_2680 state) { | + | protected void method_15730(class_1936 world, class_2338 pos, class_2680 state) { |
| - | final class_2586 blockEntity = state.method_31709() ? world.method_8321(pos) : null; | + | final class_2586 blockEntity = state.method_31709() ? world.method_8321(pos) : null; |
| - | class_2248.method_9610(state, | + | class_2248.method_9610(state, |
| - | } | + | } |
| - | /** | + | |
| * FluidState が特定の高さより高く、Fluid が Water の場合、Lava は true を返します。 | * FluidState が特定の高さより高く、Fluid が Water の場合、Lava は true を返します。 | ||
| - | * | + | * |
| - | * @return 指定された Fluid がこの FluidState に流れ込むことができるかどうか | + | |
| - | */ | + | |
| - | @Override | + | @Override |
| - | protected boolean method_15777(class_3610 fluidState, class_1922 blockView, class_2338 blockPos, class_3611 fluid, class_2350 direction) { | + | protected boolean method_15777(class_3610 fluidState, class_1922 blockView, class_2338 blockPos, class_3611 fluid, class_2350 direction) { |
| - | return false; | + | return false; |
| - | } | + | } |
| - | /** | + | |
| - | * おそらく、近くの穴に流れ込むための距離チェックに関連しています。 | + | |
| - | * 水は 4 を返します。溶岩はオーバーワールドで 2、ネザーで 4 を返します。 | + | |
| - | */ | + | |
| - | @Override | + | @Override |
| - | protected int method_15733(class_4538 worldView) { | + | protected int method_15733(class_4538 worldView) { |
| - | return 4; | + | return 4; |
| - | } | + | } |
| - | /** | + | |
| - | * 水は 1 を返します。溶岩はオーバーワールドで 2、ネザーで 1 を返します。 | + | |
| - | */ | + | |
| - | @Override | + | @Override |
| - | protected int method_15739(class_4538 worldView) { | + | protected int method_15739(class_4538 worldView) { |
| - | return 1; | + | return 1; |
| - | } | + | } |
| - | /** | + | |
| - | * 水は 5 を返します。溶岩はオーバーワールドで 30、ネザーで 10 を返します。 | + | |
| - | */ | + | |
| - | @Override | + | @Override |
| - | public int method_15789(class_4538 worldView) { | + | public int method_15789(class_4538 worldView) { |
| - | return 5; | + | return 5; |
| - | } | + | } |
| - | /** | + | |
| - | * 水と溶岩はどちらも 100.0F を返します。 | + | |
| - | */ | + | |
| - | @Override | + | @Override |
| - | protected float method_15784() { | + | protected float method_15784() { |
| - | return 100.0F; | + | return 100.0F; |
| - | } | + | } |
| } | } | ||
| </ | </ | ||
| Line 85: | Line 85: | ||
| < | < | ||
| public abstract class AcidFluid extends TutorialFluid { | public abstract class AcidFluid extends TutorialFluid { | ||
| - | @Override | + | |
| - | public class_3611 method_15751() { | + | public class_3611 method_15751() { |
| - | return YOUR_STILL_FLUID_HERE; | + | return YOUR_STILL_FLUID_HERE; |
| - | } | + | } |
| - | @Override | + | |
| - | public class_3611 method_15750() { | + | public class_3611 method_15750() { |
| - | return YOUR_FLOWING_FLUID_HERE; | + | return YOUR_FLOWING_FLUID_HERE; |
| - | } | + | } |
| - | @Override | + | |
| - | public class_1792 method_15774() { | + | public class_1792 method_15774() { |
| - | return YOUR_BUCKET_ITEM_HERE; | + | return YOUR_BUCKET_ITEM_HERE; |
| - | } | + | } |
| - | @Override | + | |
| - | protected class_2680 method_15790(class_3610 fluidState) { | + | protected class_2680 method_15790(class_3610 fluidState) { |
| - | return YOUR_FLUID_BLOCK_HERE.method_9564().method_11657(class_2741.field_12538, | + | return YOUR_FLUID_BLOCK_HERE.method_9564().method_11657(class_2741.field_12538, |
| - | } | + | } |
| - | public static class Flowing extends AcidFluid { | + | |
| - | @Override | + | @Override |
| - | protected void method_15775(class_2689.class_2690< | + | protected void method_15775(class_2689.class_2690< |
| - | super.method_15775(builder); | + | super.method_15775(builder); |
| - | builder.method_11667(field_15900); | + | builder.method_11667(field_15900); |
| - | } | + | } |
| - | @Override | + | |
| - | public int method_15779(class_3610 fluidState) { | + | public int method_15779(class_3610 fluidState) { |
| - | return fluidState.method_11654(field_15900); | + | return fluidState.method_11654(field_15900); |
| - | } | + | } |
| - | @Override | + | |
| - | public boolean method_15793(class_3610 fluidState) { | + | public boolean method_15793(class_3610 fluidState) { |
| - | return false; | + | return false; |
| - | } | + | } |
| - | } | + | } |
| - | public static class Still extends AcidFluid { | + | |
| - | @Override | + | @Override |
| - | public int method_15779(class_3610 fluidState) { | + | public int method_15779(class_3610 fluidState) { |
| - | return 8; | + | return 8; |
| - | } | + | } |
| - | @Override | + | |
| - | public boolean method_15793(class_3610 fluidState) { | + | public boolean method_15793(class_3610 fluidState) { |
| - | return true; | + | return true; |
| - | } | + | } |
| - | } | + | } |
| } | } | ||
| </ | </ | ||
| Line 146: | Line 146: | ||
| @Override | @Override | ||
| public void onInitialize() { | public void onInitialize() { | ||
| - | STILL_ACID = class_2378.method_10230(class_2378.field_11154, | + | |
| - | FLOWING_ACID = class_2378.method_10230(class_2378.field_11154, | + | FLOWING_ACID = class_2378.method_10230(class_2378.field_11154, |
| - | ACID_BUCKET = class_2378.method_10230(class_2378.field_11142, | + | ACID_BUCKET = class_2378.method_10230(class_2378.field_11142, |
| new class_1755(STILL_ACID, | new class_1755(STILL_ACID, | ||
| - | // ... | + | |
| } | } | ||
| Line 160: | Line 160: | ||
| <code json [enable_line_numbers=" | <code json [enable_line_numbers=" | ||
| { | { | ||
| - | " | + | |
| - | " | + | " |
| - | [ | + | [ |
| - | " | + | " |
| - | " | + | " |
| - | ] | + | ] |
| } | } | ||
| </ | </ | ||
| Line 177: | Line 177: | ||
| @Override | @Override | ||
| public void onInitialize() { | public void onInitialize() { | ||
| - | ACID = class_2378.method_10230(class_2378.field_11146, | + | |
| - | + | ||
| - | // ... | + | // ... |
| } | } | ||
| </ | </ | ||
| Line 187: | Line 187: | ||
| < | < | ||
| public abstract class AcidFluid extends TutorialFluid { | public abstract class AcidFluid extends TutorialFluid { | ||
| - | @Override | + | |
| - | public class_3611 method_15751() { | + | public class_3611 method_15751() { |
| - | return TutorialMod.STILL_ACID; | + | return TutorialMod.STILL_ACID; |
| - | } | + | } |
| - | @Override | + | |
| - | public class_3611 method_15750() { | + | public class_3611 method_15750() { |
| - | return TutorialMod.FLOWING_ACID; | + | return TutorialMod.FLOWING_ACID; |
| - | } | + | } |
| - | @Override | + | |
| - | public class_1792 method_15774() { | + | public class_1792 method_15774() { |
| - | return TutorialMod.ACID_BUCKET; | + | return TutorialMod.ACID_BUCKET; |
| - | } | + | } |
| - | @Override | + | |
| - | protected class_2680 method_15790(class_3610 fluidState) { | + | protected class_2680 method_15790(class_3610 fluidState) { |
| - | // method_15741 converts the LEVEL_1_8 of the fluid state to the LEVEL_15 the fluid block uses | + | // method_15741 converts the LEVEL_1_8 of the fluid state to the LEVEL_15 the fluid block uses |
| - | return TutorialMod.ACID.method_9564().method_11657(class_2741.field_12538, | + | return TutorialMod.ACID.method_9564().method_11657(class_2741.field_12538, |
| - | } | + | } |
| - | public static class Flowing extends AcidFluid { | + | |
| - | @Override | + | @Override |
| - | protected void method_15775(class_2689.class_2690< | + | protected void method_15775(class_2689.class_2690< |
| - | super.method_15775(builder); | + | super.method_15775(builder); |
| - | builder.method_11667(field_15900); | + | builder.method_11667(field_15900); |
| - | } | + | } |
| - | @Override | + | |
| - | public int method_15779(class_3610 fluidState) { | + | public int method_15779(class_3610 fluidState) { |
| - | return fluidState.method_11654(field_15900); | + | return fluidState.method_11654(field_15900); |
| - | } | + | } |
| - | @Override | + | |
| - | public boolean method_15793(class_3610 fluidState) { | + | public boolean method_15793(class_3610 fluidState) { |
| - | return false; | + | return false; |
| - | } | + | } |
| - | } | + | } |
| - | public static class Still extends AcidFluid { | + | |
| - | @Override | + | @Override |
| - | public int method_15779(class_3610 fluidState) { | + | public int method_15779(class_3610 fluidState) { |
| - | return 8; | + | return 8; |
| - | } | + | } |
| - | @Override | + | |
| - | public boolean method_15793(class_3610 fluidState) { | + | public boolean method_15793(class_3610 fluidState) { |
| - | return true; | + | return true; |
| - | } | + | } |
| - | } | + | } |
| } | } | ||
| </ | </ | ||
| Line 246: | Line 246: | ||
| public class TutorialModClient implements ClientModInitializer { | public class TutorialModClient implements ClientModInitializer { | ||
| - | @Override | + | |
| - | public void onInitializeClient() { | + | public void onInitializeClient() { |
| - | FluidRenderHandlerRegistry.INSTANCE.register(TutorialMod.STILL_ACID, | + | FluidRenderHandlerRegistry.INSTANCE.register(TutorialMod.STILL_ACID, |
| - | new class_2960(" | + | new class_2960(" |
| - | new class_2960(" | + | new class_2960(" |
| - | 0x4CC248 | + | 0x4CC248 |
| - | )); | + | )); |
| - | BlockRenderLayerMap.INSTANCE.putFluids(class_1921.method_23583(), | + | |
| - | //if you want to use custom textures they needs to be registered. | + | |
| - | //In this example this is unnecessary because the vanilla water textures are already registered. | + | //In this example this is unnecessary because the vanilla water textures are already registered. |
| - | //To register your custom textures use this method. | + | //To register your custom textures use this method. |
| - | // | + | // |
| - | // registry.register(new Identifier(" | + | // registry.register(new Identifier(" |
| - | // registry.register(new Identifier(" | + | // registry.register(new Identifier(" |
| - | //}); | + | //}); |
| - | // ... | + | |
| - | } | + | } |
| } | } | ||
| </ | </ | ||
| Line 279: | Line 279: | ||
| @Override | @Override | ||
| public void onInitialize() { | public void onInitialize() { | ||
| - | ACID_LAKE = Registry.register(Registry.FEATURE, | + | |
| - | + | ||
| - | // generate in swamps, similar to water lakes, but with a chance of 40 (the higher the number, the lower the generation chance) | + | // generate in swamps, similar to water lakes, but with a chance of 40 (the higher the number, the lower the generation chance) |
| - | Biomes.SWAMP.addFeature( | + | Biomes.SWAMP.addFeature( |
| - | GenerationStep.Feature.LOCAL_MODIFICATIONS, | + | GenerationStep.Feature.LOCAL_MODIFICATIONS, |
| - | ACID_LAKE.configure(new SingleStateFeatureConfig(ACID.getDefaultState())) | + | ACID_LAKE.configure(new SingleStateFeatureConfig(ACID.getDefaultState())) |
| - | .createDecoratedFeature(Decorator.WATER_LAKE.configure(new ChanceDecoratorConfig(40))) | + | .createDecoratedFeature(Decorator.WATER_LAKE.configure(new ChanceDecoratorConfig(40))) |
| - | ); | + | ); |
| } | } | ||
| </ | </ | ||
ja/tutorial/fluids.1660458110.txt.gz · Last modified: 2022/08/14 06:21 by skytomo