Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Majd123mc

Members
  • Posts

    30
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Majd123mc's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Oh, then it's probably the reobfuscation process. Because minecraft is obfuscated, the deobfuscated function calls lead to nowhere, so they are converted. Anyways, to find what they truly mean, look inside any of your mod projects (IntelliJ) > build > createMcpToSrg > output.tsrg. Then Ctrl + F to get the function's deobfuscated name
  2. Hold on, there might be a chance that the mod files aren't being the ones obfuscated, but simply the vanilla function calls are. @ElTotisPro50 Are all the functions and methods like this? Or are only some of them
  3. NOTE THAT: If you now send over your mod to someone else, they will have to install fastutil manually. If you want it to be included automatically, please check out this post: https://forums.minecraftforge.net/topic/104978-problems-with-shadowing-javafxopenjfx-into-my-mod-jar/?do=findComment&comment=479029
  4. I am assuming you want the 5.0.9 version, no? First, you must find the artifact string from mavencentral, I already found it for you: 'fastutil:fastutil:5.0.9' Then, you must add "implementation 'fastutil:fastutil:5.0.9'" in the "dependencies" block in build.gradle (Make sure your repositories block has "mavenCentral()" in it) So the final code should be: repositories { mavenCentral() // NOTE: Only include this if it isn't already there. // Other repositories } dependencies { implementation 'fastutil:fastutil:5.0.9' // Other dependencies such as forge, minecraft, etc. }
  5. I was facing the same issues trying to make a fat jar (that is what it is called). So instead I used the META-INF/libraries method. Forge automatically loads libraries from META-INF/libraries. Put the following code above your dependencies block in build.gradle: configurations { include } dependencies { implementation '<javafx maven string goes here, I never used it before>' include '<javafx maven string>' } jar { // Include libraries into jar from(configurations.include) { into 'META-INF/libraries' } def deps = configurations.include.collect { it.name } println deps.join(' ') manifest { attributes([ 'ContainedDeps': deps.join(' ') ]) } } NOTE: Make sure to actually change <javafx maven string...> with the maven url string thing for it.
  6. To get working with mods, you just need to download an MDK from here: https://files.minecraftforge.net/net/minecraftforge/forge/ Then, extract the zip, rename the folder to whatever you like, and open with your favorite Java IDE.
  7. I might be dumb (because of my poor understanding of maven). But isn't it trying to download 1.16.5-36.2.0 which doesn't exist? The latest version of forge is 1.16.5-36.2.20
  8. Your constructor accepts EntityType<? extends TNTEntity>, when it should be EntityType<? extends grenadeEntity> Also I would recommend capitalizing the first letter of your class names. Rename grenadeEntity (Shift+F6 in IntelliJ) to GrenadeEntity.
  9. For anyone else experiencing the same issues, the github link will no longer work. Please make sure that you have a constructor that accepts a String and passes it to super like so: @SuppressWarnings("unused") public YourSavedData(String s) { super(s); } The code for MapStorage tries to instantiate it, and if it doesn't have that constructor, it will silently throw an exception without crashing.
  10. Sure. In my ModBlocks class. public static final RegistryObject<LiquidBlock> OIL = BLOCKS.register("oil", () -> new ForgeLiquidBlock(ModFluids.OIL, BlockBehaviour.Properties.of(Material.WATER).noCollission().strength(100.0F).noDrops())); ForgeLiquidBlock package com.hotmail.majdroaydi.minitech.blocks; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.FluidTags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import java.util.Optional; import java.util.function.Supplier; public class ForgeLiquidBlock extends LiquidBlock { public ForgeLiquidBlock(Supplier<? extends FlowingFluid> supplier, Properties properties) { super(supplier, properties); } @Override public VoxelShape getCollisionShape(BlockState p_54760_, BlockGetter p_54761_, BlockPos p_54762_, CollisionContext p_54763_) { return p_54763_.isAbove(STABLE_SHAPE, p_54762_, true) && p_54760_.getValue(LEVEL) == 0 && p_54763_.canStandOnFluid(p_54761_.getFluidState(p_54762_.above()), getFluid()) ? STABLE_SHAPE : Shapes.empty(); } @Override public boolean isPathfindable(BlockState p_54704_, BlockGetter p_54705_, BlockPos p_54706_, PathComputationType p_54707_) { return !getFluid().is(FluidTags.LAVA); } @Override public boolean skipRendering(BlockState p_54716_, BlockState p_54717_, Direction p_54718_) { return p_54717_.getFluidState().getType().isSame(getFluid()); } @Override public void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) { if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) { p_54755_.getLiquidTicks().scheduleTick(p_54756_, p_54754_.getFluidState().getType(), getFluid().getTickDelay(p_54755_)); } } @Override public BlockState updateShape(BlockState p_54723_, Direction p_54724_, BlockState p_54725_, LevelAccessor p_54726_, BlockPos p_54727_, BlockPos p_54728_) { if (p_54723_.getFluidState().isSource() || p_54725_.getFluidState().isSource()) { p_54726_.getLiquidTicks().scheduleTick(p_54727_, p_54723_.getFluidState().getType(), getFluid().getTickDelay(p_54726_)); } //return super.updateShape(p_54723_, p_54724_, p_54725_, p_54726_, p_54727_, p_54728_); return p_54723_; // Calling super.updateShape will just call LiquidBlock's updateShape, not what we are looking for! Thankfully, Block.updateShape, simply enough, just returns the first parameter. } @Override public void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) { if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) { p_54710_.getLiquidTicks().scheduleTick(p_54711_, p_54709_.getFluidState().getType(), getFluid().getTickDelay(p_54710_)); } } private boolean shouldSpreadLiquid(Level p_54697_, BlockPos p_54698_, BlockState p_54699_) { if (getFluid().is(FluidTags.LAVA)) { boolean flag = p_54697_.getBlockState(p_54698_.below()).is(Blocks.SOUL_SOIL); for(Direction direction : POSSIBLE_FLOW_DIRECTIONS) { BlockPos blockpos = p_54698_.relative(direction.getOpposite()); if (p_54697_.getFluidState(blockpos).is(FluidTags.WATER)) { Block block = p_54697_.getFluidState(p_54698_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, block.defaultBlockState())); this.fizz(p_54697_, p_54698_); return false; } if (flag && p_54697_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) { p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, Blocks.BASALT.defaultBlockState())); this.fizz(p_54697_, p_54698_); return false; } } } return true; } private void fizz(LevelAccessor p_54701_, BlockPos p_54702_) { p_54701_.levelEvent(1501, p_54702_, 0); } @Override public ItemStack pickupBlock(LevelAccessor p_153772_, BlockPos p_153773_, BlockState p_153774_) { if (p_153774_.getValue(LEVEL) == 0) { p_153772_.setBlock(p_153773_, Blocks.AIR.defaultBlockState(), 11); return new ItemStack(getFluid().getBucket()); } else { return ItemStack.EMPTY; } } @Override public Optional<SoundEvent> getPickupSound() { return getFluid().getPickupSound(); } } In my ModFluids class public static RegistryObject<OilFluid.Flowing> FLOWING_OIL = FLUIDS.register("flowing_oil", OilFluid.Flowing::new); public static RegistryObject<OilFluid.Source> OIL = FLUIDS.register("oil", OilFluid.Source::new); OilFluid package com.hotmail.majdroaydi.minitech.fluids; import com.hotmail.majdroaydi.minitech.MiniTech; import com.hotmail.majdroaydi.minitech.blocks.ModBlocks; import com.hotmail.majdroaydi.minitech.items.ModItems; import com.hotmail.majdroaydi.minitech.tags.ModTags; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraftforge.client.event.RenderBlockOverlayEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fml.common.Mod; import java.util.Optional; public abstract class OilFluid extends ForgeFlowingFluid implements CustomFluidEffects { protected OilFluid() { super(new ForgeFlowingFluid.Properties( ModFluids.OIL, ModFluids.FLOWING_OIL, FluidAttributes.builder( new ResourceLocation(MiniTech.MODID, "block/oil_still"), new ResourceLocation(MiniTech.MODID, "block/oil_flow") ).overlay(new ResourceLocation(MiniTech.MODID, "block/oil_overlay")) .translationKey("block." + MiniTech.MODID + ".oil") .color(0xffffff) .viscosity(3000)) .block(ModBlocks.OIL) .bucket(ModItems.OIL_BUCKET)); } @Override public ResourceLocation getCustomOverlayTexture() { return new ResourceLocation(MiniTech.MODID, "textures/misc/oil.png"); } public Optional<SoundEvent> getPickupSound() { return Optional.of(SoundEvents.BUCKET_FILL); } public static class Flowing extends OilFluid { public Flowing() { registerDefaultState(getStateDefinition().any().setValue(LEVEL, 7)); } @Override protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> p_76476_) { super.createFluidStateDefinition(p_76476_); p_76476_.add(LEVEL); } @Override public int getAmount(FluidState p_76480_) { return p_76480_.getValue(LEVEL); } @Override public boolean isSource(FluidState p_76478_) { return false; } } public static class Source extends OilFluid { @Override public int getAmount(FluidState p_76485_) { return 8; } @Override public boolean isSource(FluidState p_76483_) { return true; } } }
  11. Thanks everybody! I managed to fix it. I just had some missing attributes in my OilFluid class
  12. Thank you everybody, I have figured out the cause. I was accidentally passing in the constructor for the Fluids instead of the RegistryObject. I changed: super(new ForgeFlowingFluid.Properties( OilFluid.Source::new, OilFluid.Flowing::new, to: super(new ForgeFlowingFluid.Properties( ModFluids.OIL, ModFluids.FLOWING_OIL, And now the fluid actually works! But it doesn't spread though, I think I'd be able to figured it out from now. Thanks a lot Luis_ST and Cratthorax!
  13. Thanks for the help everybody! I tried this and although the block did register, the fluid just appears as a flat plane you can only see if you break the block under it. I tried debugging it as much as I could but alas I couldn't solve it Here is the code for my "fixed" liquidblock as suggested by Luis_ST: package com.hotmail.majdroaydi.minitech.blocks; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.FluidTags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import java.util.Optional; import java.util.function.Supplier; public class ForgeLiquidBlock extends LiquidBlock { public ForgeLiquidBlock(Supplier<? extends FlowingFluid> supplier, Properties properties) { super(supplier, properties); } @Override public VoxelShape getCollisionShape(BlockState p_54760_, BlockGetter p_54761_, BlockPos p_54762_, CollisionContext p_54763_) { return p_54763_.isAbove(STABLE_SHAPE, p_54762_, true) && p_54760_.getValue(LEVEL) == 0 && p_54763_.canStandOnFluid(p_54761_.getFluidState(p_54762_.above()), getFluid()) ? STABLE_SHAPE : Shapes.empty(); } @Override public boolean isPathfindable(BlockState p_54704_, BlockGetter p_54705_, BlockPos p_54706_, PathComputationType p_54707_) { return !getFluid().is(FluidTags.LAVA); } @Override public boolean skipRendering(BlockState p_54716_, BlockState p_54717_, Direction p_54718_) { return p_54717_.getFluidState().getType().isSame(getFluid()); } @Override public void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) { if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) { p_54755_.getLiquidTicks().scheduleTick(p_54756_, p_54754_.getFluidState().getType(), getFluid().getTickDelay(p_54755_)); } } @Override public BlockState updateShape(BlockState p_54723_, Direction p_54724_, BlockState p_54725_, LevelAccessor p_54726_, BlockPos p_54727_, BlockPos p_54728_) { if (p_54723_.getFluidState().isSource() || p_54725_.getFluidState().isSource()) { p_54726_.getLiquidTicks().scheduleTick(p_54727_, p_54723_.getFluidState().getType(), getFluid().getTickDelay(p_54726_)); } //return super.updateShape(p_54723_, p_54724_, p_54725_, p_54726_, p_54727_, p_54728_); return p_54723_; // Calling super.updateShape will just call LiquidBlock's updateShape, not what we are looking for! Thankfully, Block.updateShape, simply enough, just returns the first parameter. } @Override public void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) { if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) { p_54710_.getLiquidTicks().scheduleTick(p_54711_, p_54709_.getFluidState().getType(), getFluid().getTickDelay(p_54710_)); } } private boolean shouldSpreadLiquid(Level p_54697_, BlockPos p_54698_, BlockState p_54699_) { if (getFluid().is(FluidTags.LAVA)) { boolean flag = p_54697_.getBlockState(p_54698_.below()).is(Blocks.SOUL_SOIL); for(Direction direction : POSSIBLE_FLOW_DIRECTIONS) { BlockPos blockpos = p_54698_.relative(direction.getOpposite()); if (p_54697_.getFluidState(blockpos).is(FluidTags.WATER)) { Block block = p_54697_.getFluidState(p_54698_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, block.defaultBlockState())); this.fizz(p_54697_, p_54698_); return false; } if (flag && p_54697_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) { p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, Blocks.BASALT.defaultBlockState())); this.fizz(p_54697_, p_54698_); return false; } } } return true; } private void fizz(LevelAccessor p_54701_, BlockPos p_54702_) { p_54701_.levelEvent(1501, p_54702_, 0); } @Override public ItemStack pickupBlock(LevelAccessor p_153772_, BlockPos p_153773_, BlockState p_153774_) { if (p_153774_.getValue(LEVEL) == 0) { p_153772_.setBlock(p_153773_, Blocks.AIR.defaultBlockState(), 11); return new ItemStack(getFluid().getBucket()); } else { return ItemStack.EMPTY; } } @Override public Optional<SoundEvent> getPickupSound() { return getFluid().getPickupSound(); } } The code for my OilFluid can be found above.
  14. Whoops! Sorry, my fault. But yes, a block entity (tile entity in 1.16-) *is* needed for storing data (i.e. furnace). But I think what OP is doing is making an item combiner, which doesn't need one
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.