your current location:首页 > news>[1.12.2] Use CRT to enhance the fun of the liquid, fishing for all things [CF] Customfishing with liquid

[1.12.2] Use CRT to enhance the fun of the liquid, fishing for all things [CF] Customfishing with liquid

2024-12-10 17:54:25|Myriagame |source:minecraft skins

This tutorial is set by the author to use the CC by-NC protocol.

When I touched the fish, I saw the MOD with the liquid. I was happy in my heart.

However, after the actual magic was changed, it was found that it was too conservative to catch the interest with liquid. Many functions had to be implemented with CRT assistance, so I rubbed a magic reform file for everyone to use.

The magic reform file can directly copy the following code or download the Baidu network disk. You can also add the CRT Magic Reform Group: 624487948 and find Xianbei.

Just need MOD: Crafttweaker, Zen Utils, CustomFishing.You can try to use the latest version of CustomFishing first, if you don't, change to 0.1.0.

Non -rigid MOD: Randomtweaker.Used to add jei.The output of items needs to be less than 64.

 // created by xian_bei010, QQ: 2234690032, mcmod: https: //center.mcmod.cn/680553/

// Made by Xianbei 010, QQ: 2234690032, mcmod: https://center.mcmod.cn/680553/, QQ communication group: 624487948

Import Mods.customfishing.fishingincoStomLiquid;

Import crafttweaker.event.itemfishedevent;

Import Crafttweaker.event.entityjoinWorldEvent;

Import crafttweaker.entity.ientityItem;

import crafttweaker.util.iaxisalignedbb;

Import crafttweaker.World.ibiome;

Import crafttweaker.World.iworld;

Import Crafttweaker.WORLD.IBLOCKPOS;

Import Crafttweaker.Item.INGREDIENT;

import crafttweaker.item.weightedItemstack;

import crafttweaker.item.iitemstack;

Import Crafttweaker.liquid.iliquidstack;

// Just need mod: crafttweaker, Zen Utils, CUSTOMFISHING.

// Non -rigid MOD: Randomtweaker.Used to add jei.The output of items needs to be less than 64.

// ---------- You need to install Randomtweaker!Otherwise, you need to delete this part of the magic reform -----------

value xbfj = mods.jei.jei.createjei ("xian_bei010_fish", "fishing");

xbfj.setmodid ("CustomFishing");

xbfj.seticon ();

xbfj.setbackGround (mods.randomtweaker.jei.jeiutils.createBackground (235, 235))););););

xbfj.addslot (mods.randomtweaker.jei.ijeiutils.createitemslot (0,0, true));

xbfj.addslot (mods.randomtweaker.jei.ijeiutils.createitemslot (18,0, true, false));

XBFJ.Addslot (mods.randomtweaker.jei.ijeiutils.createitemslot (36,0, true, false)); xbfj.addslot Itemslot (54,0, true, false);

xbfj.addslot (mods.randomtweaker.jei.jeiutils.createitemslot (72,0, true, false));

xbfj.addslot (mods.randomtweaker.jei.ijeiutils.createitemslot (0,18, true));

xbfj.addslot (mods.randomtweaker.jei.ijiutils.createitemslot (0,36, true));

for y in 1 to 9 {

For x in 1 to 9 {

Xbfj.addslot (mods.randomtweaker.jei.ijiutils.createitemslot (1+(25*x), 1+(25*y), false))

}

}

xbfj.register ();

// ---------- You need to install Randomtweaker!Otherwise, you need to delete this part of the magic reform ----------- ↑

ZenClass Fishweight {

Var item as IITEMSTACK;

Var weight as int;

ZenConStructor (I as IITEMSTACK, W AS int) {

Item = i;

Weight = w;

}

}

ZenClass Fish {

ZenConStructor () {}

Var Fluid as Iliquidstack = ;

Var Dimension as int = 114514;

Var biome as string;

Var damage as int = 0;

Var ITEMS As Fishweight [] = [];

Var Fishrods as String [] = [];

Var Fishbaitids as string [] = [];

Var Fishbaitmetas as int

Var ITemstackout As Iitemstack;

Var altitudebegin as int = 0;

Var altitudend as int = 0;

Var daytime as string;

Static Fishmap as Fishweight [] [string] = {};

Function setflum (f as IliquidStack) as fish {// Set fishing liquid

Fluid = f;

Return this;

}

Function SetDimension (D as Int) as Fish {// Set the dimension ID of fishing

Dispnse = d;

Return this;

}

Function Setbiome (B AS String) as Fish {// Set the biological group of fishing

Biome = b;

Return this;

}

Function AdditionalDamage (d as int) as fish {// cause additional damage to the fishing rod

Damage = d;

Return this;

}

Function AddWeightedItemstack (I as Fishweight) as Fish {// Add an output of weight items.That is, there is a problem with the probability of fishing when the rod is raised

Items+= i;

Return this;}

Function AddWeightedItemstacks (Is as Fishweight []) as Fish {// Add weighted items output list.

For I in is {

Items+= i;

}

Return this;

}

Function setfishrod (I as IItemstack) As Fish {// Set fishing fishing rod

Fishrods+= I.definition.id;

Return this;

}

Function Addfishrods

For I in is {

Fishrods+= I.definition.id;

}

Return this;

}

Function setfishbait (I as IITEMSTACK) As Fish {// Set the fishing bait of fishing

Fishbaits+= i;

Fishbaitids+= I.Definition.id;

Fishbaitmetas+= I.Metadata;

Return this;

}

Function Addfishbaits

Fishbaits+= i;

Fishbaitids+= I.Definition.id;

Fishbaitmetas+= I.Metadata;

}

Return this;

}

Function SetalTitude (Begin as int, End as int = 0) As Fish {// Set the latitude when fishing. Begin is the lowest point and END is the highest point.If only begin or end is 0, there is no limit to the highest place.

Ifgin

Altitudebegin = begin;

Altitudeend = end;

} Else Print ("[Error]: Fish.zs: Begin Lower than End !!!");

Return this;

}

Function settime (dayornether as string) as fish {// Set the time when fishing, can be "day" or "nether".

Daytime = dayornether.tolowercase () == "day"? "Day": "nether";

Return this;

}

Function Gettotalweight (is as Fishweight []) as int {var Totalweight = 1;

If (IS.Length> 0) {{

Totalweight- = 1;

For I in is {

Totalweight+= i.weight;

}

}

Return Totalweight;

}

Function GetWeightedItemstack

If (IS.Length> 0) {{

Valveight = world.random.NEXTINT (0, this.Gettotalweight (is));

VAR CUMULATIVEIGHT = 0;

For I in is {

CumulatingWeight+= i.weight;

If (RANDOMWEIGHT <= Cumulativeweight) {

Itemstackoutput = I.Item; Return I.Item;

}

}

} Else Return Null;

}

// ---------- You need to install Randomtweaker!Otherwise, you need to delete this part of the magic reform -----------

Function AddfishRecipe (Fishrods As String [], Fishbaits As IITemStack [], OutputItems As Fishweight [], Daytime as String, AltitudEBEGIN AS Int, A LTITUDEEND As int, Fluid as IliquidStack, Dimension as int, biome as string) as void {

Var FRS = . WithdisplayName ("fishing rod demand"). Withlore

If (Fishrods.Length> 0) {{

Var FR = [] as Iitemstack [];

For I in Fishrods {

FR+= itemutils.getITEM (i);

}

For I in FR {If (FRS.MATCHESEXACT

FRS = i;

} Else FRS = FRS.or (i);

}

}

Var FBS = . WithdisplayName ("Bait Requirements"). Withlore

If (Fishbaits.length> 0) {{

For I in Fishbaits {

If (FBS.MATCHESEXACT (. WithdisplayName ("Bait Demand"). Withlore

Fbs = i;

} Else fbs = fbs.or (i);

}

}

value = . WithdisplayName ("Time Requirements"). Withlore (["Requirement Time:" ~ ((DAYTIME)? "Daytime)" Any time "?" Any time at any time ""? "Any time at any time" "?": (Daytime ==" Day "?" Daytime ":" Night "))); Val Altitude = . WithdisplayName (" Latitude Demand "). Withlore ([" Demand minimum height: "~ AltitUdebegin~ ", The highest demand height:" ~ (altitudeend == 0? "Arbitrarily height": altitudeend)];

Value d = . WithdisplayName ("dimension demand"). Withlore (["Demand dimension:" ~ (Dimension == 114514? ": Dimension));

Valry b = . WithdisplayName ("Biological Group Demand"). Withlore

Valrer = mods.jei.jei.createjeirecipe ("xian_bei010_fish");

AFR.ADDINPUT (FRS);

AFR.Addinput (Time);

AFR.Addinput (Altitude);

AFR.ADDINPUT (d);

AFR.ADDINPUT (b);

AFR.ADDINPUT (FLUID);

AFR.ADDINPUT (FBS);

for I in OutputITITEMS {AFR.ADDOUTPUT (I.Item.withlore (["output probability:" ~ ((I.Weight As Float)/this.Gettotalweight (OutputITITEMS)* 100.0F) ~ "%"]));

}

AFR.BUILD ();

}

// ---------- You need to install Randomtweaker!Otherwise, you need to delete this part of the magic reform ----------- ↑

Function register () as void {

FishingIntomLiquid.inliquiditeMChancePoolDimbiome (isnull (FLUID)? NULL: Fluid, '', , 0.1F, isnull (biome)? ': Biome, d. imnsion == 114514? NULL: Dimension);

Items.length == 0) {{

Print ("[error]: fish.zs: item is null !!!");

Return;

}

// ---------- You need to install Randomtweaker!Otherwise, you need to delete this part of the magic reform -----------

This.addfishReCipe (Fishrods, Fishbaits, Items, Daytime, Altitudebegin, Altitudeend, Fluid, Dimension, Biome)

// ---------- You need to install Randomtweaker!Otherwise, you need to delete this part of the magic reform ----------- ↑

Fishmap [Fluid.definition.name] = items;

Events.onItemfished (Function (event as itemfishedevent) {value = event.fishhook;

Val p = event.player;

Val w = p.World;

VAL DROPS = Event.drops;

Val item = DROPS [0];

If (! W.Remote &&! Isnull (W.GetBlock (HOOK.POSITION)) &&! Isnull (W.GetBlock (Hook.position) .fluid) {{

Value f = w.getBlock (hook.position) .fluid;

Var hashrod = Fishrods.Length == 0;

Val Handitems = [P.MainhandheldiTem, P.OffhandheldiTem] as Iitemstack [];

If (! Isnull (Fishmap [F.Name]) && (isnull (biome) || (! isnull (biome) &&Getbiome (hook.position .Name == biome)) && (dimension == 114514 || (Dimension! = 114514 && W.dimension == Dimension)) {) {

If (! Hasfishrod) {

For FR in handitems {if (! Isnull (FR) && Fishrods Fr.Definition.id) {

Hasfishrod = TRUE;

Break;

}

}

}

Var RightALTITUDE = AltitudeBegin == 0 && Altitudeend == 0;

If (! Rightaltitude && Hasfishrod) {{

Value y = hook.position.y; rightaltitude = (altitudebegin <= y && (y <= altitudeend || altitalEend == 0));

}

Var righttime = isnull (daytime);

If (! Righttime) {

Righttime = (Daytime == "Day" && W.Daytime) || (Daytime == "Nether" &&! W.daytime);

}

Var hasbait = Fishbaitids.Length == 0;

If (! Hasbait &&! Isnull (p.getplayerinventoryItemHandler ())) {) {) {) {

Val itemhandler = p.getplayerinventoryitemHandler (); for I in 0 to itemhandler.size {

If (hasbait) break;

Value ites = itemhandler.getstackinslot (i);

If (! Isnull (it) &&Fishbaitids has it.definition.id) {

For II in 0 to Fishbaitids.Length {

If (IT.DEFINITION.ID == Fishbaitids [II] && it.metadata == Fishbaitmetas [II]) {

Hasbait = True; if (hasfishrod && rightaltitude && righttime) {{

If (it.amount> 1) {{

Itemhandler.setstackinslot (i, it.withamount (it.amount-1));

} Else itemhandler.setstackinslot (i, null);

} Break;

}

}

}

}

}

If (! Hasbait) {

P.sendchat ("You need bait!");

Var bs = ""; var number = 0;

For I in Fishbaits {

Number+= 1;

Bs ~ = (I.displayName ~ (number == Fishbaits.Length? ":": ",", ");

}

P.sendchat ("Available bait:" ~ bs);

}

If (! Hasfishrod) {

P.sendchat ("You need a fish pole!"); VAR RS = "";

Var number = 0;

For I in Fishrods {

Number+= 1;

RS ~ = (itemutils.getItem (i) .displayName ~ (number == Fishrods.length? ":": ",");

}

P.sendchat ("Available fish rods:" ~ rs);

}

If (! Rightaltitude) {P.Sendchat ("You need to fish at a fixed height!"););

P.sendchat ("The lowest:" ~ altitudeBegin ~ ", the highest:" ~ (altital == 0? "

}

If (! Righttime) {

P.sendchat ("You need to fish at a fixed time!");

P.sendchat ("Demand Time: ~ (Daytime ==" Day "?" Daytime ":" Night ");

}

If (Hasfishrod && Hasbait && RightalTitude && Righttime) {{

Event.adDitionAmage = DAMAGE; Hook.Update ({"itemid": item.definition.id, "itmmeta": item.metadata, "Fished": 0, "Fluid": F.Name});

}

}

}

});

Events.onentityjoinworld

Val E = Event.entity;

Val w = event.World;

If (! W.remote &&! Isnull (e) && E Instanceof IENTITITEM) {

Val Ei As IENTITEM = E;

VAL POS = EI.POSITION;

Var Fishhooke = E;

for FH in W.GetentITIESWITHINABB (IAXISALIGNEDBB.CREATE (IBLOCKPOS.CREATE (POS.X-1, POS.Y-1, POS.Z-1), iblockpos.create (POS.X+1, POS.Y+1, 1, POS.Y+1, POS.Y+1, POS.Y+1,pos.z+1)))))) {if (fH.Forgedata.asstring () has "found" &&FOH.FORGEDATA.FISHED.ASINT () == 0) {{{{{

Fishhooke = FH;

FH.UPDATE ({"FISHED": 1});

Break;

}

}

If (! E.Inshequal (Fishhooke)) {{

Val data = Fishhooke.Forgetata;

If.Item.Definition.id == Data.itemid.asstring () && Ei.Item.metada ) &&! Isnull (W.getBlock (Fishhooke.position) .fluid) {value f = w.getBlock (Fishhooke.position) .fluid;

If (! Isnull (Fishmap [F.Name])) EI.SetITITEM

}

}

}

});

}

}

Function CreatefishweigthiteMlist

Var Fw as Fishweight [] = [];

If (Item.length == Weight.Length) {

For I in 0 to item.Length {

Fw+= FISHWEIGHT (Item [i], weight [i]);

}

} Else Print ("[Error]: Fish.zs: List Length are different !!!"); Return fw;

}

// Example:

// .addweightedItemstacks (CreatefishweigthItemlist (

// [ .withamount (5), , , , .withamount (2)],,,

// [5,10,15,16,20]

//))

// Example:

Fish ()

.setflum ())

.setdimension (0)

.setbiome ("Plains")

.addweightedItemstacks ([[[[[[[[[[[[[[[[[[[[[[[[[

Fishweight ( .withamount (5), 5), 5),

Fishweight (, 10), 10

Fishweight (, 15),

Fishweight (, 16), 16, 16), 16, 16, 16), 16, 16, 16

Fishweight ( .withamount (2), 20)

] As Fishweight [])

.setfishrod ()

.addfishbaits ([, ]))))

.setaltitude (1,15)

.settime ("Day")

.register ();

// Example:

Fish ()

.addweightedItemstacks (CreateFishweigthiteMlist (

[ .withamount (5), , , , .withamount (2)],,,

[5,10,15,16,20]

))

.register ();

The final effect is as follows

Baidu web disk link: https://pan.baidu.com/s/17ar4lny-np3qmrfkuanwgg? Pwd = xb66