Jump to content

Recommended Posts

Posted

Good days 

im testing things to fix the problem whit the detonator for mi mod 

in this case i decide to make a custome redstone wire that dont update by itself soo it can keep the redstone power farter 
i just extend the RedStoneWireBlock an copy the json's manually fixing the routes to the assets 

public class merc_rs_wireblock extends RedStoneWireBlock {}

the plan is when the detonators turn on it ramdomly replace vainilla RedStoneWireBlock for the merc_rs_wireblock 

and when the detonators turn off it search for the merc_rs_wireblock and turn them back to RedStoneWireBlock

 

 

mi merc_rs_wireblock works  it conect  whit blocks and vainilla redstone normally and ignore neighborChanged() and just turn on/off externally

-> but it is white 

-> it has the particules but dont shine when on as the vainilla redstone wire 

i been looking the jsons and notice the variable "tintindex" but dont find whats providing this value  coze is not a block property

Spoiler

				
			{
		    "ambientocclusion": false,
		    "ambientocclusion": "true",
		    "render_type": "cutout",   
		    "textures": {
		        "particle": "minecraft:block/redstone_dust_dot",
		        "line": "minecraft:block/redstone_dust_line0",
		        "overlay": "minecraft:block/redstone_dust_overlay"
		    },
		    "elements": [
		        {   "from": [ 0, 0, 0.25 ],
		            "to": [ 16, 16, 0.25 ],
		            "shade": false,
		            "faces": {
		                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#line", "tintindex": 0 },
		                "north": { "uv": [ 16, 0, 0, 16 ], "texture": "#line", "tintindex": 0 }
		            }
		        },
		        {   "from": [ 0, 0, 0.25 ],
		            "to": [ 16, 16, 0.25 ],
		            "shade": false,
		            "faces": {
		                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay" },
		                "north": { "uv": [ 16, 0, 0, 16 ], "texture": "#overlay" }
		            }
		        }
		    ]
		}
		 				
			

 

i Have the theory than somewhere is a "ModItemModelProperties" class but for blocks an thats whats providing the tintindex value 
but dont  find it 

####################3

do you know what it is ?? 

 


 

Posted

	package merctool.item.tool;
	import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;
	import javax.annotation.Nullable;
	import com.google.common.collect.Sets;
	import merctool.util.Postate;
import merctool.util.Target;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
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.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.RedStoneWireBlock;
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.DirectionProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
	//import net.minecraft.item.Item;
	//########## ########## ########## ##########
public class merc_rs_wireblock extends RedStoneWireBlock {
	    private static final float PARTICLE_DENSITY = 0.2F;
    // private final BlockState crossState;
    private boolean shouldSignal = true;
	    public merc_rs_wireblock(Properties propiedades) {
        super(propiedades);
	    }
	    // ########## ########## ########## ########## ########## ########## ##########
    @Override
    public void neighborChanged(BlockState blkstate, Level warudo, BlockPos pos, Block blk, BlockPos pos2,
            boolean cosa) {
        if (!warudo.isClientSide) {
            if (blkstate.canSurvive(warudo, pos)) {
	                //this.updatePowerStrength(warudo, pos, blkstate);
            } else {
                dropResources(blkstate, warudo, pos);
                warudo.removeBlock(pos, false);
            }
	        }
    }
	    // ########## ########## ########## ########## ########## ########## ##########
    // @Override
    public void updatePowerStrength(Level warudo, BlockPos pos, BlockState blkstate) {
        int i = this.calculateTargetStrength(warudo, pos);
        if (blkstate.getValue(POWER) != i) {
            if (warudo.getBlockState(pos) == blkstate) {
                warudo.setBlock(pos, blkstate.setValue(POWER, Integer.valueOf(i)), 2);
            }
	            Set<BlockPos> set = Sets.newHashSet();
            set.add(pos);
	            for (Direction direction : Direction.values()) {
                set.add(pos.relative(direction));
            }
	            for (BlockPos blockpos : set) {
                warudo.updateNeighborsAt(blockpos, this);
            }
        }
	    }
	    // ########## ########## ########## ########## ########## ########## ##########
    // @Override
	    public int calculateTargetStrength(Level warudo, BlockPos pos) {
        this.shouldSignal = false;
        int i = warudo.getBestNeighborSignal(pos);
        this.shouldSignal = true;
        int j = 0;
        if (i < 15) {
            for (Direction direction : Direction.Plane.HORIZONTAL) {
                BlockPos blockpos = pos.relative(direction);
                BlockState blockstate = warudo.getBlockState(blockpos);
                j = Math.max(j, this.getWireSignal(blockstate));
                BlockPos blockpos1 = pos.above();
                if (blockstate.isRedstoneConductor(warudo, blockpos)
                        && !warudo.getBlockState(blockpos1).isRedstoneConductor(warudo, blockpos1)) {
                    j = Math.max(j, this.getWireSignal(warudo.getBlockState(blockpos.above())));
                } else if (!blockstate.isRedstoneConductor(warudo, blockpos)) {
                    j = Math.max(j, this.getWireSignal(warudo.getBlockState(blockpos.below())));
                }
            }
        }
	        j = ( j > 0 )? 15 : 0;
        
        return Math.max(i, j);//j - 1
    }
	    // ########## ########## ########## ########## ########## ########## ##########
    // @Override
    private int getWireSignal(BlockState p_55649_) {
        return p_55649_.is(this) ? p_55649_.getValue(POWER) : 0;
    }
	    // ########## ########## ########## ########## ########## ########## ##########
    // ##########
    // ########## ########## ########## ########## ########## ########## ##########
    // ##########
    // ########## ########## ########## ########## ########## ########## ##########
    // ##########
    // ########## ########## ########## ########## ########## ########## ##########
    // ##########
}
 
	

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.